如何解决更新 MediaWiki MobileFrontend 的代码
This site 具有以下代码,用于将 Google AdSense 添加到移动版 wiki 的标题中,但它已过期 5 年。有人能帮忙将代码更新到当前版本吗?
现场代码:
Change existing code:
protected function getHeaderHtml() {
$title = $this->getOutput()->getPageTitle();
if ( $title ) {
return Html::rawElement( 'h1',array( 'id' => 'section_0' ),$title );
}
return '';
}
TO THIS CODE:
protected function getHeaderHtml() {
$title = $this->getOutput()->getPageTitle();
if ( $title ) {
$result = 'INSERT AD CODE';
$result .= Html::rawElement( 'h1',$this->getOutput()->getPageTitle() );
return $result;
}
return '';
}
作为参考,最新版本的代码部分如下所示:
/**
* Returns the HTML representing the heading.
* @returns {String} html for header
*/
protected function getHeadingHtml() {
$heading = '';
if ( $this->isUserPage ) {
// The heading is just the username without namespace
$heading = $this->pageUser->getName();
} else {
$pageTitle = $this->getOutput()->getPageTitle();
if ( $pageTitle ) {
$heading = $pageTitle;
}
}
return Html::rawElement( 'h1',[ 'id' => 'section_0' ],$heading );
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。