parse argument for message 'ago' in MWTimestamp::getHumanTimestamp
[lhc/web/wiklou.git] / includes / Timestamp.php
index fed95c0..3b7b801 100644 (file)
@@ -140,14 +140,10 @@ class MWTimestamp {
                        $strtime = call_user_func_array( "sprintf", $da );
                }
 
-               if( function_exists( "date_create" ) ) {
-                       try {
-                               $final = new DateTime( $strtime, new DateTimeZone( 'GMT' ) );
-                       } catch(Exception $e) {
-                               throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' );
-                       }
-               } else {
-                       $final = strtotime( $strtime );
+               try {
+                       $final = new DateTime( $strtime, new DateTimeZone( 'GMT' ) );
+               } catch(Exception $e) {
+                       throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' );
                }
 
                if( $final === false ) {
@@ -200,7 +196,7 @@ class MWTimestamp {
         *
         * @since 1.20
         *
-        * @return string Formatted timestamp
+        * @return Message Formatted timestamp
         */
        public function getHumanTimestamp() {
                $then = $this->getTimestamp( TS_UNIX );
@@ -220,7 +216,7 @@ class MWTimestamp {
 
                if( $message ) {
                        $initial = call_user_func_array( 'wfMessage', $message );
-                       return wfMessage( 'ago', $initial );
+                       return wfMessage( 'ago', $initial->parse() );
                } else {
                        return wfMessage( 'just-now' );
                }