r82891 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82890‎ | r82891 | r82892 >
Date:14:50, 27 February 2011
Author:janpaul123
Status:resolved (Comments)
Tags:
Comment:
Added hook to support partial rendering for the InlineEditor extension. Doesn't affect normal behaviour.
Modified paths:
  • /trunk/extensions/Cite/Cite_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Cite/Cite_body.php
@@ -1013,6 +1013,14 @@
10141014 }
10151015 return true;
10161016 }
 1017+
 1018+ /**
 1019+ * Hook for the InlineEditor extension. If any reference is in the text, the entire
 1020+ * page should be reparsed, so we return false in that case.
 1021+ */
 1022+ function checkAnyRefs( &$output ) {
 1023+ return ( empty( $this->mRefs ) );
 1024+ }
10171025
10181026 /**
10191027 * Initialize the parser hooks
@@ -1025,6 +1033,7 @@
10261034
10271035 $wgHooks['ParserClearState'][] = array( self::$instance, 'clearState' );
10281036 $wgHooks['ParserBeforeTidy'][] = array( self::$instance, 'checkRefsNoReferences' );
 1037+ $wgHooks['InlineEditorPartialAfterParse'][] = array( self::$instance, 'checkAnyRefs' );
10291038 }
10301039 $parser->setHook( 'ref' , array( self::$instance, 'ref' ) );
10311040 $parser->setHook( 'references' , array( self::$instance, 'references' ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r82892Moved reference detection to Cite extension (per r82891).janpaul12314:54, 27 February 2011
r83213Followup of r82891 and r82894. Fixes hook for InlineEditor, which forces a pa...janpaul12311:45, 4 March 2011

Comments

#Comment by JanPaul123 (talk | contribs)   14:52, 27 February 2011

This, by the way, is the first commit in an effort to fix bug 27163.

#Comment by Reedy (talk | contribs)   15:26, 27 February 2011

Haven't we got a thing about not using empty..? "Understand and read the documentation for isset() and empty(). Use them only when appropriate." Manual:Coding conventions

Also, are you actually calling your hook anywhere?

#Comment by JanPaul123 (talk | contribs)   15:32, 27 February 2011

Good point, fixed in r82894.

I'm calling this hook in InlineEditorText.class.php, and this actually works. ;-)

Status & tagging log