Extend wfParseUrl() to handle protocol-relative URLs. parse_url() doesn't handle...
[lhc/web/wiklou.git] / languages / Language.php
index a7795a4..55a2ee7 100644 (file)
@@ -2351,10 +2351,14 @@ class Language {
        /**
         * A hidden direction mark (LRM or RLM), depending on the language direction
         *
+        * @param $opposite Boolean Get the direction mark opposite to your language
         * @return string
         */
-       function getDirMark() {
-               return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E";
+       function getDirMark( $opposite = false ) {
+               $rtl = "\xE2\x80\x8F";
+               $ltr = "\xE2\x80\x8E";
+               if( $opposite ) { return $this->isRTL() ? $ltr : $rtl; }
+               return $this->isRTL() ? $rtl : $ltr;
        }
 
        /**
@@ -2988,9 +2992,8 @@ class Language {
        }
 
        /**
-        * Maybe translate block durations.  Note that this function is somewhat misnamed: it
-        * deals with translating the *duration* ("1 week", "4 days", etc), not the expiry time
-        * (which is an absolute timestamp).
+        * This translates the duration ("1 week", "4 days", etc)
+        * as well as the expiry time (which is an absolute timestamp).
         * @param $str String: the validated block duration in English
         * @return Somehow translated block duration
         * @see LanguageFi.php for example implementation
@@ -3014,8 +3017,8 @@ class Language {
                                }
                        }
                }
-               // If all else fails, return the original string.
-               return $str;
+               // If no duration is given, but a timestamp, display that
+               return ( strtotime( $str ) ? $this->timeanddate( strtotime( $str ) ) : $str );
        }
 
        /**