Commit 7c95c2a1a10dd0133e403320d981aa10aaa4efa7
Merge remote-tracking branch 'origin/master'
Showing
3 changed files
with
70 additions
and
6 deletions
Show diff stats
.htaccess
@@ -222,6 +222,11 @@ RewriteRule ^(.*)$ $1.gz [QSA,L] | @@ -222,6 +222,11 @@ RewriteRule ^(.*)$ $1.gz [QSA,L] | ||
222 | </filesMatch> | 222 | </filesMatch> |
223 | </ifModule> | 223 | </ifModule> |
224 | 224 | ||
225 | +# сжатие text, html, javascript, css, xml: | ||
226 | +<ifModule mod_deflate.c> | ||
227 | +AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript | ||
228 | +</ifModule> | ||
229 | + | ||
225 | #Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE | 230 | #Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE |
226 | <IfModule mod_setenvif.c> | 231 | <IfModule mod_setenvif.c> |
227 | BrowserMatch "MSIE" force-no-vary | 232 | BrowserMatch "MSIE" force-no-vary |
frontend/views/layouts/main.php
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | use yii\widgets\Breadcrumbs; | 12 | use yii\widgets\Breadcrumbs; |
13 | use frontend\widgets\Seo; | 13 | use frontend\widgets\Seo; |
14 | use common\models\Event; | 14 | use common\models\Event; |
15 | + use frontend\widgets\AssetWidget; | ||
15 | 16 | ||
16 | AppAsset::register($this); | 17 | AppAsset::register($this); |
17 | ?> | 18 | ?> |
@@ -249,20 +250,25 @@ | @@ -249,20 +250,25 @@ | ||
249 | foreach($links as $index => $link) { | 250 | foreach($links as $index => $link) { |
250 | if(is_array($link)) { | 251 | if(is_array($link)) { |
251 | $links[$index]['itemprop'] = 'url'; | 252 | $links[$index]['itemprop'] = 'url'; |
252 | - $links[$index]['label'] = '<span itemprop="title">'.$links[$index]['label'].'</span>'; | 253 | + $links[$index]['label'] = '<span itemprop="name">'.$links[$index]['label'].'</span>'; |
253 | } | 254 | } |
254 | } | 255 | } |
255 | } | 256 | } |
256 | echo Breadcrumbs::widget([ | 257 | echo Breadcrumbs::widget([ |
258 | + 'options' => [ | ||
259 | + 'class' => 'breadcrumb', | ||
260 | + 'itemscope' => "", | ||
261 | + 'itemtype' => " http://schema.org/BreadcrumbList" | ||
262 | + ], | ||
257 | 'encodeLabels' => false, | 263 | 'encodeLabels' => false, |
258 | - 'itemTemplate' => "<li><span itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\">{link}</span></li>\n", | 264 | + 'itemTemplate' => "<li itemprop=\"itemListElement\" itemscope itemtype=\"http://schema.org/ListItem\">{link}</li>\n", |
259 | 'links' => isset($links) ? $links : [], | 265 | 'links' => isset($links) ? $links : [], |
260 | 'homeLink' => [ | 266 | 'homeLink' => [ |
261 | - 'label' => '<span itemprop="title">Интернет-магазин светильников</span>', | 267 | + 'label' => '<span itemprop="name">Интернет-магазин светильников</span>', |
262 | 'url' => Url::to([ '/' ]), | 268 | 'url' => Url::to([ '/' ]), |
263 | 'itemprop' => 'url', | 269 | 'itemprop' => 'url', |
264 | ], | 270 | ], |
265 | - 'activeItemTemplate' => '<li class="active"><span itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">{link}</span></span></li>', | 271 | + 'activeItemTemplate' => '<li class="active" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="item">{link}</span></li>', |
266 | ]) | 272 | ]) |
267 | ?> | 273 | ?> |
268 | 274 | ||
@@ -610,8 +616,6 @@ | @@ -610,8 +616,6 @@ | ||
610 | </div> | 616 | </div> |
611 | </noscript> | 617 | </noscript> |
612 | 618 | ||
613 | - | ||
614 | - | ||
615 | <?php $this->endBody() ?> | 619 | <?php $this->endBody() ?> |
616 | </body> | 620 | </body> |
617 | </html> | 621 | </html> |
1 | +<?php | ||
2 | + /** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: timur | ||
5 | + * Date: 19.06.17 | ||
6 | + * Time: 14:20 | ||
7 | + */ | ||
8 | + | ||
9 | + namespace frontend\widgets; | ||
10 | + | ||
11 | + use yii\base\InvalidConfigException; | ||
12 | + use yii\base\Widget; | ||
13 | + use yii\helpers\Html; | ||
14 | + use yii\web\AssetBundle; | ||
15 | + | ||
16 | + class AssetWidget extends Widget | ||
17 | + { | ||
18 | + public $assets = []; | ||
19 | + | ||
20 | + public function init() | ||
21 | + { | ||
22 | + parent::init(); | ||
23 | + if(!empty($this->assets) && !is_array($this->assets)) { | ||
24 | + throw new InvalidConfigException('Assets must be an array'); | ||
25 | + } | ||
26 | + } | ||
27 | + | ||
28 | + public function run() | ||
29 | + { | ||
30 | + if(!empty($this->assets)) { | ||
31 | + $assets = $this->assets; | ||
32 | + $bundles = $this->view->assetBundles; | ||
33 | + foreach ($assets as $asset) { | ||
34 | + if(array_key_exists($asset, $bundles)) { | ||
35 | + /** | ||
36 | + * @var AssetBundle $bundle | ||
37 | + */ | ||
38 | + $bundle = $bundles[$asset]; | ||
39 | + foreach ($bundle->css as $item) { | ||
40 | + if(isset((new $asset)->sourcePath)){ | ||
41 | + $QQQ = \Yii::$app->assetManager->publish( | ||
42 | + (new $asset)->sourcePath."/".$item, | ||
43 | + [] | ||
44 | + ); | ||
45 | + $item = $QQQ[1]; // [0] - full path, [1] - /assets/... | ||
46 | + } | ||
47 | + echo Html::cssFile($item); | ||
48 | + } | ||
49 | + $bundle->css = []; | ||
50 | + } | ||
51 | + } | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
0 | \ No newline at end of file | 56 | \ No newline at end of file |