mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 14:52:24 +09:00
Add options to customize the browser title format
This commit is contained in:
parent
f25e685209
commit
9bdc30b325
11 changed files with 79 additions and 18 deletions
|
|
@ -863,14 +863,21 @@ class Context
|
|||
* Set string to browser title
|
||||
*
|
||||
* @param string $site_title Browser title to be set
|
||||
* @param array $vars
|
||||
* @return void
|
||||
*/
|
||||
public static function setBrowserTitle($title)
|
||||
public static function setBrowserTitle($title, $vars = array())
|
||||
{
|
||||
if(!$title)
|
||||
if (!$title)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (count($vars))
|
||||
{
|
||||
$title = preg_replace_callback('/\\$(\w+)/', function($matches) use($vars) {
|
||||
return isset($vars[strtolower($matches[1])]) ? $vars[strtolower($matches[1])] : $matches[0];
|
||||
}, $title);
|
||||
}
|
||||
self::$_instance->site_title = $title;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,15 +287,21 @@ class ModuleHandler extends Handler
|
|||
$this->module_info = $module_info;
|
||||
if ($module_info->mid == $site_module_info->mid)
|
||||
{
|
||||
Context::setBrowserTitle(Context::getSiteTitle());
|
||||
Context::addBrowserTitle(Context::getSiteSubtitle());
|
||||
$seo_title = config('seo.main_title') ?: '$SITE_TITLE - $SITE_SUBTITLE';
|
||||
}
|
||||
else
|
||||
{
|
||||
Context::setBrowserTitle(Context::getSiteTitle());
|
||||
Context::addBrowserTitle($module_info->browser_title);
|
||||
$seo_title = config('seo.subpage_title') ?: '$SITE_TITLE - $SUBPAGE_TITLE';
|
||||
}
|
||||
|
||||
getController('module')->replaceDefinedLangCode($seo_title);
|
||||
Context::setBrowserTitle($seo_title, array(
|
||||
'site_title' => Context::getSiteTitle(),
|
||||
'site_subtitle' => Context::getSiteSubtitle(),
|
||||
'subpage_title' => $module_info->browser_title,
|
||||
'page' => Context::get('page') ?: 1,
|
||||
));
|
||||
|
||||
$module_config = $oModuleModel->getModuleConfig('module');
|
||||
if ($module_info->meta_keywords)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue