当前位置: 首页>>代码示例>>PHP>>正文


PHP Yii::setPathOfAlias方法代码示例

本文整理汇总了PHP中Yii::setPathOfAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Yii::setPathOfAlias方法的具体用法?PHP Yii::setPathOfAlias怎么用?PHP Yii::setPathOfAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Yii的用法示例。


在下文中一共展示了Yii::setPathOfAlias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     // take the current extension path
     $dir = dirname(__FILE__);
     // generate alias name
     $alias = md5($dir);
     // create alias
     Yii::setPathOfAlias($alias, $dir);
     // import other classes
     Yii::import($alias . '.components.*');
     if (isset($this->widgetId)) {
         $this->_widgetId = $this->widgetId;
     } else {
         $this->_widgetId = 'clonnable-fields-widget-' . $this->getId(true);
     }
     $fieldNum = 1;
     foreach ($this->fields as &$field) {
         if (!isset($field['field']['fieldClassName']) || !is_string($field['field']['fieldClassName']) || $field['field']['fieldClassName'] == '') {
             $field['field']['fieldClassName'] = 'clonnable-field-' . $fieldNum;
         }
         $fieldNum++;
     }
     if ($this->minCloneRows > $this->startRows) {
         $this->startRows = $this->minCloneRows;
     }
     parent::init();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:27,代码来源:ClonnableFields.php

示例2: run

 public function run()
 {
     if (empty($this->config['action'])) {
         throw new CException('EAjaxUpload: param "action" cannot be empty.');
     }
     if (empty($this->config['allowedExtensions'])) {
         throw new CException('EAjaxUpload: param "allowedExtensions" cannot be empty.');
     }
     if (empty($this->config['sizeLimit'])) {
         throw new CException('EAjaxUpload: param "sizeLimit" cannot be empty.');
     }
     unset($this->config['element']);
     echo '<div id="' . $this->id . '"><noscript><p>Please enable JavaScript to use file uploader.</p></noscript></div>';
     //$assets = dirname(__FILE__).'/assets';
     //$baseUrl = Yii::app()->assetManager->publish($assets);
     //Yii::app()->clientScript->registerScriptFile($baseUrl . '/fileuploader.js', CClientScript::POS_HEAD);
     //$this->css=(!empty($this->css))?$this->css:$baseUrl.'/fileuploader.css';
     //Yii::app()->clientScript->registerCssFile($this->css);
     $this->css = !empty($this->css) ? $this->css : 'fileuploader.css';
     Yii::setPathOfAlias('ajaxupload', dirname(__FILE__));
     $cs = Yii::app()->getClientScript();
     $cs->packages['ajaxupload'] = array('basePath' => 'ajaxupload.assets', 'css' => array($this->css), 'js' => array('fileuploader.js'));
     $cs->registerPackage('ajaxupload');
     $postParams = array('PHPSESSID' => session_id(), 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken);
     if (isset($this->postParams)) {
         $postParams = array_merge($postParams, $this->postParams);
     }
     $config = array('button' => 'js:document.getElementById("' . $this->id . '")', 'debug' => false, 'multiple' => false);
     $config = array_merge($config, $this->config);
     $config['params'] = $postParams;
     $config = CJavaScript::encode($config);
     Yii::app()->getClientScript()->registerScript("FileUploader_" . $this->id, "var FileUploader_" . $this->id . " = new qq.FileUploaderBasic({$config}); ", CClientScript::POS_LOAD);
 }
开发者ID:narwold,项目名称:Small-Potatoes,代码行数:33,代码来源:EAjaxUpload.php

示例3: getModulePaths

 /**
  * @return array list of all modules
  */
 public function getModulePaths()
 {
     if ($this->_modulePaths === null) {
         $this->_modulePaths = array();
         foreach (Yii::app()->modules as $module => $config) {
             if (is_array($config)) {
                 $alias = 'application.modules.' . $module . '.' . ltrim($this->migrationSubPath, '.');
                 if (isset($config['class'])) {
                     Yii::setPathOfAlias($alias, dirname(Yii::getPathOfAlias($config['class'])) . '/' . str_replace('.', '/', ltrim($this->migrationSubPath, '.')));
                 } elseif (isset($config['basePath'])) {
                     Yii::setPathOfAlias($alias, $config['basePath'] . '/' . str_replace('.', '/', ltrim($this->migrationSubPath, '.')));
                 }
                 $this->_modulePaths[$module] = $alias;
                 $path = Yii::getPathOfAlias($alias);
                 if ($path === false || !is_dir($path)) {
                     $this->_disabledModules[] = $module;
                 }
             } else {
                 $this->_modulePaths[$config] = 'application.modules.' . $config . '.' . ltrim($this->migrationSubPath, '.');
             }
         }
     }
     // add a pseudo-module 'core'
     $this->_modulePaths[$this->applicationModuleName] = $this->migrationPath;
     $path = Yii::getPathOfAlias($this->migrationPath);
     if ($path === false || !is_dir($path)) {
         $this->_disabledModules[] = $this->applicationModuleName;
     }
     return $this->_modulePaths;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:33,代码来源:EMigrateCommand.php

示例4: 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 );');
     }
 }
开发者ID:charlesportwoodii,项目名称:eanalytics,代码行数:34,代码来源:EAnalytics.php

示例5: 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();
 }
开发者ID:Orlac,项目名称:yii2-debug,代码行数:34,代码来源:Yii2Debug.php

示例6: init

 /**
  * Initializes the component.
  */
 public function init()
 {
     // Register the bootstrap path alias.
     if (Yii::getPathOfAlias('bootstrap') === false) {
         Yii::setPathOfAlias('bootstrap', realpath(dirname(__FILE__) . '/..'));
     }
     // Prevents the extension from registering scripts and publishing assets when ran from the command line.
     if (Yii::app() instanceof CConsoleApplication) {
         return;
     }
     if ($this->coreCss !== false) {
         $this->registerCoreCss();
     }
     if ($this->responsiveCss !== false) {
         $this->registerResponsiveCss();
     }
     if ($this->yiiCss !== false) {
         $this->registerYiiCss();
     }
     if ($this->jqueryCss !== false) {
         $this->registerJQueryCss();
     }
     if ($this->enableJS !== false) {
         $this->registerCoreScripts();
     }
     parent::init();
 }
开发者ID:schlypel,项目名称:YiiBackboneBoilerplate,代码行数:30,代码来源:Bootstrap.php

示例7: init

 public function init()
 {
     $modules = glob(Yii::getPathOfAlias('application.modules') . '/*', GLOB_ONLYDIR);
     foreach ($modules as $dir) {
         Yii::setPathOfAlias(basename($dir), $dir);
     }
     if (isset($this->_domains[Yii::app()->request->serverName])) {
         $config = $this->_domains[Yii::app()->request->serverName];
         if (is_string($config)) {
             $configFile = Yii::getPathOfAlias('application.config.domains.' . $config) . '.php';
             if (is_file($configFile)) {
                 $config = (include $configFile);
             } else {
                 $config = array();
             }
         }
         Yii::app()->configure($config);
         $this->loadDomain();
         $domainTheme = Yii::app()->getParams()->offsetGet('theme');
         if (!empty($domainTheme)) {
             Yii::app()->configure(array('theme' => $domainTheme));
         }
         if (null !== Yii::app()->theme) {
             $config = Yii::app()->theme->basePath . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'config.php';
             if (is_file($config)) {
                 $config = (include $config);
                 Yii::app()->configure($config);
             }
         }
     }
 }
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:31,代码来源:DomainManager.php

示例8: init

 /**
  * Initializes the component.
  */
 public function init()
 {
     // Register the bootstrap path alias.
     if (Yii::getPathOfAlias('bootstrap') === false) {
         Yii::setPathOfAlias('bootstrap', realpath(dirname(__FILE__) . '/..'));
     }
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:10,代码来源:Bootstrap.php

示例9: 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();
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:7,代码来源:AutosearchAMQP.php

示例10: init

 /**
  * Initializes the admin module.
  */
 public function init()
 {
     parent::init();
     Yii::setPathOfAlias('admin', dirname(__FILE__));
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => $this->getId() . '/default/error'), 'user' => array('class' => 'WebUser', 'stateKeyPrefix' => 'admin', 'loginUrl' => Yii::app()->createUrl($this->getId() . '/default/login')), 'widgetFactory' => array('class' => 'CWidgetFactory', 'widgets' => array())), false);
     $this->setImport(array('admin.models.*', 'admin.components.*'));
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:10,代码来源:AdminModule.php

示例11: __construct

 public function __construct($config = null)
 {
     if (is_string($config)) {
         $config = (require $config);
     }
     Yii::setApplication($this);
     //保存整个app实例
     if (isset($config['basePath'])) {
         $this->setBasePath($config['basePath']);
         unset($config['basePath']);
     } else {
         $this->setBasePath('protected');
     }
     //设置别名,后面就可以用application表示basePath了
     Yii::setPathOfAlias('application', $this->getBasePath());
     //钩子,模块 预 初始化时执行,子类实现。不过这时,配置还没有写入框架
     $this->preinit();
     $this->registerCoreComponents();
     //父类实现
     $this->configure($config);
     //加载静态应用组件
     $this->preloadComponents();
     //这才开始初始化模块
     $this->init();
 }
开发者ID:RandomCivil,项目名称:tiny-yii,代码行数:25,代码来源:CApplication.php

示例12: init

 public function init()
 {
     $this->_params = isset(Yii::app()->params['migraptor']) && is_array(Yii::app()->params['migraptor']) ? Yii::app()->params['migraptor'] : [];
     $migrationsBasePath = realpath(isset($this->_params['base_path']) ? $this->_params['base_path'] : Yii::app()->basePath . '/../migraptor');
     $this->_skipConnections = isset($this->_params['skip_connections']) ? $this->_params['skip_connections'] : [];
     if (!is_array($this->_skipConnections)) {
         $this->_skipConnections = [$this->_skipConnections];
     }
     Yii::setPathOfAlias('migraptor', $migrationsBasePath);
     $this->_migrationsBasePath = 'migraptor';
     $this->_projectMigrationTypes = isset($this->_params['migration_types']) && is_array($this->_params['migration_types']) ? $this->_params['migration_types'] : [];
     $this->_migrationTypes = $this->_defaultMigrationTypes;
     $migrationTypesDefault = array_combine($this->_migrationTypesDefault, $this->_migrationTypesDefault);
     foreach ($this->_projectMigrationTypes as $migrationTypeKey => $migrationType) {
         if (isset($this->_migrationTypes[$migrationTypeKey])) {
             $projectMigrationType = $this->_projectMigrationTypes[$migrationTypeKey];
             if ($projectMigrationType === false) {
                 unset($this->_migrationTypes[$migrationTypeKey]);
                 unset($migrationTypesDefault[$migrationTypeKey]);
                 continue;
             }
         }
         $this->_migrationTypes[$migrationTypeKey] = $migrationType;
     }
     $this->_migrationTypesDefault = $migrationTypesDefault;
     $this->isDone = false;
     register_shutdown_function([$this, 'onShutdown']);
 }
开发者ID:eugenesavenko,项目名称:migraptor,代码行数:28,代码来源:MigraptorCommand.php

示例13: init

 public function init()
 {
     Controller::initParams();
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     Yii::app()->setComponent('bootstrap', array('class' => 'ext.bootstrap.components.Bootstrap', 'responsiveCss' => true));
     Yii::setPathOfAlias('bootstrap', dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../extensions/bootstrap');
     Yii::app()->bootstrap->init();
     // import the module-level models and components
     $this->setImport(array('admin.models.*', 'admin.components.*'));
     Yii::app()->setComponents(array('user' => array('class' => 'AdminUser', 'loginUrl' => Yii::app()->createAbsoluteUrl('admin/login'), 'allowAutoLogin' => true)), true);
     $this->layout = 'application.modules.admin.views.layouts.column1';
     if (Yii::app()->params['STORE_OFFLINE'] == '-1') {
         die('Admin Panel unavailable due to account suspension.');
     }
     if (isset($_POST['url']) && isset($_POST['password'])) {
         $model = new LoginForm();
         if ($model->loginLightspeed($_POST['user'], $_POST['password'])) {
             Yii::app()->getRequest()->redirect(Yii::app()->createUrl("/admin"));
         } else {
             die("You have an invalid password set in your eCommerce options. Cannot continue.");
         }
     }
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->shouldLogOut()) {
             Yii::app()->user->logout(false);
         }
     }
     _xls_set_conf('ADMIN_PANEL', date("Y-m-d H:i:s"));
     parent::init();
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:31,代码来源:AdminModule.php

示例14: launch_codeception_yii_bridge

function launch_codeception_yii_bridge()
{
    Yii::setPathOfAlias('codeception-yii', __DIR__);
    Yii::import('codeception-yii.test.CTestCase');
    Yii::import('codeception-yii.web.CodeceptionHttpRequest');
    Yii::import('system.test.CDbTestCase');
    Yii::import('system.test.CWebTestCase');
}
开发者ID:Digizijn,项目名称:YiiBridge,代码行数:8,代码来源:yiit.php

示例15: init

 public function init()
 {
     parent::init();
     $dir = dirname(__FILE__);
     $alias = md5($dir);
     Yii::setPathOfAlias($alias, $dir);
     Yii::import($alias . '.simple_image');
 }
开发者ID:reggi49,项目名称:plansys,代码行数:8,代码来源:CSimpleImage.php


注:本文中的Yii::setPathOfAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。