From bcae9c85dec3c148636687dde5d2f3b2e9cf8cfd Mon Sep 17 00:00:00 2001 From: Alejandro Mostajo Date: Tue, 27 Oct 2015 18:21:13 -0600 Subject: [PATCH] Add-on support and readme update New core package support, this comes with add-ons and global functions. Readme updated. --- README.md | 27 +++++++++++++++++++++++++-- boot/autoload.php | 6 +++--- config/plugin.php | 10 ++++++---- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 92c271f..2a02839 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ The power of **Composer** and **MVC** in your **Wordpress** plugins. - [Hooks and Filters](#hooks-and-filters) - [MVC](#mvc) - [Config](#config) + - [Add-ons](#add-ons) +- [Change Log](#change-log) - [Coding Guidelines](#coding-guidelines) - [License](#license) @@ -270,7 +272,7 @@ You can add your own config variables into `config\plugin.php` and access them w ```php // In config\plugin.php - + 'myapi' => array( 'key' => 'jdsldjsfl12938nfk', ), @@ -292,10 +294,31 @@ class Main extends Plugin } ``` +### Add-ons + +WPP now supports **Addons** or external **Packages** developed using WP code. + +Add your add-ons at the config file, like: + +```php + // In config\plugin.php + + 'addons' => [ + 'SpecialAddonNamespace\AddonClass', + 'PackageAddon\AddonClass', + ], +``` + +For more information about add-on development, click [here](https://github.com/amostajo/wordpress-plugin-core). + +## Change Log + +For version upgrades and change log, click [here](https://github.com/amostajo/wordpress-plugin/releases). + ## Coding Guidelines The coding is a mix between PSR-2 and Wordpress PHP guidelines. ## License -**Wordpress Plugin** is free software distributed under the terms of the MIT license. \ No newline at end of file +**Wordpress Plugin** is free software distributed under the terms of the MIT license. diff --git a/boot/autoload.php b/boot/autoload.php index 13f75e2..6b1f4cc 100644 --- a/boot/autoload.php +++ b/boot/autoload.php @@ -17,12 +17,12 @@ $$plugin_name = new $plugin_class( new Amostajo\WPPluginCore\Config( $config ) ); //--- INIT -$$plugin_name->init(); +$$plugin_name->autoload_init(); //--- ON ADMIN if ( is_admin() ) { - $$plugin_name->on_admin(); + $$plugin_name->autoload_on_admin(); } @@ -30,4 +30,4 @@ unset($config); unset($plugin_namespace); unset($plugin_name); -unset($plugin_class); \ No newline at end of file +unset($plugin_class); diff --git a/config/plugin.php b/config/plugin.php index de9a888..a0c1987 100644 --- a/config/plugin.php +++ b/config/plugin.php @@ -5,15 +5,17 @@ * -------------------------- */ -return array( +return [ 'namespace' => 'Plugin', - 'paths' => array( + 'paths' => [ 'controllers' => __DIR__ . '/../controllers/', 'views' => __DIR__ . '/../views/', - ), + ], -); \ No newline at end of file + 'addons' => [], + +];