X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FDateFormatter.php;h=40da3685ab4a4f04aa405736050dd81ffed7ed04;hb=80a6fdb70ec1ba38e87de1d02f7e78bda2ea6f6e;hp=edb9ff1d2850137fefb38e3a6864ee430f5774e5;hpb=25d33bacb3496e9acb6ec0d7147b48a6a552c81d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index edb9ff1d28..40da3685ab 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -108,13 +108,13 @@ class DateFormatter { $this->rules[self::ALL][self::DM] = self::DM; $this->rules[self::NONE][self::ISO2] = self::ISO1; - $this->preferences = array( + $this->preferences = [ 'default' => self::NONE, 'dmy' => self::DMY, 'mdy' => self::MDY, 'ymd' => self::YMD, 'ISO 8601' => self::ISO1, - ); + ]; } /** @@ -151,7 +151,7 @@ class DateFormatter { * * @return string */ - public function reformat( $preference, $text, $options = array( 'linked' ) ) { + public function reformat( $preference, $text, $options = [ 'linked' ] ) { $linked = in_array( 'linked', $options ); $match_whole = in_array( 'match-whole', $options ); @@ -179,7 +179,7 @@ class DateFormatter { // Horrible hack if ( !$linked ) { - $regex = str_replace( array( '\[\[', '\]\]' ), '', $regex ); + $regex = str_replace( [ '\[\[', '\]\]' ], '', $regex ); } if ( $match_whole ) { @@ -191,7 +191,7 @@ class DateFormatter { // Another horrible hack $this->mLinked = $linked; - $text = preg_replace_callback( $regex, array( &$this, 'replace' ), $text ); + $text = preg_replace_callback( $regex, [ &$this, 'replace' ], $text ); unset( $this->mLinked ); } return $text; @@ -208,7 +208,7 @@ class DateFormatter { $linked = $this->mLinked; } - $bits = array(); + $bits = []; $key = $this->keys[$this->mSource]; $keyLength = strlen( $key ); for ( $p = 0; $p < $keyLength; $p++ ) { @@ -232,7 +232,7 @@ class DateFormatter { // strip piped links $format = preg_replace( '/\[\[[^|]+\|([^\]]+)\]\]/', '$1', $format ); // strip remaining links - $format = str_replace( array( '[[', ']]' ), '', $format ); + $format = str_replace( [ '[[', ']]' ], '', $format ); } # Construct new date @@ -304,7 +304,7 @@ class DateFormatter { $text = $matches[0]; } - $isoBits = array(); + $isoBits = []; if ( isset( $bits['y'] ) ) { $isoBits[] = $bits['y']; } @@ -314,7 +314,7 @@ class DateFormatter { // Output is not strictly HTML (it's wikitext), but is whitelisted. $text = Html::rawElement( 'span', - array( 'class' => 'mw-formatted-date', 'title' => $isoDate ), $text ); + [ 'class' => 'mw-formatted-date', 'title' => $isoDate ], $text ); return $text; } @@ -324,7 +324,7 @@ class DateFormatter { * @return string regex to find the months with */ public function getMonthRegex() { - $names = array(); + $names = []; for ( $i = 1; $i <= 12; $i++ ) { $names[] = $this->lang->getMonthName( $i ); $names[] = $this->lang->getMonthAbbreviation( $i );