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); } }
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']); }
/** * 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'); }
public function init() { parent::init(); Yii::setAlias('@webroot', '@frontend/web'); Yii::setAlias('@web', '/'); Yii::$app->set('assetManager', $this->assetManager); }
public function bootstrap($app) { \Yii::setAlias("@appBuilder", __DIR__ . '/..'); if ($app instanceof \yii\console\Application) { $app->controllerMap[$this->id] = ['class' => 'AppBuilder\\Controllers\\AppBuilderController', 'module' => $this]; } }
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']); } } }
/** * Initializes the widget * @throw InvalidConfigException */ public function init() { parent::init(); \Yii::setAlias('@xeditable', dirname(__FILE__)); $this->registerAssets(); //test }
/** * 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(); }
/** * 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'; } } } }
/** * 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']; } }
/** * @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']; } }
public function init() { \Yii::setAlias('@summernote', dirname(__FILE__)); if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->getId(); } parent::init(); }
public function init() { Yii::setAlias('@daterangepicker', __DIR__); foreach (static::$extra_js as $js_file) { $this->js[] = $js_file; } return parent::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); }
public function init() { \Yii::setAlias('@dropzone', dirname(__FILE__)); if (!isset($this->url)) { $this->url = \Yii::$app->urlManager->createUrl('site/upload'); } parent::init(); }
public function init() { parent::init(); /** * Aliases for nitm\widgets module */ \Yii::setAlias('nitm/widgets', dirname(__DIR__) . "/yii2-widgets"); }
public static function registerAlias($classMaps) { foreach ($classMaps as $namespace => $paths) { foreach ($paths as $path) { \Yii::setAlias(rtrim(str_replace('\\', '/', $namespace), "/"), $path); } } }
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); } }
public function init() { parent::init(); if (empty($this->templatePath)) { $this->templatePath = '/' . __DIR__ . '/template'; } \Yii::setAlias('@templatePath', $this->templatePath); }
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(); }
/** * 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); } } }
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']]]; } }
private function _setupPath() { if (isset($this->alias)) { Yii::setAlias('@maintenance', Yii::getAlias($this->alias)); } if (isset($this->path)) { Yii::setAlias('@maintenance', $this->path); } }
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); }
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); } }
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(); }
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"); } }
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; }
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(); }
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"); } }