public function publish($path, $options = [])
{
$path = Yii::getAlias($path);
if (isset($this->_published[$path])) {
return $this->_published[$path];
}
if (!is_string($path) || ($src = realpath($path)) === false) {
throw new InvalidArgumentException("The file or directory to be published does not exist: $path");
}
if (!is_readable($path)) {
throw new InvalidArgumentException("The file or directory to be published is not readable: $path");
}
if (is_file($src)) {
return $this->_published[$path] = $this->publishFile($src);
}
* 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 AssetBundle $bundle */
$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.
*/
]
);
$clientOptions = Json::encode($this->clientOptions);
$selector = 'img.'.$this->cssClass;
LazyloadAsset::register($this->view);
$this->view->registerJs("$('$selector').lazyload($clientOptions);");
if($this->fallback) {
$this->view->registerCss($selector.'{display:none}');
}
}
if(isset($this->options['src'])) {
unset($this->options['src']);
}
$this->registerClientScript();
parent::init();
}
/**
* @inheritdoc
*/
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;
}
$class = $class->id;
}
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));
return static::$container->get($class, $params, $type);
}
if (isset($type['class'])) {
$class = $type['class'];
unset($type['class']);
return static::$container->get($class, $params, $type);
}
throw new InvalidConfigException('Object configuration must be an array containing a "class" or "__class" element.');
}
private static $_logger;
{
ob_start();
ob_implicit_flush(false);
try {
$config['class'] = get_called_class();
/** @var self $widget */
$widget = Yii::createObject($config);
$out = '';
if ($widget->beforeRun()) {
$result = $widget->run();
$out = $widget->afterRun($result);
}
} catch (\Exception $e) {
</div>
</div>
</div>
<div class="hero-image">
<div class="img-overlay">
<div class="img-slide">
<?= LazyLoad::widget(['src' => $blog['icon']]); ?>
</div>
</div>
</div>
</div>
<section class="section">
<div class="container-fluid">
{
$_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 ViewRenderer $renderer */
$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
]);
Yii::$app->view->registerMetaTag([
'name' => 'description',
'content' => $blog->meta_description . ' | Radioguide.FM ',
]);
$related = Blog::find()->where(['category_id' => (string)$blog['category_id']])->andWhere(['!=', '_id', $blog['_id']])->andWhere(['enabled' => true])->orderBy(['created' => SORT_ASC])->limit(6)->all();
return $this->render('show', [
'blog' => $blog,
'related' => $related
]);
}
public function actionCategory($slug)
$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__ . '/../vendor/yiisoft/yii2/Yii.php'; require __DIR__ . '/../config/bootstrap.php'; $config = require __DIR__ . '/../config/api.php'; (new yii\web\Application($config))->run();
$_GET = [
'slug' => 'wolf-cut-hairstyle-2025-the-wild-trend-that-refuses-to-fade',
];
$_COOKIE = [
'PHPSESSID' => 'a367d19af792686a03269b021cc0dbf3',
];
$_SESSION = [
'__flash' => [],
'country_code' => 'US',
'user_region_id' => unserialize('O:21:"MongoDB\\BSON\\ObjectId":1:{s:3:"oid";s:24:"5bd6c180b5551ee2538b47da";}'),
];