protected $mCanonicalUrl = false;
/**
- * @var string Should be private - has getter and setter. Contains
- * the HTML title */
- public $mPagetitle = '';
+ * @var string The contents of <h1> */
+ private $mPageTitle = '';
/**
* @var string Contains all of the "<body>" content. Should be private we
return $this->mLinktags;
}
- /**
- * Add a new \<link\> with "rel" attribute set to "meta"
- *
- * @param array $linkarr Associative array mapping attribute names to their
- * values, both keys and values will be escaped, and the
- * "rel" attribute will be automatically added
- */
- function addMetadataLink( array $linkarr ) {
- $linkarr['rel'] = $this->getMetadataAttribute();
- $this->addLink( $linkarr );
- }
-
/**
* Set the URL to be used for the <link rel=canonical>. This should be used
* in preference to addLink(), to avoid duplicate link tags.
return $this->mCanonicalUrl;
}
- /**
- * Get the value of the "rel" attribute for metadata links
- *
- * @return string
- */
- public function getMetadataAttribute() {
- # note: buggy CC software only reads first "meta" link
- static $haveMeta = false;
- if ( $haveMeta ) {
- return 'alternate meta';
- } else {
- $haveMeta = true;
- return 'meta';
- }
- }
-
/**
* Add raw HTML to the list of scripts (including \<script\> tag, etc.)
* Internal use only. Use OutputPage::addModules() or OutputPage::addJsConfigVars()
# this breaks strtotime().
$clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
- Wikimedia\suppressWarnings(); // E_STRICT system time bitching
+ Wikimedia\suppressWarnings(); // E_STRICT system time warnings
$clientHeaderTime = strtotime( $clientHeader );
Wikimedia\restoreWarnings();
if ( !$clientHeaderTime ) {
# change "<script>foo&bar</script>" to "<script>foo&bar</script>"
# but leave "<i>foobar</i>" alone
$nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $name ) );
- $this->mPagetitle = $nameWithTags;
+ $this->mPageTitle = $nameWithTags;
# change "<i>foo&bar</i>" to "foo&bar"
$this->setHTMLTitle(
* @return string
*/
public function getPageTitle() {
- return $this->mPagetitle;
+ return $this->mPageTitle;
}
/**
}
}
+ /**
+ * Output an error page
+ *
+ * @note FatalError exception class provides an alternative.
+ * @param string $message Error to output. Must be escaped for HTML.
+ */
public function showFatalError( $message ) {
$this->prepareErrorPage( $this->msg( 'internalerror' ) );
$this->addHTML( $message );
}
+ /**
+ * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+ */
public function showUnexpectedValueError( $name, $val ) {
- $this->showFatalError( $this->msg( 'unexpected', $name, $val )->text() );
+ wfDeprecated( __METHOD__, '1.32' );
+ $this->showFatalError( $this->msg( 'unexpected', $name, $val )->escaped() );
}
+ /**
+ * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+ */
public function showFileCopyError( $old, $new ) {
- $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->text() );
+ wfDeprecated( __METHOD__, '1.32' );
+ $this->showFatalError( $this->msg( 'filecopyerror', $old, $new )->escaped() );
}
+ /**
+ * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+ */
public function showFileRenameError( $old, $new ) {
- $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->text() );
+ wfDeprecated( __METHOD__, '1.32' );
+ $this->showFatalError( $this->msg( 'filerenameerror', $old, $new )->escpaed() );
}
+ /**
+ * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+ */
public function showFileDeleteError( $name ) {
- $this->showFatalError( $this->msg( 'filedeleteerror', $name )->text() );
+ wfDeprecated( __METHOD__, '1.32' );
+ $this->showFatalError( $this->msg( 'filedeleteerror', $name )->escaped() );
}
+ /**
+ * @deprecated 1.32 Use OutputPage::showFatalError or throw FatalError instead.
+ */
public function showFileNotFoundError( $name ) {
- $this->showFatalError( $this->msg( 'filenotfound', $name )->text() );
+ wfDeprecated( __METHOD__, '1.32' );
+ $this->showFatalError( $this->msg( 'filenotfound', $name )->escaped() );
}
/**
] );
}
+ // Allow extensions to add, remove and/or otherwise manipulate these links
+ // If you want only to *add* <head> links, please use the addHeadItem()
+ // (or addHeadItems() for multiple items) method instead.
+ // This hook is provided as a last resort for extensions to modify these
+ // links before the output is sent to client.
+ Hooks::run( 'OutputPageAfterGetHeadLinksArray', [ &$tags, $this ] );
+
return $tags;
}