Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Guaraci WordPress Plugin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
Guaraci WordPress Plugin
Commits
7f3e6409
Commit
7f3e6409
authored
Feb 14, 2020
by
Rafael Chaves Freitas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
define a random GET parameter when users are logged in
parent
fa2f0242
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
20 deletions
+4
-20
library/admin.php
library/admin.php
+4
-20
No files found.
library/admin.php
View file @
7f3e6409
...
...
@@ -14,19 +14,12 @@ add_action( 'admin_init', function(){
<input
name=
"admin_qs__use"
id=
"admin_qs__use"
type=
"checkbox"
value=
"1"
class=
"code"
<?=
checked
(
1
,
get_option
(
'admin_qs__use'
),
false
)
?>
/>
<?php
_e
(
'Adicionar parâmetro GET nas urls para os editores.'
,
'guaraci'
)
?>
</label>
</p>
<p>
<label>
<?php
_e
(
'Nome do parâmetro get'
)
?>
<br>
<input
name=
"admin_qs__param"
id=
"admin_qs__param"
type=
"text"
value=
"
<?=
get_option
(
'admin_qs__param'
,
'admin'
)
?>
"
class=
"code"
/>
</label>
</p>
<?php
},
'general'
,
);
register_setting
(
'general'
,
'admin_qs__use'
);
register_setting
(
'general'
,
'admin_qs__param'
);
});
...
...
@@ -36,7 +29,7 @@ add_action('wp', function (){
$post_types
=
get_post_types
([
'public'
=>
true
]);
unset
(
$post_types
[
'attachment'
]);
$param
=
get_option
(
'admin_qs__param'
,
'admin'
);
$param
=
base_convert
(
time
()
-
strtotime
(
date
(
'Y-m-d'
)),
10
,
36
);
add_filter
(
'post_link'
,
function
(
$link
,
$post
)
use
(
$post_types
,
$param
)
{
$link
=
urldecode
(
$link
);
...
...
@@ -52,12 +45,9 @@ add_action('wp', function (){
return
$link
;
}
if
(
strpos
(
$link
,
"?
{
$param
}
"
)
>
0
||
strpos
(
$link
,
"&
{
$param
}
"
)
>
0
){
if
(
strpos
(
$link
,
"?
{
$param
}
"
)
>
0
){
return
$link
;
}
else
if
(
strpos
(
$link
,
'?'
)
>
0
){
return
$link
.
"&
{
$param
}
"
;
}
else
{
return
$link
.
"?
{
$param
}
"
;
}
...
...
@@ -66,12 +56,9 @@ add_action('wp', function (){
add_filter
(
'term_link'
,
function
(
$link
)
use
(
$param
)
{
$link
=
urldecode
(
$link
);
if
(
strpos
(
$link
,
"?
{
$param
}
"
)
>
0
||
strpos
(
$link
,
"&
{
$param
}
"
)
>
0
)
{
if
(
strpos
(
$link
,
"?
{
$param
}
"
)
>
0
)
{
return
$link
;
}
else
if
(
strpos
(
$link
,
'?'
)
>
0
){
return
$link
.
"&
{
$param
}
"
;
}
else
{
return
$link
.
"?
{
$param
}
"
;
}
...
...
@@ -79,12 +66,9 @@ add_action('wp', function (){
add_filter
(
'home_url'
,
function
(
$link
)
use
(
$param
)
{
$link
=
urldecode
(
$link
);
if
(
strpos
(
$link
,
"?
{
$param
}
"
)
>
0
||
strpos
(
$link
,
"&
{
$param
}
"
)
>
0
){
if
(
strpos
(
$link
,
"?"
)
>
0
){
return
$link
;
}
else
if
(
strpos
(
$link
,
'?'
)
>
0
){
return
$link
.
"&
{
$param
}
"
;
}
else
{
return
$link
.
"?
{
$param
}
"
;
}
...
...
Write
Preview
Markdown
is supported
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