| @@ -1,69 +1,67 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Pimple container | |
| 4 | - * | |
| 5 | - * @package Allex\Core | |
| 6 | - */ | |
| 7 | - | |
| 8 | -namespace UpStream; | |
| 9 | - | |
| 10 | -use Allex\Core; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * Pimple container | |
| 14 | - */ | |
| 15 | -class Container extends \Pimple\Container { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * Instance of the Pimple container | |
| 19 | - * | |
| 20 | - * @var $instance Class instance. | |
| 21 | - */ | |
| 22 | - protected static $instance; | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * Get class instance. | |
| 26 | - */ | |
| 27 | - public static function get_instance() { | |
| 28 | - if ( empty( static::$instance ) ) { | |
| 29 | - $instance = new self(); | |
| 30 | - | |
| 31 | - // Define the services. | |
| 32 | - $instance['PLUGIN_BASENAME'] = function ( $c ) { | |
| 33 | - return plugin_basename( 'upstream/upstream.php' ); | |
| 34 | - }; | |
| 35 | - | |
| 36 | - $instance['EDD_API_URL'] = function ( $c ) { | |
| 37 | - return 'https://upstreamplugin.com'; | |
| 38 | - }; | |
| 39 | - | |
| 40 | - $instance['PLUGIN_AUTHOR'] = function ( $c ) { | |
| 41 | - return 'UpStream'; | |
| 42 | - }; | |
| 43 | - | |
| 44 | - $instance['UPDATES_DOC_URL'] = function ( $c ) { | |
| 45 | - // @todo: Update this link adding an specific page for this subject. | |
| 46 | - return 'http://upstreamplugin.com/docs/'; | |
| 47 | - }; | |
| 48 | - | |
| 49 | - $instance['framework'] = function ( $c ) { | |
| 50 | - return new Core( | |
| 51 | - $c['PLUGIN_BASENAME'], | |
| 52 | - $c['EDD_API_URL'], | |
| 53 | - $c['PLUGIN_AUTHOR'], | |
| 54 | - $c['UPDATES_DOC_URL'] | |
| 55 | - ); | |
| 56 | - }; | |
| 57 | - | |
| 58 | - if ( is_admin() ) { | |
| 59 | - $instance['reviews'] = function ( $c ) { | |
| 60 | - return new \UpStream_Admin_Reviews(); | |
| 61 | - }; | |
| 62 | - } | |
| 63 | - | |
| 64 | - static::$instance = $instance; | |
| 65 | - } | |
| 66 | - | |
| 67 | - return static::$instance; | |
| 68 | - } | |
| 69 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Pimple container | |
| 4 | + * | |
| 5 | + * @package Allex\Core | |
| 6 | + */ | |
| 7 | + | |
| 8 | +use Allex\Core; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Pimple container | |
| 12 | + */ | |
| 13 | +class Container extends \Pimple\Container { | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * Instance of the Pimple container | |
| 17 | + * | |
| 18 | + * @var $instance Class instance. | |
| 19 | + */ | |
| 20 | + protected static $instance; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Get class instance. | |
| 24 | + */ | |
| 25 | + public static function get_instance() { | |
| 26 | + if ( empty( static::$instance ) ) { | |
| 27 | + $instance = new self(); | |
| 28 | + | |
| 29 | + // Define the services. | |
| 30 | + $instance['PLUGIN_BASENAME'] = function ( $c ) { | |
| 31 | + return plugin_basename( 'upstream/upstream.php' ); | |
| 32 | + }; | |
| 33 | + | |
| 34 | + $instance['EDD_API_URL'] = function ( $c ) { | |
| 35 | + return 'https://upstreamplugin.com'; | |
| 36 | + }; | |
| 37 | + | |
| 38 | + $instance['PLUGIN_AUTHOR'] = function ( $c ) { | |
| 39 | + return 'UpStream'; | |
| 40 | + }; | |
| 41 | + | |
| 42 | + $instance['UPDATES_DOC_URL'] = function ( $c ) { | |
| 43 | + // @todo: Update this link adding an specific page for this subject. | |
| 44 | + return 'http://upstreamplugin.com/docs/'; | |
| 45 | + }; | |
| 46 | + | |
| 47 | + $instance['framework'] = function ( $c ) { | |
| 48 | + return new Core( | |
| 49 | + $c['PLUGIN_BASENAME'], | |
| 50 | + $c['EDD_API_URL'], | |
| 51 | + $c['PLUGIN_AUTHOR'], | |
| 52 | + $c['UPDATES_DOC_URL'] | |
| 53 | + ); | |
| 54 | + }; | |
| 55 | + | |
| 56 | + if ( is_admin() ) { | |
| 57 | + $instance['reviews'] = function ( $c ) { | |
| 58 | + return new UpStream_Admin_Reviews(); | |
| 59 | + }; | |
| 60 | + } | |
| 61 | + | |
| 62 | + static::$instance = $instance; | |
| 63 | + } | |
| 64 | + | |
| 65 | + return static::$instance; | |
| 66 | + } | |
| 67 | +} | |