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
0
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
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
8b4a9c63
Commit
8b4a9c63
authored
7 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
PHPCS fixes
parent
b173fea1
Branches
add/scaffolding
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bulk-edit-cron-offload.php
+3
-3
3 additions, 3 deletions
bulk-edit-cron-offload.php
includes/class-main.php
+35
-9
35 additions, 9 deletions
includes/class-main.php
includes/class-singleton.php
+18
-0
18 additions, 0 deletions
includes/class-singleton.php
with
56 additions
and
12 deletions
bulk-edit-cron-offload.php
+
3
−
3
View file @
8b4a9c63
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
// Plugin dependencies
// Plugin dependencies
.
require
__DIR__
.
'/includes/
abstract-
class-singleton.php'
;
require
__DIR__
.
'/includes/class-singleton.php'
;
// Plugin functionality
// Plugin functionality
.
require
__DIR__
.
'/includes/class-main.php'
;
require
__DIR__
.
'/includes/class-main.php'
;
This diff is collapsed.
Click to expand it.
includes/class-main.php
+
35
−
9
View file @
8b4a9c63
<?php
<?php
/**
* Plugin's main class, dispatcher for specific bulk-edit requests
*
* @package Bulk_Edit_Cron_Offload
*/
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
/**
* Class Main
*/
class
Main
extends
Singleton
{
class
Main
extends
Singleton
{
/**
/**
* Requested action
* Requested action
*
* @var string
*/
*/
private
$action
=
null
;
private
$action
=
null
;
/**
/**
* Posts to process
* Posts to process
*
* @var array
*/
*/
private
$posts
=
null
;
private
$posts
=
null
;
/**
/**
* Taxonomy terms to add
* Taxonomy terms to add
*
* @var array
*/
*/
private
$tax_input
=
null
;
private
$tax_input
=
null
;
/**
/**
* Post author to set
* Post author to set
*
* @var int
*/
*/
private
$post_author
=
null
;
private
$post_author
=
null
;
/**
/**
* Comment status to set
* Comment status to set
*
* @var string
*/
*/
private
$comment_status
=
null
;
private
$comment_status
=
null
;
/**
/**
* Ping status to set
* Ping status to set
*
* @var string
*/
*/
private
$ping_status
=
null
;
private
$ping_status
=
null
;
/**
/**
* New post status
* New post status
*
* @var string
*/
*/
private
$post_status
=
null
;
private
$post_status
=
null
;
/**
/**
* Posts' stick status
* Posts' sticky status
*
* @var int
*/
*/
private
$post_sticky
=
null
;
private
$post_sticky
=
null
;
/**
/**
* Posts' format
* Posts' format
*
* @var string
*/
*/
private
$post_format
=
null
;
private
$post_format
=
null
;
...
@@ -59,12 +85,12 @@ class Main extends Singleton {
...
@@ -59,12 +85,12 @@ class Main extends Singleton {
* Call appropriate handler
* Call appropriate handler
*/
*/
public
function
intercept
()
{
public
function
intercept
()
{
// Nothing to do
// Nothing to do
.
if
(
!
isset
(
$_REQUEST
[
'action'
]
)
)
{
if
(
!
isset
(
$_REQUEST
[
'action'
]
)
)
{
return
;
return
;
}
}
// Parse request to determine what to do
// Parse request to determine what to do
.
$this
->
populate_vars
();
$this
->
populate_vars
();
// Now what?
// Now what?
...
@@ -72,20 +98,20 @@ class Main extends Singleton {
...
@@ -72,20 +98,20 @@ class Main extends Singleton {
case
'delete_all'
:
case
'delete_all'
:
break
;
break
;
case
'trash'
:
case
'trash'
:
break
;
break
;
case
'untrash'
:
case
'untrash'
:
break
;
break
;
case
'delete'
:
case
'delete'
:
break
;
break
;
case
'edit'
:
case
'edit'
:
break
;
break
;
// How did you get here?
// How did you get here?
default
:
default
:
return
;
return
;
break
;
break
;
}
}
...
@@ -129,7 +155,7 @@ class Main extends Singleton {
...
@@ -129,7 +155,7 @@ class Main extends Singleton {
$this
->
post_format
=
$_REQUEST
[
'post_format'
];
$this
->
post_format
=
$_REQUEST
[
'post_format'
];
}
}
// Stop Core from processing bulk request
// Stop Core from processing bulk request
.
unset
(
$_REQUEST
[
'action'
]
);
unset
(
$_REQUEST
[
'action'
]
);
unset
(
$_REQUEST
[
'action2'
]
);
unset
(
$_REQUEST
[
'action2'
]
);
}
}
...
...
This diff is collapsed.
Click to expand it.
includes/
abstract-
class-singleton.php
→
includes/class-singleton.php
+
18
−
0
View file @
8b4a9c63
<?php
<?php
/**
* Abstract singleton for plugin's main classes
*
* @package Bulk_Edit_Cron_Offload
*/
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
/**
* Class Singleton
*/
abstract
class
Singleton
{
abstract
class
Singleton
{
/**
/**
* Class instance
* Class instance
*
* @var array
*/
*/
private
static
$__instances
=
array
();
private
static
$__instances
=
array
();
/**
* Instantiate the class
*
* @return self
*/
public
static
function
instance
()
{
public
static
function
instance
()
{
$caller
=
get_called_class
();
$caller
=
get_called_class
();
...
@@ -20,6 +35,9 @@ abstract class Singleton {
...
@@ -20,6 +35,9 @@ abstract class Singleton {
return
self
::
$__instances
[
$caller
];
return
self
::
$__instances
[
$caller
];
}
}
/**
* Singleton constructor
*/
protected
function
__construct
()
{}
protected
function
__construct
()
{}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Erick Hitter
@ethitter
mentioned in commit
0338fc34
·
7 years ago
mentioned in commit
0338fc34
mentioned in commit 0338fc348f0c05c3478491ea5fec324b65e8cf10
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