<?php
+/**
+ * Methods to make links and related items.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
/**
* Some internal bits split of from Skin.php. These functions are used
* for primarily page content: links, embedded images, table of contents. Links
return "<strong class=\"selflink\">{$prefix}{$html}{$inside}</strong>{$trail}";
}
+ /**
+ * Get a message saying that an invalid title was encountered.
+ * This should be called after a method like Title::makeTitleSafe() returned
+ * a value indicating that the title object is invalid.
+ *
+ * @param $context IContextSource context to use to get the messages
+ * @param $namespace int Namespace number
+ * @param $title string Text of the title, without the namespace part
+ */
+ public static function getInvalidTitleDescription( IContextSource $context, $namespace, $title ) {
+ global $wgContLang;
+
+ // First we check whether the namespace exists or not.
+ if ( MWNamespace::exists( $namespace ) ) {
+ if ( $namespace == NS_MAIN ) {
+ $name = $context->msg( 'blanknamespace' )->text();
+ } else {
+ $name = $wgContLang->getFormattedNsText( $namespace );
+ }
+ return $context->msg( 'invalidtitle-knownnamespace', $namespace, $name, $title )->text();
+ } else {
+ return $context->msg( 'invalidtitle-unknownnamespace', $namespace, $title )->text();
+ }
+ }
+
/**
* @param $title Title
* @return Title
wfRunHooks( 'UserToolLinksEdit', array( $userId, $userText, &$items ) );
if ( $items ) {
- return ' <span class="mw-usertoollinks">(' . $wgLang->pipeList( $items ) . ')</span>';
+ return ' <span class="mw-usertoollinks">' . wfMessage( 'parentheses' )->rawParams( $wgLang->pipeList( $items ) )->escaped() . '</span>';
} else {
return '';
}
}
if ( $pre ) {
# written summary $presep autocomment (summary /* section */)
- $auto = wfMsgExt( 'autocomment-prefix', array( 'escapenoentities', 'content' ) ) . $auto;
+ $pre .= wfMsgExt( 'autocomment-prefix', array( 'escapenoentities', 'content' ) );
}
if ( $post ) {
# autocomment $postsep written summary (/* section */ summary)
return '';
} else {
$formatted = self::formatComment( $comment, $title, $local );
- return " <span class=\"comment\" dir=\"auto\">($formatted)</span>";
+ $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped();
+ return " <span class=\"comment\">$formatted</span>";
}
}
} else {
global $wgLang;
$stxt = wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $size ) );
- $stxt = "($stxt)";
+ $stxt = wfMessage( 'parentheses' )->rawParams( $stxt )->escaped();
}
$stxt = htmlspecialchars( $stxt );
return "<span class=\"history-size\">$stxt</span>";
$html = $delete ? wfMsgHtml( 'rev-delundel' ) : wfMsgHtml( 'rev-showdeleted' );
$tag = $restricted ? 'strong' : 'span';
$link = self::link( $sp, $html, array(), $query, array( 'known', 'noclasses' ) );
- return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), "($link)" );
+ return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), wfMessage( 'parentheses' )->rawParams( $link )->escaped() );
}
/**
*/
public static function revDeleteLinkDisabled( $delete = true ) {
$html = $delete ? wfMsgHtml( 'rev-delundel' ) : wfMsgHtml( 'rev-showdeleted' );
- return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), "($html)" );
+ return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), wfMessage( 'parentheses' )->rawParams( $html )->escaped() );
}
/* Deprecated methods */