Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -541,7 +541,7 @@ |
542 | 542 | $text = $inside; |
543 | 543 | $tail = null; |
544 | 544 | } else { |
545 | | - if( $element == '!--' ) { |
| 545 | + if( $element === '!--' ) { |
546 | 546 | $end = '/(-->)/'; |
547 | 547 | } else { |
548 | 548 | $end = "/(<\\/$element\\s*>)/i"; |
— | — | @@ -786,7 +786,7 @@ |
787 | 787 | // Don't do any of the following |
788 | 788 | $out .= $outLine."\n"; |
789 | 789 | continue; |
790 | | - } else if ( substr ( $line , 0 , 2 ) == '|}' ) { |
| 790 | + } else if ( substr ( $line , 0 , 2 ) === '|}' ) { |
791 | 791 | // We are ending a table |
792 | 792 | $line = '</table>' . substr ( $line , 2 ); |
793 | 793 | $last_tag = array_pop ( $last_tag_history ); |
— | — | @@ -804,7 +804,7 @@ |
805 | 805 | } |
806 | 806 | array_pop ( $tr_attributes ); |
807 | 807 | $outLine = $line . str_repeat( '</dd></dl>' , $indent_level ); |
808 | | - } else if ( substr ( $line , 0 , 2 ) == '|-' ) { |
| 808 | + } else if ( substr ( $line , 0 , 2 ) === '|-' ) { |
809 | 809 | // Now we have a table row |
810 | 810 | $line = preg_replace( '#^\|-+#', '', $line ); |
811 | 811 | |
— | — | @@ -832,16 +832,16 @@ |
833 | 833 | array_push ( $td_history , false ); |
834 | 834 | array_push ( $last_tag_history , '' ); |
835 | 835 | } |
836 | | - else if ( $first_character == '|' || $first_character == '!' || substr ( $line , 0 , 2 ) == '|+' ) { |
| 836 | + else if ( $first_character === '|' || $first_character === '!' || substr ( $line , 0 , 2 ) === '|+' ) { |
837 | 837 | // This might be cell elements, td, th or captions |
838 | | - if ( substr ( $line , 0 , 2 ) == '|+' ) { |
| 838 | + if ( substr ( $line , 0 , 2 ) === '|+' ) { |
839 | 839 | $first_character = '+'; |
840 | 840 | $line = substr ( $line , 1 ); |
841 | 841 | } |
842 | 842 | |
843 | 843 | $line = substr ( $line , 1 ); |
844 | 844 | |
845 | | - if ( $first_character == '!' ) { |
| 845 | + if ( $first_character === '!' ) { |
846 | 846 | $line = str_replace ( '!!' , '||' , $line ); |
847 | 847 | } |
848 | 848 | |
— | — | @@ -857,7 +857,7 @@ |
858 | 858 | foreach ( $cells as $cell ) |
859 | 859 | { |
860 | 860 | $previous = ''; |
861 | | - if ( $first_character != '+' ) |
| 861 | + if ( $first_character !== '+' ) |
862 | 862 | { |
863 | 863 | $tr_after = array_pop ( $tr_attributes ); |
864 | 864 | if ( !array_pop ( $tr_history ) ) { |
— | — | @@ -875,11 +875,11 @@ |
876 | 876 | $previous = "</{$last_tag}>{$previous}"; |
877 | 877 | } |
878 | 878 | |
879 | | - if ( $first_character == '|' ) { |
| 879 | + if ( $first_character === '|' ) { |
880 | 880 | $last_tag = 'td'; |
881 | | - } else if ( $first_character == '!' ) { |
| 881 | + } else if ( $first_character === '!' ) { |
882 | 882 | $last_tag = 'th'; |
883 | | - } else if ( $first_character == '+' ) { |
| 883 | + } else if ( $first_character === '+' ) { |
884 | 884 | $last_tag = 'caption'; |
885 | 885 | } else { |
886 | 886 | $last_tag = ''; |
— | — | @@ -926,12 +926,12 @@ |
927 | 927 | } |
928 | 928 | |
929 | 929 | // Remove trailing line-ending (b/c) |
930 | | - if ( substr( $out, -1 ) == "\n" ) { |
| 930 | + if ( substr( $out, -1 ) === "\n" ) { |
931 | 931 | $out = substr( $out, 0, -1 ); |
932 | 932 | } |
933 | 933 | |
934 | 934 | // special case: don't return empty table |
935 | | - if( $out == "<table>\n<tr><td></td></tr>\n</table>" ) { |
| 935 | + if( $out === "<table>\n<tr><td></td></tr>\n</table>" ) { |
936 | 936 | $out = ''; |
937 | 937 | } |
938 | 938 | |
— | — | @@ -1013,10 +1013,10 @@ |
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | function magicLinkCallback( $m ) { |
1017 | | - if ( substr( $m[0], 0, 1 ) == '<' ) { |
| 1017 | + if ( substr( $m[0], 0, 1 ) === '<' ) { |
1018 | 1018 | # Skip HTML element |
1019 | 1019 | return $m[0]; |
1020 | | - } elseif ( substr( $m[0], 0, 4 ) == 'ISBN' ) { |
| 1020 | + } elseif ( substr( $m[0], 0, 4 ) === 'ISBN' ) { |
1021 | 1021 | $isbn = $m[2]; |
1022 | 1022 | $num = strtr( $isbn, array( |
1023 | 1023 | '-' => '', |
— | — | @@ -1028,11 +1028,11 @@ |
1029 | 1029 | $titleObj->escapeLocalUrl() . |
1030 | 1030 | "\" class=\"internal\">ISBN $isbn</a>"; |
1031 | 1031 | } else { |
1032 | | - if ( substr( $m[0], 0, 3 ) == 'RFC' ) { |
| 1032 | + if ( substr( $m[0], 0, 3 ) === 'RFC' ) { |
1033 | 1033 | $keyword = 'RFC'; |
1034 | 1034 | $urlmsg = 'rfcurl'; |
1035 | 1035 | $id = $m[1]; |
1036 | | - } elseif ( substr( $m[0], 0, 4 ) == 'PMID' ) { |
| 1036 | + } elseif ( substr( $m[0], 0, 4 ) === 'PMID' ) { |
1037 | 1037 | $keyword = 'PMID'; |
1038 | 1038 | $urlmsg = 'pubmedurl'; |
1039 | 1039 | $id = $m[1]; |
— | — | @@ -1140,9 +1140,9 @@ |
1141 | 1141 | { |
1142 | 1142 | $x1 = substr ($arr[$i-1], -1); |
1143 | 1143 | $x2 = substr ($arr[$i-1], -2, 1); |
1144 | | - if ($x1 == ' ') { |
| 1144 | + if ($x1 === ' ') { |
1145 | 1145 | if ($firstspace == -1) $firstspace = $i; |
1146 | | - } else if ($x2 == ' ') { |
| 1146 | + } else if ($x2 === ' ') { |
1147 | 1147 | if ($firstsingleletterword == -1) $firstsingleletterword = $i; |
1148 | 1148 | } else { |
1149 | 1149 | if ($firstmultiletterword == -1) $firstmultiletterword = $i; |
— | — | @@ -1182,7 +1182,7 @@ |
1183 | 1183 | { |
1184 | 1184 | if (($i % 2) == 0) |
1185 | 1185 | { |
1186 | | - if ($state == 'both') |
| 1186 | + if ($state === 'both') |
1187 | 1187 | $buffer .= $r; |
1188 | 1188 | else |
1189 | 1189 | $output .= $r; |
— | — | @@ -1191,41 +1191,41 @@ |
1192 | 1192 | { |
1193 | 1193 | if (strlen ($r) == 2) |
1194 | 1194 | { |
1195 | | - if ($state == 'i') |
| 1195 | + if ($state === 'i') |
1196 | 1196 | { $output .= '</i>'; $state = ''; } |
1197 | | - else if ($state == 'bi') |
| 1197 | + else if ($state === 'bi') |
1198 | 1198 | { $output .= '</i>'; $state = 'b'; } |
1199 | | - else if ($state == 'ib') |
| 1199 | + else if ($state === 'ib') |
1200 | 1200 | { $output .= '</b></i><b>'; $state = 'b'; } |
1201 | | - else if ($state == 'both') |
| 1201 | + else if ($state === 'both') |
1202 | 1202 | { $output .= '<b><i>'.$buffer.'</i>'; $state = 'b'; } |
1203 | 1203 | else # $state can be 'b' or '' |
1204 | 1204 | { $output .= '<i>'; $state .= 'i'; } |
1205 | 1205 | } |
1206 | 1206 | else if (strlen ($r) == 3) |
1207 | 1207 | { |
1208 | | - if ($state == 'b') |
| 1208 | + if ($state === 'b') |
1209 | 1209 | { $output .= '</b>'; $state = ''; } |
1210 | | - else if ($state == 'bi') |
| 1210 | + else if ($state === 'bi') |
1211 | 1211 | { $output .= '</i></b><i>'; $state = 'i'; } |
1212 | | - else if ($state == 'ib') |
| 1212 | + else if ($state === 'ib') |
1213 | 1213 | { $output .= '</b>'; $state = 'i'; } |
1214 | | - else if ($state == 'both') |
| 1214 | + else if ($state === 'both') |
1215 | 1215 | { $output .= '<i><b>'.$buffer.'</b>'; $state = 'i'; } |
1216 | 1216 | else # $state can be 'i' or '' |
1217 | 1217 | { $output .= '<b>'; $state .= 'b'; } |
1218 | 1218 | } |
1219 | 1219 | else if (strlen ($r) == 5) |
1220 | 1220 | { |
1221 | | - if ($state == 'b') |
| 1221 | + if ($state === 'b') |
1222 | 1222 | { $output .= '</b><i>'; $state = 'i'; } |
1223 | | - else if ($state == 'i') |
| 1223 | + else if ($state === 'i') |
1224 | 1224 | { $output .= '</i><b>'; $state = 'b'; } |
1225 | | - else if ($state == 'bi') |
| 1225 | + else if ($state === 'bi') |
1226 | 1226 | { $output .= '</i></b>'; $state = ''; } |
1227 | | - else if ($state == 'ib') |
| 1227 | + else if ($state === 'ib') |
1228 | 1228 | { $output .= '</b></i>'; $state = ''; } |
1229 | | - else if ($state == 'both') |
| 1229 | + else if ($state === 'both') |
1230 | 1230 | { $output .= '<i><b>'.$buffer.'</b></i>'; $state = ''; } |
1231 | 1231 | else # ($state == '') |
1232 | 1232 | { $buffer = ''; $state = 'both'; } |
— | — | @@ -1234,14 +1234,14 @@ |
1235 | 1235 | $i++; |
1236 | 1236 | } |
1237 | 1237 | # Now close all remaining tags. Notice that the order is important. |
1238 | | - if ($state == 'b' || $state == 'ib') |
| 1238 | + if ($state === 'b' || $state === 'ib') |
1239 | 1239 | $output .= '</b>'; |
1240 | | - if ($state == 'i' || $state == 'bi' || $state == 'ib') |
| 1240 | + if ($state === 'i' || $state === 'bi' || $state === 'ib') |
1241 | 1241 | $output .= '</i>'; |
1242 | | - if ($state == 'bi') |
| 1242 | + if ($state === 'bi') |
1243 | 1243 | $output .= '</b>'; |
1244 | 1244 | # There might be lonely ''''', so make sure we have a buffer |
1245 | | - if ($state == 'both' && $buffer) |
| 1245 | + if ($state === 'both' && $buffer) |
1246 | 1246 | $output .= '<b><i>'.$buffer.'</i></b>'; |
1247 | 1247 | return $output; |
1248 | 1248 | } |
— | — | @@ -1291,7 +1291,7 @@ |
1292 | 1292 | $dtrail = ''; |
1293 | 1293 | |
1294 | 1294 | # Set linktype for CSS - if URL==text, link is essentially free |
1295 | | - $linktype = ($text == $url) ? 'free' : 'text'; |
| 1295 | + $linktype = ($text === $url) ? 'free' : 'text'; |
1296 | 1296 | |
1297 | 1297 | # No link text, e.g. [http://domain.tld/some.link] |
1298 | 1298 | if ( $text == '' ) { |
— | — | @@ -1631,7 +1631,7 @@ |
1632 | 1632 | $link = $m[1]; |
1633 | 1633 | } |
1634 | 1634 | |
1635 | | - $noforce = (substr($m[1], 0, 1) != ':'); |
| 1635 | + $noforce = (substr($m[1], 0, 1) !== ':'); |
1636 | 1636 | if (!$noforce) { |
1637 | 1637 | # Strip off leading ':' |
1638 | 1638 | $link = substr($link, 1); |
— | — | @@ -1892,7 +1892,7 @@ |
1893 | 1893 | # bug 7425 |
1894 | 1894 | $target = trim( $target ); |
1895 | 1895 | # Look at the first character |
1896 | | - if( $target != '' && $target{0} == '/' ) { |
| 1896 | + if( $target != '' && $target{0} === '/' ) { |
1897 | 1897 | # / at end means we don't want the slash to be shown |
1898 | 1898 | $m = array(); |
1899 | 1899 | $trailingSlashes = preg_match_all( '%(/+)$%', $target, $m ); |
— | — | @@ -1919,7 +1919,7 @@ |
1920 | 1920 | if( count( $exploded ) > $dotdotcount ) { # not allowed to go below top level page |
1921 | 1921 | $ret = implode( '/', array_slice( $exploded, 0, -$dotdotcount ) ); |
1922 | 1922 | # / at the end means don't show full path |
1923 | | - if( substr( $nodotdot, -1, 1 ) == '/' ) { |
| 1923 | + if( substr( $nodotdot, -1, 1 ) === '/' ) { |
1924 | 1924 | $nodotdot = substr( $nodotdot, 0, -1 ); |
1925 | 1925 | if( '' === $text ) { |
1926 | 1926 | $text = $nodotdot . $suffix; |
— | — | @@ -1971,10 +1971,10 @@ |
1972 | 1972 | /* private */ function openList( $char ) { |
1973 | 1973 | $result = $this->closeParagraph(); |
1974 | 1974 | |
1975 | | - if ( '*' == $char ) { $result .= '<ul><li>'; } |
1976 | | - else if ( '#' == $char ) { $result .= '<ol><li>'; } |
1977 | | - else if ( ':' == $char ) { $result .= '<dl><dd>'; } |
1978 | | - else if ( ';' == $char ) { |
| 1975 | + if ( '*' === $char ) { $result .= '<ul><li>'; } |
| 1976 | + else if ( '#' === $char ) { $result .= '<ol><li>'; } |
| 1977 | + else if ( ':' === $char ) { $result .= '<dl><dd>'; } |
| 1978 | + else if ( ';' === $char ) { |
1979 | 1979 | $result .= '<dl><dt>'; |
1980 | 1980 | $this->mDTopen = true; |
1981 | 1981 | } |
— | — | @@ -1984,11 +1984,11 @@ |
1985 | 1985 | } |
1986 | 1986 | |
1987 | 1987 | /* private */ function nextItem( $char ) { |
1988 | | - if ( '*' == $char || '#' == $char ) { return '</li><li>'; } |
1989 | | - else if ( ':' == $char || ';' == $char ) { |
| 1988 | + if ( '*' === $char || '#' === $char ) { return '</li><li>'; } |
| 1989 | + else if ( ':' === $char || ';' === $char ) { |
1990 | 1990 | $close = '</dd>'; |
1991 | 1991 | if ( $this->mDTopen ) { $close = '</dt>'; } |
1992 | | - if ( ';' == $char ) { |
| 1992 | + if ( ';' === $char ) { |
1993 | 1993 | $this->mDTopen = true; |
1994 | 1994 | return $close . '<dt>'; |
1995 | 1995 | } else { |
— | — | @@ -2000,9 +2000,9 @@ |
2001 | 2001 | } |
2002 | 2002 | |
2003 | 2003 | /* private */ function closeList( $char ) { |
2004 | | - if ( '*' == $char ) { $text = '</li></ul>'; } |
2005 | | - else if ( '#' == $char ) { $text = '</li></ol>'; } |
2006 | | - else if ( ':' == $char ) { |
| 2004 | + if ( '*' === $char ) { $text = '</li></ul>'; } |
| 2005 | + else if ( '#' === $char ) { $text = '</li></ol>'; } |
| 2006 | + else if ( ':' === $char ) { |
2007 | 2007 | if ( $this->mDTopen ) { |
2008 | 2008 | $this->mDTopen = false; |
2009 | 2009 | $text = '</dt></dl>'; |
— | — | @@ -2068,7 +2068,7 @@ |
2069 | 2069 | $output .= $this->nextItem( substr( $prefix, -1 ) ); |
2070 | 2070 | $paragraphStack = false; |
2071 | 2071 | |
2072 | | - if ( substr( $prefix, -1 ) == ';') { |
| 2072 | + if ( substr( $prefix, -1 ) === ';') { |
2073 | 2073 | # The one nasty exception: definition lists work like this: |
2074 | 2074 | # ; title : definition text |
2075 | 2075 | # So we check for : in the remainder text to split up the |
— | — | @@ -2095,7 +2095,7 @@ |
2096 | 2096 | $char = substr( $prefix, $commonPrefixLength, 1 ); |
2097 | 2097 | $output .= $this->openList( $char ); |
2098 | 2098 | |
2099 | | - if ( ';' == $char ) { |
| 2099 | + if ( ';' === $char ) { |
2100 | 2100 | # FIXME: This is dupe of code above |
2101 | 2101 | if ($this->findColonNoLinks($t, $term, $t2) !== false) { |
2102 | 2102 | $t = $t2; |
— | — | @@ -2127,9 +2127,9 @@ |
2128 | 2128 | $inBlockElem = true; |
2129 | 2129 | } |
2130 | 2130 | } else if ( !$inBlockElem && !$this->mInPre ) { |
2131 | | - if ( ' ' == $t{0} and ( $this->mLastSection == 'pre' or trim($t) != '' ) ) { |
| 2131 | + if ( ' ' == $t{0} and ( $this->mLastSection === 'pre' or trim($t) != '' ) ) { |
2132 | 2132 | // pre |
2133 | | - if ($this->mLastSection != 'pre') { |
| 2133 | + if ($this->mLastSection !== 'pre') { |
2134 | 2134 | $paragraphStack = false; |
2135 | 2135 | $output .= $this->closeParagraph().'<pre>'; |
2136 | 2136 | $this->mLastSection = 'pre'; |
— | — | @@ -2143,7 +2143,7 @@ |
2144 | 2144 | $paragraphStack = false; |
2145 | 2145 | $this->mLastSection = 'p'; |
2146 | 2146 | } else { |
2147 | | - if ($this->mLastSection != 'p' ) { |
| 2147 | + if ($this->mLastSection !== 'p' ) { |
2148 | 2148 | $output .= $this->closeParagraph(); |
2149 | 2149 | $this->mLastSection = ''; |
2150 | 2150 | $paragraphStack = '<p>'; |
— | — | @@ -2156,7 +2156,7 @@ |
2157 | 2157 | $output .= $paragraphStack; |
2158 | 2158 | $paragraphStack = false; |
2159 | 2159 | $this->mLastSection = 'p'; |
2160 | | - } else if ($this->mLastSection != 'p') { |
| 2160 | + } else if ($this->mLastSection !== 'p') { |
2161 | 2161 | $output .= $this->closeParagraph().'<p>'; |
2162 | 2162 | $this->mLastSection = 'p'; |
2163 | 2163 | } |
— | — | @@ -2299,7 +2299,7 @@ |
2300 | 2300 | break; |
2301 | 2301 | case 3: // self::COLON_STATE_CLOSETAG: |
2302 | 2302 | // In a </tag> |
2303 | | - if( $c == ">" ) { |
| 2303 | + if( $c === ">" ) { |
2304 | 2304 | $stack--; |
2305 | 2305 | if( $stack < 0 ) { |
2306 | 2306 | wfDebug( __METHOD__.": Invalid input; too many close tags\n" ); |
— | — | @@ -2310,7 +2310,7 @@ |
2311 | 2311 | } |
2312 | 2312 | break; |
2313 | 2313 | case self::COLON_STATE_TAGSLASH: |
2314 | | - if( $c == ">" ) { |
| 2314 | + if( $c === ">" ) { |
2315 | 2315 | // Yes, a self-closed tag <blah/> |
2316 | 2316 | $state = self::COLON_STATE_TEXT; |
2317 | 2317 | } else { |
— | — | @@ -2319,19 +2319,19 @@ |
2320 | 2320 | } |
2321 | 2321 | break; |
2322 | 2322 | case 5: // self::COLON_STATE_COMMENT: |
2323 | | - if( $c == "-" ) { |
| 2323 | + if( $c === "-" ) { |
2324 | 2324 | $state = self::COLON_STATE_COMMENTDASH; |
2325 | 2325 | } |
2326 | 2326 | break; |
2327 | 2327 | case self::COLON_STATE_COMMENTDASH: |
2328 | | - if( $c == "-" ) { |
| 2328 | + if( $c === "-" ) { |
2329 | 2329 | $state = self::COLON_STATE_COMMENTDASHDASH; |
2330 | 2330 | } else { |
2331 | 2331 | $state = self::COLON_STATE_COMMENT; |
2332 | 2332 | } |
2333 | 2333 | break; |
2334 | 2334 | case self::COLON_STATE_COMMENTDASHDASH: |
2335 | | - if( $c == ">" ) { |
| 2335 | + if( $c === ">" ) { |
2336 | 2336 | $state = self::COLON_STATE_TEXT; |
2337 | 2337 | } else { |
2338 | 2338 | $state = self::COLON_STATE_COMMENT; |
— | — | @@ -3291,7 +3291,7 @@ |
3292 | 3292 | } |
3293 | 3293 | } |
3294 | 3294 | |
3295 | | - if ( $name == 'html' || $name == 'nowiki' ) { |
| 3295 | + if ( $name === 'html' || $name === 'nowiki' ) { |
3296 | 3296 | $this->mStripState->nowiki->setPair( $marker, $output ); |
3297 | 3297 | } else { |
3298 | 3298 | $this->mStripState->general->setPair( $marker, $output ); |
— | — | @@ -3623,7 +3623,7 @@ |
3624 | 3624 | $i = 0; |
3625 | 3625 | |
3626 | 3626 | foreach( $blocks as $block ) { |
3627 | | - if( $showEditLink && $headlineCount > 0 && $i == 0 && $block != "\n" ) { |
| 3627 | + if( $showEditLink && $headlineCount > 0 && $i == 0 && $block !== "\n" ) { |
3628 | 3628 | # This is the [edit] link that appears for the top block of text when |
3629 | 3629 | # section editing is enabled |
3630 | 3630 | |
— | — | @@ -4003,7 +4003,7 @@ |
4004 | 4004 | $syn = '#' . $syn; |
4005 | 4005 | } |
4006 | 4006 | # Remove trailing colon |
4007 | | - if ( substr( $syn, -1, 1 ) == ':' ) { |
| 4007 | + if ( substr( $syn, -1, 1 ) === ':' ) { |
4008 | 4008 | $syn = substr( $syn, 0, -1 ); |
4009 | 4009 | } |
4010 | 4010 | $this->mFunctionSynonyms[$sensitive][$syn] = $id; |
— | — | @@ -4224,7 +4224,7 @@ |
4225 | 4225 | list( $type, $paramName ) = $paramMap[$magicName]; |
4226 | 4226 | |
4227 | 4227 | // Special case; width and height come in one variable together |
4228 | | - if( $type == 'handler' && $paramName == 'width' ) { |
| 4228 | + if( $type === 'handler' && $paramName === 'width' ) { |
4229 | 4229 | $m = array(); |
4230 | 4230 | # (bug 13500) In both cases (width/height and width only), |
4231 | 4231 | # permit trailing "px" for backward compatibility. |
— | — | @@ -4247,7 +4247,7 @@ |
4248 | 4248 | } |
4249 | 4249 | } // else no validation -- bug 13436 |
4250 | 4250 | } else { |
4251 | | - if ( $type == 'handler' ) { |
| 4251 | + if ( $type === 'handler' ) { |
4252 | 4252 | # Validate handler parameter |
4253 | 4253 | $validated = $handler->validateParam( $paramName, $value ); |
4254 | 4254 | } else { |
— | — | @@ -4392,7 +4392,7 @@ |
4393 | 4393 | $sectionParts = explode( '-', $section ); |
4394 | 4394 | $sectionIndex = array_pop( $sectionParts ); |
4395 | 4395 | foreach ( $sectionParts as $part ) { |
4396 | | - if ( $part == 'T' ) { |
| 4396 | + if ( $part === 'T' ) { |
4397 | 4397 | $flags |= self::PTD_FOR_INCLUSION; |
4398 | 4398 | } |
4399 | 4399 | } |
— | — | @@ -4409,14 +4409,14 @@ |
4410 | 4410 | $targetLevel = 1000; |
4411 | 4411 | } else { |
4412 | 4412 | while ( $node ) { |
4413 | | - if ( $node->getName() == 'h' ) { |
| 4413 | + if ( $node->getName() === 'h' ) { |
4414 | 4414 | $bits = $node->splitHeading(); |
4415 | 4415 | if ( $bits['i'] == $sectionIndex ) { |
4416 | 4416 | $targetLevel = $bits['level']; |
4417 | 4417 | break; |
4418 | 4418 | } |
4419 | 4419 | } |
4420 | | - if ( $mode == 'replace' ) { |
| 4420 | + if ( $mode === 'replace' ) { |
4421 | 4421 | $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG ); |
4422 | 4422 | } |
4423 | 4423 | $node = $node->getNextSibling(); |
— | — | @@ -4425,7 +4425,7 @@ |
4426 | 4426 | |
4427 | 4427 | if ( !$node ) { |
4428 | 4428 | // Not found |
4429 | | - if ( $mode == 'get' ) { |
| 4429 | + if ( $mode === 'get' ) { |
4430 | 4430 | return $newText; |
4431 | 4431 | } else { |
4432 | 4432 | return $text; |
— | — | @@ -4434,21 +4434,21 @@ |
4435 | 4435 | |
4436 | 4436 | // Find the end of the section, including nested sections |
4437 | 4437 | do { |
4438 | | - if ( $node->getName() == 'h' ) { |
| 4438 | + if ( $node->getName() === 'h' ) { |
4439 | 4439 | $bits = $node->splitHeading(); |
4440 | 4440 | $curLevel = $bits['level']; |
4441 | 4441 | if ( $bits['i'] != $sectionIndex && $curLevel <= $targetLevel ) { |
4442 | 4442 | break; |
4443 | 4443 | } |
4444 | 4444 | } |
4445 | | - if ( $mode == 'get' ) { |
| 4445 | + if ( $mode === 'get' ) { |
4446 | 4446 | $outText .= $frame->expand( $node, PPFrame::RECOVER_ORIG ); |
4447 | 4447 | } |
4448 | 4448 | $node = $node->getNextSibling(); |
4449 | 4449 | } while ( $node ); |
4450 | 4450 | |
4451 | 4451 | // Write out the remainder (in replace mode only) |
4452 | | - if ( $mode == 'replace' ) { |
| 4452 | + if ( $mode === 'replace' ) { |
4453 | 4453 | // Output the replacement text |
4454 | 4454 | // Add two newlines on -- trailing whitespace in $newText is conventionally |
4455 | 4455 | // stripped by the editor, so we need both newlines to restore the paragraph gap |
— | — | @@ -4713,7 +4713,7 @@ |
4714 | 4714 | var $output = ''; |
4715 | 4715 | |
4716 | 4716 | function replace( $matches ) { |
4717 | | - if ( substr( $matches[1], -1 ) == "\n" ) { |
| 4717 | + if ( substr( $matches[1], -1 ) === "\n" ) { |
4718 | 4718 | $this->output .= substr( $matches[1], 0, -1 ); |
4719 | 4719 | } else { |
4720 | 4720 | $this->output .= $matches[1]; |