r19525 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19524‎ | r19525 | r19526 >
Date:19:51, 20 January 2007
Author:robchurch
Status:old
Tags:
Comment:
Introduce 'CustomEditor' hook; see docs/hooks.txt for more information
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -317,6 +317,14 @@
318318 $isbn: ISBN to show information for
319319 $output: OutputPage object in use
320320
 321+'CustomEditor': When invoking the page editor
 322+$article: Article being edited
 323+$user: User performing the edit
 324+
 325+Return true to allow the normal editor to be used, or false
 326+if implementing a custom editor, e.g. for a special namespace,
 327+etc.
 328+
321329 'DiffViewHeader': called before diff display
322330 $diff: DifferenceEngine object that's calling
323331 $oldRev: Revision object of the "old" revision (may be null/invalid)
Index: trunk/phase3/includes/Wiki.php
@@ -405,18 +405,20 @@
406406 }
407407 /* Continue... */
408408 case 'edit':
409 - $internal = $request->getVal( 'internaledit' );
410 - $external = $request->getVal( 'externaledit' );
411 - $section = $request->getVal( 'section' );
412 - $oldid = $request->getVal( 'oldid' );
413 - if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
414 - $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
415 - $editor = new EditPage( $article );
416 - $editor->submit();
417 - } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
418 - $mode = $request->getVal( 'mode' );
419 - $extedit = new ExternalEdit( $article, $mode );
420 - $extedit->edit();
 409+ if( wfRunHooks( 'CustomEditor', array( $article, $user ) ) ) {
 410+ $internal = $request->getVal( 'internaledit' );
 411+ $external = $request->getVal( 'externaledit' );
 412+ $section = $request->getVal( 'section' );
 413+ $oldid = $request->getVal( 'oldid' );
 414+ if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
 415+ $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
 416+ $editor = new EditPage( $article );
 417+ $editor->submit();
 418+ } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
 419+ $mode = $request->getVal( 'mode' );
 420+ $extedit = new ExternalEdit( $article, $mode );
 421+ $extedit->edit();
 422+ }
421423 }
422424 break;
423425 case 'history':
Index: trunk/phase3/RELEASE-NOTES
@@ -129,6 +129,7 @@
130130 * ar: fix the 'create a new page' on search page when no exact match found
131131 * (bug 8703) Corrected Talk namespace name for Limburgish (li)
132132 * (bug 8712) Expose user groups as a JavaScript global
 133+* Introduce 'CustomEditor' hook; see docs/hooks.txt for more information
133134
134135 == Languages updated ==
135136