429
回編集
細編集の要約なし |
|||
28行目: | 28行目: | ||
function wfAddKeywordsMetaTag(&$out, &$text) { | function wfAddKeywordsMetaTag(&$out, &$text) { | ||
global $wgTitle, $wgParser, $wgRequest, $action; | |||
if ($action !== 'edit' && | if ($action !== 'edit' && | ||
$action !== 'history' && | $action !== 'history' && | ||
$action !== 'delete' && | $action !== 'delete' && | ||
$action !== 'watch' | $action !== 'watch') { | ||
// Mediawiki:Keywords | |||
$title = Title::MakeTitle(NS_MEDIAWIKI, 'Keywords'); | $title = Title::MakeTitle(NS_MEDIAWIKI, 'Keywords'); | ||
$article = new Article($title); | $article = new Article($title); | ||
$keywords = explode(',', $article->getRawText()); | $keywords = array_map('trim', explode(',', $article->getRawText())); | ||
foreach ($keywords as $keyword) | foreach ($keywords as $keyword) | ||
if (!empty($keyword)) | |||
$out->addKeyword($keyword); | $out->addKeyword($keyword); | ||
$namespaces = array(NS_MAIN, NS_USER, NS_PROJECT, NS_MEDIAWIKI); | |||
foreach ($namespaces as $namespace) { | |||
// Mediawiki::Keywords-$namespace | |||
if ($wgTitle->getNamespace() === $namespace) { | |||
$page = sprintf('Keywords-%u', $namespace); | |||
$title = Title::MakeTitle(NS_MEDIAWIKI, $page); | |||
$article = new Article($title); | |||
$keywords = array_map('trim', explode(',', $article->getRawText())); | |||
foreach ($keywords as $keyword) | |||
if (!empty($keyword)) | |||
$out->addKeyword($keyword); | |||
} | |||
} | } | ||
} | } |