Skip to content
Snippets Groups Projects
Commit f21e1b21 authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

Start to reorganize

parent c666fb76
No related branches found
No related tags found
No related merge requests found
{
"name": "Connected",
"author": "Mathieu Loiseau",
"version": "0.0",
"url": "https://gitlab.liris.cnrs.fr/mloiseau/mw_connected",
"descriptionmsg": "A small mediawiki extension to have a variable to know if the user is logged in or not.",
"license-name": "GPL-2.0-or-later",
"type": "parserhook",
"AutoloadClasses": {
"ExampleExtensionHooks": "src/Connected.php"
},
"ExtensionMessagesFiles": {
"ExampleExtensionMagic": "Connected.i18n.magic.php"
},
"Hooks": {
"ParserGetVariableValueSwitch": "ConnectedHooks::onParserFirstCallInit"
},
"manifest_version": 1
}
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
* @link https://gitlab.liris.cnrs.fr/mloiseau/mw_connected * @link https://gitlab.liris.cnrs.fr/mloiseau/mw_connected
* *
**/ **/
$wgExtensionMessagesFiles['Connected'] = __DIR__ . '/Connected.i18n.magic.php'; $wgExtensionMessagesFiles['Connected'] = __DIR__ . '/Connected.i18n.magic.php';
$wgHooks['ParserGetVariableValueSwitch'][] = 'wfConnectedAssignValue'; $wgHooks['ParserGetVariableValueSwitch'][] = 'wfConnectedAssignValue';
function wfConnectedAssignValue( &$parser, &$cache, &$magicWordId, &$ret ) { function wfConnectedAssignValue( &$parser, &$cache, &$magicWordId, &$ret ) {
global $wgUser; global $wgUser;
$result = false; $result = false;
if($wgUser->isSafeToLoad()){ if($wgUser->isSafeToLoad()){
...@@ -42,18 +42,10 @@ ...@@ -42,18 +42,10 @@
return $result; return $result;
} }
$wgExtensionCredits['variable'][] = [ $wgHooks['MagicWordwgVariableIDs'][] = 'connectedMyDeclareVarIds';
'name' => 'Connected', function connectedMyDeclareVarIds( &$customVariableIds ) {
'author' => 'Mathieu Loiseau', // $customVariableIds is where MediaWiki wants to store its list of custom
'version' => '0', // variable IDs. We oblige by adding ours:
'description' => 'A small mediawiki extension to have a variable to know if the user is logged in or not.',
'url' => 'https://gitlab.liris.cnrs.fr/mloiseau/mw_connected',
];
$wgHooks['MagicWordwgVariableIDs'][] = 'connectedMyDeclareVarIds';
function connectedMyDeclareVarIds( &$customVariableIds ) {
// $customVariableIds is where MediaWiki wants to store its list of custom
// variable IDs. We oblige by adding ours:
$customVariableIds[] = 'connected'; $customVariableIds[] = 'connected';
$customVariableIds[] = 'u_name'; $customVariableIds[] = 'u_name';
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment