Skip to content
Snippets Groups Projects
Commit 8b4a9c63 authored by Erick Hitter's avatar Erick Hitter
Browse files

PHPCS fixes

parent b173fea1
No related branches found
No related tags found
No related merge requests found
...@@ -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';
<?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'] );
} }
......
<?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() {}
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment