Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CSU
tweeki
Commits
92fa24ff
Commit
92fa24ff
authored
Oct 04, 2020
by
thaider
Browse files
remove deprecated disableCache() function, fixes #163
parent
dfef93a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
includes/Hooks.php
View file @
92fa24ff
...
...
@@ -127,6 +127,20 @@ class TweekiHooks {
return
true
;
}
/**
* Pages could be hidden for anonymous users or only be shown for specific groups
* so we put a user's group memberships into the page rendering hash
*
* @param $confstr
* @param $user
* @param $options
*/
static
function
onPageRenderingHash
(
&
$confstr
,
$user
,
&
$options
)
{
$groups
=
$user
->
getEffectiveGroups
();
sort
(
$groups
);
$confstr
.
=
"!groups="
.
join
(
','
,
$groups
);
}
/**
* Enable TOC
*/
...
...
@@ -156,7 +170,7 @@ class TweekiHooks {
*/
static
function
setHiddenElements
(
Parser
$parser
)
{
global
$wgTweekiSkinHideAll
,
$wgTweekiSkinHideable
;
$parser
->
disableCache
();
for
(
$i
=
1
;
$i
<
func_num_args
();
$i
++
)
{
if
(
in_array
(
func_get_arg
(
$i
),
$wgTweekiSkinHideable
)
)
{
$wgTweekiSkinHideAll
[]
=
func_get_arg
(
$i
);
...
...
@@ -166,14 +180,14 @@ class TweekiHooks {
}
/**
* Set elements that should be hidden except for specific groups
* Set elements that should be hidden except for
members of
specific groups
*
* @param $parser Parser current parser
* @return string
*/
static
function
setHiddenElementsGroups
(
Parser
$parser
)
{
global
$wgTweekiSkinHideAll
,
$wgTweekiSkinHideable
;
$parser
->
disableCache
();
$groups_except
=
explode
(
','
,
func_get_arg
(
1
)
);
$groups_user
=
$parser
->
getUser
()
->
getEffectiveGroups
();
if
(
count
(
array_intersect
(
$groups_except
,
$groups_user
)
)
==
0
)
{
...
...
@@ -193,8 +207,6 @@ class TweekiHooks {
* @return string
*/
static
function
addBodyclass
(
Parser
$parser
)
{
$parser
->
disableCache
();
// Argument 0 is $parser, so begin iterating at 1
for
(
$i
=
1
;
$i
<
func_num_args
();
$i
++
)
{
$GLOBALS
[
'wgTweekiSkinAdditionalBodyClasses'
][]
=
func_get_arg
(
$i
);
}
...
...
skin.json
View file @
92fa24ff
...
...
@@ -30,6 +30,7 @@
"TweekiTemplate"
:
"includes/TweekiTemplate.php"
},
"Hooks"
:
{
"PageRenderingHash"
:
"TweekiHooks::onPageRenderingHash"
,
"GetPreferences"
:
"TweekiHooks::onGetPreferences"
,
"ParserFirstCallInit"
:
"TweekiHooks::onParserFirstCallInit"
,
"SkinEditSectionLinks"
:
"TweekiHooks::onSkinEditSectionLinks"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment