diff --git a/bulk-edit-cron-offload.php b/bulk-edit-cron-offload.php index 05afa82e896de99cf2271c6eadd21f94decff7fe..4c3e2552dece2650a094463bba329732e88604b4 100644 --- a/bulk-edit-cron-offload.php +++ b/bulk-edit-cron-offload.php @@ -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'; diff --git a/includes/class-main.php b/includes/class-main.php index c9fdb000ed232581deb1ecee2a569fbd0cfe3319..4cd019a946f4051378b48de83c63e7f750423177 100644 --- a/includes/class-main.php +++ b/includes/class-main.php @@ -1,50 +1,76 @@ <?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'] ); } diff --git a/includes/abstract-class-singleton.php b/includes/class-singleton.php similarity index 70% rename from includes/abstract-class-singleton.php rename to includes/class-singleton.php index 5c8042f8b4a3fb97a80c17e81d3a75a2a104482b..53ed87ab65755e26b70fd53644f6e2d3387d6b01 100644 --- a/includes/abstract-class-singleton.php +++ b/includes/class-singleton.php @@ -1,13 +1,28 @@ <?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() {} /**