/* PUBLIC METHODS
***********************************************************************
497025
public function getUri($parameters = [])
    {
        $uri = $this->uri;
        foreach ($parameters as $name => $value) {
            if (!is_numeric($name)) {
                $uri = str_replace(['#'.$name, '::'.$name, ':'.$name], $value, $uri);
                unset($parameters[$name]);
            }
        }
        ksort($parameters);
        foreach ($parameters as $value) {
            $uri = preg_replace('@^([^:#]*)(:|::|#)\w+@', '${1}'.$value, $uri);
        }
        $uri = preg_replace('@\(([^):#]*)\)@', '${1}', $uri);
        $uri = preg_replace('@\([^)]*\)@', '', $uri);
        $uri = preg_replace('@(:|::|#)(\w+)@', '', $uri);
        return $uri;
    }
650442
public function init()
    {
        $this->header('Content-Type: text/html'); // default header.

        $this->proc = new \PHPDaemon\Core\ShellCommand();
        $this->proc->readPacketSize = $this->appInstance->readPacketSize;
        $this->proc->onReadData([$this, 'onReadData']);
        $this->proc->onWrite([$this, 'onWrite']);
        $this->proc->binPath = $this->appInstance->binPath;
        $this->proc->chroot = $this->appInstance->chroot;

        if (isset($this->attrs->server['BINPATH'])) {
            if (isset($this->appInstance->binAliases[$this->attrs->server['BINPATH']])) {
                $this->proc->binPath = $this->appInstance->binAliases[$this->attrs->server['BINPATH']];
            } elseif ($this->appInstance->config->allowoverridebinpath->value) {
                $this->proc->binPath = $this->attrs->server['BINPATH'];
            }
        }

        if (isset($this->attrs->server['CHROOT']) && $this->appInstance->config->allowoverridechroot->value) {
            $this->proc->chroot = $this->attrs->server['CHROOT'];
        }

        if (isset($this->attrs->server['SETUSER']) && $this->appInstance->config->allowoverrideuser->value) {
            $this->proc->setUser = $this->attrs->server['SETUSER'];
        }

        if (isset($this->attrs->server['SETGROUP']) && $this->appInstance->config->allowoverridegroup->value) {
            $this->proc->setGroup = $this->attrs->server['SETGROUP'];
        }

        if (isset($this->attrs->server['CWD']) && $this->appInstance->config->allowoverridecwd->value) {
            $this->proc->cwd = $this->attrs->server['CWD'];
        } elseif ($this->appInstance->config->cwd->value !== null) {
            $this->proc->cwd = $this->appInstance->config->cwd->value;
        } else {
            $this->proc->cwd = dirname($this->attrs->server['SCRIPT_FILENAME']);
        }

        $this->proc->setArgs([$this->attrs->server['SCRIPT_FILENAME']]);
        $this->proc->setEnv($this->attrs->server);
        $this->proc->execute();
    }
470344
public function init()
    {
        $grav = Grav::instance();
        /** @var Config $config */
        $config = $grav['config'];

        $asset_config = (array)$config->get('system.assets');

        /** @var UniformResourceLocator $locator */
        $locator = $grav['locator'];
        $this->assets_dir = $locator->findResource('asset://') . DS;
        $this->assets_url = $locator->findResource('asset://', false);

        $this->config($asset_config);

        // Register any preconfigured collections
        foreach ((array) $this->collections as $name => $collection) {
            $this->registerCollection($name, (array)$collection);
        }
    }
603920
protected function initData()
    {
        if ($this->data !== null) {
            return;
        }

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

        if ($this->model instanceof Model) {
            $data = ($this->model->hasProperty($this->attribute) || isset($this->model->{$this->attribute}))
                ? ArrayHelper::getValue($this->model, $this->attribute, [])
                : [];

            if (!is_array($data) && empty($data)) {
                return;
            }

            if (!($data instanceof \Traversable)) {
                $data = (array) $data;
            }

            foreach ($data as $index => $value) {
                $this->data[$index] = $value;
            }
        }
    }
527857
public function init() {
		
		if (!isset($this->htmlOptions['id'])) {
			$this->htmlOptions['id'] = $this->getId();
		}

		if ($this->autoOpen === false && !isset($this->options['show'])) {
			$this->options['show'] = false;
		}

		$classes = array('modal');

		if ($this->fade === true) {
			$classes[] = 'fade';
		}

		if (!empty($classes)) {
			$classes = implode(' ', $classes);
			if (isset($this->htmlOptions['class'])) {
				$this->htmlOptions['class'] .= ' ' . $classes;
			} else {
				$this->htmlOptions['class'] = $classes;
			}
		}
		
        	if (isset($this->modalDialogOptions['class'])) {
            		$this->modalDialogOptions['class'] .= ' modal-dialog';
        	} else {
            		$this->modalDialogOptions['class'] = 'modal-dialog';
        	}

        	if (isset($this->modalContentOptions['class'])) {
            		$this->modalContentOptions['class'] .= ' modal-content';
        	} else {
            		$this->modalContentOptions['class'] = 'modal-content';
        	}

        	echo CHtml::openTag('div', $this->htmlOptions); //modal
        	echo CHtml::openTag('div', $this->modalDialogOptions); //modal-dialog
        	echo CHtml::openTag('div', $this->modalContentOptions); //modal-content
	}
295508
public function init()
    {
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }

        if (!isset($this->options['data-success-class'])) {
            $this->options['data-success-class'] = $this->successCssClass;
        }

        if (!isset($this->options['data-error-class'])) {
            $this->options['data-error-class'] = $this->errorCssClass;
        }

        if ($this->enableClientValidation) {
            $this->registerAfterValidateHandler();
        }

        parent::init();
    }
616232
public function postAction()
    {
        $data = json_decode($this->getRequest()->getRawBody());
        if (!is_array($data)) $data = array($data);

        $ret = array();
        foreach ($data as $d) {
            $row = $this->_model->createRow();
            if (isset($d->id) && $d->id) {
                $row->id = $d->id;
            }

            $this->_validateInsert((array)$d);
            $this->_validateSave((array)$d);
            $this->_fillRowInsert($row, $d);
            $this->_beforeInsert($row);
            $this->_beforeSave($row);
            $row->save();
            $this->_afterSave($row, $d);
            $this->_afterInsert($row, $d);

            $ret[] = $this->_loadDataFromRow($row);
        }
        if (count($ret) == 1) $ret = reset($ret);

        $this->view->data = $ret;
    }
1233206
public function init()
    {
        /* @var $options MailOptions */
        $options = $this->getServiceLocator()
            ->getServiceLocator()
            ->get(MailOptions::class);

        $emailAddresses = $options->getAddressList();

        $addressList = [];

        foreach ($emailAddresses as $transport => $address) {

            $addressList[] = [
                'label' => $address['name'] . ' <' . $address['address'] . '>',
                'value' => $transport,
            ];
        }

        $this->setValueOptions($addressList);
    }
216853
public function init() {
        if (!Config::config()['user']['debug']['maintenance']) {
            date_default_timezone_set(Config::config()['user']['output']['timezone']);
            $this->_setEnvironment();
            $this->_route();

            if ($this->_route == true) {
                $this->_setDatabase();
                $this->_setSecure();
                $this->_setLibrary();
                $this->_setEvent();
                $this->_setCron();
                $this->_setFunction();
                $this->_setFunction($this->request->src);
                $this->_setEvent($this->request->src);
            }
        }
    }
1081007
public function populate($data = array())
    {
        parent::populate($data);

        if (isset($data['postDisplayMode']) && $data['postDisplayMode'] !== null) {
            $this->postDisplayMode = $data['postDisplayMode'];
        }

        if (isset($data['voteAnonymous']) && $data['voteAnonymous'] !== null) {
            $this->voteAnonymous = $data['voteAnonymous'];
        }
    }
1066557
public function init()
	{
		list($name,$id)=$this->resolveNameID();
		if(isset($this->htmlOptions['id']))
			$id=$this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;
		if(isset($this->htmlOptions['name']))
			$name=$this->htmlOptions['name'];

		$this->registerClientScript();

		if($this->hasModel())
		{
			$field=$this->textArea ? 'activeTextArea' : 'activeTextField';
			echo CHtml::$field($this->model,$this->attribute,$this->htmlOptions);
		}
		else
		{
			$field=$this->textArea ? 'textArea' : 'textField';
			echo CHtml::$field($name,$this->value,$this->htmlOptions);
		}
	}
898114
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getModel();

        if (in_array($payment->getState(), array(PaymentInterface::STATE_APPROVED, PaymentInterface::STATE_DEPOSITED))) {
            $request->markCaptured();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_DEPOSITING))) {
            $request->markPending();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_CANCELED))) {
            $request->markCanceled();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_EXPIRED))) {
            $request->markExpired();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_FAILED))) {
            $request->markFailed();

            return;
        }

        if (in_array($payment->getState(), array(PaymentInterface::STATE_NEW, PaymentInterface::STATE_APPROVING))) {
            $request->markNew();

            return;
        }

        $request->markUnknown();
    }
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';
	}
435107
public function process()
    {
        parent::process();

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

        $this->value = trim($this->value);

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

        if (!$this->validateUri($this->value)) {
            if (
                $this->validateUri($this->default_scheme . '://' . $this->value)
            ) {
                if ($this->scheme_required) {
                    $this->addMessage(
                        $this->getValidationMessage('scheme-required')
                    );
                } else {
                    $this->value = $this->default_scheme . '://' . $this->value;
                }
            } else {
                $this->addMessage($this->getValidationMessage('invalid-uri'));
            }
        }
    }
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);");
	}
104400
public function init() {
        $this->_req = $this->getRequest()->getParam('request');
        $this->_response = $this->getRequest()->getParam('response');
    }
834059
public function delete()
    {
        if ( ! is_null($this->parent)) {
            $this->parent->removeChild($this->id);
        }

        $this->parent = null;
    }