@@ -2,10 +2,10 @@ |
||
2 | 2 | namespace Intraxia\Jaxion\Contract\Core; |
3 | 3 | |
4 | 4 | interface I18n { |
5 | - /** |
|
6 | - * Loads the plugin's textdomain. |
|
7 | - * |
|
8 | - * @return void |
|
9 | - */ |
|
10 | - public function load_plugin_textdomain(); |
|
5 | + /** |
|
6 | + * Loads the plugin's textdomain. |
|
7 | + * |
|
8 | + * @return void |
|
9 | + */ |
|
10 | + public function load_plugin_textdomain(); |
|
11 | 11 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param $basename |
32 | 32 | * @param $path |
33 | 33 | */ |
34 | - public function __construct( $basename, $path ) { |
|
34 | + public function __construct($basename, $path) { |
|
35 | 35 | $this->basename = $basename; |
36 | 36 | $this->path = $path; |
37 | 37 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | load_plugin_textdomain( |
44 | 44 | $this->basename, |
45 | 45 | false, |
46 | - basename( $this->path ) . '/languages/' |
|
46 | + basename($this->path).'/languages/' |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 |
@@ -11,53 +11,53 @@ |
||
11 | 11 | * @subpackage Core |
12 | 12 | */ |
13 | 13 | class I18n implements I18nContract, HasActions { |
14 | - /** |
|
15 | - * Plugin basename |
|
16 | - * |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - private $basename; |
|
14 | + /** |
|
15 | + * Plugin basename |
|
16 | + * |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + private $basename; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Plugin path. |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - private $path; |
|
21 | + /** |
|
22 | + * Plugin path. |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + private $path; |
|
27 | 27 | |
28 | - /** |
|
29 | - * I18n constructor. |
|
30 | - * |
|
31 | - * @param string $basename Plugin basename. |
|
32 | - * @param string $path Plugin path. |
|
33 | - */ |
|
34 | - public function __construct( $basename, $path ) { |
|
35 | - $this->basename = $basename; |
|
36 | - $this->path = $path; |
|
37 | - } |
|
28 | + /** |
|
29 | + * I18n constructor. |
|
30 | + * |
|
31 | + * @param string $basename Plugin basename. |
|
32 | + * @param string $path Plugin path. |
|
33 | + */ |
|
34 | + public function __construct( $basename, $path ) { |
|
35 | + $this->basename = $basename; |
|
36 | + $this->path = $path; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritdoc} |
|
41 | - */ |
|
42 | - public function load_plugin_textdomain() { |
|
43 | - load_plugin_textdomain( |
|
44 | - $this->basename, |
|
45 | - false, |
|
46 | - basename( $this->path ) . '/languages/' |
|
47 | - ); |
|
48 | - } |
|
39 | + /** |
|
40 | + * {@inheritdoc} |
|
41 | + */ |
|
42 | + public function load_plugin_textdomain() { |
|
43 | + load_plugin_textdomain( |
|
44 | + $this->basename, |
|
45 | + false, |
|
46 | + basename( $this->path ) . '/languages/' |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * {@inheritDoc} |
|
52 | - * |
|
53 | - * @return array |
|
54 | - */ |
|
55 | - public function action_hooks() { |
|
56 | - return array( |
|
57 | - array( |
|
58 | - 'hook' => 'init', |
|
59 | - 'method' => 'load_plugin_textdomain', |
|
60 | - ), |
|
61 | - ); |
|
62 | - } |
|
50 | + /** |
|
51 | + * {@inheritDoc} |
|
52 | + * |
|
53 | + * @return array |
|
54 | + */ |
|
55 | + public function action_hooks() { |
|
56 | + return array( |
|
57 | + array( |
|
58 | + 'hook' => 'init', |
|
59 | + 'method' => 'load_plugin_textdomain', |
|
60 | + ), |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |
@@ -13,137 +13,137 @@ |
||
13 | 13 | * @package Intraxia\Jaxion |
14 | 14 | */ |
15 | 15 | class Application extends Container implements ApplicationContract { |
16 | - /** |
|
17 | - * Define plugin version on Application. |
|
18 | - */ |
|
19 | - const VERSION = ''; |
|
20 | - |
|
21 | - /** |
|
22 | - * Singleton instance of the Application object |
|
23 | - * |
|
24 | - * @var Application |
|
25 | - */ |
|
26 | - protected static $instance = null; |
|
27 | - |
|
28 | - /** |
|
29 | - * Instantiates a new Application container. |
|
30 | - * |
|
31 | - * The Application constructor enforces the presence of of a single instance |
|
32 | - * of the Application. If an instance already exists, an Exception will be thrown. |
|
33 | - * |
|
34 | - * @param string $file |
|
35 | - * @param array $providers |
|
36 | - * |
|
37 | - * @throws ApplicationAlreadyBootedException |
|
38 | - */ |
|
39 | - public function __construct( $file, array $providers = array() ) { |
|
40 | - if ( null !== static::$instance ) { |
|
41 | - throw new ApplicationAlreadyBootedException; |
|
42 | - } |
|
43 | - |
|
44 | - static::$instance = $this; |
|
45 | - |
|
46 | - $this->register_constants( $file ); |
|
47 | - $this->register_core_services(); |
|
48 | - |
|
49 | - register_activation_hook( $file, array( $this, 'activate' ) ); |
|
50 | - register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
51 | - |
|
52 | - parent::__construct( $providers ); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * {@inheritDoc} |
|
57 | - * |
|
58 | - * @throws UnexpectedValueException |
|
59 | - */ |
|
60 | - public function boot() { |
|
61 | - $loader = $this->fetch( 'loader' ); |
|
62 | - |
|
63 | - if ( ! $loader instanceof LoaderContract ) { |
|
64 | - throw new UnexpectedValueException; |
|
65 | - } |
|
66 | - |
|
67 | - foreach ( $this as $alias => $value ) { |
|
68 | - if ( $value instanceof HasActions ) { |
|
69 | - $loader->register_actions( $value ); |
|
70 | - } |
|
71 | - |
|
72 | - if ( $value instanceof HasFilters ) { |
|
73 | - $loader->register_filters( $value ); |
|
74 | - } |
|
75 | - |
|
76 | - if ( $value instanceof HasShortcode ) { |
|
77 | - $loader->register_shortcode( $value ); |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - add_action( 'plugins_loaded', array( $loader, 'run' ) ); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * {@inheritdoc} |
|
86 | - * |
|
87 | - * @codeCoverageIgnore |
|
88 | - */ |
|
89 | - public function activate() { |
|
90 | - // no-op |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * {@inheritdoc} |
|
95 | - * |
|
96 | - * @codeCoverageIgnore |
|
97 | - */ |
|
98 | - public function deactivate() { |
|
99 | - // no-op |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * {@inheritDoc} |
|
104 | - * |
|
105 | - * @return Application |
|
106 | - * @throws ApplicationNotBootedException |
|
107 | - */ |
|
108 | - public static function instance() { |
|
109 | - if ( null === static::$instance ) { |
|
110 | - throw new ApplicationNotBootedException; |
|
111 | - } |
|
112 | - |
|
113 | - return static::$instance; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * {@inheritDoc} |
|
118 | - */ |
|
119 | - public static function shutdown() { |
|
120 | - if ( null !== static::$instance ) { |
|
121 | - static::$instance = null; |
|
122 | - } |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Sets the plugin's url, path, and basename. |
|
127 | - * |
|
128 | - * @param string $file |
|
129 | - */ |
|
130 | - private function register_constants( $file ) { |
|
131 | - $this->share( 'url', plugin_dir_url( $file ) ); |
|
132 | - $this->share( 'path', plugin_dir_path( $file ) ); |
|
133 | - $this->share( 'basename', $basename = plugin_basename( $file ) ); |
|
134 | - $this->share( 'slug', dirname( $basename ) ); |
|
135 | - $this->share( 'version', static::VERSION ); |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * Registers the built-in services with the Application container. |
|
140 | - */ |
|
141 | - private function register_core_services() { |
|
142 | - $this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) { |
|
143 | - return new Loader( $app ); |
|
144 | - } ); |
|
145 | - $this->share( array( 'i18n' => 'Intaxia\Jaxion\Contract\Core\I18n' ), function ( $app ) { |
|
146 | - return new I18n( $app->fetch( 'basename' ), $app->fetch( 'path' ) ); |
|
147 | - } ); |
|
148 | - } |
|
16 | + /** |
|
17 | + * Define plugin version on Application. |
|
18 | + */ |
|
19 | + const VERSION = ''; |
|
20 | + |
|
21 | + /** |
|
22 | + * Singleton instance of the Application object |
|
23 | + * |
|
24 | + * @var Application |
|
25 | + */ |
|
26 | + protected static $instance = null; |
|
27 | + |
|
28 | + /** |
|
29 | + * Instantiates a new Application container. |
|
30 | + * |
|
31 | + * The Application constructor enforces the presence of of a single instance |
|
32 | + * of the Application. If an instance already exists, an Exception will be thrown. |
|
33 | + * |
|
34 | + * @param string $file |
|
35 | + * @param array $providers |
|
36 | + * |
|
37 | + * @throws ApplicationAlreadyBootedException |
|
38 | + */ |
|
39 | + public function __construct( $file, array $providers = array() ) { |
|
40 | + if ( null !== static::$instance ) { |
|
41 | + throw new ApplicationAlreadyBootedException; |
|
42 | + } |
|
43 | + |
|
44 | + static::$instance = $this; |
|
45 | + |
|
46 | + $this->register_constants( $file ); |
|
47 | + $this->register_core_services(); |
|
48 | + |
|
49 | + register_activation_hook( $file, array( $this, 'activate' ) ); |
|
50 | + register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
51 | + |
|
52 | + parent::__construct( $providers ); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * {@inheritDoc} |
|
57 | + * |
|
58 | + * @throws UnexpectedValueException |
|
59 | + */ |
|
60 | + public function boot() { |
|
61 | + $loader = $this->fetch( 'loader' ); |
|
62 | + |
|
63 | + if ( ! $loader instanceof LoaderContract ) { |
|
64 | + throw new UnexpectedValueException; |
|
65 | + } |
|
66 | + |
|
67 | + foreach ( $this as $alias => $value ) { |
|
68 | + if ( $value instanceof HasActions ) { |
|
69 | + $loader->register_actions( $value ); |
|
70 | + } |
|
71 | + |
|
72 | + if ( $value instanceof HasFilters ) { |
|
73 | + $loader->register_filters( $value ); |
|
74 | + } |
|
75 | + |
|
76 | + if ( $value instanceof HasShortcode ) { |
|
77 | + $loader->register_shortcode( $value ); |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + add_action( 'plugins_loaded', array( $loader, 'run' ) ); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * {@inheritdoc} |
|
86 | + * |
|
87 | + * @codeCoverageIgnore |
|
88 | + */ |
|
89 | + public function activate() { |
|
90 | + // no-op |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * {@inheritdoc} |
|
95 | + * |
|
96 | + * @codeCoverageIgnore |
|
97 | + */ |
|
98 | + public function deactivate() { |
|
99 | + // no-op |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * {@inheritDoc} |
|
104 | + * |
|
105 | + * @return Application |
|
106 | + * @throws ApplicationNotBootedException |
|
107 | + */ |
|
108 | + public static function instance() { |
|
109 | + if ( null === static::$instance ) { |
|
110 | + throw new ApplicationNotBootedException; |
|
111 | + } |
|
112 | + |
|
113 | + return static::$instance; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * {@inheritDoc} |
|
118 | + */ |
|
119 | + public static function shutdown() { |
|
120 | + if ( null !== static::$instance ) { |
|
121 | + static::$instance = null; |
|
122 | + } |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Sets the plugin's url, path, and basename. |
|
127 | + * |
|
128 | + * @param string $file |
|
129 | + */ |
|
130 | + private function register_constants( $file ) { |
|
131 | + $this->share( 'url', plugin_dir_url( $file ) ); |
|
132 | + $this->share( 'path', plugin_dir_path( $file ) ); |
|
133 | + $this->share( 'basename', $basename = plugin_basename( $file ) ); |
|
134 | + $this->share( 'slug', dirname( $basename ) ); |
|
135 | + $this->share( 'version', static::VERSION ); |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * Registers the built-in services with the Application container. |
|
140 | + */ |
|
141 | + private function register_core_services() { |
|
142 | + $this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) { |
|
143 | + return new Loader( $app ); |
|
144 | + } ); |
|
145 | + $this->share( array( 'i18n' => 'Intaxia\Jaxion\Contract\Core\I18n' ), function ( $app ) { |
|
146 | + return new I18n( $app->fetch( 'basename' ), $app->fetch( 'path' ) ); |
|
147 | + } ); |
|
148 | + } |
|
149 | 149 | } |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @throws ApplicationAlreadyBootedException |
38 | 38 | */ |
39 | - public function __construct( $file, array $providers = array() ) { |
|
40 | - if ( null !== static::$instance ) { |
|
39 | + public function __construct($file, array $providers = array()) { |
|
40 | + if (null !== static::$instance) { |
|
41 | 41 | throw new ApplicationAlreadyBootedException; |
42 | 42 | } |
43 | 43 | |
44 | 44 | static::$instance = $this; |
45 | 45 | |
46 | - $this->register_constants( $file ); |
|
46 | + $this->register_constants($file); |
|
47 | 47 | $this->register_core_services(); |
48 | 48 | |
49 | - register_activation_hook( $file, array( $this, 'activate' ) ); |
|
50 | - register_deactivation_hook( $file, array( $this, 'deactivate' ) ); |
|
49 | + register_activation_hook($file, array($this, 'activate')); |
|
50 | + register_deactivation_hook($file, array($this, 'deactivate')); |
|
51 | 51 | |
52 | - parent::__construct( $providers ); |
|
52 | + parent::__construct($providers); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -58,27 +58,27 @@ discard block |
||
58 | 58 | * @throws UnexpectedValueException |
59 | 59 | */ |
60 | 60 | public function boot() { |
61 | - $loader = $this->fetch( 'loader' ); |
|
61 | + $loader = $this->fetch('loader'); |
|
62 | 62 | |
63 | - if ( ! $loader instanceof LoaderContract ) { |
|
63 | + if (!$loader instanceof LoaderContract) { |
|
64 | 64 | throw new UnexpectedValueException; |
65 | 65 | } |
66 | 66 | |
67 | - foreach ( $this as $alias => $value ) { |
|
68 | - if ( $value instanceof HasActions ) { |
|
69 | - $loader->register_actions( $value ); |
|
67 | + foreach ($this as $alias => $value) { |
|
68 | + if ($value instanceof HasActions) { |
|
69 | + $loader->register_actions($value); |
|
70 | 70 | } |
71 | 71 | |
72 | - if ( $value instanceof HasFilters ) { |
|
73 | - $loader->register_filters( $value ); |
|
72 | + if ($value instanceof HasFilters) { |
|
73 | + $loader->register_filters($value); |
|
74 | 74 | } |
75 | 75 | |
76 | - if ( $value instanceof HasShortcode ) { |
|
77 | - $loader->register_shortcode( $value ); |
|
76 | + if ($value instanceof HasShortcode) { |
|
77 | + $loader->register_shortcode($value); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - add_action( 'plugins_loaded', array( $loader, 'run' ) ); |
|
81 | + add_action('plugins_loaded', array($loader, 'run')); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @throws ApplicationNotBootedException |
107 | 107 | */ |
108 | 108 | public static function instance() { |
109 | - if ( null === static::$instance ) { |
|
109 | + if (null === static::$instance) { |
|
110 | 110 | throw new ApplicationNotBootedException; |
111 | 111 | } |
112 | 112 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * {@inheritDoc} |
118 | 118 | */ |
119 | 119 | public static function shutdown() { |
120 | - if ( null !== static::$instance ) { |
|
120 | + if (null !== static::$instance) { |
|
121 | 121 | static::$instance = null; |
122 | 122 | } |
123 | 123 | } |
@@ -127,23 +127,23 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @param string $file |
129 | 129 | */ |
130 | - private function register_constants( $file ) { |
|
131 | - $this->share( 'url', plugin_dir_url( $file ) ); |
|
132 | - $this->share( 'path', plugin_dir_path( $file ) ); |
|
133 | - $this->share( 'basename', $basename = plugin_basename( $file ) ); |
|
134 | - $this->share( 'slug', dirname( $basename ) ); |
|
135 | - $this->share( 'version', static::VERSION ); |
|
130 | + private function register_constants($file) { |
|
131 | + $this->share('url', plugin_dir_url($file)); |
|
132 | + $this->share('path', plugin_dir_path($file)); |
|
133 | + $this->share('basename', $basename = plugin_basename($file)); |
|
134 | + $this->share('slug', dirname($basename)); |
|
135 | + $this->share('version', static::VERSION); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Registers the built-in services with the Application container. |
140 | 140 | */ |
141 | 141 | private function register_core_services() { |
142 | - $this->share( array( 'loader' => 'Intraxia\Jaxion\Contract\Core\Loader' ), function ( $app ) { |
|
143 | - return new Loader( $app ); |
|
142 | + $this->share(array('loader' => 'Intraxia\Jaxion\Contract\Core\Loader'), function($app) { |
|
143 | + return new Loader($app); |
|
144 | 144 | } ); |
145 | - $this->share( array( 'i18n' => 'Intaxia\Jaxion\Contract\Core\I18n' ), function ( $app ) { |
|
146 | - return new I18n( $app->fetch( 'basename' ), $app->fetch( 'path' ) ); |
|
145 | + $this->share(array('i18n' => 'Intaxia\Jaxion\Contract\Core\I18n'), function($app) { |
|
146 | + return new I18n($app->fetch('basename'), $app->fetch('path')); |
|
147 | 147 | } ); |
148 | 148 | } |
149 | 149 | } |