* Get all registered JS and CSS tags for the header.
*
* @return string
+ * @deprecated since 1.24 Use OutputPage::headElement to build the full header.
*/
function getScript() {
+ wfDeprecated( __METHOD__, '1.24' );
return $this->mScripts . $this->getHeadItems();
}
* Get all header items in a string
*
* @return string
+ * @deprecated since 1.24 Use OutputPage::headElement or
+ * if absolutely necessary use OutputPage::getHeadItemsArray
*/
function getHeadItems() {
+ wfDeprecated( __METHOD__, '1.24' );
$s = '';
foreach ( $this->mHeadItems as $item ) {
$s .= $item;
*/
public function parseInline( $text, $linestart = true, $interface = false ) {
$parsed = $this->parse( $text, $linestart, $interface );
-
- $m = array();
- if ( preg_match( '/^<p>(.*)\n?<\/p>\n?/sU', $parsed, $m ) ) {
- $parsed = $m[1];
- }
-
- return $parsed;
+ return Parser::stripOuterParagraph( $parsed );
}
/**
* /w/index.php?title=Main_page&variant=zh-cn should never be served.
*/
function addAcceptLanguage() {
- $lang = $this->getTitle()->getPageLanguage();
+ $title = $this->getTitle();
+ if ( !$title instanceof Title ) {
+ return;
+ }
+
+ $lang = $title->getPageLanguage();
if ( !$this->getRequest()->getCheck( 'variant' ) && $lang->hasVariants() ) {
$variants = $lang->getVariants();
$aloption = array();
$ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
- $ret .= (
- $this->getHeadLinks() .
- "\n" .
- $this->buildCssLinks() .
- // No newline after buildCssLinks since makeResourceLoaderLink did that already
- $this->getHeadScripts() .
- "\n" .
- $this->getHeadItems()
- );
+ foreach ( $this->getHeadLinksArray() as $item ) {
+ $ret .= $item . "\n";
+ }
+
+ // No newline after buildCssLinks since makeResourceLoaderLink did that already
+ $ret .= $this->buildCssLinks();
+
+ $ret .= $this->getHeadScripts() . "\n";
+
+ foreach ( $this->mHeadItems as $item ) {
+ $ret .= $item . "\n";
+ }
$closeHead = Html::closeElement( 'head' );
if ( $closeHead ) {
'rel' => 'alternate',
'type' => 'application/x-wiki',
'title' => $msg,
- 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
+ 'href' => $this->getTitle()->getEditURL(),
) );
// Alternate edit link
$tags['alternative-edit'] = Html::element( 'link', array(
'rel' => 'edit',
'title' => $msg,
- 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
+ 'href' => $this->getTitle()->getEditURL(),
) );
}
}
/**
* @return string HTML tag links to be put in the header.
+ * @deprecated since 1.24 Use OutputPage::headElement or if you have to,
+ * OutputPage::getHeadLinksArray directly.
*/
public function getHeadLinks() {
+ wfDeprecated( __METHOD__, '1.24' );
return implode( "\n", $this->getHeadLinksArray() );
}