PHP Method Yii::setAlias Code Examples

This page contains top rated real world PHP examples of method Yii::setAlias extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: m160418_201842_page_data.php Project: lav45/yii2-translated-behavior-demo
0
 public function init()
 {
     parent::init();
     Yii::setAlias('@webroot', '@frontend/web');
     Yii::setAlias('@web', '/');
     Yii::$app->set('assetManager', $this->assetManager);
 }
Example #2
Show file File: Bootstrap.php Project: oakcms/oakcms
0
 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']);
         }
     }
 }
Example #3
Show file File: XEditable.php Project: perminder-klair/yii2-x-editable
0
 /**
  * Initializes the widget
  * @throw InvalidConfigException
  */
 public function init()
 {
     parent::init();
     \Yii::setAlias('@xeditable', dirname(__FILE__));
     $this->registerAssets();
     //test
 }
Example #4
Show file File: ViewTest.php Project: slinstj/yii2-assets-optimizer
0
 /**
  * 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');
 }
Example #5
Show file File: Module.php Project: Choate/coderelease
0
 /**
  * @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'];
     }
 }
Example #6
Show file File: Bootstrap.php Project: cornernote/yii2-dashboard
0
 /**
  * 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'];
     }
 }
Example #7
Show file File: Webuploader.php Project: yidashi/yii2-webuploader
0
 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);
     }
 }
Example #8
Show file File: Bootstrap.php Project: carono/yii2-components
0
 /**
  * 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';
             }
         }
     }
 }
Example #9
Show file File: Module.php Project: Vlsirko/yii2-application-builder
0
 public function bootstrap($app)
 {
     \Yii::setAlias("@appBuilder", __DIR__ . '/..');
     if ($app instanceof \yii\console\Application) {
         $app->controllerMap[$this->id] = ['class' => 'AppBuilder\\Controllers\\AppBuilderController', 'module' => $this];
     }
 }
Example #10
Show file File: FoundationNavbar.php Project: pramana08/yii2-foundation-topbar
0
 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']);
 }
Example #11
Show file File: DropZone.php Project: alejandrososa/AB
0
 /**
  * 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();
 }
Example #12
Show file File: Module.php Project: keyeMyria/YetCMS
0
 public function setPluginViewPath()
 {
     $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . $this->pluginid . DIRECTORY_SEPARATOR . 'views';
     if (is_dir($path)) {
         $this->setViewPath($path);
         Yii::setAlias("@pluginView", $path);
     }
 }
Example #13
Show file File: MailerQueue.php Project: Sergey005139/yii2-mailerqueue
0
 public function init()
 {
     parent::init();
     if (empty($this->templatePath)) {
         $this->templatePath = '/' . __DIR__ . '/template';
     }
     \Yii::setAlias('@templatePath', $this->templatePath);
 }
Example #14
Show file File: Module.php Project: nhatvuvan/yii2-widgets
0
 public function init()
 {
     parent::init();
     /**
      * Aliases for nitm\widgets module
      */
     \Yii::setAlias('nitm/widgets', dirname(__DIR__) . "/yii2-widgets");
 }
Example #15
Show file File: HassClassLoader.php Project: rocketyang/hasscms-app
0
 public static function registerAlias($classMaps)
 {
     foreach ($classMaps as $namespace => $paths) {
         foreach ($paths as $path) {
             \Yii::setAlias(rtrim(str_replace('\\', '/', $namespace), "/"), $path);
         }
     }
 }
Example #16
Show file File: Summernote.php Project: zainiafzan/yii2-summernote
0
 public function init()
 {
     \Yii::setAlias('@summernote', dirname(__FILE__));
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
     parent::init();
 }
Example #17
Show file File: DateRangePickerAsset.php Project: fatjiong/yii2-daterangepicker
0
 public function init()
 {
     Yii::setAlias('@daterangepicker', __DIR__);
     foreach (static::$extra_js as $js_file) {
         $this->js[] = $js_file;
     }
     return parent::init();
 }
Example #18
Show file File: JsonRPCModule.php Project: voenniy/yii2-jsonrpc
0
 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);
 }
Example #19
Show file File: Dropzone.php Project: zainiafzan/yii2-dropzone
0
 public function init()
 {
     \Yii::setAlias('@dropzone', dirname(__FILE__));
     if (!isset($this->url)) {
         $this->url = \Yii::$app->urlManager->createUrl('site/upload');
     }
     parent::init();
 }
Example #20
Show file File: Module.php Project: NageshVeeravalli/yii2-packaii
0
 public function init()
 {
     parent::init();
     // auto-configure alias @root, if not set in config
     if (\Yii::getAlias('@root', false) === false) {
         \Yii::setAlias('@root', __DIR__ . '/../../..');
     }
     $this->validateSettings();
 }
Example #21
Show file File: Bootstrap.php Project: yinheark/yincart2
0
 /**
  * set the alias of extension namespace for autoload
  */
 public function initModuleNamespace()
 {
     foreach ($this->codePools as $codePoolDir) {
         $namespaceDirs = DirHelper::getDirs(\Yii::getAlias($codePoolDir));
         foreach ($namespaceDirs as $namespaceDir) {
             \Yii::setAlias($namespaceDir, $codePoolDir . '/' . $namespaceDir);
         }
     }
 }
Example #22
Show file File: Bootstrap.php Project: lenarx/yii2-cms-media
0
 public function bootstrap($app)
 {
     // Uploads Path
     \Yii::setAlias('uploads', dirname(dirname(dirname(__DIR__))) . '/uploads');
     if (!$app instanceof ConsoleApplication) {
         $app->getUrlManager()->addRules(["page/<link:[a-z0-9\\-_\\.]+>" => 'pages/default/view'], false);
         \Yii::$app->params['modules']['media'] = ['parent' => false, 'version' => '0.5', 'name' => 'media', 'description' => 'Медиафайлы', 'isSettingsPage' => true, 'rbac' => ['BMediaIndex' => ['description' => 'Доступ к модулю "Медиафайлы"', 'full_description' => 'Просмотр списка медиафайлов, отображение пункта в меню', 'type' => 'checkbox'], 'BMediaCreate' => ['description' => 'Загрузка новых медиафайлов', 'full_description' => '', 'type' => 'checkbox'], 'BMediaDelete' => ['description' => 'Удаление медиафайлов', 'full_description' => '', 'type' => 'checkbox']], 'menu' => ['icon' => Html::tag('i', "", ['class' => 'fa fa-picture-o']), 'url' => ['/media'], 'label' => 'Медиафайлы', 'visible' => \Yii::$app->user->can('BMediaIndex') ? true : false, 'active' => ['module' => 'media', 'controller' => 'default']]];
     }
 }
Example #23
Show file File: DefaultController.php Project: humanized/yii2-maintenance
0
 private function _setupPath()
 {
     if (isset($this->alias)) {
         Yii::setAlias('@maintenance', Yii::getAlias($this->alias));
     }
     if (isset($this->path)) {
         Yii::setAlias('@maintenance', $this->path);
     }
 }
Example #24
Show file File: PlacesAutocompleteTest.php Project: nevermnd/yii2-places
0
 public function testWidget()
 {
     \Yii::setAlias('@bower', __DIR__ . '/../vendor/bower-asset');
     $view = \Yii::$app->getView();
     $model = new Model();
     $content = $view->render('//test', compact('model'));
     $actual = $view->render('//layouts/main', compact('content'));
     $expected = file_get_contents(__DIR__ . '/data/test.bin');
     $this->assertEquals($expected, $actual);
 }
Example #25
Show file File: App.php Project: Vincent-X/yii2-app-advanced
0
 public function setAliases()
 {
     if (!is_array($this->aliases)) {
         say("You must load your Aliases file in ./cmd");
         exit;
     }
     foreach ($this->aliases as $name => $path) {
         Yii::setAlias($name, $path);
     }
 }
Example #26
Show file File: SyntaxHighlighterAsset.php Project: giovdk21/yii2-syntaxhighlighter
0
 public function init()
 {
     Yii::setAlias('@yii2SyntaxHighlighter', __DIR__);
     foreach (static::$extraCss as $css) {
         $this->css[] = $css;
     }
     foreach (static::$extraJs as $js) {
         $this->js[] = $js;
     }
     return parent::init();
 }
Example #27
Show file File: RatingModule.php Project: MaizerGomes/openbay
0
 public function init()
 {
     parent::init();
     \Yii::setAlias('@rating', realpath(dirname(__FILE__) . '/'));
     if (empty($this->recordModel)) {
         throw new Exception("Unknown class recordModel");
     }
     if (empty($this->salt)) {
         throw new Exception("Salt is incorrect");
     }
 }
Example #28
Show file File: yii2.php Project: neam/php-orm-benchmark
0
 public function setup()
 {
     define('YII_DEBUG', false);
     $basePath = dirname(dirname(dirname(dirname(__DIR__))));
     // go 4 up
     require $basePath . '/vendor/yiisoft/yii2/Yii.php';
     Yii::setAlias('@model', "{$basePath}/app/classes/model");
     $dbConfig = $this->get_db_params();
     $db = new \yii\db\Connection(['dsn' => "mysql:host={$dbConfig['host']};dbname={$dbConfig['dbname']}", 'username' => $dbConfig['username'], 'password' => $dbConfig['password'], 'charset' => 'utf8']);
     Post::$db = $db;
     Comment::$db = $db;
 }
Example #29
Show file File: Ueditor.php Project: hustshenl/yii2-ueditor
0
 public function init()
 {
     if (isset($this->options['ucontent'])) {
         $this->ucontent = $this->options['ucontent'];
         unset($this->options['ucontent']);
     }
     $this->events = $this->options;
     \Yii::setAlias('@hustshenl\\ueditor\\assets', '@vendor/hustshenl/yii2-ueditor/assets');
     if (empty($this->name)) {
         $this->name = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->id;
     }
     //register css & js
     $asset = UeditorAsset::register($this->view);
     //init options
     parent::init();
 }
Example #30
Show file File: CommentModule.php Project: testbots/openbay
0
 public function init()
 {
     parent::init();
     \Yii::setAlias('@comment', realpath(dirname(__FILE__) . '/'));
     if (empty($this->recordModel)) {
         throw new Exception("Unknown class recordModel");
     }
     if (empty($this->salt)) {
         throw new Exception("Salt is incorrect");
     }
     if (empty($this->reCaptchaSiteKey)) {
         throw new Exception("Empty reCaptchaSiteKey");
     }
     if (empty($this->reCaptchaSecretKey)) {
         throw new Exception("Empty reCaptchaSecretKey");
     }
 }