當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。