Get status of maxviews and maxclicks

@param    array    $Banner
@return   array    array(bool $intMaxViews, bool $intMaxClicks)
183270
protected function getMaxViewsClicksStatus( &$Banner )
    {
        $intMaxViews = false;
        $intMaxClicks= false;
        
        if ($Banner['banner_until'] == 1
         && $Banner['banner_views_until'] != ''
         && $Banner['banner_views'] >= $Banner['banner_views_until']
           )
        {
            //max views erreicht
            $intMaxViews =  true;
        }
        
        if ($Banner['banner_until'] == 1
         && $Banner['banner_clicks_until'] !=''
         && $Banner['banner_clicks'] >= $Banner['banner_clicks_until']
           )
        {
            //max clicks erreicht
            $intMaxClicks = true;
        }
        
        return array($intMaxViews,$intMaxClicks);
    }
342795
public static function getMaxKeyLength(array $array)
    {
        $maxKeyLength = '0';
        foreach ($array as $key => $value) {
            $currentLength = static::getVisibleStringLength($key);

            if ($currentLength > $maxKeyLength) {
                $maxKeyLength = $currentLength;
            }
        }

        return $maxKeyLength;
    }
1363209
public function process($banner, Request $request)
    {
        if ($request->isMethod('DELETE')) {
            $this->manager->remove($banner);

            return true;
        }

        return false;
    }
910395
public function onSuccess(BannerInterface $banner)
    {
        $alert = $this->alertManager->create();

        $alert->addSuccess($this->translator->trans('success.save_banner', array(), 'SilvestraBanner'));
        $this->alertManager->setFlashAlert($alert);

        return new RedirectResponse($this->router->generate(
            'silvestra_banner.banner_list',
            array('zoneId' => $banner->getZone()->getId())
        ));
    }
299427
private function maxResult($feature)
    {
        return (isset($this->options['maxResults'][$feature]))
            ? $this->options['maxResults'][$feature]
            : null;
    }
557951
public function actionView($id) 
	{
		$siteType = OmmuSettings::getInfo('site_type');
		if($this->permission == 0)
			$this->redirect($siteType == 0 ? Yii::app()->createUrl('site/index') : Yii::app()->createUrl('site/login'));
		
		$setting = BannerSetting::model()->findByPk(1, array(
			'select' => 'meta_keyword',
		));

		$model=$this->loadModel($id);
		BannerViews::insertView($model->banner_id);

		$this->pageTitle =  Yii::t('phrase', 'Detail Banners');
		$this->pageDescription = $model->banner_desc;
		$this->pageMeta = $setting->meta_keyword;
		$this->render('front_view', array(
			'model'=>$model,
		));
	}
168685
public function fetch()
    {
        $this->query->where(implode(' AND ', $this->where));
        $record = DB::fetch($this->query);

        if (!$record)
        {
            return null;
        }

        $banner = Banners_Factory::createFromArray($record);
        return $banner;
    }
1160909
public function getLinks($all = false)
    {
        $links = [];

        $this->getLinksByTagAttribute("link", "href", $links);
        $this->getLinksByTagAttribute("a", "href", $links);
        $this->getLinksByTagAttribute("script", "src", $links);
        $this->getLinksByTagAttribute("iframe", "src", $links);
        $this->getLinksByTagAttribute("img", "src", $links);

        //get all string started with http
        $regexUrl = '/[">\s]+((http|https|ftp|ftps)\:\/\/(.*?))["<\s]+/';
        $urls     = null;
        if (preg_match_all($regexUrl, $this->html, $urls) > 0) {
            $matches = $urls[1];
            foreach ($matches as $url) {
                if (filter_var($url, FILTER_VALIDATE_URL)) {
                    $links[$url] = $url;
                }
            }
        }

        if ($all) {
            //get all params which can be a url
            $regexParam = '/["](.*?)["]/';
            $params     = [];
            if (preg_match_all($regexParam, $this->html, $params) > 0) {
                $urls = $params[1];
                foreach ($urls as $url) {
                    $url = trim($url);
                    if ((strpbrk($url, "/.") !== false) && (strpbrk($url, " ") === false)) {
                        $links[$url] = $url;
                    }
                }
            }
        }

        foreach ($links as $link) {
            $url = parse_url($link);
            if (!((isset($url['host']) && isset($url['scheme'])) || (isset($url['path'])))) {
                unset($links[$link]);
            }
        }

        return $links;
    }
212223
function() {
      var vals = [],
          max = arr.length,
          idx = 0;

      while (idx < max) {
        if (!wysihtml5.lang.array(vals).contains(arr[idx])) {
          vals.push(arr[idx]);
        }
        idx++;
      }
      return vals;
    }
539303
public function actionManage($category=null) 
	{
		$model=new Banners('search');
		$model->unsetAttributes();	// clear any default values
		if(Yii::app()->getRequest()->getParam('Banners')) {
			$model->attributes=Yii::app()->getRequest()->getParam('Banners');
		}

		$columns = $model->getGridColumn($this->gridColumnTemp());

		$pageTitle = Yii::t('phrase', 'Banners');
		if($category != null) {
			$data = BannerCategory::model()->findByPk($category);
			$pageTitle = Yii::t('phrase', 'Banners: Category {category_name}', array ('{category_name}'=>$data->title->message));
		}
		
		$this->pageTitle = $pageTitle;
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('admin_manage', array(
			'model'=>$model,
			'columns' => $columns,
		));
	}
1035138
public function getBannerByZone($bannerZoneCode, LanguageInterface $language = null)
    {
        $parameters = [
            'code' => $bannerZoneCode,
        ];

        if (!is_null($language)) {
            $parameters['language'] = $language;
        }

        $banners = $this
            ->createQueryBuilder('b')
            ->leftJoin('b.bannerZones', 'bz')
            ->where(
                is_null($language)
                    ? 'bz.language is NULL'
                    : 'bz.language = :language'
            )
            ->andWhere('bz.code = :code')
            ->orderBy('b.position', 'ASC')
            ->setParameters($parameters)
            ->getQuery()
            ->getResult();

        return new ArrayCollection($banners);
    }
325685
public function getCandidatesStatus(): array
    {
        $candidates = [];

        foreach ($this->getElectedCandidates() as $candidate) {
            $candidates['elected'][] = $candidate->getId();
        }

        foreach ($this->getActiveCandidates() as $candidate) {
            $candidates['active'][] = [$candidate->getId(), $candidate->getVotes()];
        }

        foreach ($this->getDefeatedCandidates() as $candidate) {
            $candidates['defeated'][] = $candidate->getId();
        }

        return $candidates;
    }
13980
public function getSubTreeLimitations()
    {
        if ( $this->attribute( 'main_tag_id' ) != 0 )
            return array();

        return parent::fetchObjectList( eZContentClassAttribute::definition(), null,
                                                    array( 'data_type_string'              => 'eztags',
                                                           eZTagsType::SUBTREE_LIMIT_FIELD => $this->attribute( 'id' ),
                                                           'version'                       => eZContentClass::VERSION_STATUS_DEFINED ) );
    }
541208
protected function getMax()
    {
        $params = array_filter(func_get_args() ?: [], function ($arg) {
            return !is_null($arg) && $arg !== "";
        });

        return count($params) > 0 ? max($params) : null;
    }
394014
protected function setStatViewUpdateBlockerId($banner_id=0)
	{
	    if ($banner_id==0) { return; }// keine Banner ID, nichts zu tun
    	//das können mehrere sein!, mergen!
	    $this->setSession('StatViewUpdateBlocker'.$this->module_id, array( $banner_id => time() ), true );
	    return ;
	}
1070211
private function getPermissionArray()
    {
        $permissionArray = array(
            'can_add'           => false,
            'subtree_limit'     => $this->Attribute->contentClassAttribute()->attribute( eZTagsType::SUBTREE_LIMIT_FIELD ),
            'allowed_locations' => array(),
            'allowed_locations_tags' => false );

        $userLimitations = eZTagsTemplateFunctions::getSimplifiedUserAccess( 'tags', 'add' );

        if ( $userLimitations['accessWord'] == 'no' )
            return $permissionArray;

        $userLimitations = isset( $userLimitations['simplifiedLimitations']['Tag'] ) ? $userLimitations['simplifiedLimitations']['Tag'] : array();
        $limitTag = eZTagsObject::fetchWithMainTranslation( $permissionArray['subtree_limit'] );

        if ( empty( $userLimitations ) )
        {
            if ( $permissionArray['subtree_limit'] == 0 || $limitTag instanceof eZTagsObject )
            {
                $permissionArray['allowed_locations'] = array( $permissionArray['subtree_limit'] );

                if ( $limitTag instanceof eZTagsObject )
                    $permissionArray['allowed_locations_tags'] = array( $limitTag );
            }
        }
        else if ( $permissionArray['subtree_limit'] == 0 )
        {
            $permissionArray['allowed_locations_tags'] = array();

            /** @var eZTagsObject[] $userLimitations */
            $userLimitations = eZTagsObject::fetchList( array( 'id' => array( $userLimitations ) ), null, null, true );
            if ( is_array( $userLimitations ) && !empty( $userLimitations ) )
            {
                foreach ( $userLimitations as $limitation )
                {
                    $permissionArray['allowed_locations'][] = $limitation->attribute( 'id' );
                    $permissionArray['allowed_locations_tags'][] = $limitation;
                }
            }
        }
        else if ( $limitTag instanceof eZTagsObject )
        {
            /** @var eZTagsObject[] $userLimitations */
            $userLimitations = eZTagsObject::fetchList( array( 'id' => array( $userLimitations ) ), null, null, true );
            if ( is_array( $userLimitations ) && !empty( $userLimitations ) )
            {
                $pathString = $limitTag->attribute( 'path_string' );
                foreach ( $userLimitations as $limitation )
                {
                    if ( strpos( $pathString, '/' . $limitation->attribute( 'id' ) . '/' ) !== false )
                    {
                        $permissionArray['allowed_locations'] = array( $permissionArray['subtree_limit'] );
                        $permissionArray['allowed_locations_tags'] = array( $limitTag );
                        break;
                    }
                }
            }
        }

        if ( !empty( $permissionArray['allowed_locations'] ) )
            $permissionArray['can_add'] = true;

        return $permissionArray;
    }
110519
public function getDisplayLimitByMode($mode)
    {
        $result = 0;

        switch ($mode) {
            case 'related':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_RELATED_PRODUCTS_ITEMS
                );
                break;
            case 'upsell':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_UPSELL_PRODUCTS_ITEMS
                );
                break;
            case 'crosssell':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_CROSSSELL_PRODUCTS_ITEMS
                );
                break;
            case 'bestsellers':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_BESTSELLER_PRODUCT_ITEMS
                );
                break;
            case 'mostviewed':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_MOSTVIEWED_PRODUCT_ITEMS
                );
                break;
            case 'recentlyviewed':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS
                );
                break;
            case 'push':
                $result = $this->scopeConfig->getValue(
                    self::XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS
                );
        }

        return $result;
    }