本文整理汇总了PHP中CApplicationComponent类的典型用法代码示例。如果您正苦于以下问题:PHP CApplicationComponent类的具体用法?PHP CApplicationComponent怎么用?PHP CApplicationComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CApplicationComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: __call
public function __call($name, $parameters)
{
if (method_exists($this->_api, $name)) {
return call_user_func_array(array($this->_api, $name), $parameters);
}
return parent::__call($name, $parameters);
}
示例3: init
/**
* 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();
}
示例4: init
/**
* Init
*
* @throws CException
*/
public function init()
{
if (!function_exists('curl_init')) {
throw new CException('Для работы расширения требуется cURL');
}
parent::init();
}
示例5: init
public function init()
{
if (!function_exists("imagecreatetruecolor")) {
throw new Exception("使用这个类,需要启用GD库", 500);
}
parent::init();
}
示例6: init
/**
* Set default gateway from config
*/
public function init()
{
if ($this->activeGateway === null && $this->defaultGateway !== null) {
$this->setGateway($this->defaultGateway);
}
parent::init();
}
示例7: 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())));
}
}
}
示例8: init
/**
* Initializes this component.
*/
public function init()
{
parent::init();
if ($this->bootstrapPath === null) {
$this->bootstrapPath = Yii::getPathOfAlias('bootstrap');
}
}
示例9: init
public function init()
{
parent::init();
Yii::import('ext.imageapi.Toolkit');
Yii::import('ext.imageapi.GDToolkit');
$this->toolkit = new GDToolkit();
}
示例10: __get
/**
* Magic accessor for image collections.
*/
public function __get($name)
{
if (!isset($this->collections[$name])) {
return parent::__get($name);
}
return $this->getCollection($name);
}
示例11: init
/**
* @inheritdoc
*/
public function init()
{
$this->preInit();
Yii::import('bootstrap.widgets.*');
parent::init();
$this->setScriptMap();
}
示例12: 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();
}
示例13: __call
public function __call($name, $parameters)
{
if (\method_exists($this->_imageHandler, $name)) {
return \call_user_func_array(array($this->_imageHandler, $name), $parameters);
}
return parent::__call($name, $parameters);
}
示例14: init
public function init()
{
parent::init();
require Yii::getPathOfAlias('ext.PHPMailer') . '/PHPMailerAutoload.php';
$this->PHPMailer = new PHPMailer();
$this->settings();
}
示例15: 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();
}
}