Add options to customize the browser title format

This commit is contained in:
Kijin Sung 2016-05-09 22:39:19 +09:00
parent f25e685209
commit 9bdc30b325
11 changed files with 79 additions and 18 deletions

View file

@ -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;
}