/* PRIVATE METHODS
***********************************************************************
499677
protected function callController($controller, $action, $route)
    {
        $controllers = $this->setting->getAsArray('auth.controller');
        $exclude = ($this->setting['auth.mode'] == 'exclude');
        $level = $this->setting->get('auth.level', 0);
        $inner = in_array($controller, $controllers);
        if ($exclude xor $inner) {
            if (!\Staq::Ctrl('Auth')->isLogged()) {
                throw new \Stack\Exception\MustBeLogged();
            }
            $user = \Staq::Ctrl('Auth')->currentUser();
            if ($user->hasAttribute('right')){
                if ($user->getAttribute('right')->getSeed() < $level) {
                    throw new \Stack\Exception\NotAllowed();
                }
            }
        }
        $result = parent::callController($controller, $action, $route);
        return $result;
    }
918945
public function process()
    {
        parent::process();

        if ($this->value === null) {
            return;
        }

        if ($this->value == '') {
            $this->value = null;
            return;
        }

        if (!$this->validateEmailAddress()) {
            $this->addMessage($this->getValidationMessage('email'));
        }
    }
801860
public function init()
	{
		if($this->nextPageLabel===null)
			$this->nextPageLabel=Yii::t('yii','Next &gt;');
		if($this->prevPageLabel===null)
			$this->prevPageLabel=Yii::t('yii','&lt; Previous');
		if($this->firstPageLabel===null)
			$this->firstPageLabel=Yii::t('yii','&lt;&lt; First');
		if($this->lastPageLabel===null)
			$this->lastPageLabel=Yii::t('yii','Last &gt;&gt;');
		if($this->header===null)
			$this->header=Yii::t('yii','Go to page: ');

		if(!isset($this->htmlOptions['id']))
			$this->htmlOptions['id']=$this->getId();
		if(!isset($this->htmlOptions['class']))
			$this->htmlOptions['class']='yiiPager';
	}
935331
public function init()
    {
        parent::init();

        foreach ($this->children as $child) {
            $child->init();
            foreach ($child->getPages() as $page) {
                $this->addPage($page);
            }
        }

        foreach ($this->pages as $page) {
            $page->init();
        }
    }
1228890
public function init()
    {
        parent::init();

        if (empty($this->id)) {
            $this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
        }
        if (empty($this->name)) {
            $this->name = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->id;
        }
        if (empty($this->value) && $this->hasModel() && $this->model->hasAttribute($this->attribute)) {
            $this->value = $this->model->getAttribute($this->attribute);
        }

        if(!$this->autoHeightEnable){
            if(empty($this->width)){
                $this->width = '100%';
            }
            if(empty($this->height)){
                $this->height = '350';
            }
        }

        $options = [
            'id' => $this->id,
            'style' => 'width:100%;height:350px'
        ];
        $this->options = array_merge($options,$this->options);

        $jsOptions = [
            'serverUrl' => Url::to(['ueditor','type'=>'ueditor']),
            'autoHeightEnable' => $this->autoHeightEnable,
            'autoFloatEnable' => true,
            'textarea'=>$this->name
        ];
        $this->jsOptions = array_merge($jsOptions,$this->jsOptions);
    }
1183651
public function Bind()
	{
		$this->getAbstractNode(0)->Bind();
		/**
		 * @var QName $qname
		 */
		$qname = $this->getQNVarName();
		$this->_varRef = $this->getContext()->RunningContext->NameBinder->PushVar( $qname );
		$this->getAbstractNode(1)->Bind();
		$this->getContext()->RunningContext->NameBinder->PopVar();
	}
306374
private function initializeForPrefix(): void
    {
        $keys = AdapterUtil::getPropertyValue($this, 'keys');
        $values = AdapterUtil::getPropertyValue($this, 'values');

        if (null === $values) {
            $file = AdapterUtil::getPropertyValue($this, 'file');
            $values = @(include $file) ?: [];

            AdapterUtil::setPropertyValue($this, 'keys', $keys);
            AdapterUtil::setPropertyValue($this, 'values', $values);
        }
    }
104400
public function init() {
        $this->_req = $this->getRequest()->getParam('request');
        $this->_response = $this->getRequest()->getParam('response');
    }
236169
public function _afterLoad()
    {
        $value = $this->getValue();
        /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
        /** @noinspection PhpParamsInspection */
        $this->setValue(empty($value) ? false : $this->encoder->decode($value));
        parent::_afterLoad();
    }
832681
public function init()
    {
        if (true === $this->beforeInit()) {
            HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_SAVE, [$this, 'onSave']);
            HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_UPDATE, [$this, 'onUpdate']);
            HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_BEFORE_DELETE, [$this, 'onDelete']);
        }
    }
194347
private function initialize()
    {
        $params = $this->getParameters();
        if ($params !== null) {
            foreach ($params as $param) {
                if (self::LINES_KEY === $param->getName()) {
                    $this->lines = (int) $param->getValue();
                    continue;
                }
                if (self::SKIP_KEY === $param->getName()) {
                    $this->lines = (int) $param->getValue();
                    continue;
                }
            }
        }
    }
291012
public function run()
	{
		list($name,$id)=$this->resolveNameID();
		if(isset($this->htmlOptions['id']))
			$id=$this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;

		$isRange=isset($this->options['range']) && $this->options['range'] &&
			$this->options['range']!=='max' && $this->options['range']!=='min';

		if($this->hasModel())
		{
			$attribute=$this->attribute;
			if($isRange)
			{
				$options=$this->htmlOptions;
				echo CHtml::activeHiddenField($this->model,$this->attribute,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::activeHiddenField($this->model,$this->maxAttribute,$options);
				$maxAttribute=$this->maxAttribute;
				$this->options['values']=array($this->model->$attribute,$this->model->$maxAttribute);
			}
			else
			{
				echo CHtml::activeHiddenField($this->model,$this->attribute,$this->htmlOptions);
				$this->options['value']=$this->model->$attribute;
			}
		}
		else
		{
			if($isRange)
			{
				list($maxName,$maxId)=$this->resolveNameID('maxName','maxAttribute');
				$options=$this->htmlOptions;
				echo CHtml::hiddenField($name,$this->value,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::hiddenField($maxName,$this->maxValue,$options);
				$this->options['values']=array($this->value,$this->maxValue);
			}
			else
			{
				echo CHtml::hiddenField($name,$this->value,$this->htmlOptions);
				if($this->value!==null)
					$this->options['value']=$this->value;
			}
		}

		$idHidden=$this->htmlOptions['id'];
		$this->htmlOptions['id']=$idHidden.'_slider';
		echo CHtml::tag($this->tagName,$this->htmlOptions,'');

		$this->options[$this->event]=$isRange
			? new CJavaScriptExpression("function(e,ui){ v=ui.values; jQuery('#{$idHidden}').val(v[0]); jQuery('#{$idHidden}{$this->maxIdSuffix}').val(v[1]); }")
			: new CJavaScriptExpression("function(event, ui) { jQuery('#{$idHidden}').val(ui.value); }");

		$options=CJavaScript::encode($this->options);
		Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}_slider').slider($options);");
	}
1209001
public function process()
    {
        $this->debug->groupCollapsed(__METHOD__);
        if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'HEAD') {
            $this->debug->warn('head request - do not process form');
            $this->debug->groupEnd();
            return;
        }
        $this->alerts->clear();
        $this->configNormalize();
        $this->initPersist();
        $this->status['submitted'] = $this->persist->get('submitted');
        $this->storeValues();
        $this->redirectPost();
        $this->setCurrentFields();
        // $this->debug->log('persist', $this->persist);
        // $this->debug->log('status', $this->status);
        $headers = $this->getHeaders();
        $this->processSubmit();
        $this->trashCollect();
        if (!\headers_sent()) {
            $this->debug->log('headers', $headers);
            foreach ($headers as $header) {
                \header($header);
            }
        }
        $this->persist->set('submitted', false);
        $this->debug->groupEnd();
        return;
    }
82043
public function value($value): void
    {
        $obj = array_pop($this->stack);
        if (!empty($this->keys[$this->level])) {
            $obj[$this->keys[$this->level]] = $value;
            $this->keys[$this->level] = null;
        } else {
            $obj[] = $value;
        }
        $this->stack[] = $obj;
    }
578025
public function process()
        {
            if ($this->_isXhtml === null) {
                $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
            }

            $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']);
            $this->_placeholders = array();

            // replace SCRIPTs (and minify) with placeholders
            $this->_html = preg_replace_callback(
                    '/(\\s*)(<script\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/i'
                    , array($this, '_removeScriptCB')
                    , $this->_html);

            // replace STYLEs (and minify) with placeholders
            $this->_html = preg_replace_callback(
                    '/\\s*(<style\\b[^>]*?>)([\\s\\S]*?)<\\/style>\\s*/i'
                    , array($this, '_removeStyleCB')
                    , $this->_html);

            // remove HTML comments (not containing IE conditional comments).
            $this->_html = preg_replace_callback(
                    '/<!--([\\s\\S]*?)-->/'
                    , array($this, '_commentCB')
                    , $this->_html);

            // replace PREs with placeholders
            $this->_html = preg_replace_callback('/\\s*(<pre\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/i'
                    , array($this, '_removePreCB')
                    , $this->_html);

            // replace TEXTAREAs with placeholders
            $this->_html = preg_replace_callback(
                    '/\\s*(<textarea\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/i'
                    , array($this, '_removeTextareaCB')
                    , $this->_html);

            // trim each line.
            // @todo take into account attribute values that span multiple lines.
            $this->_html = preg_replace('/^\\s+|\\s+$/m', '', $this->_html);

            // remove ws around block/undisplayed elements
            $this->_html = preg_replace('/\\s+(<\\/?(?:area|base(?:font)?|blockquote|body'
                    . '|caption|center|cite|col(?:group)?|dd|dir|div|dl|dt|fieldset|form'
                    . '|frame(?:set)?|h[1-6]|head|hr|html|legend|li|link|map|menu|meta'
                    . '|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h||r|foot|itle)'
                    . '|ul)\\b[^>]*>)/i', '$1', $this->_html);

            // remove ws outside of all elements
            $this->_html = preg_replace_callback(
                    '/>([^<]+)</'
                    , array($this, '_outsideTagCB')
                    , $this->_html);

            // use newlines before 1st attribute in open tags (to limit line lengths)
            $this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/i', "$1\n$2", $this->_html);

            // fill placeholders
            $this->_html = str_replace(
                    array_keys($this->_placeholders)
                    , array_values($this->_placeholders)
                    , $this->_html
            );

            return $this->_html;
        }
649406
protected function initItems()
	{
		$initItems = null;
		
		if ($this->items != null)
		{
			foreach ($this->items as $item)
			{
				if (isset($item['value']))
				{
					$i = $item['value'];
					unset($item['value']);
					$initItems[$i] = $item;
				}
				else 
				{
					$initItems = $this->items;	
				}
			}
			
			$this->items = array_replace($this->defaults, $initItems);
		}
		else 
		{
			$this->items = $this->defaults;
		}
	}
1262835
public function init()
    {
        parent::init();

        self::$plugin = $this;

        if (!Craft::$app->getRequest()->getIsCpRequest()) {
            return;
        }

        // Register Components (Services)
        $this->setComponents([
            'singlesList' => SinglesList::class,
        ]);

        // Modified the entry index sources
        Event::on(Entry::class, Element::EVENT_REGISTER_SOURCES, function(RegisterElementSourcesEvent $event) {
            
            // Have we enabled the plugin?
            if ($this->getSettings()->expandSingles) {

                // Are there any Singles at all?
                foreach ($event->sources as $source) {
                    if (array_key_exists('key', $source) && $source['key'] === 'singles') {
                        $this->singlesList->createSinglesList($event);
                    }
                }
            }
        });

        // Hook onto a special hook from Redactor - it handles singles a little differently!
        if (class_exists(RedactorField::class)) {
            Event::on(RedactorField::class, RedactorField::EVENT_REGISTER_LINK_OPTIONS, function(RegisterLinkOptionsEvent $event) {
                
                // Have we enabled the plugin?
                if ($this->getSettings()->expandSingles) {

                    foreach ($event->linkOptions as $i => $linkOption) {

                        // Only apply this for entries, and if there are any singles
                        if ($linkOption['refHandle'] === 'entry') {
                            if (in_array('singles', $linkOption['sources'])) {
                                $modifiedSources = $this->singlesList->createSectionedSinglesList($linkOption['sources']);

                                if ($modifiedSources) {
                                    $event->linkOptions[$i]['sources'] = $modifiedSources;
                                }
                            }
                        }
                    }
                }
            });
        }
    }