Localisation updates for extension messages from Betawiki (2008-07-11 11:00 CEST)
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 25c3162..56a313f 100644 (file)
@@ -452,7 +452,7 @@ function wfMsgWeirdKey ( $key ) {
  * @param string $key
  * @param bool $useDB
  * @param string $langcode Code of the language to get the message for, or
- *                         behaves as a content language switch if it is a 
+ *                         behaves as a content language switch if it is a
  *                         boolean.
  * @return string
  * @private
@@ -460,6 +460,8 @@ function wfMsgWeirdKey ( $key ) {
 function wfMsgGetKey( $key, $useDB, $langCode = false, $transform = true ) {
        global $wgParser, $wgContLang, $wgMessageCache, $wgLang;
 
+       wfRunHooks('NormalizeMessageKey', array(&$key, &$useDB, &$langCode, &$transform));
+       
        # If $wgMessageCache isn't initialised yet, try to return something sensible.
        if( is_object( $wgMessageCache ) ) {
                $message = $wgMessageCache->get( $key, $useDB, $langCode );
@@ -1732,7 +1734,7 @@ function wfMkdirParents( $fullDir, $mode = 0777 ) {
                        $currentDir = substr( $currentDir, 0, $p );
                }
        }
-       
+
        if ( count( $createList ) == 0 ) {
                # Directory specified already exists
                return true;
@@ -1752,7 +1754,7 @@ function wfMkdirParents( $fullDir, $mode = 0777 ) {
                wfDebugLog( 'mkdir', "Not writable: $currentDir\n" );
                return false;
        }
-       
+
        foreach ( $createList as $dir ) {
                # use chmod to override the umask, as suggested by the PHP manual
                if ( !mkdir( $dir, $mode ) || !chmod( $dir, $mode ) ) {
@@ -1812,7 +1814,7 @@ function wfPercent( $nr, $acc = 2, $round = true ) {
 function wfEncryptPassword( $userid, $password ) {
        wfDeprecated(__FUNCTION__);
        # Just wrap around User::oldCrypt()
-       return User::oldCrypt($password, $userid); 
+       return User::oldCrypt($password, $userid);
 }
 
 /**
@@ -2294,12 +2296,20 @@ function wfCreateObject( $name, $p ){
 }
 
 /**
- * Aliases for modularized functions
+ * Alias for modularized function
+ * @deprecated Use Http::get() instead
  */
 function wfGetHTTP( $url, $timeout = 'default' ) {
+       wfDeprecated(__FUNCTION__);
        return Http::get( $url, $timeout );
 }
+
+/**
+ * Alias for modularized function
+ * @deprecated Use Http::isLocalURL() instead
+ */
 function wfIsLocalURL( $url ) {
+       wfDeprecated(__FUNCTION__);
        return Http::isLocalURL( $url );
 }
 
@@ -2307,7 +2317,7 @@ function wfHttpOnlySafe() {
        global $wgHttpOnlyBlacklist;
        if( !version_compare("5.2", PHP_VERSION, "<") )
                return false;
-       
+
        if( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
                foreach( $wgHttpOnlyBlacklist as $regex ) {
                        if( preg_match( $regex, $_SERVER['HTTP_USER_AGENT'] ) ) {
@@ -2315,7 +2325,7 @@ function wfHttpOnlySafe() {
                        }
                }
        }
-       
+
        return true;
 }
 
@@ -2454,9 +2464,9 @@ function wfSplitWikiID( $wiki ) {
  *
  * @param string $wiki The wiki ID, or false for the current wiki
  *
- * Note: multiple calls to wfGetDB(DB_SLAVE) during the course of one request 
- * will always return the same object, unless the underlying connection or load 
- * balancer is manually destroyed. 
+ * Note: multiple calls to wfGetDB(DB_SLAVE) during the course of one request
+ * will always return the same object, unless the underlying connection or load
+ * balancer is manually destroyed.
  */
 function &wfGetDB( $db = DB_LAST, $groups = array(), $wiki = false ) {
        return wfGetLB( $wiki )->getConnection( $db, $groups, $wiki );
@@ -2675,3 +2685,13 @@ function wfGenerateToken( $salt = '' ) {
 
        return md5( mt_rand( 0, 0x7fffffff ) . $salt );
 }
+
+/**
+ * Replace all invalid characters with -
+ * @param mixed $title Filename to process
+ */
+function wfStripIllegalFilenameChars( $name ) {
+       $name = wfBaseName( $name );
+       $name = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name );
+       return $name;
+}