give path when not able to write the thumb
[lhc/web/wiklou.git] / includes / Linker.php
index 8bea052..8e02fd9 100644 (file)
@@ -1,4 +1,25 @@
 <?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
@@ -397,6 +418,31 @@ class Linker {
                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
@@ -995,7 +1041,7 @@ class Linker {
                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 '';
                }
@@ -1193,7 +1239,7 @@ class Linker {
                }
                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)