Add support for Number grouping(commafy) based on CLDR number grouping patterns like...
[lhc/web/wiklou.git] / includes / Article.php
index e453b37..a91ad26 100644 (file)
@@ -23,7 +23,7 @@ class Article extends Page {
         */
 
        /**
-        * @var RequestContext
+        * @var IContextSource
         */
        protected $mContext;
 
@@ -88,10 +88,10 @@ class Article extends Page {
         * Create an Article object of the appropriate class for the given page.
         *
         * @param $title Title
-        * @param $context RequestContext
+        * @param $context IContextSource
         * @return Article object
         */
-       public static function newFromTitle( $title, RequestContext $context ) {
+       public static function newFromTitle( $title, IContextSource $context ) {
                if ( NS_MEDIA == $title->getNamespace() ) {
                        // FIXME: where should this go?
                        $title = Title::makeTitle( NS_FILE, $title->getDBkey() );
@@ -1050,13 +1050,14 @@ class Article extends Page {
         * @return string containing HMTL with redirect link
         */
        public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
-               global $wgOut, $wgLang, $wgStylePath;
+               global $wgOut, $wgStylePath;
 
                if ( !is_array( $target ) ) {
                        $target = array( $target );
                }
 
-               $imageDir = $wgLang->getDir();
+               $lang = $this->getTitle()->getPageLanguage();
+               $imageDir = $lang->getDir();
 
                if ( $appendSubtitle ) {
                        $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) );
@@ -1072,7 +1073,7 @@ class Article extends Page {
                }
 
                $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png';
-               $alt = $wgLang->isRTL() ? '←' : '→';
+               $alt = $lang->isRTL() ? '←' : '→';
                // Automatically append redirect=no to each link, since most of them are redirect pages themselves.
                foreach ( $target as $rt ) {
                        $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) );
@@ -1856,7 +1857,7 @@ class Article extends Page {
        /**
         * Sets the context this Article is executed in
         *
-        * @param $context RequestContext
+        * @param $context IContextSource
         * @since 1.18
         */
        public function setContext( $context ) {
@@ -1866,11 +1867,11 @@ class Article extends Page {
        /**
         * Gets the context this Article is executed in
         *
-        * @return RequestContext
+        * @return IContextSource
         * @since 1.18
         */
        public function getContext() {
-               if ( $this->mContext instanceof RequestContext ) {
+               if ( $this->mContext instanceof IContextSource ) {
                        return $this->mContext;
                } else {
                        wfDebug( __METHOD__ . " called and \$mContext is null. Return RequestContext::getMain(); for sanity\n" );