Toniher has uploaded a new change for review. https://gerrit.wikimedia.org/r/161185
Change subject: composer-compatible extension ...................................................................... composer-compatible extension making extension compatible with composer Change-Id: I26c6cc85d2a4113b722ac8775fa0642a0420df7a adding composer.json Change-Id: Idb0cab56d1161a2676cc92c4db5523752fc3fd7e --- M UserFunctions.php A composer.json 2 files changed, 60 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UserFunctions refs/changes/85/161185/1 diff --git a/UserFunctions.php b/UserFunctions.php index 5d0366f..dbf4563 100644 --- a/UserFunctions.php +++ b/UserFunctions.php @@ -1,7 +1,7 @@ <?php /** * UserFunctions extension - Provides a set of dynamic parser functions that trigger on the current user. - * @version 2.4.3 - 2014/03/16 (Based on ParserFunctions) + * @version 2.6.0 - 2014/09/18 (Based on ParserFunctions) * * @link http://www.mediawiki.org/wiki/Extension:UserFunctions Documentation * @@ -23,38 +23,42 @@ die( 'This file is a MediaWiki extension, it is not a valid entry point' ); } -/** - * Enable Personal Data Functions - * Set this to true if you want your users to be able to use the following functions: - * realname, username, useremail, nickname, ip - * WARNING: These functions can be used to leak your user's email addresses and real names. - * If unsure, don't activate these features. -**/ -$wgUFEnablePersonalDataFunctions = false; +//self executing anonymous function to prevent global scope assumptions +call_user_func( function() { -/** Allow to be used in places such as SF form **/ -$wgUFEnableSpecialContexts = true; + /** + * Enable Personal Data Functions + * Set this to true if you want your users to be able to use the following functions: + * realname, username, useremail, nickname, ip + * WARNING: These functions can be used to leak your user's email addresses and real names. + * If unsure, don't activate these features. + **/ + $GLOBALS['wgUFEnablePersonalDataFunctions'] = false; -/** Restrict to certain namespaces **/ -$wgUFAllowedNamespaces = array( - NS_MEDIAWIKI => true -); + /** Allow to be used in places such as SF form **/ + $GLOBALS['wgUFEnableSpecialContexts'] = true; -$wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'UserFunctions', - 'version' => '2.5.0', - 'url' => 'https://www.mediawiki.org/wiki/Extension:UserFunctions', - 'author' => array( 'Algorithm ', 'Toniher', 'Kghbln', 'Wikinaut', 'Reedy', '...' ), - 'descriptionmsg' => 'userfunctions-desc', -); + /** Restrict to certain namespaces **/ + $GLOBALS['wgUFAllowedNamespaces'] = array( + NS_MEDIAWIKI => true + ); -$wgAutoloadClasses['ExtUserFunctions'] = dirname(__FILE__).'/UserFunctions_body.php'; -$wgMessagesDirs['UserFunctions'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['UserFunctions'] = dirname( __FILE__ ) . '/UserFunctions.i18n.php'; -$wgExtensionMessagesFiles['UserFunctionsMagic'] = dirname( __FILE__ ) . '/UserFunctions.i18n.magic.php'; + $GLOBALS['wgExtensionCredits']['parserhook'][] = array( + 'path' => __FILE__, + 'name' => 'UserFunctions', + 'version' => '2.6.0', + 'url' => 'https://www.mediawiki.org/wiki/Extension:UserFunctions', + 'author' => array( 'Algorithm ', 'Toniher', 'Kghbln', 'Wikinaut', 'Reedy', '...' ), + 'descriptionmsg' => 'userfunctions-desc', + ); -$wgHooks['ParserFirstCallInit'][] = 'wfRegisterUserFunctions'; + $GLOBALS['wgAutoloadClasses']['ExtUserFunctions'] = dirname(__FILE__).'/UserFunctions_body.php'; + $GLOBALS['wgMessagesDirs']['UserFunctions'] = __DIR__ . '/i18n'; + $GLOBALS['wgExtensionMessagesFiles']['UserFunctions'] = dirname( __FILE__ ) . '/UserFunctions.i18n.php'; + $GLOBALS['wgExtensionMessagesFiles']['UserFunctionsMagic'] = dirname( __FILE__ ) . '/UserFunctions.i18n.magic.php'; + + $GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'wfRegisterUserFunctions'; +}); /** * @param $parser Parser @@ -77,23 +81,22 @@ $process = false; // As far it's not special case, check if current page NS is in the allowed list - if (!$special) { - if (isset($wgUFAllowedNamespaces[$cur_ns])) { - if ($wgUFAllowedNamespaces[$cur_ns]) { + if ( !$special ) { + if ( isset( $wgUFAllowedNamespaces[$cur_ns] ) ) { + if ( $wgUFAllowedNamespaces[$cur_ns] ) { $process = true; } } } else { - if ($wgUFEnableSpecialContexts) { - - if ($special) { - $process = true; - } + if ( $wgUFEnableSpecialContexts ) { + if ( $special ) { + $process = true; + } } } - if ($process) { + if ( $process ) { // These functions accept DOM-style arguments $parser->setFunctionHook( 'ifanon', 'ExtUserFunctions::ifanonObj', SFH_OBJECT_ARGS ); diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..316b91f --- /dev/null +++ b/composer.json @@ -0,0 +1,20 @@ +{ + "name": "mediawiki/user-functions", + "type": "mediawiki-extension", + "description": "Enhance parser with user functions", + "keywords": [ + "MediaWiki", + "User" + ], + "homepage": "https://www.mediawiki.org/wiki/Extension:UserFunctions", + "license": "GPL-2.0+", + "require": { + "php": ">=5.3.0", + "composer/installers": "1.*,>=1.0.1" + }, + "autoload": { + "files": ["UserFunctions.php"], + "classmap": ["UserFunctions_body.php"] + } +} + -- To view, visit https://gerrit.wikimedia.org/r/161185 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idb0cab56d1161a2676cc92c4db5523752fc3fd7e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UserFunctions Gerrit-Branch: master Gerrit-Owner: Toniher <toni...@cau.cat> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits