Skip to content
Permalink
Browse files

MyController

  • Loading branch information...
Thoulah committed Mar 10, 2019
1 parent 019e787 commit 96d03b0a92b58212810544958e3922e7bb04d049

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,27 @@
<?php
namespace app\controllers;
use Yii;
use yii\base\BaseObject;
use yii\filters\HttpCache;
class MyController extends \yii\web\Controller {
public function behaviors(): array {
return [
[
'class' => HttpCache::class,
'enabled' => !YII_DEBUG,
'etagSeed' => function(BaseObject $action) {
$file = "@app/views/{$action->controller->id}/{$action->id}.php";
return serialize([phpversion(), Yii::$app->user->id, Yii::$app->view->renderFile($file)]);
},
'lastModified' => function(BaseObject $action) {
return filemtime(Yii::getAlias("@app/views/{$action->controller->id}/{$action->id}.php"));
},
],
];
}
public function actionPi(): string {
return $this->render('pi');
}
}
@@ -39,7 +39,7 @@ public function behaviors(): array {
'lastModified' => function(BaseObject $action) {
return filemtime(Yii::getAlias(($action->id === 'faviconico') ? '@assetsroot/images/favicon.ico' : "@app/views/{$action->controller->id}/{$action->id}.php"));
},
'except' => ['index', 'contact', 'offline'],
'except' => ['index', 'contact', 'offline', 'webmanifest'],
],
];
}
@@ -82,10 +82,6 @@ public function actionBrowserconfigxml(): string {
return $this->renderPartial('browserconfigxml');
}
public function actionPi(): string {
return $this->render('pi');
}
public function actionPrivacy(): string {
return $this->render('privacy');
}
@@ -78,7 +78,7 @@ private function getData(): array {
['label' => Yii::$app->icon->show('share-alt', ['class' => 'mr-1']).Html::tag('span', Yii::$app->name), 'url' => null,
'items' => [
['label' => Yii::t('mr42', 'Contact'), 'url' => ['/site/contact']],
['label' => Yii::t('mr42', 'My Pi'), 'url' => ['/site/pi']],
['label' => Yii::t('mr42', 'My Pi'), 'url' => ['/my/pi']],
],
],
];
File renamed without changes.
@@ -6,17 +6,15 @@
echo Html::tag('h1', $this->title);
foreach (get_loaded_extensions() as $i => $ext) :
foreach (get_loaded_extensions() as $i => $ext)
$modules[phpversion($ext)][] = $ext;
endforeach;
$modules[INTL_ICU_VERSION][] = 'ICU';
$modules[INTL_ICU_DATA_VERSION][] = 'ICU Data';
echo Html::beginTag('div', ['class' => 'site-php-version']);
foreach ($modules as $version => $items) :
foreach ($modules as $version => $items)
echo Html::tag('div',
Html::tag('div', Inflector::sentence($items, ' &amp; '), ['class' => 'col']).
Html::tag('div', $version, ['class' => 'col-auto text-right'])
, ['class' => 'row']);
endforeach;
echo Html::endTag('div');

0 comments on commit 96d03b0

Please sign in to comment.
You can’t perform that action at this time.