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


PHP Yii::setAlias方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     \Yii::setAlias('@webuploader', __DIR__);
     if (empty($this->driver)) {
         $this->driver = isset(\Yii::$app->params['webuploader_driver']) ? \Yii::$app->params['webuploader_driver'] : 'local';
     }
     if ($this->driver == 'local') {
         // 初始化@static别名,默认@web/static,最好根据自己的需求提前设置好@static别名
         $static = \Yii::getAlias('@static', false);
         $staticroot = \Yii::getAlias('@staticroot', false);
         if (!$static || !$staticroot) {
             \Yii::setAlias('@static', '@web/static');
             \Yii::setAlias('@staticroot', '@webroot/static');
         }
     }
     $this->server = $this->server ?: Url::to(['/site/webupload', 'driver' => $this->driver]);
     $this->options['boxId'] = isset($this->options['boxId']) ? $this->options['boxId'] : 'picker';
     $this->options['previewWidth'] = isset($this->options['previewWidth']) ? $this->options['previewWidth'] : '250';
     $this->options['previewHeight'] = isset($this->options['previewHeight']) ? $this->options['previewHeight'] : '150';
     if ($this->hasModel()) {
         $this->hiddenInput = Html::activeHiddenInput($this->model, $this->attribute);
     } else {
         $this->hiddenInput = Html::hiddenInput($this->name, $this->value);
     }
 }
开发者ID:yidashi,项目名称:yii2-webuploader,代码行数:26,代码来源:Webuploader.php

示例2: init

 public function init()
 {
     parent::init();
     \Yii::setAlias('@foundationTopbar', dirname(__FILE__));
     $this->registerAsset();
     if (!is_null($this->contain)) {
         echo Html::beginTag('div', $this->contain);
     }
     Html::addCssClass($this->title['nameOptions'], 'top-bar');
     Html::addCssClass($this->title['listNameOptions'], 'name');
     Html::addCssClass($this->options['sectionOptions'], 'top-bar-section');
     Html::addCssClass($this->options['navOptions'], 'top-bar');
     if (!isset($this->options['navOptions']['data-topbar'])) {
         $this->options['navOptions']['data-topbar'] = '';
     }
     echo Html::beginTag('nav', $this->options['navOptions']);
     echo Html::beginTag('ul', ['class' => 'title-area']);
     if (!empty($this->title['name'])) {
         echo Html::beginTag('li', $this->title['listNameOptions']);
         echo Html::beginTag('h1');
         echo Html::a($this->title['name'], $this->title['nameUrl'], $this->title['nameOptions']);
         echo Html::endTag('h1');
         echo Html::endTag('li');
     }
     echo Html::tag('li', '<a href="#"><span>Menu</span></a>', ['class' => "toggle-topbar menu-icon"]);
     echo Html::endTag('ul');
     echo Html::beginTag('section', $this->options['sectionOptions']);
 }
开发者ID:pramana08,项目名称:yii2-foundation-topbar,代码行数:28,代码来源:FoundationNavbar.php

示例3: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->mockWebApplication();
     \Yii::setAlias('@webroot', __DIR__ . '/runtime/web');
     \Yii::setAlias('@web', '/runtime/web');
 }
开发者ID:slinstj,项目名称:yii2-assets-optimizer,代码行数:11,代码来源:ViewTest.php

示例4: init

 public function init()
 {
     parent::init();
     Yii::setAlias('@webroot', '@frontend/web');
     Yii::setAlias('@web', '/');
     Yii::$app->set('assetManager', $this->assetManager);
 }
开发者ID:lav45,项目名称:yii2-translated-behavior-demo,代码行数:7,代码来源:m160418_201842_page_data.php

示例5: bootstrap

 public function bootstrap($app)
 {
     \Yii::setAlias("@appBuilder", __DIR__ . '/..');
     if ($app instanceof \yii\console\Application) {
         $app->controllerMap[$this->id] = ['class' => 'AppBuilder\\Controllers\\AppBuilderController', 'module' => $this];
     }
 }
开发者ID:Vlsirko,项目名称:yii2-application-builder,代码行数:7,代码来源:Module.php

示例6: bootstrap

 public function bootstrap($app)
 {
     /**
      *
      * @var Module $systemModule
      * @var \app\modules\user\Module $userModule
      *
      */
     if ($app->hasModule('system') && ($systemModule = $app->getModule('system')) instanceof Module) {
         // Установка теми з настроек сайту
         $themeFrontend = Yii::$app->keyStorage->get('themeFrontend');
         \Yii::$app->set('view', ['class' => 'app\\components\\FrontendView', 'title' => 'Frontend Template', 'enableMinify' => false, 'web_path' => '@web', 'base_path' => '@webroot', 'minify_path' => '@webroot/assets', 'js_position' => [\yii\web\View::POS_HEAD], 'force_charset' => 'UTF-8', 'expand_imports' => !YII_ENV_DEV, 'compress_output' => !YII_ENV_DEV, 'compress_options' => ['extra' => !YII_ENV_DEV], 'concatCss' => !YII_ENV_DEV, 'minifyCss' => !YII_ENV_DEV, 'concatJs' => !YII_ENV_DEV, 'minifyJs' => !YII_ENV_DEV, 'theme' => ['basePath' => '@app/templates/frontend/' . $themeFrontend, 'baseUrl' => '@web/templates/frontend/' . $themeFrontend . '/web', 'pathMap' => ['@app/views' => '@app/templates/frontend/' . $themeFrontend . '/views', '@app/modules' => '@app/templates/frontend/' . $themeFrontend . '/modules', '@app/widgets' => '@app/templates/frontend/' . $themeFrontend . '/widgets']], 'as seo' => ['class' => 'app\\modules\\system\\components\\SeoViewBehavior']]);
         $assetManager = ['class' => 'yii\\web\\AssetManager', 'linkAssets' => false, 'appendTimestamp' => YII_ENV_DEV, 'converter' => ['class' => 'nizsheanez\\assetConverter\\Converter', 'destinationDir' => 'css/../', 'parsers' => ['sass' => ['class' => 'nizsheanez\\assetConverter\\Sass', 'output' => 'css', 'options' => ['cachePath' => '@app/runtime/cache/sass-parser']], 'scss' => ['class' => 'nizsheanez\\assetConverter\\Scss', 'output' => 'css', 'options' => []], 'less' => ['class' => 'nizsheanez\\assetConverter\\Less', 'output' => 'css', 'options' => ['auto' => true]]]]];
         $assetManager['bundles'] = ['yii\\jui\\JuiAsset' => ['sourcePath' => '@app/media/', 'js' => ['js/jquery-ui.min.js'], 'css' => []]];
         if (strpos(Yii::$app->request->pathInfo, 'admin') !== 0) {
             $assetManager['bundles'] = ['yii\\bootstrap\\BootstrapAsset' => []];
         }
         \Yii::$app->set('assetManager', $assetManager);
         \Yii::setAlias('@frontendTemplate', realpath(__DIR__ . '/../../templates/frontend/' . $themeFrontend));
         // Індексація сайту
         if (!Yii::$app->keyStorage->get('indexing')) {
             \Yii::$app->getView()->registerMetaTag(['name' => 'robots', 'content' => 'noindex, nofollow']);
         }
     }
 }
开发者ID:oakcms,项目名称:oakcms,代码行数:25,代码来源:Bootstrap.php

示例7: init

 /**
  * Initializes the widget
  * @throw InvalidConfigException
  */
 public function init()
 {
     parent::init();
     \Yii::setAlias('@xeditable', dirname(__FILE__));
     $this->registerAssets();
     //test
 }
开发者ID:perminder-klair,项目名称:yii2-x-editable,代码行数:11,代码来源:XEditable.php

示例8: init

 /**
  * Initializes the widget
  * @throw InvalidConfigException
  */
 public function init()
 {
     parent::init();
     //base url
     $asset = new DropZoneAsset();
     DropZoneAsset::register($this->view);
     \Yii::setAlias('@cmsAB-Dropzone', dirname(__FILE__));
     $this->_ruta = \Yii::getAlias('@cmsAB-Dropzone');
     //set defaults
     $loading = '/vendor/cmsAB/yii2-dropzone/assets/img/cargando.gif';
     $this->_imagenes = !empty($this->initImagenes) ? $this->initImagenes : '';
     $this->_iconLoading = !empty($this->iconLoading) ? $loading : $this->iconLoading;
     if (!isset($this->options['url'])) {
         $this->options['url'] = $this->uploadUrl;
     }
     // Set the url
     if (!isset($this->options['previewsContainer'])) {
         $this->options['previewsContainer'] = '#' . $this->previewsContainer;
     }
     // Define the element that should be used as click trigger to select files.
     if (!isset($this->options['clickable'])) {
         $this->options['clickable'] = true;
     }
     // Define the element that should be used as click trigger to select files.
     $this->autoDiscover = $this->autoDiscover === false ? 'false' : 'true';
     if (\Yii::$app->getRequest()->enableCsrfValidation) {
         $this->options['headers'][\yii\web\Request::CSRF_HEADER] = \Yii::$app->getRequest()->getCsrfToken();
         $this->options['params'][\Yii::$app->getRequest()->csrfParam] = \Yii::$app->getRequest()->getCsrfToken();
     }
     $this->registerAssets();
 }
开发者ID:alejandrososa,项目名称:AB,代码行数:35,代码来源:DropZone.php

示例9: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     /**
      * @var Module $gii
      */
     \Yii::setAlias('@carono', '@vendor/carono/yii2-components');
     if ($app instanceof \yii\console\Application) {
         $commands = ['city' => 'CityController', 'currency' => 'CurrencyController', 'dumper' => 'DumperController', 'carono' => 'CaronoController'];
         foreach ($commands as $name => $command) {
             $name = file_exists(\Yii::getAlias("@app/commands/{$command}.php")) ? "carono" . ucfirst($name) : $name;
             $app->controllerMap[$name] = 'carono\\components\\commands\\' . $command;
         }
         if (!isset($app->controllerMap['giix'])) {
             if (($gii = $app->getModule('gii')) && isset($gii->generators["giiant-model"])) {
                 if (!isset($gii->generators["giiant-model"]["templates"])) {
                     if (is_array($gii->generators["giiant-model"])) {
                         $gii->generators["giiant-model"]["templates"] = [];
                     } else {
                         $gii->generators["giiant-model"] = ["class" => 'schmunk42\\giiant\\generators\\model\\Generator', "templates" => []];
                     }
                 }
                 $template = '@vendor/carono/yii2-components/templates/giiant-model';
                 $gii->generators["giiant-model"]["templates"]["caronoModel"] = $template;
                 $app->controllerMap['giix'] = 'carono\\components\\commands\\GiixController';
             }
         }
     }
 }
开发者ID:carono,项目名称:yii2-components,代码行数:33,代码来源:Bootstrap.php

示例10: bootstrap

 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     \Yii::setAlias('@cornernote/dashboard', __DIR__);
     if ($app->has('i18n')) {
         $app->i18n->translations['dashboard'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en', 'basePath' => '@cornernote/dashboard/messages'];
     }
 }
开发者ID:cornernote,项目名称:yii2-dashboard,代码行数:12,代码来源:Bootstrap.php

示例11: bootstrap

 /**
  * @inheritDoc
  */
 public function bootstrap($app)
 {
     \Yii::setAlias('@choate/coderelease', __DIR__);
     if ($app instanceof \yii\console\Application) {
         $app->controllerMap[$this->id] = ['class' => '\\choate\\coderelease\\console\\CodeReleaseController'];
     }
 }
开发者ID:Choate,项目名称:coderelease,代码行数:10,代码来源:Module.php

示例12: init

 public function init()
 {
     \Yii::setAlias('@summernote', dirname(__FILE__));
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
     parent::init();
 }
开发者ID:zainiafzan,项目名称:yii2-summernote,代码行数:8,代码来源:Summernote.php

示例13: init

 public function init()
 {
     Yii::setAlias('@daterangepicker', __DIR__);
     foreach (static::$extra_js as $js_file) {
         $this->js[] = $js_file;
     }
     return parent::init();
 }
开发者ID:fatjiong,项目名称:yii2-daterangepicker,代码行数:8,代码来源:DateRangePickerAsset.php

示例14: init

 public function init()
 {
     parent::init();
     \Yii::$app->response->formatters = ArrayHelper::merge(\Yii::$app->response->formatters, $this->responseFormatter);
     \Yii::setAlias('@jsonrpc', __DIR__);
     $view = \Yii::$app->getView();
     JsonrpcAsset::register($view);
 }
开发者ID:voenniy,项目名称:yii2-jsonrpc,代码行数:8,代码来源:JsonRPCModule.php

示例15: init

 public function init()
 {
     \Yii::setAlias('@dropzone', dirname(__FILE__));
     if (!isset($this->url)) {
         $this->url = \Yii::$app->urlManager->createUrl('site/upload');
     }
     parent::init();
 }
开发者ID:zainiafzan,项目名称:yii2-dropzone,代码行数:8,代码来源:Dropzone.php


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