Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
bulk-actions-cron-offload
Commits
8b4a9c63
Commit
8b4a9c63
authored
Sep 12, 2017
by
Erick Hitter
Browse files
PHPCS fixes
parent
b173fea1
Changes
3
Hide whitespace changes
Inline
Side-by-side
bulk-edit-cron-offload.php
View file @
8b4a9c63
...
...
@@ -14,8 +14,8 @@
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
// Plugin dependencies
require
__DIR__
.
'/includes/
abstract-
class-singleton.php'
;
// Plugin dependencies
.
require
__DIR__
.
'/includes/class-singleton.php'
;
// Plugin functionality
// Plugin functionality
.
require
__DIR__
.
'/includes/class-main.php'
;
includes/class-main.php
View file @
8b4a9c63
<?php
/**
* Plugin's main class, dispatcher for specific bulk-edit requests
*
* @package Bulk_Edit_Cron_Offload
*/
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
/**
* Class Main
*/
class
Main
extends
Singleton
{
/**
* Requested action
*
* @var string
*/
private
$action
=
null
;
/**
* Posts to process
*
* @var array
*/
private
$posts
=
null
;
/**
* Taxonomy terms to add
*
* @var array
*/
private
$tax_input
=
null
;
/**
* Post author to set
*
* @var int
*/
private
$post_author
=
null
;
/**
* Comment status to set
*
* @var string
*/
private
$comment_status
=
null
;
/**
* Ping status to set
*
* @var string
*/
private
$ping_status
=
null
;
/**
* New post status
*
* @var string
*/
private
$post_status
=
null
;
/**
* Posts' stick status
* Posts' sticky status
*
* @var int
*/
private
$post_sticky
=
null
;
/**
* Posts' format
*
* @var string
*/
private
$post_format
=
null
;
...
...
@@ -59,12 +85,12 @@ class Main extends Singleton {
* Call appropriate handler
*/
public
function
intercept
()
{
// Nothing to do
// Nothing to do
.
if
(
!
isset
(
$_REQUEST
[
'action'
]
)
)
{
return
;
}
// Parse request to determine what to do
// Parse request to determine what to do
.
$this
->
populate_vars
();
// Now what?
...
...
@@ -72,20 +98,20 @@ class Main extends Singleton {
case
'delete_all'
:
break
;
case
'trash'
:
case
'trash'
:
break
;
case
'untrash'
:
case
'untrash'
:
break
;
case
'delete'
:
case
'delete'
:
break
;
case
'edit'
:
case
'edit'
:
break
;
// How did you get here?
default
:
default
:
return
;
break
;
}
...
...
@@ -129,7 +155,7 @@ class Main extends Singleton {
$this
->
post_format
=
$_REQUEST
[
'post_format'
];
}
// Stop Core from processing bulk request
// Stop Core from processing bulk request
.
unset
(
$_REQUEST
[
'action'
]
);
unset
(
$_REQUEST
[
'action2'
]
);
}
...
...
includes/
abstract-
class-singleton.php
→
includes/class-singleton.php
View file @
8b4a9c63
<?php
/**
* Abstract singleton for plugin's main classes
*
* @package Bulk_Edit_Cron_Offload
*/
namespace
Automattic\WP\Bulk_Edit_Cron_Offload
;
/**
* Class Singleton
*/
abstract
class
Singleton
{
/**
* Class instance
*
* @var array
*/
private
static
$__instances
=
array
();
/**
* Instantiate the class
*
* @return self
*/
public
static
function
instance
()
{
$caller
=
get_called_class
();
...
...
@@ -20,6 +35,9 @@ abstract class Singleton {
return
self
::
$__instances
[
$caller
];
}
/**
* Singleton constructor
*/
protected
function
__construct
()
{}
/**
...
...
Erick Hitter
@ethitter
mentioned in commit
0338fc34
·
Sep 13, 2017
mentioned in commit
0338fc34
mentioned in commit 0338fc348f0c05c3478491ea5fec324b65e8cf10
Toggle commit list
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