/** * Initializes the application component. * This method overrides the parent implementation by preprocessing * the user request data. */ public function init() { parent::init(); if ($this->sanitizePost && count($_POST) > 0 || $this->sanitizeGet && count($_GET) > 0 || $this->sanitizePost && count($_COOKIE) > 0) { $this->sanitizeRequest(); } }
/** * Initializes this component. */ public function init() { parent::init(); if ($this->bootstrapPath === null) { $this->bootstrapPath = Yii::getPathOfAlias('bootstrap'); } }
public function init() { $path = dirname(__FILE__) . '/lib/google-api-php-client/src'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); require_once 'Google_Client.php'; parent::init(); }
public function init() { parent::init(); if (!$this->isComponentActive()) { return; } try { $this->userInfo = call_user_func($this->userInfoCallable); $this->setUser($this->userInfo); $memcacheServerName = $this->cacheServer['host']; $memcacheServerPort = $this->cacheServer['port']; if ($memcacheServerName && $memcacheServerPort) { $memcached = new \Memcached(); $memcached->addServer($memcacheServerName, $memcacheServerPort); $cacheDriver = new \Doctrine\Common\Cache\MemcachedCache(); $cacheDriver->setMemcached($memcached); $cacheStorage = new \Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage($cacheDriver); } else { $cacheStorage = new \Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage(new \Doctrine\Common\Cache\FilesystemCache('/tmp/')); } $this->client = new \LaunchDarkly\LDClient($this->apiKey, array("cache" => $cacheStorage)); $this->featureToggleUser = (new \LaunchDarkly\LDUserBuilder($this->user->key))->secondary($this->user->secondary)->ip($this->user->ip)->country($this->user->country)->email($this->user->email)->name($this->user->name)->avatar($this->user->avatar)->firstName($this->user->firstName)->lastName($this->user->lastName)->anonymous($this->user->anonymous)->custom(array('type' => $this->user->type, 'parentCompanyId' => $this->user->parentId, 'referredAccountId' => $this->user->referredAccountId, 'channel' => $this->user->channel, 'payoutMethod' => isset($this->user->payoutMethod) ? $this->user->payoutMethod : null))->build(); } catch (\Exception $ex) { $this->componentActive = false; \Yii::log("Cannot initiate Feature Toggles: {$ex->getMessage()}", \CLogger::LEVEL_WARNING, 'system.featureToggle'); } }
/** * Initializes the component. * This method is required by {@link IApplicationComponent} and is invoked by application * when the EFtpComponent is used as an application component. * If you override this method, make sure to call the parent implementation * so that the component can be marked as initialized. */ public function init() { parent::init(); if ($this->autoConnect) { $this->setActive(true); } }
/** * Registers Analytics.js and initializes the tracking code */ public function init() { $sapi = php_sapi_name(); if ($sapi == 'cli') { return; } // Set the alias path if (Yii::getPathOfAlias('analytics') === false) { Yii::setPathOfAlias('analytics', realpath(dirname(__FILE__) . '/..')); } parent::init(); // Don't load up the analytics.js if we don't have any data $providers = $this->getProviders(); if (empty($providers)) { return; } // Conver options into json $json = CJSON::encode($providers); // Load up the asset manager $asset = Yii::app()->assetManager->publish(__DIR__ . DS . 'assets' . DS . 'js', true, -1, YII_DEBUG); $cs = Yii::app()->getClientScript(); // Register the appropriate script file $cs->registerScriptFile($asset . (YII_DEBUG ? '/analytics.js' : '/analytics.min.js')); // Initialize $cs->registerScript('analytics.js', "analytics.initialize({$json}); analytics.page();"); if ($this->lowerBounceRate) { $cs->registerScript('analytics.js-bounce-rate-15', 'setTimeout(function() { analytics.track("_trackEvent", "15 Seconds"); }, 15000 );'); $cs->registerScript('analytics.js-bounce-rate-30', 'setTimeout(function() { analytics.track("_trackEvent", "30 Seconds"); }, 30000 );'); $cs->registerScript('analytics.js-bounce-rate-60', 'setTimeout(function() { analytics.track("_trackEvent", "60 Seconds"); }, 60000 );'); } }
/** * */ public function init() { parent::init(); $this->setHasher(Yii::createComponent($this->hasher)); $this->setTokenStorage(Yii::createComponent($this->tokenStorage)); $this->userModule = Yii::app()->getModule('user'); }
/** * CmsInput::init() * * @return */ public function init() { $this->originalPost = $_POST; $this->originalGet = $_GET; parent::init(); Yii::app()->attachEventHandler('onBeginRequest', array($this, 'cleanGlobals')); }
/** * Initializes the application component. * * @throws CException */ public function init() { parent::init(); // adding LessPhp library directory to include path Yii::import($this->lessphpDir . '.*'); // including LessPhp class require_once 'lessc.inc.php'; if ($this->basePath === null) { $this->basePath = Yii::getPathOfAlias('webroot'); } if (!is_array($this->files)) { throw new CException('Failed to compile LESS. Property files must be an array.'); } foreach ($this->files as $fileLess => $fileCss) { $pathLess = $this->basePath . '/' . $fileLess; $pathCss = $this->basePath . '/' . $fileCss; try { if (file_exists($pathLess)) { if ($this->forceCompile === true) { $this->getLessphp()->compileFile($pathLess, $pathCss); } else { $this->getLessphp()->checkedCompile($pathLess, $pathCss); } } } catch (Exception $e) { throw new CException(__CLASS__ . ': ' . Yii::t('less', 'Failed to compile less file with message: `{message}`.', array('{message}' => $e->getMessage()))); } } }
public function init() { parent::init(); require Yii::getPathOfAlias('ext.PHPMailer') . '/PHPMailerAutoload.php'; $this->PHPMailer = new PHPMailer(); $this->settings(); }
public function init() { parent::init(); Yii::import('ext.imageapi.Toolkit'); Yii::import('ext.imageapi.GDToolkit'); $this->toolkit = new GDToolkit(); }
/** * @inheritdoc */ public function init() { $this->preInit(); Yii::import('bootstrap.widgets.*'); parent::init(); $this->setScriptMap(); }
/** * Initializes this component. */ public function init() { parent::init(); if ($this->bootstrapPath === null) { $this->bootstrapPath = Yii::getPathOfAlias('vendor.twbs.bootstrap.dist'); } }
/** * Initialize the component */ public function init() { $this->initAutoloader($this->swiftBasePath); $this->transport = Swift_SmtpTransport::newInstance($this->host, $this->port, $this->security); $this->transport->setUsername($this->username)->setPassword($this->password); parent::init(); }
/** * handles the initialization parameters of the components */ function init() { if (!count($this->acceptedLanguages)) { $this->getAcceptedLanguages(); } return parent::init(); }
public function init() { if (!function_exists("imagecreatetruecolor")) { throw new Exception("使用这个类,需要启用GD库", 500); } parent::init(); }
/** * */ public function init() { parent::init(); Yii::app()->getModule('email'); $this->registerSwiftMailerAutoloader(); $this->registerMustacheAutoloader(); }
/** * Set default gateway from config */ public function init() { if ($this->activeGateway === null && $this->defaultGateway !== null) { $this->setGateway($this->defaultGateway); } parent::init(); }
public function init() { parent::init(); Yii::setPathOfAlias('PhpAmqpLib', Yii::getPathOfAlias('vendor.yiiext.AMQP.PhpAmqpLib')); $this->_connect = new PhpAmqpLib\Connection\AMQPConnection($this->host, $this->port, $this->login, $this->password, $this->vhost); $this->_channel = $this->_connect->channel(); }
/** * Initializes the application component. * This method overrides the parent implementation by setting default cache key prefix. */ public function init() { parent::init(); if ($this->keyPrefix === null) { $this->keyPrefix = Yii::app()->getId(); } }
public function init() { parent::init(); if (isset(Yii::app()->user->userId)) { $this->data = UserState::model()->findByPk(Yii::app()->user->userId)->attributes; } }
/** * */ public function init() { parent::init(); if (null === $this->mutexFile) { $this->mutexFile = Yii::app()->getRuntimePath() . '/mutex.bin'; } }
/** * Init * * @throws CException */ public function init() { if (!function_exists('curl_init')) { throw new CException('Для работы расширения требуется cURL'); } parent::init(); }
public function init() { parent::init(); if ($this->driver != 'GD' && $this->driver != 'ImageMagick') { throw new CException('driver must be GD or ImageMagick'); } }
/** * Panel initialization. * Generate unique tag for page. Attach panels, log watcher. Register scripts for printing debug panel. */ public function init() { parent::init(); if (!$this->enabled) { return; } Yii::setPathOfAlias('yii2-debug', dirname(__FILE__)); Yii::app()->setImport(array('yii2-debug.*', 'yii2-debug.panels.*')); if ($this->logPath === null) { $this->logPath = Yii::app()->getRuntimePath() . '/debug'; } $panels = array(); foreach (CMap::mergeArray($this->corePanels(), $this->panels) as $id => $config) { if (!isset($config['highlightCode'])) { $config['highlightCode'] = $this->highlightCode; } $panels[$id] = Yii::createComponent($config, $this, $id); } $this->panels = $panels; Yii::app()->setModules(array($this->moduleId => array('class' => 'Yii2DebugModule', 'owner' => $this))); if ($this->internalUrls && Yii::app()->getUrlManager()->urlFormat == 'path') { $rules = array(); foreach ($this->coreUrlRules() as $key => $value) { $rules[$this->moduleId . '/' . $key] = $this->moduleId . '/' . $value; } Yii::app()->getUrlManager()->addRules($rules, false); } Yii::app()->attachEventHandler('onEndRequest', array($this, 'onEndRequest')); $this->initToolbar(); }
/** * Initializes the application component. * This method is required by IApplicationComponent and is invoked by application. */ public function init() { parent::init(); if ($this->autoStart) { $this->open(); } register_shutdown_function(array($this, 'close')); }
/** * Инициализирует компонент приложения. */ public function init() { parent::init(); if ($this->basePath === null) { $this->basePath = Yii::getPathOfAlias('application.tests.fixtures'); } $this->prepare(); }
/** * Initialize component */ public function init() { parent::init(); $this->setCompiledCssPath(); $this->setCompiledCustomCssPath(); $this->setLessFilesPath(); $this->setThemeColors(); }
public function init() { self::setTsTranslation($this); $this->setRootAliasIfUndefined(); Yii::app()->setImport(array('tstranslation.models.*', 'tstranslation.components.*')); $this->setTsLanguage(); parent::init(); }
public function init() { parent::init(); $dir = dirname(__FILE__); $alias = md5($dir); Yii::setPathOfAlias($alias, $dir); Yii::import($alias . '.simple_image'); }