if ($this->_isBasePathPermissionChecked) { return; } if (!is_dir($this->basePath)) { throw new InvalidConfigException("The directory does not exist: {$this->basePath}"); } if (!is_writable($this->basePath)) { throw new InvalidConfigException("The directory is not writable by the Web process: {$this->basePath}"); } $this->_isBasePathPermissionChecked = true; } /** * Returns the named asset bundle. * * This method will first look for the bundle in [[bundles]]. If not found,
* * @return string[] the path directory and the URL that the asset is published as. * @throws InvalidArgumentException if the asset to be published does not exist. */ protected function publishDirectory($src, $options) { $this->checkBasePathPermission(); $dir = $this->hash($src); $dstDir = $this->basePath . DIRECTORY_SEPARATOR . $dir; if ($this->linkAssets) { if (!is_dir($dstDir)) { FileHelper::createDirectory(dirname($dstDir), $this->dirMode, true);
} if (is_file($src)) { return $this->_published[$path] = $this->publishFile($src); } return $this->_published[$path] = $this->publishDirectory($src, $options); } /** * Publishes a file. * @param string $src the asset file to be published * @return string[] the path and the URL that the asset is published as.
* CSS or JS files using [[AssetManager::converter|asset converter]]. * @param AssetManager $am the asset manager to perform the asset publishing */ public function publish($am) { if ($this->sourcePath !== null && !isset($this->basePath, $this->baseUrl)) { list($this->basePath, $this->baseUrl) = $am->publish($this->sourcePath, $this->publishOptions); } if (isset($this->basePath, $this->baseUrl) && ($converter = $am->getConverter()) !== null) { foreach ($this->js as $i => $js) { if (is_array($js)) { $file = array_shift($js);
if (!isset($config['class'])) { $config['class'] = $name; } /* @var $bundle AssetBundle */ $bundle = Yii::createObject($config); if ($publish) { $bundle->publish($this); } return $bundle; } /**
*/ public function getBundle($name, $publish = true) { if ($this->bundles === false) { return $this->loadDummyBundle($name); } elseif (!isset($this->bundles[$name])) { return $this->bundles[$name] = $this->loadBundle($name, [], $publish); } elseif ($this->bundles[$name] instanceof AssetBundle) { return $this->bundles[$name]; } elseif (is_array($this->bundles[$name])) { return $this->bundles[$name] = $this->loadBundle($name, $this->bundles[$name], $publish); } elseif ($this->bundles[$name] === false) { return $this->loadDummyBundle($name);
* @throws InvalidConfigException if the asset bundle does not exist or a circular dependency is detected */ public function registerAssetBundle($name, $position = null) { if (!isset($this->assetBundles[$name])) { $am = $this->getAssetManager(); $bundle = $am->getBundle($name); $this->assetBundles[$name] = false; // register dependencies $pos = isset($bundle->jsOptions['position']) ? $bundle->jsOptions['position'] : null; foreach ($bundle->depends as $dep) { $this->registerAssetBundle($dep, $pos); }
* Registers this asset bundle with a view. * @param View $view the view to be registered with * @return static the registered asset bundle instance */ public static function register($view) { return $view->registerAssetBundle(get_called_class()); } /** * Initializes the bundle. * If you override this method, make sure you call the parent implementation in the last. */
public function registerClientScript() { $id = $this->options['id']; $options = Json::htmlEncode($this->getClientOptions()); $attributes = Json::htmlEncode($this->attributes); $view = $this->getView(); ActiveFormAsset::register($view); $view->registerJs("jQuery('#$id').yiiActiveForm($attributes, $options);"); } /** * Returns the options for the form JS widget. * @return array the options.
$content = ob_get_clean(); $html = Html::beginForm($this->action, $this->method, $this->options); $html .= $content; if ($this->enableClientScript) { $this->registerClientScript(); } $html .= Html::endForm(); return $html; }
if ($assign) { $template->assign($assign, $widget); } } else { $widget = array_pop(Widget::$stack); echo $content; $out = $widget->run(); return ob_get_clean() . $out; } } /** * Smarty plugin callback function to support widgets as Smarty functions.
if (isset($this->widgets['functions'][$alias])) { if (($methodInfo[0] === '_widget_function') && (count($args) === 2)) { return $this->widgetFunction($this->widgets['functions'][$alias], $args[0], $args[1]); } } elseif (isset($this->widgets['blocks'][$alias])) { if (($methodInfo[0] === '_widget_block') && (count($args) === 4)) { return $this->widgetBlock($this->widgets['blocks'][$alias], $args[0], $args[1], $args[2], $args[3]); } } else { throw new InvalidConfigException('Widget "' . $alias . '" not declared.'); } }
</div> </div> </div> <?php echo yii\helpers\Html::submitButton('Отправить',array('class'=>'btn btn-primary'));?> <?php $_block_repeat=false; echo $_block_plugin1->_widget_block__ActiveForm(array('assign'=>'form','id'=>'ask-form'), ob_get_clean(), $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?> <?php }?> </div> </div> </div><?php }
} if ($_template->startRenderCallbacks) { foreach ($_template->startRenderCallbacks as $callback) { call_user_func($callback, $_template); } } $unifunc($_template); foreach ($_template->endRenderCallbacks as $callback) { call_user_func($callback, $_template); } $_template->isRenderingCache = false; } catch (Exception $e) { $_template->isRenderingCache = false;
$_template->cached->file_dependency = array_merge($_template->cached->file_dependency, $this->file_dependency); } if ($_template->source->handler->uncompiled) { $_template->source->handler->renderUncompiled($_template->source, $_template); } else { $this->getRenderedTemplateCode($_template); } if ($_template->caching && $this->has_nocache_code) { $_template->cached->hashes[ $this->nocache_hash ] = true; } if ($_template->smarty->debugging) { $_template->smarty->_debug->end_render($_template);
} $this->cached->render($this, $no_output_filter); } else { if (!isset($this->compiled) || $this->compiled->compile_id !== $this->compile_id) { $this->loadCompiled(true); } $this->compiled->render($this); } // display or fetch if ($display) { if ($this->caching && $this->smarty->cache_modified_check) { $this->smarty->ext->_cacheModify->cacheModifiedCheck( $this->cached,
} ob_start(); $template->_mergeVars(); if (!empty(Smarty::$global_tpl_vars)) { $template->tpl_vars = array_merge(Smarty::$global_tpl_vars, $template->tpl_vars); } $result = $template->render(false, $function); $template->_cleanUp(); if ($saveVars) { $template->tpl_vars = $savedTplVars; $template->config_vars = $savedConfigVars; } else { if (!$function && !isset(Smarty_Internal_Template::$tplObjCache[ $template->templateId ])) {
* @throws Exception * @throws SmartyException * @return string rendered template output */ public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) { $result = $this->_execute($template, $cache_id, $compile_id, $parent, 0); return $result === null ? ob_get_clean() : $result; } /** * displays a Smarty template *
// Make Yii params available as smarty config variables $template->config_vars = Yii::$app->params; $template->assign('app', \Yii::$app); $template->assign('this', $view); return $template->fetch(); } /** * Resolves Yii alias into file path * * @param string $type
if (isset($this->renderers[$ext])) { if (is_array($this->renderers[$ext]) || is_string($this->renderers[$ext])) { $this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); }
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the [path alias](guide:concept-aliases) of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidArgumentException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
{ $success = true; } } $this->getView()->title = 'Задать вопрос' . Yii::$app->params['title_separator'] . Yii::$app->params['name']; return $this->render('ask.tpl', ['success' => $success, 'model' => $model]); } public function actionError() { if (($exception = Yii::$app->getErrorHandler()->exception) === null) { return '';
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
$config = yii\helpers\ArrayHelper::merge( require(__DIR__ . '/../chudo/common/config/main.php'), require(__DIR__ . '/../chudo/frontend/config/web.php') ); (new yii\web\Application($config))->run();