1
0
Ответвление 0
зеркало из https://github.com/Oreolek/ifhub.club.git синхронизирован 2024-04-24 21:19:22 +03:00
Этот коммит содержится в:
Mzhelskiy Maxim 2017-03-30 16:08:25 +07:00
родитель 212ecde64d
коммит 0aa67825d2
7 изменённых файлов: 111 добавлений и 2 удалений

Просмотреть файл

@ -58,6 +58,23 @@ class HookMain extends Hook
public function StartAction()
{
$this->LoadDefaultJsVarAndLang();
/**
* Обработка сайтмапа
*/
$this->Sitemap_AddTargetType('general', array(
'callback_counters' => function () {
return 1;
},
'callback_data' => function () {
return array(
$this->Sitemap_GetDataForSitemapRow(Router::GetPath('/'), time(), '1', 'hourly'),
$this->Sitemap_GetDataForSitemapRow(Router::GetPath('stream/all'), time(), '0.7', 'hourly'),
);
}
));
$this->Topic_RegisterSitemap();
$this->Blog_RegisterSitemap();
$this->User_RegisterSitemap();
/**
* Запуск обработки сборщика
*/

Просмотреть файл

@ -1195,4 +1195,31 @@ class ModuleBlog extends Module
)
);
}
/**
* Регистрация сайтмапа для блогов
*/
public function RegisterSitemap()
{
$aFilter = array(
'type' => array(
'open',
),
);
$this->Sitemap_AddTargetType('blogs', array(
'callback_data' => function ($iPage) use ($aFilter) {
$aBlogs = $this->GetBlogsByFilter($aFilter, array('blog_id' => 'asc'), $iPage, 500, array());
$aData = array();
foreach ($aBlogs['collection'] as $oBlog) {
$aData[] = $this->Sitemap_GetDataForSitemapRow($oBlog->getUrlFull(), null, '0.8', 'weekly');
}
return $aData;
},
'callback_counters' => function () use ($aFilter) {
$aBlogs = $this->GetBlogsByFilter($aFilter, array(), 1, 1, array());
$iCount = (int)$aBlogs['count'];
return ceil($iCount / 500);
}
));
}
}

Просмотреть файл

@ -2002,4 +2002,37 @@ class ModuleTopic extends Module
);
return true;
}
/**
* Регистрация сайтмапа для топиков
*/
public function RegisterSitemap()
{
$aFilter = array(
'blog_type' => array(
'open',
'personal',
),
'topic_publish' => 1,
'order' => 't.topic_id asc'
);
$this->Sitemap_AddTargetType('topics', array(
'callback_data' => function ($iPage) use ($aFilter) {
$aTopics = $this->GetTopicsByFilter($aFilter, $iPage, 500, array('blog' => array()));
$aData = array();
foreach ($aTopics['collection'] as $oTopic) {
$aData[] = $this->Sitemap_GetDataForSitemapRow(
$oTopic->getUrl(),
is_null($oTopic->getDateEdit()) ? $oTopic->getDatePublish() : $oTopic->getDateEdit(),
'0.9', 'weekly'
);
}
return $aData;
},
'callback_counters' => function () use ($aFilter) {
$iCount = (int)$this->GetCountTopicsByFilter($aFilter);
return ceil($iCount / 500);
}
));
}
}

Просмотреть файл

@ -1985,4 +1985,30 @@ class ModuleUser extends Module
{
return true;
}
/**
* Регистрация сайтмапа для пользователей
*/
public function RegisterSitemap()
{
$aFilter = array(
'activate' => 1,
);
$this->Sitemap_AddTargetType('users', array(
'callback_data' => function ($iPage) use ($aFilter) {
$aUsers = $this->GetUsersByFilter($aFilter, array('user_id' => 'asc'), $iPage, 500, array());
$aData = array();
foreach ($aUsers['collection'] as $oUser) {
$aData[] = $this->Sitemap_GetDataForSitemapRow($oUser->getUserWebPath(),
is_null($oUser->getProfileDate()) ? $oUser->getDateRegister() : $oUser->getProfileDate(), '0.5', 'weekly');
}
return $aData;
},
'callback_counters' => function () use ($aFilter) {
$aUsers = $this->GetUsersByFilter($aFilter, array(), 1, 1, array());
$iCount = (int)$aUsers['count'];
return ceil($iCount / 500);
}
));
}
}

Просмотреть файл

@ -422,6 +422,8 @@ $config['router']['rewrite'] = array();
$config['router']['uri'] = array(
// короткий вызов топиков из личных блогов
'~^(\d+)\.html~i' => "blog/\\1.html",
'~^sitemap\.xml~i' => "sitemap",
'~^sitemap_(\w+)_(\d+)\.xml~i' => "sitemap/\\1/\\2",
);
// Распределение action
$config['router']['page']['error'] = 'ActionError';
@ -445,6 +447,9 @@ $config['router']['page']['subscribe'] = 'ActionSubscribe';
$config['router']['page']['content'] = 'ActionContent';
$config['router']['page']['property'] = 'ActionProperty';
$config['router']['page']['wall'] = 'ActionWall';
$config['router']['page']['sitemap'] = function() {
return LS::Sitemap_ShowSitemap();
};
// Глобальные настройки роутинга
$config['router']['config']['default']['action'] = 'index';
$config['router']['config']['default']['event'] = null;

@ -1 +1 @@
Subproject commit c3b04d7992dc227971c8c0f9e1a46f21f3860c41
Subproject commit 955619fcd2139f549e8cc2ab0f34df029b1ca652

Просмотреть файл

@ -12,4 +12,5 @@ Disallow: /page/$
Disallow: /error/$
Disallow: /settings/$
Disallow: /content/$
Disallow: /talk/$
Disallow: /talk/$
# Sitemap: http://example.com/sitemap.xml