Commit 87640a9d authored by Shakarim Sapa's avatar Shakarim Sapa

Merge remote-tracking branch 'origin/master'

parents 8caa0b45 84304dec
......@@ -4,7 +4,7 @@ namespace common\modules\content\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use himiklab\sitemap\behaviors\SitemapBehavior;
use frontend\modules\sitemap\behaviors\SitemapBehavior;
use \yii\helpers\Url;
use common\modules\content\models\CoBlocks;
......@@ -78,11 +78,11 @@ class CoContent extends \common\components\ActiveRecordModel
'scope' => function ($model) {
/** @var \yii\db\ActiveQuery $model */
$model->select(['url', 'updated_at', 'priority']);
// $model->andWhere(['is_deleted' => 0]);
$model->andWhere(['active' => 1]);
},
'dataClosure' => function ($model) {
return [
'loc' => Url::to($model->url, true),
'loc' => Url::to($model->url),
'lastmod' => date('c', $model->updated_at),
'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
'priority' => $model->priority
......
......@@ -10,7 +10,7 @@ class GoogleOAuth2Service extends \nodge\eauth\services\GoogleOAuth2Service
protected function fetchAttributes()
{
$info = $this->makeSignedRequest('https://www.googleapis.com/oauth2/v1/userinfo');
\Yii::info($info, 'social');
$profile = [
'id' => $info['id'],
'email' => $info['email'],
......
......@@ -123,7 +123,6 @@ class UserEAuth extends \common\components\ActiveRecordModel
$eauth->user_id = $model->id;
$eauth->{$eauthField} = $socialProfile['id'];
$eauth->save();
return $model;
}
else {
......
......@@ -40,7 +40,8 @@ WidgetAssetBundle::register($this);
}
},
theme: {
services: 'vkontakte,facebook,gplus,twitter,tumblr'
services: 'vkontakte,facebook,gplus,twitter,tumblr',
counter: true,
},
content: {
title: 'Школа аналитики',
......
......@@ -45,7 +45,8 @@ WidgetAssetBundle::register($this);
}
},
theme: {
services: 'vkontakte,facebook,gplus,twitter,tumblr'
services: 'vkontakte,facebook,gplus,twitter,tumblr',
counter: true,
},
content: {
title: 'Школа аналитики',
......
......@@ -32,7 +32,6 @@
"dompdf/dompdf": "dev-master",
"tecnick.com/tcpdf": "dev-master",
"mikehaertl/phpwkhtmltopdf": "^2.0@dev",
"himiklab/yii2-sitemap-module" : "*",
"mirocow/yii2-minify-view" : "*",
"kartik-v/yii2-widget-fileinput": "@dev",
"nodge/yii2-eauth": "~2.0",
......
......@@ -25,7 +25,7 @@ return [
'users' => ['class' => 'common\modules\users\users',],
'blog' => ['class' => 'common\modules\blog\Module'],
'sitemap' => [
'class' => 'himiklab\sitemap\Sitemap',
'class' => 'frontend\modules\sitemap\Sitemap',
'models' => [
// your models
'common\modules\content\models\CoContent',
......
<?php
/**
* @link https://github.com/himiklab/yii2-sitemap-module
* @copyright Copyright (c) 2014 HimikLab
* @license http://opensource.org/licenses/MIT MIT
*/
namespace frontend\modules\sitemap;
use Yii;
use yii\base\InvalidConfigException;
use yii\base\Module;
use yii\caching\Cache;
use common\modules\languages\models\Languages;
/**
* Yii2 module for automatically generating XML Sitemap.
*
* @author HimikLab
* @package himiklab\sitemap
*/
class Sitemap extends Module
{
public $controllerNamespace = 'frontend\modules\sitemap\controllers';
/** @var int */
public $cacheExpire = 86400;
/** @var Cache|string */
public $cacheProvider = 'cache';
/** @var string */
public $cacheKey = 'sitemap';
/** @var boolean Use php's gzip compressing. */
public $enableGzip = false;
/** @var array */
public $models = [];
/** @var array */
public $urls = [];
public function init()
{
parent::init();
if (is_string($this->cacheProvider)) {
$this->cacheProvider = Yii::$app->{$this->cacheProvider};
}
if (!$this->cacheProvider instanceof Cache) {
throw new InvalidConfigException('Invalid `cacheKey` parameter was specified.');
}
}
/**
* Build and cache a site map.
* @return string
* @throws \yii\base\InvalidConfigException
*/
public function buildSitemap()
{
$urls = $this->urls;
foreach ($this->models as $modelName)
{
/** @var behaviors\SitemapBehavior $model */
if (is_array($modelName))
{
$model = new $modelName['class'];
if (isset($modelName['behaviors'])) {
$model->attachBehaviors($modelName['behaviors']);
}
}
else
{
$model = new $modelName;
}
$urls = array_merge($urls, $model->generateSiteMap());
}
$langs = Languages::find()->all();
$sitemapData = $this->createControllerByID('default')->renderPartial('index', [
'urls' => $urls,
'langs' => $langs
]);
$this->cacheProvider->set($this->cacheKey, $sitemapData, $this->cacheExpire);
return $sitemapData;
}
}
<?php
/**
* @link https://github.com/himiklab/yii2-sitemap-module
* @copyright Copyright (c) 2014 HimikLab
* @license http://opensource.org/licenses/MIT MIT
*/
namespace frontend\modules\sitemap\behaviors;
use yii\base\Behavior;
use yii\base\InvalidConfigException;
/**
* Behavior for XML Sitemap Yii2 module.
*
* For example:
*
* ```php
* public function behaviors()
* {
* return [
* 'sitemap' => [
* 'class' => SitemapBehavior::className(),
* 'scope' => function ($model) {
* $model->select(['url', 'lastmod']);
* $model->andWhere(['is_deleted' => 0]);
* },
* 'dataClosure' => function ($model) {
* return [
* 'loc' => Url::to($model->url, true),
* 'lastmod' => strtotime($model->lastmod),
* 'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
* 'priority' => 0.8
* ];
* }
* ],
* ];
* }
* ```
*
* @see http://www.sitemaps.org/protocol.html
* @author HimikLab
* @package himiklab\sitemap
*/
class SitemapBehavior extends Behavior
{
const CHANGEFREQ_ALWAYS = 'always';
const CHANGEFREQ_HOURLY = 'hourly';
const CHANGEFREQ_DAILY = 'daily';
const CHANGEFREQ_WEEKLY = 'weekly';
const CHANGEFREQ_MONTHLY = 'monthly';
const CHANGEFREQ_YEARLY = 'yearly';
const CHANGEFREQ_NEVER = 'never';
const BATCH_MAX_SIZE = 100;
/** @var callable */
public $dataClosure;
/** @var string|bool */
public $defaultChangefreq = false;
/** @var float|bool */
public $defaultPriority = false;
/** @var callable */
public $scope;
public function init()
{
if (!is_callable($this->dataClosure)) {
throw new InvalidConfigException('SitemapBehavior::$dataClosure isn\'t callable.');
}
}
public function generateSiteMap()
{
$result = [];
$n = 0;
/** @var \yii\db\ActiveRecord $owner */
$owner = $this->owner;
$query = $owner::find();
if (is_callable($this->scope)) {
call_user_func($this->scope, $query);
}
foreach ($query->each(self::BATCH_MAX_SIZE) as $model) {
$urlData = call_user_func($this->dataClosure, $model);
if (empty($urlData)) {
continue;
}
$result[$n]['loc'] = $urlData['loc'];
$result[$n]['lastmod'] = $urlData['lastmod'];
if (isset($urlData['changefreq'])) {
$result[$n]['changefreq'] = $urlData['changefreq'];
} elseif ($this->defaultChangefreq !== false) {
$result[$n]['changefreq'] = $this->defaultChangefreq;
}
if (isset($urlData['priority'])) {
$result[$n]['priority'] = $urlData['priority'];
} elseif ($this->defaultPriority !== false) {
$result[$n]['priority'] = $this->defaultPriority;
}
if (isset($urlData['news'])) {
$result[$n]['news'] = $urlData['news'];
}
if (isset($urlData['images'])) {
$result[$n]['images'] = $urlData['images'];
}
++$n;
}
return $result;
}
}
<?php
/**
* @link https://github.com/himiklab/yii2-sitemap-module
* @copyright Copyright (c) 2014 HimikLab
* @license http://opensource.org/licenses/MIT MIT
*/
namespace frontend\modules\sitemap\controllers;
use Yii;
use yii\web\Controller;
/**
* @author HimikLab
* @package himiklab\sitemap
*/
class DefaultController extends Controller
{
public function actionIndex()
{
/** @var \himiklab\sitemap\Sitemap $module */
$module = $this->module;
if (!$sitemapData = $module->cacheProvider->get($module->cacheKey))
{
$sitemapData = $module->buildSitemap();
}
Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
$headers = Yii::$app->response->headers;
$headers->add('Content-Type', 'application/xml');
if ($module->enableGzip)
{
$sitemapData = gzencode($sitemapData);
$headers->add('Content-Encoding', 'gzip');
$headers->add('Content-Length', strlen($sitemapData));
}
return $sitemapData;
}
}
<?php
/**
* @link https://github.com/himiklab/yii2-sitemap-module
* @copyright Copyright (c) 2014 HimikLab
* @license http://opensource.org/licenses/MIT MIT
*
* @var array $urls
*/
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<?php foreach ($urls as $url): ?>
<url>
<loc><?= yii\helpers\Url::to($url['loc'], true) ?></loc>
<?php if($langs) :
foreach ($langs as $lang) : ?>
<xhtml:link rel="alternate" hreflang="<?=$lang->url?>" href="<?= yii\helpers\Url::to((!$lang->default?'/'.$lang->url:'').($url['loc']=='/'?'':'/'.$url['loc']), true) ?>"/>
<?php endforeach;
endif; ?>
<?php if (isset($url['lastmod'])): ?>
<lastmod><?= is_string($url['lastmod']) ?
$url['lastmod'] : date(DATE_W3C, $url['lastmod']) ?></lastmod>
<?php endif; ?>
<?php if (isset($url['changefreq'])): ?>
<changefreq><?= $url['changefreq'] ?></changefreq>
<?php endif; ?>
<?php if (isset($url['priority'])): ?>
<priority><?= $url['priority'] ?></priority>
<?php endif; ?>
<?php if (isset($url['news'])): ?>
<news:news>
<news:publication>
<news:name><?= $url['news']['publication']['name'] ?></news:name>
<news:language><?= $url['news']['publication']['language'] ?></news:language>
</news:publication>
<?php
echo isset($url['news']['access']) ? "<news:access>{$url['news']['access']}</news:access>" : '';
echo isset($url['news']['genres']) ? "<news:genres>{$url['news']['genres']}</news:genres>" : '';
?>
<news:publication_date>
<?= is_string($url['news']['publication_date']) ?
$url['news']['publication_date'] : date(DATE_W3C, $url['news']['publication_date']) ?>
</news:publication_date>
<news:title> <?= $url['news']['title'] ?></news:title>
<?php
echo isset($url['news']['keywords']) ?
"<news:keywords>{$url['news']['keywords']}</news:keywords>" : '';
echo isset($url['news']['stock_tickers']) ?
"<news:stock_tickers>{$url['news']['stock_tickers']}</news:stock_tickers>" : '';
?>
</news:news>
<?php endif; ?>
<?php if (isset($url['images'])):
foreach ($url['images'] as $image): ?>
<image:image>
<image:loc><?= yii\helpers\Url::to($image['loc'], true) ?></image:loc>
<?php
echo isset($image['caption']) ?
"<image:caption>{$image['caption']}</image:caption>" : '';
echo isset($image['geo_location']) ?
"<image:geo_location>{$image['geo_location']}</image:geo_location>" : '';
echo isset($image['title']) ?
"<image:title>{$image['title']}</image:title>" : '';
echo isset($image['license']) ?
"<image:license>{$image['license']}</image:license>" : '';
?>
</image:image>
<?php endforeach;
endif; ?>
</url>
<?php endforeach; ?>
</urlset>
<meta name="title" content="<?php echo \Yii::$app->controller->meta_title?>">
<meta name="keywords" content="<?php echo \Yii::$app->controller->meta_keywords?>">
<meta name="description" content="<?php echo \Yii::$app->controller->meta_description?>">
<?php
<meta name='yandex-verification' content='6f739356d418cfe3' />
use common\modules\languages\models\Languages;
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/images/favicon/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/favicon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/favicon/apple-touch-icon-114x114.png">
$langs = Languages::find()->all();
?>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="title" content="<?php echo \Yii::$app->controller->meta_title?>">
<meta name="keywords" content="<?php echo \Yii::$app->controller->meta_keywords?>">
<meta name="description" content="<?php echo \Yii::$app->controller->meta_description?>">
<?php $this->registerCssFile('/css/animate.css');?>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<meta name='yandex-verification' content='6f739356d418cfe3' />
<?php $this->registerCssFile('/js/libs/bootstrap/css/bootstrap.css');?>
<?php $this->registerCssFile('/js/libs/magnific/magnific-popup.css');?>
<?php $this->registerCssFile('/js/libs/bxslider/jquery.bxslider.css');?>
<?php if($langs) :
foreach ($langs as $lang) : $url = \Yii::$app->request->getLangUrl(); ?>
<link rel="alternate" hreflang="<?=$lang->url?>" href="<?= yii\helpers\Url::to((!$lang->default?'/'.$lang->url:'').($url=='/'?'':'/'.$url), true) ?>" />
<?php endforeach;
endif; ?>
<?php $this->registerCssFile('/css/fonts.css');?>
<?php $this->registerCssFile('/css/screen.css');?>
<?php $this->registerCssFile('/css/media.css');?>
<?php $this->registerCssFile('/css/custom.css');?>
\ No newline at end of file
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/images/favicon/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/favicon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/favicon/apple-touch-icon-114x114.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<?php $this->registerCssFile('/css/animate.css');?>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<?php $this->registerCssFile('/js/libs/bootstrap/css/bootstrap.css');?>
<?php $this->registerCssFile('/js/libs/magnific/magnific-popup.css');?>
<?php $this->registerCssFile('/js/libs/bxslider/jquery.bxslider.css');?>
<?php $this->registerCssFile('/css/fonts.css');?>
<?php $this->registerCssFile('/css/screen.css');?>
<?php $this->registerCssFile('/css/media.css');?>
<?php $this->registerCssFile('/css/custom.css');?>
\ No newline at end of file
......@@ -177,5 +177,28 @@ a.toggle_bottom:hover .icon-arrowDown2:after, a.toggle_bottom:active .icon-arrow
.top_ops a.toggle_bottom {
top: 15px;
position: relative;
float: none;
}
.first_neft a.toggle_bottom {
position: static;
top: 0;
left: 0;
float: none;
margin: 20px auto 40px;
}
.keys_appl_top a.toggle_bottom {
position: static;
top: 0;
left: 0;
float: none;
margin: 20px auto 40px;
}
}
@media only screen and (max-width: 479px) and (min-width: 320px) {
.video_sec a.toggle_bottom {
width: 270px;
font-size: 14px;
margin-top: 90px;
}
}
\ No newline at end of file
......@@ -53,10 +53,12 @@ $(document).ready(function() {
if ($('.dep_block_hide__btn').text() == $(this).data('show')){
$('.dep_block__hide').slideDown(1000);
$(this).text($(this).data('hide'));
$('.dep_block .line_hide').fadeTo( "slow" , 0);
}
else {
$('.dep_block__hide').slideUp(1000);
$(this).text($(this).data('show'));
$('.dep_block .line_hide').fadeTo( "slow" , 1);
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment