X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FDateFormatter.php;h=0a69b045182f2467550b5e9303b0830a61bb9d6f;hb=55d5f04e56c1fdddd13073b2749d50778d1e3770;hp=8103b60529afa56cbbf882354c2d825c71181735;hpb=853f21b42e95b16c876c94245a5a4645dd982e93;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 8103b60529..0a69b04518 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -156,10 +156,10 @@ class DateFormatter { } for ( $i = 1; $i <= self::LAST; $i++ ) { $this->mSource = $i; - if ( isset ( $this->rules[$preference][$i] ) ) { + if ( isset( $this->rules[$preference][$i] ) ) { # Specific rules $this->mTarget = $this->rules[$preference][$i]; - } elseif ( isset ( $this->rules[self::ALL][$i] ) ) { + } elseif ( isset( $this->rules[self::ALL][$i] ) ) { # General rules $this->mTarget = $this->rules[self::ALL][$i]; } elseif ( $preference ) { @@ -198,8 +198,9 @@ class DateFormatter { function replace( $matches ) { # Extract information from $matches $linked = true; - if ( isset( $this->mLinked ) ) + if ( isset( $this->mLinked ) ) { $linked = $this->mLinked; + } $bits = array(); $key = $this->keys[$this->mSource]; @@ -232,10 +233,12 @@ class DateFormatter { $fail = false; // Pre-generate y/Y stuff because we need the year for the title. - if ( !isset( $bits['y'] ) && isset( $bits['Y'] ) ) + if ( !isset( $bits['y'] ) && isset( $bits['Y'] ) ) { $bits['y'] = $this->makeIsoYear( $bits['Y'] ); - if ( !isset( $bits['Y'] ) && isset( $bits['y'] ) ) + } + if ( !isset( $bits['Y'] ) && isset( $bits['y'] ) ) { $bits['Y'] = $this->makeNormalYear( $bits['y'] ); + } if ( !isset( $bits['m'] ) ) { $m = $this->makeIsoMonth( $bits['F'] ); @@ -293,8 +296,9 @@ class DateFormatter { } $isoBits = array(); - if ( isset( $bits['y'] ) ) + if ( isset( $bits['y'] ) ) { $isoBits[] = $bits['y']; + } $isoBits[] = $bits['m']; $isoBits[] = $bits['d']; $isoDate = implode( '-', $isoBits ); @@ -312,7 +316,7 @@ class DateFormatter { */ function getMonthRegex() { $names = array(); - for( $i = 1; $i <= 12; $i++ ) { + for ( $i = 1; $i <= 12; $i++ ) { $names[] = $this->lang->getMonthName( $i ); $names[] = $this->lang->getMonthAbbreviation( $i ); } @@ -353,7 +357,7 @@ class DateFormatter { */ function makeNormalYear( $iso ) { if ( $iso[0] == '-' ) { - $text = (intval( substr( $iso, 1 ) ) + 1) . ' BC'; + $text = ( intval( substr( $iso, 1 ) ) + 1 ) . ' BC'; } else { $text = intval( $iso ); }