Index: trunk/extensions/Cite/Cite_body.php |
— | — | @@ -71,6 +71,12 @@ |
72 | 72 | * @var int |
73 | 73 | */ |
74 | 74 | var $mInCnt = 0; |
| 75 | + |
| 76 | + /** |
| 77 | + * Counter to track the total number of (useful) calls to either the |
| 78 | + * ref or references tag hook |
| 79 | + */ |
| 80 | + var $mCallCnt = 0; |
75 | 81 | |
76 | 82 | /** |
77 | 83 | * The backlinks, in order, to pass as $3 to |
— | — | @@ -151,6 +157,7 @@ |
152 | 158 | if ( $this->mInCite ) { |
153 | 159 | return htmlspecialchars( "<ref>$str</ref>" ); |
154 | 160 | } else { |
| 161 | + $this->mCallCnt++; |
155 | 162 | $this->mInCite = true; |
156 | 163 | $ret = $this->guardedRef( $str, $argv, $parser ); |
157 | 164 | $this->mInCite = false; |
— | — | @@ -507,6 +514,7 @@ |
508 | 515 | return htmlspecialchars( "<references>$str</references>" ); |
509 | 516 | } |
510 | 517 | } else { |
| 518 | + $this->mCallCnt++; |
511 | 519 | $this->mInReferences = true; |
512 | 520 | $ret = $this->guardedReferences( $str, $argv, $parser ); |
513 | 521 | $this->mInReferences = false; |
— | — | @@ -984,6 +992,7 @@ |
985 | 993 | $this->mGroupCnt = array(); |
986 | 994 | $this->mOutCnt = - 1; |
987 | 995 | $this->mInCnt = 0; |
| 996 | + $this->mCallCnt = 0; |
988 | 997 | $this->mRefs = array(); |
989 | 998 | $this->mReferencesErrors = array(); |
990 | 999 | $this->mRefCallStack = array(); |
— | — | @@ -1015,11 +1024,11 @@ |
1016 | 1025 | } |
1017 | 1026 | |
1018 | 1027 | /** |
1019 | | - * Hook for the InlineEditor extension. If any reference is in the text, the entire |
| 1028 | + * Hook for the InlineEditor extension. If any ref or reference reference tag is in the text, the entire |
1020 | 1029 | * page should be reparsed, so we return false in that case. |
1021 | 1030 | */ |
1022 | | - function checkAnyRefs( &$output ) { |
1023 | | - return ( count( $this->mRefs ) <= 0 ); |
| 1031 | + function checkAnyCalls( &$output ) { |
| 1032 | + return ( $this->mCallCnt <= 0 ); |
1024 | 1033 | } |
1025 | 1034 | |
1026 | 1035 | /** |
— | — | @@ -1033,7 +1042,7 @@ |
1034 | 1043 | |
1035 | 1044 | $wgHooks['ParserClearState'][] = array( self::$instance, 'clearState' ); |
1036 | 1045 | $wgHooks['ParserBeforeTidy'][] = array( self::$instance, 'checkRefsNoReferences' ); |
1037 | | - $wgHooks['InlineEditorPartialAfterParse'][] = array( self::$instance, 'checkAnyRefs' ); |
| 1046 | + $wgHooks['InlineEditorPartialAfterParse'][] = array( self::$instance, 'checkAnyCalls' ); |
1038 | 1047 | } |
1039 | 1048 | $parser->setHook( 'ref' , array( self::$instance, 'ref' ) ); |
1040 | 1049 | $parser->setHook( 'references' , array( self::$instance, 'references' ) ); |