Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Connected
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathieu Loiseau
Connected
Commits
f21e1b21
Commit
f21e1b21
authored
3 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
Start to reorganize
parent
c666fb76
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extension.json
+19
-0
19 additions, 0 deletions
extension.json
src/Connected.php
+51
-0
51 additions, 0 deletions
src/Connected.php
with
70 additions
and
0 deletions
extension.json
0 → 100644
+
19
−
0
View file @
f21e1b21
{
"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
}
This diff is collapsed.
Click to expand it.
Connected.php
→
src/
Connected.php
+
51
−
0
View file @
f21e1b21
...
@@ -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'
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment