本文整理汇总了PHP中CApplicationComponent::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CApplicationComponent::init方法的具体用法?PHP CApplicationComponent::init怎么用?PHP CApplicationComponent::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApplicationComponent
的用法示例。
在下文中一共展示了CApplicationComponent::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* 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();
}
}
示例2: init
/**
* Initializes this component.
*/
public function init()
{
parent::init();
if ($this->bootstrapPath === null) {
$this->bootstrapPath = Yii::getPathOfAlias('bootstrap');
}
}
示例3: init
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();
}
示例4: 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');
}
}
示例5: init
/**
* 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);
}
}
示例6: init
/**
* 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 );');
}
}
示例7: init
/**
*
*/
public function init()
{
parent::init();
$this->setHasher(Yii::createComponent($this->hasher));
$this->setTokenStorage(Yii::createComponent($this->tokenStorage));
$this->userModule = Yii::app()->getModule('user');
}
示例8: init
/**
* CmsInput::init()
*
* @return
*/
public function init()
{
$this->originalPost = $_POST;
$this->originalGet = $_GET;
parent::init();
Yii::app()->attachEventHandler('onBeginRequest', array($this, 'cleanGlobals'));
}
示例9: init
/**
* 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())));
}
}
}
示例10: init
public function init()
{
parent::init();
require Yii::getPathOfAlias('ext.PHPMailer') . '/PHPMailerAutoload.php';
$this->PHPMailer = new PHPMailer();
$this->settings();
}
示例11: init
public function init()
{
parent::init();
Yii::import('ext.imageapi.Toolkit');
Yii::import('ext.imageapi.GDToolkit');
$this->toolkit = new GDToolkit();
}
示例12: init
/**
* @inheritdoc
*/
public function init()
{
$this->preInit();
Yii::import('bootstrap.widgets.*');
parent::init();
$this->setScriptMap();
}
示例13: init
/**
* 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();
}
示例14: init
/**
* handles the initialization parameters of the components
*/
function init()
{
if (!count($this->acceptedLanguages)) {
$this->getAcceptedLanguages();
}
return parent::init();
}
示例15: init
public function init()
{
if (!function_exists("imagecreatetruecolor")) {
throw new Exception("使用这个类,需要启用GD库", 500);
}
parent::init();
}