/** * Initializes the widget params. */ public function init() { parent::init(); if (empty($this->model)) { throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "model" property must be set.')); } if (empty($this->pjaxContainerId)) { $this->pjaxContainerId = 'comment-pjax-container-' . $this->getId(); } if (empty($this->model->{$this->entityIdAttribute})) { throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "entityIdAttribute" value for widget model cannot be empty.')); }
*/ 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.
$config = $this->resolveDependencies($config); 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); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
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 static::$container->invoke($type, $params); } elseif (is_array($type)) { throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); }
{ ob_start(); ob_implicit_flush(false); try { /* @var $widget Widget */ $config['class'] = get_called_class(); $widget = Yii::createObject($config); $out = ''; if ($widget->beforeRun()) { $result = $widget->run(); $out = $widget->afterRun($result); } } catch (\Exception $e) {
endforeach; ?> <?php echo \yii2mod\comments\widgets\Comment::widget([ 'model' => $personModel, 'commentView' => '@frontend/views/site/comment/index' ]); ?> </div> </div> </div> <style type="text/css">
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$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;
* @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
public function actionPerson($id) { // $filmModel = Films::find_base()->with(['filmCountries','filmGenres','filmsFrames','personsToFilms'])->where(['slug'=>$slug])->published()->one(); $personModel = \common\models\Persons::find()->where(['id' => $id])->one(); return $this->render('person_detail', ['personModel' => $personModel]); } public function implodeGenres($genres, $t = 0) { $genres_string = '';
$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();
require(__DIR__ . '/../../common/config/main.php'), require(__DIR__ . '/../../common/config/main-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); (new yii\web\Application($config))->run();
$_GET = [ 'id' => '2677', 'slug' => 'roland-emmeriks', ]; $_SESSION = [ '__flash' => [], 'lysenkobv\\GeoIP\\GeoIP:44.222.113.28' => unserialize('O:22:"lysenkobv\\GeoIP\\Result":2:{s:7:"' . "\0" . '*' . "\0" . 'data";a:7:{s:4:"city";a:2:{s:10:"geoname_id";i:5391811;s:5:"names";a:7:{s:2:"de";s:9:"San Diego";s:2:"en";s:9:"San Diego";s:2:"es";s:9:"San Diego";s:2:"fr";s:9:"San Diego";s:2:"ja";s:18:"サンディエゴ";s:5:"pt-BR";s:9:"San Diego";s:2:"ru";s:17:"Сан-Диего";}}s:9:"continent";a:3:{s:4:"code";s:2:"NA";s:10:"geoname_id";i:6255149;s:5:"names";a:8:{s:2:"de";s:11:"Nordamerika";s:2:"en";s:13:"North America";s:2:"es";s:13:"Norteamérica";s:2:"fr";s:17:"Amérique du Nord";s:2:"ja";s:15:"北アメリカ";s:5:"pt-BR";s:17:"América do Norte";s:2:"ru";s:31:"Северная Америка";s:5:"zh-CN";s:9:"北美洲";}}s:7:"country";a:3:{s:10:"geoname_id";i:6252001;s:8:"iso_code";s:2:"US";s:5:"names";a:8:{s:2:"de";s:3:"USA";s:2:"en";s:13:"United States";s:2:"es";s:14:"Estados Unidos";s:2:"fr";s:11:"États-Unis";s:2:"ja";s:21:"アメリカ合衆国";s:5:"pt-BR";s:14:"Estados Unidos";s:2:"ru";s:6:"США";s:5:"zh-CN";s:6:"美国";}}s:8:"location";a:5:{s:15:"accuracy_radius";i:1000;s:8:"latitude";d:32.80720000000000169393388205207884311676025390625;s:9:"longitude";d:-117.1649000000000029331204132176935672760009765625;s:10:"metro_code";i:825;s:9:"time_zone";s:19:"America/Los_Angeles";}s:6:"postal";a:1:{s:4:"code";s:5:"92111";}s:18:"registered_country";a:3:{s:10:"geoname_id";i:6252001;s:8:"iso_code";s:2:"US";s:5:"names";a:8:{s:2:"de";s:3:"USA";s:2:"en";s:13:"United States";s:2:"es";s:14:"Estados Unidos";s:2:"fr";s:11:"États-Unis";s:2:"ja";s:21:"アメリカ合衆国";s:5:"pt-BR";s:14:"Estados Unidos";s:2:"ru";s:6:"США";s:5:"zh-CN";s:6:"美国";}}s:12:"subdivisions";a:1:{i:0;a:3:{s:10:"geoname_id";i:5332921;s:8:"iso_code";s:2:"CA";s:5:"names";a:8:{s:2:"de";s:11:"Kalifornien";s:2:"en";s:10:"California";s:2:"es";s:10:"California";s:2:"fr";s:10:"Californie";s:2:"ja";s:24:"カリフォルニア州";s:5:"pt-BR";s:11:"Califórnia";s:2:"ru";s:20:"Калифорния";s:5:"zh-CN";s:18:"加利福尼亚州";}}}}s:13:"' . "\0" . '*' . "\0" . 'attributes";a:1:{s:7:"isoCode";s:2:"US";}}'), ];