if (!empty($value)) { $target .= ".setTargeting('". $key ."',[". $value . "])"; } else { $target .= ".setTargeting('". $key ."')"; } } if (!isset($this->_parrams['mapping'])) { $target .= '.addService(googletag.pubads());'; $content = $this->_parrams['define_slot'].$target; } else { $target .= '.defineSizeMapping(mapping).addService(googletag.pubads());'; $content = 'mapping[{key}] = '. $this->_parrams['mapping']; $content .= 'gptAdSlots[{key}] = '. $this->_parrams['define_slot']. str_replace('(mapping)', '(mapping[{key}])', $target); } array_push(Yii::$app->params['dfp'], $content); } elseif(empty($_GET['ads']) && !empty($_GET['view']) && $_GET['view'] == 'info' && isset($this->_parrams['define_slot'])) { if(isset($this->_parrams['mapping'])) { // KTS DFP
else { $target .= ".setTargeting('". $key ."')"; } } if (!isset($this->_parrams['mapping'])) { $target .= '.addService(googletag.pubads());'; $content = $this->_parrams['define_slot'].$target; } else { $target .= '.defineSizeMapping(mapping).addService(googletag.pubads());'; $content = 'mapping[{key}] = '. $this->_parrams['mapping']; $content .= 'gptAdSlots[{key}] = '. $this->_parrams['define_slot']. str_replace('(mapping)', '(mapping[{key}])', $target); } array_push(Yii::$app->params['dfp'], $content);
ob_start(); foreach ($modules as $module) { $obj = FpFactory::getObject($module); if ($obj) { echo $obj->render(); } } $content = ob_get_clean(); } return $content; }
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) { // close the output buffer opened above if it has not been closed already if (ob_get_level() > 0) { ob_end_clean();
} if (count($element) >= 6) { $num = round(count($element) / 3, 0, PHP_ROUND_HALF_DOWN); $pos = array_keys($element); // get position // Add Ads $adscode = ModuleWidget::widget(['position' => 'fp_post_mid']); if(!empty($adscode)) { $element[$pos[$num]]->innertext .= "<p>[Ads]</p>"; $contents = $html->save(); $contents = str_replace('<p>[Ads]</p>', '<div class="ads-inline">'.$adscode.'</div>', $contents); }
public function getOrSet($key, $callable, $duration = null, $dependency = null) { if (($value = $this->get($key)) !== false) { return $value; } $value = call_user_func($callable, $this); if (!$this->set($key, $value, $duration, $dependency)) { Yii::warning('Failed to set cache value for key ' . json_encode($key), __METHOD__); } return $value; }
} } $html->clear(); $data['contents'] = $contents; return $data; }, Yii::$app->params['memcache_expire']); } /** * Add nofollow to link not from kts * @param $content * @return mixed
<div class="post-content" itemprop="articleBody"> <?php $contents = str_replace('../../../../images', FpUtil::getMediaLink() . '/images', $model['content']); $contents = FpUtil::addNofollow($contents); // if($model['baipr'] == 0){ $contents = FpUtil::ModifyContent($model['id'], $contents, $tags); /** Form in Post **/ if (!empty($contents['libs'])) { $fw = new FormWidget; $fw->includeLibs($contents['libs']['css'], $contents['libs']['js']); if (isset($contents['libs']['range'])) {
{ $_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
$related = FpUtil::getRelatedContentByTags($tags, $model['id'], $model['catid']); return $this->render('content/info', [ 'model' => $model, 'category' => $category, 'related' => $related, 'tags' => $tags ]); } public function actionDacbiet()
$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['components']['cache']['servers'][0]['host'] = '10.100.100.36'; $config['components']['db']['dsn'] = 'mysql:host=localhost;dbname=beta_kts;port=3306'; $config['components']['db']['username'] = 'root'; $config['components']['db']['password'] = 'root';} (new yii\web\Application($config))->run();
$_GET = [ 'id' => '47191', 'url' => 'hoc-gioi-tieng-anh-chia-khoa-vang-dan-den-thanh-cong', 'titlerobot' => 'Học giỏi Tiếng Anh - chìa khóa vàng dẫn đến thành công', 'ogtitle' => null, 'metades' => 'Học giỏi tiếng Anh và giao tiếp tiếng Anh tốt sẽ đưa bạn đến những cơ hội mới và mở ra nhiều con đường thành công cho bạn trong tương lai.', 'metakey' => 'học giỏi tiếng anh', 'metarobot' => 'index, follow', 'canonical' => null, 'app' => 'content', 'view' => 'info', 'entity_type' => 'contents', 'entity_id' => '37765', 'css' => '', 'js' => '', 'num_views' => '0', 'num_comments' => '0', 'num_liked' => '0', 'ads' => 'a:1:{s:9:"tieng-anh";s:11:""giao-tiep"";}', 'slug' => 'hoc-gioi-tieng-anh-chia-khoa-vang-dan-den-thanh-cong',];$_COOKIE = [ '_csrf-frontend' => '34e50dcf4c5fba6e1d74d93c4d7d9f2b3b180428c77e948e21b1a26bdbe29b07a:2:{i:0;s:14:"_csrf-frontend";i:1;s:32:"cqJWCI7ZboSbp74S9BLyjAckofkr3Iya";}', 'advanced-frontend' => '6ec5d95f5404f05d59485b83a74080c9',];$_SESSION = [ '__flash' => [],];