Index: trunk/extensions/AssertEdit/ApiAssertEdit.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | } |
7 | 7 | |
8 | 8 | class ApiAssertEdit extends ApiBase { |
9 | | - |
| 9 | + |
10 | 10 | public function __construct( $main, $action ) { |
11 | 11 | parent::__construct( $main, $action ); |
12 | 12 | } |
— | — | @@ -13,15 +13,15 @@ |
14 | 14 | public function execute() { |
15 | 15 | $this->dieUsage( '', 'assertedit' ); |
16 | 16 | } |
17 | | - |
| 17 | + |
18 | 18 | public function getDescription() { |
19 | 19 | return 'Allows bots to make assertions. Can only be used during of editing'; |
20 | 20 | } |
21 | | - |
| 21 | + |
22 | 22 | public function isReadMode() { |
23 | 23 | return false; |
24 | 24 | } |
25 | | - |
| 25 | + |
26 | 26 | public function shouldCheckMaxlag() { |
27 | 27 | return false; |
28 | 28 | } |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | 'test' => 'Verify that this wiki allows random testing. Defaults to false, but can be overridden in LocalSettings.php.' |
38 | 38 | ); |
39 | 39 | } |
40 | | - |
| 40 | + |
41 | 41 | public function getPossibleErrors() { |
42 | 42 | return array(); |
43 | 43 | } |
Index: trunk/extensions/AssertEdit/AssertEdit_body.php |
— | — | @@ -24,20 +24,20 @@ |
25 | 25 | * List of assertions; can be modified with setAssert |
26 | 26 | */ |
27 | 27 | static private $msAssert = array( |
28 | | - //simple constants, i.e. to test if the extension is installed. |
| 28 | + // simple constants, i.e. to test if the extension is installed. |
29 | 29 | 'true' => true, |
30 | 30 | 'false' => false, |
31 | | - //useful variable tests, to ensure we stay logged in |
| 31 | + // useful variable tests, to ensure we stay logged in |
32 | 32 | 'user' => array( 'AssertEdit', 'assert_user' ), |
33 | 33 | 'bot' => array( 'AssertEdit', 'assert_bot' ), |
34 | 34 | 'exists' => array( 'AssertEdit', 'assert_exists' ), |
35 | | - //override these in LocalSettings.php |
36 | | - //'wikimedia' => false, //is this an offical wikimedia site? |
37 | | - 'test' => false //Do we allow random tests? |
| 35 | + // override these in LocalSettings.php |
| 36 | + // 'wikimedia' => false, //is this an offical wikimedia site? |
| 37 | + 'test' => false // Do we allow random tests? |
38 | 38 | ); |
39 | 39 | |
40 | 40 | static function setAssert( $key, $value ) { |
41 | | - //Don't confuse things by changing core assertions. |
| 41 | + // Don't confuse things by changing core assertions. |
42 | 42 | switch ( $key ) { |
43 | 43 | case 'true': |
44 | 44 | case 'false': |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | case 'exists': |
48 | 48 | return false; |
49 | 49 | } |
50 | | - //make sure it's useable. |
| 50 | + // make sure it's useable. |
51 | 51 | if ( is_bool( $value ) || is_callable( $value ) ) { |
52 | 52 | self::$msAssert[$key] = $value; |
53 | 53 | return true; |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | | - //call the specified assertion |
| 59 | + // call the specified assertion |
60 | 60 | static function callAssert( $assertName, $negate ) { |
61 | 61 | if ( isset( self::$msAssert[$assertName] ) ) { |
62 | 62 | if ( is_bool( self::$msAssert[$assertName] ) ) { |
— | — | @@ -68,10 +68,9 @@ |
69 | 69 | $pass = !$pass; |
70 | 70 | } |
71 | 71 | } else { |
72 | | - //unrecognized assert fails, regardless of negation. |
| 72 | + // unrecognized assert fails, regardless of negation. |
73 | 73 | $pass = false; |
74 | 74 | } |
75 | 75 | return $pass; |
76 | 76 | } |
77 | | - |
78 | 77 | } |
Index: trunk/extensions/AssertEdit/AssertEdit.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
5 | 4 | die(); |
6 | 5 | /**#@+ |
— | — | @@ -25,7 +24,7 @@ |
26 | 25 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Assert_Edit', |
27 | 26 | ); |
28 | 27 | |
29 | | -$dir = dirname(__FILE__) . '/'; |
| 28 | +$dir = dirname( __FILE__ ) . '/'; |
30 | 29 | $wgExtensionMessagesFiles['AssertEdit'] = $dir . 'AssertEdit.i18n.php'; |
31 | 30 | $wgAutoloadClasses['AssertEdit'] = $dir . 'AssertEdit_body.php'; |
32 | 31 | $wgHooks['AlternateEdit'][] = 'efAssertEditHook'; |
— | — | @@ -44,7 +43,7 @@ |
45 | 44 | $pass = AssertEdit::callAssert( $assertName, false ); |
46 | 45 | } |
47 | 46 | |
48 | | - //check for negative assert |
| 47 | + // check for negative assert |
49 | 48 | if ( $pass ) { |
50 | 49 | $assertName = $wgRequest->getVal( 'nassert' ); |
51 | 50 | if ( $assertName != '' ) { |
— | — | @@ -57,7 +56,7 @@ |
58 | 57 | } else { |
59 | 58 | wfLoadExtensionMessages( 'AssertEdit' ); |
60 | 59 | |
61 | | - //slightly modified from showErrorPage(), to return back here. |
| 60 | + // slightly modified from showErrorPage(), to return back here. |
62 | 61 | $wgOut->setPageTitle( wfMsg( 'assert_edit_title' ) ); |
63 | 62 | $wgOut->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); |
64 | 63 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
— | — | @@ -72,6 +71,7 @@ |
73 | 72 | return false; |
74 | 73 | } |
75 | 74 | } |
| 75 | + |
76 | 76 | function efAssertApiEditHook( $editPage, $textBox, &$result ) { |
77 | 77 | global $wgOut, $wgRequest; |
78 | 78 | |
— | — | @@ -80,11 +80,11 @@ |
81 | 81 | |
82 | 82 | if ( $assertName != '' ) { |
83 | 83 | $pass = AssertEdit::callAssert( $assertName, false ); |
84 | | - if ( !$pass ) |
| 84 | + if ( !$pass ) |
85 | 85 | $result['assert'] = $assertName; |
86 | 86 | } |
87 | 87 | |
88 | | - //check for negative assert |
| 88 | + // check for negative assert |
89 | 89 | if ( $pass ) { |
90 | 90 | $assertName = $wgRequest->getVal( 'nassert' ); |
91 | 91 | if ( $assertName != '' ) { |