Commit 51ed8cc58a8c5a467ec1dbd889ad2ad4e89e3753
1 parent
ace41b9d
increase speed for site
Showing
5 changed files
with
123 additions
and
8 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/assets/AppAsset.php
@@ -19,8 +19,8 @@ class AppAsset extends AssetBundle | @@ -19,8 +19,8 @@ class AppAsset extends AssetBundle | ||
19 | public $baseUrl = '@web'; | 19 | public $baseUrl = '@web'; |
20 | public $css = [ | 20 | public $css = [ |
21 | 'css/css_header.css', | 21 | 'css/css_header.css', |
22 | - 'css/comments.css', | ||
23 | - 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', | 22 | +// 'css/comments.css', |
23 | +// 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', | ||
24 | ]; | 24 | ]; |
25 | public $js = [ | 25 | public $js = [ |
26 | 26 |
1 | +<?php | ||
2 | + /** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: timur | ||
5 | + * Date: 19.06.17 | ||
6 | + * Time: 14:39 | ||
7 | + */ | ||
8 | + | ||
9 | + /** | ||
10 | + * @link http://www.yiiframework.com/ | ||
11 | + * @copyright Copyright (c) 2008 Yii Software LLC | ||
12 | + * @license http://www.yiiframework.com/license/ | ||
13 | + */ | ||
14 | + | ||
15 | + namespace frontend\assets; | ||
16 | + | ||
17 | + use yii\web\AssetBundle; | ||
18 | + /** | ||
19 | + * @author Qiang Xue <qiang.xue@gmail.com> | ||
20 | + * @since 2.0 | ||
21 | + */ | ||
22 | + class CssAsset extends AssetBundle | ||
23 | + { | ||
24 | + public $basePath = '@webroot'; | ||
25 | + public $baseUrl = '@web'; | ||
26 | + public $css = [ | ||
27 | + 'css/comments.css', | ||
28 | + 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', | ||
29 | + ]; | ||
30 | + } |
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 | ||
@@ -609,8 +615,34 @@ | @@ -609,8 +615,34 @@ | ||
609 | <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/928178078/?guid=ON&script=0"/> | 615 | <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/928178078/?guid=ON&script=0"/> |
610 | </div> | 616 | </div> |
611 | </noscript> | 617 | </noscript> |
612 | - | ||
613 | - | 618 | + |
619 | + <?php | ||
620 | + echo AssetWidget::widget( | ||
621 | + [ | ||
622 | + 'assets' => [ | ||
623 | + 'all', | ||
624 | + 'sersid\owlcarousel\Asset', | ||
625 | + ], | ||
626 | + ] | ||
627 | + ); | ||
628 | + | ||
629 | + echo AssetWidget::widget( | ||
630 | + [ | ||
631 | + 'assets' => [ | ||
632 | + 'all', | ||
633 | + 'frontend\assets\CssAsset', | ||
634 | + ], | ||
635 | + ] | ||
636 | + ); | ||
637 | + echo AssetWidget::widget( | ||
638 | + [ | ||
639 | + 'assets' => [ | ||
640 | + 'all', | ||
641 | + 'frontend\assets\FlipclockAsset', | ||
642 | + ], | ||
643 | + ] | ||
644 | + ); | ||
645 | + ?> | ||
614 | 646 | ||
615 | <?php $this->endBody() ?> | 647 | <?php $this->endBody() ?> |
616 | </body> | 648 | </body> |
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 | + echo Html::cssFile($item); | ||
41 | + } | ||
42 | + $bundle->css = []; | ||
43 | + } | ||
44 | + } | ||
45 | + } | ||
46 | + } | ||
47 | + } | ||
48 | + | ||
0 | \ No newline at end of file | 49 | \ No newline at end of file |