Merge branch 'master' into pr/manager-scopes

This commit is contained in:
Kijin Sung 2024-10-27 23:09:40 +09:00
commit 2620049b4e
18 changed files with 136 additions and 202 deletions

View file

@ -2879,14 +2879,10 @@ class Context
{
return isset(self::$_instance->meta_tags[$name]) ? self::$_instance->meta_tags[$name]['content'] : null;
}
$ret = array();
foreach(self::$_instance->meta_tags as $name => $content)
else
{
$ret[] = array('name' => $name, 'is_http_equiv' => $content['is_http_equiv'], 'content' => escape($content['content'], false));
return array_values(self::$_instance->meta_tags);
}
return $ret;
}
/**
@ -2894,14 +2890,17 @@ class Context
*
* @param string $name name of meta tag
* @param string $content content of meta tag
* @param mixed $is_http_equiv value of http_equiv
* @param bool $is_http_equiv
* @param bool $is_before_title
* @return void
*/
public static function addMetaTag($name, $content, $is_http_equiv = false)
public static function addMetaTag($name, $content, $is_http_equiv = false, $is_before_title = true)
{
self::$_instance->meta_tags[$name] = array(
'name' => $name,
'content' => escape(self::replaceUserLang($content, true), false),
'is_http_equiv' => (bool)$is_http_equiv,
'content' => self::replaceUserLang($content, true),
'is_before_title' => (bool)$is_before_title,
);
}

View file

@ -196,6 +196,12 @@ class HTMLDisplayHandler
Context::set('favicon_url', $favicon_url);
Context::set('mobicon_url', $mobicon_url);
// Only print the X-UA-Compatible meta tag if somebody is still using IE
if (preg_match('!Trident/7\.0!', $_SERVER['HTTP_USER_AGENT'] ?? ''))
{
Context::addMetaTag('X-UA-Compatible', 'IE=edge', true);
}
return $output;
}
@ -641,7 +647,7 @@ class HTMLDisplayHandler
{
if ($tag !== '')
{
Context::addOpenGraphData('og:article:tag', $tag, false);
Context::addOpenGraphData('og:article:tag', $tag);
}
}
@ -683,21 +689,21 @@ class HTMLDisplayHandler
function _addTwitterMetadata()
{
$card_type = $this->_image_type === 'document' ? 'summary_large_image' : 'summary';
Context::addMetaTag('twitter:card', $card_type);
Context::addMetaTag('twitter:card', $card_type, false, false);
foreach(Context::getOpenGraphData() as $val)
{
if ($val['property'] === 'og:title')
{
Context::addMetaTag('twitter:title', $val['content']);
Context::addMetaTag('twitter:title', $val['content'], false, false);
}
if ($val['property'] === 'og:description')
{
Context::addMetaTag('twitter:description', $val['content']);
Context::addMetaTag('twitter:description', $val['content'], false, false);
}
if ($val['property'] === 'og:image' && $this->_image_type === 'document')
{
Context::addMetaTag('twitter:image', $val['content']);
Context::addMetaTag('twitter:image', $val['content'], false, false);
}
}
}

View file

@ -693,7 +693,8 @@ class ModuleHandler extends Handler
}
}
if ($kind === 'admin') {
if ($kind === 'admin')
{
Context::addMetaTag('robots', 'noindex');
}