diff --git a/README.md b/README.md index 200b9ef..4276b94 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,21 @@ WP Batch Processing is WordPress plugin for creating batches of data and process ## Installation -You can install this library as a plugin +1. Install this library as a plugin. It doesn't require anything from below. -or via composer: +2. Or install it as a composer package (read the **notes** bellow) ``` composer require gdarko/wp-batch-processing ``` -**Note/Optional**: The plugin should be able to find its public path, however if you see messed up screen it means that it was unable to find the stylesheet/JS file and you will need to define them manually before including composer's autoload.php file. +```php +WP_Batch_Processor::boot(); +``` + +**Note**: The boot() method should be called only if you install the plugin via composer somewhere in your plugin or theme. + +**Note**: If you are using composer, the plugin should be able to find its public path, however if you see messed up screen it means that it was unable to find the stylesheet/JS file and you will need to define them manually before including composer's autoload.php file. ```php if ( ! defined('WP_BP_PATH')) { diff --git a/includes/class-batch-ajax-handler.php b/includes/class-batch-ajax-handler.php index 23a4893..93ef669 100644 --- a/includes/class-batch-ajax-handler.php +++ b/includes/class-batch-ajax-handler.php @@ -141,5 +141,3 @@ public function restart_batch() { } } -// Init -WP_Batch_Processing_Ajax_Handler::get_instance(); \ No newline at end of file diff --git a/includes/class-batch-processor-admin.php b/includes/class-batch-processor-admin.php index 41e9127..1929072 100644 --- a/includes/class-batch-processor-admin.php +++ b/includes/class-batch-processor-admin.php @@ -169,4 +169,3 @@ private function load_paths() { } } -WP_Batch_Processor_Admin::get_instance(); diff --git a/includes/class-batch-processor.php b/includes/class-batch-processor.php index dba22d7..2339d80 100644 --- a/includes/class-batch-processor.php +++ b/includes/class-batch-processor.php @@ -78,6 +78,13 @@ public function get_batch( $id ) { return null; } -} + /** + * Boot the plugin + */ + public static function boot() { + WP_Batch_Processor_Admin::get_instance(); + WP_Batch_Processing_Ajax_Handler::get_instance(); + WP_Batch_Processor::get_instance(); + } -WP_Batch_Processor::get_instance(); \ No newline at end of file +} diff --git a/wp-batch-processing.php b/wp-batch-processing.php index 5b3fd01..fb4390a 100644 --- a/wp-batch-processing.php +++ b/wp-batch-processing.php @@ -3,27 +3,27 @@ Plugin Name: WP Batch Processing Plugin URI: https://github.com/gdarko/wp-batch-processing Description: Batch Processing for WordPress. Imagine you have to send custom emails to a lots of users based on some kind of logic. This plugin makes batch tasks easy. -Version: 1.1.0 +Version: 1.1.1 Author: Darko Gjorgjijoski Author URI: https://darkog.com License: GPL-2+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt */ -if ( ! defined('ABSPATH')) { - die; +if ( ! defined( 'ABSPATH' ) ) { + die; } -if ( ! is_admin()) { - return; +if ( ! is_admin() ) { + return; } -if ( ! defined('WP_BP_PATH')) { - define('WP_BP_PATH', plugin_dir_path(__FILE__)); +if ( ! defined( 'WP_BP_PATH' ) ) { + define( 'WP_BP_PATH', plugin_dir_path( __FILE__ ) ); } -if ( ! defined('WP_BP_URL')) { - define('WP_BP_URL', plugin_dir_url(__FILE__)); +if ( ! defined( 'WP_BP_URL' ) ) { + define( 'WP_BP_URL', plugin_dir_url( __FILE__ ) ); } require_once 'includes/class-bp-helper.php'; @@ -35,5 +35,7 @@ require_once 'includes/class-batch-list-table.php'; require_once 'includes/class-batch-processor-admin.php'; +WP_Batch_Processor::boot(); + // Examples // require_once 'examples/class-example-batch.php';