':web_id' => $web_id, ':actual_date' => Yii::$app->formatter->asDate('now', 'y-MM-dd') ]); } $this->_items = $query->all(); $this->setMenuUrlParts(); } else { throw new InvalidParamException(\Yii::t('front', 'No required parameter given') . ' - categoryId'); } } public function run() { $config = [ 'items' => $this->_items, 'menuUrlParts' => $this->_menuUrlParts, 'columnsCount' => $this->columnsCount, 'title' => $this->title,
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
return $reflection->newInstanceArgs($dependencies); } if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } else { $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; } return $object;
public function get($class, $params = [], $config = []) { if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
{ if (is_string($type)) { return static::$container->get($type, $params); } elseif (is_array($type) && isset($type['class'])) { $class = $type['class']; unset($type['class']); return static::$container->get($class, $params, $type); } elseif (is_callable($type, true)) { return call_user_func($type, $params); } elseif (is_array($type)) { throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); } else { throw new InvalidConfigException("Unsupported configuration type: " . gettype($type));
{ ob_start(); ob_implicit_flush(false); try { /* @var $widget Widget */ $config['class'] = get_called_class(); $widget = Yii::createObject($config); $out = $widget->run(); } catch (\Exception $e) { // close the output buffer opened above if it has not been closed already if (ob_get_level() > 0) { ob_end_clean(); }
<div class="col s12 m3"> <?= CategoryArticlesList::widget([ 'categoryId' => $menuContent->category->id, 'articleId' => $articleContent->id, 'itemsCount' => 5, 'title' => Yii::t('front', 'Recent articles in category') ]); ?> <?= Tags::widget(); ?> <div class="row"> <div class="col s12"> <?= Html::a(Html::img('@web/basic-assets/img/facebook.png', ['alt' => 'facebook icon']), 'http://www.facebook.com/sharer.php?u=' . Url::current([], true), [ 'title' => Yii::t('front', 'Share on Facebook'), 'onclick' => $windowOpen
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$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); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @since 2.0.1 */ public function renderContent($content) { $layoutFile = $this->findLayoutFile($this->getView()); if ($layoutFile !== false) { return $this->getView()->renderFile($layoutFile, ['content' => $content], $this); } else { return $content; } } /**
* @return string the rendering result. * @throws InvalidParamException 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 * @return string the rendering result of the layout with the given static string as the `$content` variable.
return $pdf->render(); } else { return $this->render( $viewName, [ 'menuContent' => $this->_menuContent, 'articleContent' => $articleContent ] ); } } /** * Search action * @return string
$args = $this->controller->bindActionParams($this, $params); Yii::trace('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); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
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();
require( __DIR__ . '/../private/common/config/main-local.php' ), require( __DIR__ . '/../private/frontend/config/main.php' ), require( __DIR__ . '/../private/frontend/config/main-local.php' ) ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'name' => 'zpravy-a-udalosti', 'id' => '22', 'article' => 'upozorneni', 'ida' => '938', ]; $_SERVER = [ 'PATH' => '/usr/local/bin:/usr/bin:/bin', 'REDIRECT_HANDLER' => 'php-script', 'REDIRECT_STATUS' => '200', 'SCRIPT_URL' => '/zpravy-a-udalosti,22/upozorneni,938', 'SCRIPT_URI' => 'https://www.knihovnaslany.cz/zpravy-a-udalosti,22/upozorneni,938', 'HTTP_MOD_REWRITE' => 'On', 'HTTPS' => 'on', 'SSL_TLS_SNI' => 'www.knihovnaslany.cz', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_HOST' => 'www.knihovnaslany.cz', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache', 'SERVER_NAME' => 'www.knihovnaslany.cz', 'SERVER_ADDR' => '109.123.223.100', 'SERVER_PORT' => '443', 'REMOTE_ADDR' => '54.242.220.142', 'DOCUMENT_ROOT' => '/data/www/knihovnaslany.cz/www.knihovnaslany.cz/web', 'SERVER_ADMIN' => 'webmaster@skok.cz', 'SCRIPT_FILENAME' => '/data/www/knihovnaslany.cz/www.knihovnaslany.cz/web/index.php', 'REMOTE_PORT' => '39970', 'REDIRECT_URL' => '/index.php', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/zpravy-a-udalosti,22/upozorneni,938', 'SCRIPT_NAME' => '/index.php', 'TMPDIR' => '/data/www/knihovnaslany.cz/tmp/www.knihovnaslany.cz', 'ORIG_SCRIPT_FILENAME' => '/etc/cgi-bin/www/knihovnaslany.cz/www.knihovnaslany.cz/php', 'ORIG_PATH_INFO' => '/index.php', 'ORIG_PATH_TRANSLATED' => '/data/www/knihovnaslany.cz/www.knihovnaslany.cz/web/index.php', 'ORIG_SCRIPT_NAME' => '/php-sys/php', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1712729956.955059051513671875, 'REQUEST_TIME' => 1712729956, ]; $_SESSION = [ '__flash' => [], 'web' => null, 'page' => '/zpravy-a-udalosti,22/upozorneni,938', ];