Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/241717
Change subject: Add support for PHP CodeSniffer checks
..
Add support for PHP CodeSniffer checks
Also fix any remaining errors and warnings.
Change-Id: I8f94e2e3f1a136a01f0da45085197bc026925a93
---
M AccessControl.php
M changelog.txt
2 files changed, 119 insertions(+), 109 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AccessControl
refs/changes/17/241717/1
diff --git a/AccessControl.php b/AccessControl.php
index be1c676..7895a6e 100644
--- a/AccessControl.php
+++ b/AccessControl.php
@@ -11,8 +11,8 @@
* @licence GNU General Public Licence
*/
-if( !defined( 'MEDIAWIKI' ) ) {
- echo ( "This file is an extension to the MediaWiki software and cannot
be used standalone.\n" );
+if ( !defined( 'MEDIAWIKI' ) ) {
+ echo "This file is an extension to the MediaWiki software and cannot be
used standalone.\n";
die();
}
@@ -21,73 +21,74 @@
$wgAccessControlRedirect = true;
$wgExtensionCredits['parserhook'][] = array(
- 'path' => __FILE__,
- 'name' => 'AccessControl',
- 'author'=> array(
'[https://www.mediawiki.org/wiki/m:User:Want Aleš Kapica]' ),
- 'url' =>
'http://www.mediawiki.org/wiki/Extension:AccessControl',
- 'version' => '2.5',
- 'descriptionmsg'=> 'accesscontrol-desc'
+ 'path' => __FILE__,
+ 'name' => 'AccessControl',
+ 'author' => array( '[https://www.mediawiki.org/wiki/m:User:Want Aleš
Kapica]' ),
+ 'url' => 'http://www.mediawiki.org/wiki/Extension:AccessControl',
+ 'version' => '2.5',
+ 'descriptionmsg' => 'accesscontrol-desc'
);
-$wgHooks['ParserFirstCallInit'][] = 'wfAccessControlExtension' ;
+$wgHooks['ParserFirstCallInit'][] = 'wfAccessControlExtension';
-$dir = dirname( __FILE__ ) . '/';
$wgMessagesDirs['AccessControl'] = __DIR__ . '/i18n';
+// Hook the userCan function for bypassing the cache
+$wgHooks['userCan'][] = 'wfHookUserCan';
-//Hook the userCan function for bypassing the cache
-$wgHooks['userCan'][] = 'hookUserCan';
+// Hook the UnknownAction function for information user about restrictions
+$wgHooks['UnknownAction'][] = 'wfOnUnknownAction';
-//Hook the UnknownAction function for information user about restrictions
-$wgHooks['UnknownAction'][] = 'onUnknownAction' ;
-
-function onUnknownAction ( $action, Page $article ) {
+function wfOnUnknownAction( $action, Page $article ) {
global $wgOut;
switch ( $action ) {
default:
$wgOut->setPageTitle( $article->getTitle() . "->" .
$action );
- $wgOut->addWikiText( wfMessage(
'accesscontrol-actions-deny' )->text());
+ $wgOut->addWikiText( wfMessage(
'accesscontrol-actions-deny' )->text() );
}
+
return false;
}
function wfAccessControlExtension( Parser $parser ) {
/* This the hook function adds the tag to the wiki
parser */
- $parser->setHook( "accesscontrol", "doControlUserAccess" );
+ $parser->setHook( "accesscontrol", "wfDoControlUserAccess" );
+
return true;
}
-function doControlUserAccess( $input, array $args, Parser $parser, PPFrame
$frame ) {
+function wfDoControlUserAccess( $input, array $args, Parser $parser, PPFrame
$frame ) {
/* Funcion called by wfAccessControlExtension */
- return displayGroups();
+ return wfDisplayGroups();
}
-function accessControl( $tagContent ){
- $accessgroup = Array( Array(), Array() );
+function wfAccessControl( $tagContent ) {
+ $accessgroup = array( array(), array() );
$listaccesslist = explode( ",", $tagContent );
foreach ( $listaccesslist as $accesslist ) {
if ( strpos( $accesslist, "(ro)" ) !== false ) {
$accesslist = trim( str_replace( "(ro)", "",
$accesslist ) );
- $group = makeGroupArray( $accesslist );
+ $group = wfMakeGrouparray( $accesslist );
$accessgroup[1] = array_merge( $accessgroup[1],
$group[0] );
$accessgroup[1] = array_merge( $accessgroup[1],
$group[1] );
} else {
$accesslist = trim( $accesslist );
- $group = makeGroupArray ( $accesslist );
+ $group = wfMakeGrouparray( $accesslist );
$accessgroup[0] = array_merge( $accessgroup[0],
$group[0] );
$accessgroup[1] = array_merge( $accessgroup[1],
$group[1] );
}
}
+
return $accessgroup;
}
-function makeGroupArray( $accesslist ) {
+function wfMakeGrouparray( $accesslist ) {
/* Function returns array with two lists.
First is list