Skip to content

Commit

Permalink
Improved composer support
Browse files Browse the repository at this point in the history
  • Loading branch information
gdarko committed Oct 23, 2021
1 parent e1c25e4 commit 927522c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
2 changes: 0 additions & 2 deletions includes/class-batch-ajax-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,3 @@ public function restart_batch() {
}
}

// Init
WP_Batch_Processing_Ajax_Handler::get_instance();
1 change: 0 additions & 1 deletion includes/class-batch-processor-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,3 @@ private function load_paths() {
}
}

WP_Batch_Processor_Admin::get_instance();
11 changes: 9 additions & 2 deletions includes/class-batch-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
20 changes: 11 additions & 9 deletions wp-batch-processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';

0 comments on commit 927522c

Please sign in to comment.