Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WP-Cron Control
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
WP-Cron Control
Commits
ef2abcc8
Commit
ef2abcc8
authored
10 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
v0.7.1 synched from WP.org plugins SVN
See
https://plugins.trac.wordpress.org/changeset/921303
parent
9b940efc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
readme.txt
+9
-4
9 additions, 4 deletions
readme.txt
wp-cron-control.php
+33
-11
33 additions, 11 deletions
wp-cron-control.php
with
42 additions
and
15 deletions
readme.txt
+
9
−
4
View file @
ef2abcc8
=== WP-Cron Control ===
=== WP-Cron Control ===
Contributors: tott, ethitter, automattic
Contributors: tott, ethitter, automattic
, batmoo
Tags: wp-cron, cron, cron jobs, post missed schedule, scheduled posts
Tags: wp-cron, cron, cron jobs, post missed schedule, scheduled posts
Donate link: http://hitchhackerguide.com
Requires at least: 3.4
Tested up to:
3.6
Tested up to:
4.1
Stable tag: 0.7
Stable tag: 0.7
.1
This plugin allows you to take control over the execution of cron jobs.
This plugin allows you to take control over the execution of cron jobs.
...
@@ -30,6 +30,11 @@ This plugin performs a `remove_action( 'sanitize_comment_cookies', 'wp_cron' );`
...
@@ -30,6 +30,11 @@ This plugin performs a `remove_action( 'sanitize_comment_cookies', 'wp_cron' );`
== ChangeLog ==
== ChangeLog ==
= Version 0.7.1 =
* Security hardening (better escaping, sanitization of saved values)
* Update plugin to use core's updated cron hook
= Version 0.7 =
= Version 0.7 =
* Remove unneeded use of `$wpdb->prepare()` that triggered PHP warnings because a second argument wasn't provided.
* Remove unneeded use of `$wpdb->prepare()` that triggered PHP warnings because a second argument wasn't provided.
...
...
This diff is collapsed.
Click to expand it.
wp-cron-control.php
+
33
−
11
View file @
ef2abcc8
...
@@ -4,8 +4,7 @@
...
@@ -4,8 +4,7 @@
Plugin URI: http://wordpress.org/extend/plugins/wp-cron-control/
Plugin URI: http://wordpress.org/extend/plugins/wp-cron-control/
Description: Take control of wp-cron execution.
Description: Take control of wp-cron execution.
Author: Thorsten Ott, Erick Hitter, Automattic
Author: Thorsten Ott, Erick Hitter, Automattic
Version: 0.7
Version: 0.7.1
Author URI: http://hitchhackerguide.com
Text Domain: wp-cron-control
Text Domain: wp-cron-control
*/
*/
...
@@ -127,7 +126,7 @@ class WP_Cron_Control {
...
@@ -127,7 +126,7 @@ class WP_Cron_Control {
* and http://core.trac.wordpress.org/browser/trunk/wp-includes/cron.php#L258
* and http://core.trac.wordpress.org/browser/trunk/wp-includes/cron.php#L258
*/
*/
if
(
1
==
$this
->
settings
[
'enable'
]
)
{
if
(
1
==
$this
->
settings
[
'enable'
]
)
{
remove_action
(
'
sanitize_comment_cookies
'
,
'wp_cron'
);
remove_action
(
'
init
'
,
'wp_cron'
);
add_action
(
'init'
,
array
(
&
$this
,
'validate_cron_request'
)
);
add_action
(
'init'
,
array
(
&
$this
,
'validate_cron_request'
)
);
}
}
...
@@ -142,15 +141,38 @@ class WP_Cron_Control {
...
@@ -142,15 +141,38 @@ class WP_Cron_Control {
}
}
public
function
validate_settings
(
$settings
)
{
public
function
validate_settings
(
$settings
)
{
// reset to defaults
$validated_settings
=
array
();
if
(
!
empty
(
$_POST
[
$this
->
dashed_name
.
'-defaults'
]
)
)
{
if
(
!
empty
(
$_POST
[
$this
->
dashed_name
.
'-defaults'
]
)
)
{
$settings
=
$this
->
default_settings
;
// Reset to defaults
$validated_settings
=
$this
->
default_settings
;
$_REQUEST
[
'_wp_http_referer'
]
=
add_query_arg
(
'defaults'
,
'true'
,
$_REQUEST
[
'_wp_http_referer'
]
);
$_REQUEST
[
'_wp_http_referer'
]
=
add_query_arg
(
'defaults'
,
'true'
,
$_REQUEST
[
'_wp_http_referer'
]
);
// or do some custom validations
}
else
{
}
else
{
foreach
(
$this
->
settings_texts
as
$setting
=>
$setting_info
)
{
switch
(
$setting
)
{
case
'enable'
:
case
'enable_scheduled_post_validation'
:
$validated_settings
[
$setting
]
=
intval
(
$settings
[
$setting
]
);
if
(
$validated_settings
[
$setting
]
>
1
||
$validated_settings
[
$setting
]
<
0
)
{
$validated_settings
[
$setting
]
=
$this
->
default_settings
[
$setting
];
}
break
;
case
'secret_string'
:
$validated_settings
[
$setting
]
=
sanitize_text_field
(
$settings
[
$setting
]
);
if
(
empty
(
$validated_settings
[
$setting
]
)
)
{
$validated_settings
[
$setting
]
=
$this
->
default_settings
[
$setting
];
}
break
;
default
:
$validated_settings
[
$setting
]
=
sanitize_text_field
(
$settings
[
$setting
]
);
break
;
}
}
}
}
return
$settings
;
return
$validated_settings
;
}
}
public
function
settings_page
()
{
public
function
settings_page
()
{
...
@@ -191,13 +213,13 @@ class WP_Cron_Control {
...
@@ -191,13 +213,13 @@ class WP_Cron_Control {
<div><input
type=
"text"
name=
"
<?php
echo
$this
->
plugin_prefix
;
?>
settings[
<?php
echo
$setting
;
?>
]"
id=
"
<?php
echo
$this
->
dashed_name
.
'-'
.
$setting
;
?>
"
class=
"postform"
value=
"
<?php
echo
esc_attr
(
$value
);
?>
"
/></div>
<div><input
type=
"text"
name=
"
<?php
echo
$this
->
plugin_prefix
;
?>
settings[
<?php
echo
$setting
;
?>
]"
id=
"
<?php
echo
$this
->
dashed_name
.
'-'
.
$setting
;
?>
"
class=
"postform"
value=
"
<?php
echo
esc_attr
(
$value
);
?>
"
/></div>
<?php
break
;
<?php
break
;
case
'echo'
:
?>
case
'echo'
:
?>
<div><span
id=
"
<?php
echo
$this
->
dashed_name
.
'-'
.
$setting
;
?>
"
class=
"postform"
>
<?php
echo
esc_
attr
(
$value
);
?>
</span></div>
<div><span
id=
"
<?php
echo
$this
->
dashed_name
.
'-'
.
$setting
;
?>
"
class=
"postform"
>
<?php
echo
esc_
html
(
$value
);
?>
</span></div>
<?php
break
;
<?php
break
;
default
:
?>
default
:
?>
<?php
echo
$this
->
settings_texts
[
$setting
][
'type'
];
?>
<?php
echo
esc_html
(
$this
->
settings_texts
[
$setting
][
'type'
]
)
;
?>
<?php
break
;
<?php
break
;
endswitch
;
?>
endswitch
;
?>
<?php
if
(
!
empty
(
$this
->
settings_texts
[
$setting
][
'desc'
]
)
)
{
echo
$this
->
settings_texts
[
$setting
][
'desc'
];
}
?>
<?php
if
(
!
empty
(
$this
->
settings_texts
[
$setting
][
'desc'
]
)
)
{
echo
wp_kses_post
(
$this
->
settings_texts
[
$setting
][
'desc'
]
)
;
}
?>
</td>
</td>
</tr>
</tr>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
...
...
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