Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Bulk Actions Cron Offload
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Bulk Actions Cron Offload
Commits
a62feed5
Commit
a62feed5
authored
7 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Bail if nothing is chosen
parent
5682cb33
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/class-main.php
+21
-0
21 additions, 0 deletions
includes/class-main.php
languages/bulk-actions-cron-offload.pot
+5
-1
5 additions, 1 deletion
languages/bulk-actions-cron-offload.pot
with
26 additions
and
1 deletion
includes/class-main.php
+
21
−
0
View file @
a62feed5
...
@@ -16,6 +16,11 @@ class Main {
...
@@ -16,6 +16,11 @@ class Main {
*/
*/
const
ACTION
=
'bulk_actions_cron_offload_'
;
const
ACTION
=
'bulk_actions_cron_offload_'
;
/**
* Generic admin notices
*/
const
ADMIN_NOTICE_KEY
=
'bulk_actions_cron_offload_general'
;
/**
/**
* Common cron action
* Common cron action
*/
*/
...
@@ -28,6 +33,8 @@ class Main {
...
@@ -28,6 +33,8 @@ class Main {
add_action
(
self
::
CRON_EVENT
,
array
(
__CLASS__
,
'do_cron'
)
);
add_action
(
self
::
CRON_EVENT
,
array
(
__CLASS__
,
'do_cron'
)
);
add_action
(
'load-edit.php'
,
array
(
__CLASS__
,
'intercept'
)
);
add_action
(
'load-edit.php'
,
array
(
__CLASS__
,
'intercept'
)
);
add_action
(
'admin_notices'
,
array
(
__CLASS__
,
'admin_notices'
)
);
}
}
/**
/**
...
@@ -59,6 +66,11 @@ class Main {
...
@@ -59,6 +66,11 @@ class Main {
return
;
return
;
}
}
// Nothing to do.
if
(
empty
(
$vars
->
posts
)
)
{
self
::
do_admin_redirect
(
self
::
ADMIN_NOTICE_KEY
,
false
);
}
// Pass request to a class to handle offloading to cron, UX, etc.
// Pass request to a class to handle offloading to cron, UX, etc.
do_action
(
$action
,
$vars
);
do_action
(
$action
,
$vars
);
...
@@ -207,6 +219,15 @@ class Main {
...
@@ -207,6 +219,15 @@ class Main {
return
in_array
(
$action
,
$allowed_actions
,
true
);
return
in_array
(
$action
,
$allowed_actions
,
true
);
}
}
/**
* Let the user know what's going on
*/
public
static
function
admin_notices
()
{
if
(
isset
(
$_REQUEST
[
self
::
ADMIN_NOTICE_KEY
]
)
&&
'-1'
===
$_REQUEST
[
self
::
ADMIN_NOTICE_KEY
]
)
{
self
::
render_admin_notice
(
'error'
,
__
(
'The requested bulk action was not processed because no posts were selected.'
,
'bulk-actions-cron-offload'
)
);
}
}
/**
/**
* Build a WP hook specific to a bulk request
* Build a WP hook specific to a bulk request
*
*
...
...
This diff is collapsed.
Click to expand it.
languages/bulk-actions-cron-offload.pot
+
5
−
1
View file @
a62feed5
...
@@ -5,7 +5,7 @@ msgstr ""
...
@@ -5,7 +5,7 @@ msgstr ""
"Project-Id-Version: Bulk Actions Cron Offload 1.0\n"
"Project-Id-Version: Bulk Actions Cron Offload 1.0\n"
"Report-Msgid-Bugs-To: "
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/bulk-actions-cron-offload\n"
"https://wordpress.org/support/plugin/bulk-actions-cron-offload\n"
"POT-Creation-Date: 2017-09-1
4 22:18:30
+00:00\n"
"POT-Creation-Date: 2017-09-1
5 00:51:21
+00:00\n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
...
@@ -65,6 +65,10 @@ msgid ""
...
@@ -65,6 +65,10 @@ msgid ""
"These items are hidden until they are processed."
"These items are hidden until they are processed."
msgstr ""
msgstr ""
#: includes/class-main.php:227
msgid "The requested bulk action was not processed because no posts were selected."
msgstr ""
#: includes/class-move-to-trash.php:111
#: includes/class-move-to-trash.php:111
msgid "Success! The selected posts will be moved to the trash shortly."
msgid "Success! The selected posts will be moved to the trash shortly."
msgstr ""
msgstr ""
...
...
This diff is collapsed.
Click to expand it.
Erick Hitter
@ethitter
mentioned in commit
228c30ff
·
7 years ago
mentioned in commit
228c30ff
mentioned in commit 228c30ffec2e75a906459be5ef2b7b98ecf888d0
Toggle commit list
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