@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Shortcode Attributes Parser Base Implementation. |
|
4 | - * |
|
5 | - * @package BrightNucleus\Shortcode |
|
6 | - * @author Alain Schlesser <[email protected]> |
|
7 | - * @license GPL-2.0+ |
|
8 | - * @link http://www.brightnucleus.com/ |
|
9 | - * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | - */ |
|
3 | + * Shortcode Attributes Parser Base Implementation. |
|
4 | + * |
|
5 | + * @package BrightNucleus\Shortcode |
|
6 | + * @author Alain Schlesser <[email protected]> |
|
7 | + * @license GPL-2.0+ |
|
8 | + * @link http://www.brightnucleus.com/ |
|
9 | + * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Shortcode Attributes Parser Interface. |
|
4 | - * |
|
5 | - * @package BrightNucleus\Shortcode |
|
6 | - * @author Alain Schlesser <[email protected]> |
|
7 | - * @license GPL-2.0+ |
|
8 | - * @link http://www.brightnucleus.com/ |
|
9 | - * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | - */ |
|
3 | + * Shortcode Attributes Parser Interface. |
|
4 | + * |
|
5 | + * @package BrightNucleus\Shortcode |
|
6 | + * @author Alain Schlesser <[email protected]> |
|
7 | + * @license GPL-2.0+ |
|
8 | + * @link http://www.brightnucleus.com/ |
|
9 | + * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Shortcode Interface. |
|
4 | - * |
|
5 | - * @package BrightNucleus\Shortcode |
|
6 | - * @author Alain Schlesser <[email protected]> |
|
7 | - * @license GPL-2.0+ |
|
8 | - * @link http://www.brightnucleus.com/ |
|
9 | - * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | - */ |
|
3 | + * Shortcode Interface. |
|
4 | + * |
|
5 | + * @package BrightNucleus\Shortcode |
|
6 | + * @author Alain Schlesser <[email protected]> |
|
7 | + * @license GPL-2.0+ |
|
8 | + * @link http://www.brightnucleus.com/ |
|
9 | + * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Shortcode Manager. |
|
4 | - * |
|
5 | - * @package BrightNucleus\Shortcode |
|
6 | - * @author Alain Schlesser <[email protected]> |
|
7 | - * @license GPL-2.0+ |
|
8 | - * @link http://www.brightnucleus.com/ |
|
9 | - * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | - */ |
|
3 | + * Shortcode Manager. |
|
4 | + * |
|
5 | + * @package BrightNucleus\Shortcode |
|
6 | + * @author Alain Schlesser <[email protected]> |
|
7 | + * @license GPL-2.0+ |
|
8 | + * @link http://www.brightnucleus.com/ |
|
9 | + * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | /* |
40 | 40 | * Default classes that are used when omitted from the config. |
41 | 41 | */ |
42 | - const DEFAULT_SHORTCODE = __NAMESPACE__ . '\Shortcode'; |
|
43 | - const DEFAULT_SHORTCODE_ATTS_PARSER = __NAMESPACE__ . '\ShortcodeAttsParser'; |
|
44 | - const DEFAULT_SHORTCODE_UI = __NAMESPACE__ . '\ShortcodeUI'; |
|
42 | + const DEFAULT_SHORTCODE = __NAMESPACE__.'\Shortcode'; |
|
43 | + const DEFAULT_SHORTCODE_ATTS_PARSER = __NAMESPACE__.'\ShortcodeAttsParser'; |
|
44 | + const DEFAULT_SHORTCODE_UI = __NAMESPACE__.'\ShortcodeUI'; |
|
45 | 45 | |
46 | 46 | /* |
47 | 47 | * The names of the configuration keys. |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @var ShortcodeInterface[] |
60 | 60 | */ |
61 | - protected $shortcodes = [ ]; |
|
61 | + protected $shortcodes = []; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * DependencyManagerInterface implementation. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @var ShortcodeUIInterface[] |
78 | 78 | */ |
79 | - protected $shortcode_uis = [ ]; |
|
79 | + protected $shortcode_uis = []; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Instantiate a ShortcodeManager object. |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | ConfigInterface $config, |
98 | 98 | $config_key = null |
99 | 99 | ) { |
100 | - $this->processConfig( $config, $config_key ); |
|
100 | + $this->processConfig($config, $config_key); |
|
101 | 101 | |
102 | - if ( ! $this->hasConfigKey( self::KEY_TAGS ) ) { |
|
102 | + if ( ! $this->hasConfigKey(self::KEY_TAGS)) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function init_shortcodes() { |
117 | 117 | |
118 | - foreach ( $this->getConfigKey( self::KEY_TAGS ) as $tag => $config ) { |
|
119 | - $this->init_shortcode( $tag ); |
|
118 | + foreach ($this->getConfigKey(self::KEY_TAGS) as $tag => $config) { |
|
119 | + $this->init_shortcode($tag); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -127,21 +127,21 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @param string $tag The tag of the shortcode to register. |
129 | 129 | */ |
130 | - protected function init_shortcode( $tag ) { |
|
131 | - $config_key = $this->get_config_key( $tag ); |
|
132 | - $shortcode_class = $this->get_shortcode_class( $tag ); |
|
133 | - $shortcode_atts_parser = $this->get_shortcode_atts_parser_class( $tag ); |
|
130 | + protected function init_shortcode($tag) { |
|
131 | + $config_key = $this->get_config_key($tag); |
|
132 | + $shortcode_class = $this->get_shortcode_class($tag); |
|
133 | + $shortcode_atts_parser = $this->get_shortcode_atts_parser_class($tag); |
|
134 | 134 | |
135 | 135 | $this->shortcodes[] = new $shortcode_class( |
136 | 136 | $tag, |
137 | - new $shortcode_atts_parser( $tag, $this->config, $config_key ), |
|
137 | + new $shortcode_atts_parser($tag, $this->config, $config_key), |
|
138 | 138 | $this->dependencies, |
139 | 139 | $this->config, |
140 | 140 | $config_key |
141 | 141 | ); |
142 | 142 | |
143 | - if ( $this->hasConfigKey( self::KEY_TAGS, $tag, self::KEY_UI ) ) { |
|
144 | - $this->init_shortcode_ui( $tag ); |
|
143 | + if ($this->hasConfigKey(self::KEY_TAGS, $tag, self::KEY_UI)) { |
|
144 | + $this->init_shortcode_ui($tag); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * @param string $tag The shortcode tag to get the config key for. |
154 | 154 | * @return string Configuration key. |
155 | 155 | */ |
156 | - protected function get_config_key( $tag ) { |
|
157 | - return self::KEY_TAGS . self::CONFIG_SEPARATOR . $tag; |
|
156 | + protected function get_config_key($tag) { |
|
157 | + return self::KEY_TAGS.self::CONFIG_SEPARATOR.$tag; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | * @param string $tag Shortcode tag to get the class for. |
166 | 166 | * @return string Class name of the Shortcode. |
167 | 167 | */ |
168 | - protected function get_shortcode_class( $tag ) { |
|
169 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_CLASS ]; |
|
170 | - $shortcode_class = $this->hasConfigKey( $key ) |
|
171 | - ? $this->getConfigKey( $key ) |
|
168 | + protected function get_shortcode_class($tag) { |
|
169 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_CLASS]; |
|
170 | + $shortcode_class = $this->hasConfigKey($key) |
|
171 | + ? $this->getConfigKey($key) |
|
172 | 172 | : self::DEFAULT_SHORTCODE; |
173 | 173 | return $shortcode_class; |
174 | 174 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | * @param string $tag Shortcode tag to get the class for. |
183 | 183 | * @return string Class name of the ShortcodeAttsParser. |
184 | 184 | */ |
185 | - protected function get_shortcode_atts_parser_class( $tag ) { |
|
186 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_ATTS_PARSER ]; |
|
187 | - $atts_parser = $this->hasConfigKey( $key ) |
|
188 | - ? $this->getConfigKey( $key ) |
|
185 | + protected function get_shortcode_atts_parser_class($tag) { |
|
186 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_ATTS_PARSER]; |
|
187 | + $atts_parser = $this->hasConfigKey($key) |
|
188 | + ? $this->getConfigKey($key) |
|
189 | 189 | : self::DEFAULT_SHORTCODE_ATTS_PARSER; |
190 | 190 | return $atts_parser; |
191 | 191 | } |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string $tag The tag of the shortcode to register the UI for. |
199 | 199 | */ |
200 | - protected function init_shortcode_ui( $tag ) { |
|
201 | - $shortcode_ui_class = $this->get_shortcode_ui_class( $tag ); |
|
200 | + protected function init_shortcode_ui($tag) { |
|
201 | + $shortcode_ui_class = $this->get_shortcode_ui_class($tag); |
|
202 | 202 | |
203 | 203 | $this->shortcode_uis[] = new $shortcode_ui_class( |
204 | 204 | $tag, |
205 | 205 | $this->dependencies, |
206 | 206 | $this->config, |
207 | - $this->get_config_key( $tag ) |
|
207 | + $this->get_config_key($tag) |
|
208 | 208 | ); |
209 | 209 | } |
210 | 210 | |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | * @param string $tag Configuration settings. |
217 | 217 | * @return string Class name of the ShortcodeUI. |
218 | 218 | */ |
219 | - protected function get_shortcode_ui_class( $tag ) { |
|
220 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_UI ]; |
|
221 | - $ui_class = $this->hasConfigKey( $key ) |
|
222 | - ? $this->getConfigKey( $key ) |
|
219 | + protected function get_shortcode_ui_class($tag) { |
|
220 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_UI]; |
|
221 | + $ui_class = $this->hasConfigKey($key) |
|
222 | + ? $this->getConfigKey($key) |
|
223 | 223 | : self::DEFAULT_SHORTCODE_UI; |
224 | 224 | return $ui_class; |
225 | 225 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | public function register() { |
235 | - array_walk( $this->shortcodes, function ( $shortcode ) { |
|
235 | + array_walk($this->shortcodes, function($shortcode) { |
|
236 | 236 | /** @var ShortcodeInterface $shortcode */ |
237 | 237 | $shortcode->register(); |
238 | 238 | } ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // This hook only gets fired when Shortcode UI plugin is active. |
241 | 241 | \add_action( |
242 | 242 | 'register_shortcode_ui', |
243 | - [ $this, 'register_shortcode_ui', ] |
|
243 | + [$this, 'register_shortcode_ui', ] |
|
244 | 244 | ); |
245 | 245 | } |
246 | 246 | |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function register_shortcode_ui() { |
253 | 253 | $template = $this->get_page_template(); |
254 | - $context = [ 'page_template' => $template ]; |
|
254 | + $context = ['page_template' => $template]; |
|
255 | 255 | |
256 | - array_walk( $this->shortcode_uis, |
|
257 | - function ( $shortcode_ui ) use ( $context ) { |
|
256 | + array_walk($this->shortcode_uis, |
|
257 | + function($shortcode_ui) use ($context) { |
|
258 | 258 | /** @var ShortcodeUIInterface $shortcode_ui */ |
259 | - $shortcode_ui->register( $context ); |
|
259 | + $shortcode_ui->register($context); |
|
260 | 260 | } |
261 | 261 | ); |
262 | 262 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | protected function get_page_template() { |
272 | 272 | $template = str_replace( |
273 | - \trailingslashit( \get_stylesheet_directory() ), |
|
273 | + \trailingslashit(\get_stylesheet_directory()), |
|
274 | 274 | '', |
275 | 275 | \get_page_template() |
276 | 276 | ); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * ShortcodeUI Class. |
|
4 | - * |
|
5 | - * @package BrightNucleus\Shortcode |
|
6 | - * @author Alain Schlesser <[email protected]> |
|
7 | - * @license GPL-2.0+ |
|
8 | - * @link http://www.brightnucleus.com/ |
|
9 | - * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | - */ |
|
3 | + * ShortcodeUI Class. |
|
4 | + * |
|
5 | + * @package BrightNucleus\Shortcode |
|
6 | + * @author Alain Schlesser <[email protected]> |
|
7 | + * @license GPL-2.0+ |
|
8 | + * @link http://www.brightnucleus.com/ |
|
9 | + * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * ShortcodeUIInterface Interface. |
|
4 | - * |
|
5 | - * @package BrightNucleus\Shortcode |
|
6 | - * @author Alain Schlesser <[email protected]> |
|
7 | - * @license GPL-2.0+ |
|
8 | - * @link http://www.brightnucleus.com/ |
|
9 | - * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | - */ |
|
3 | + * ShortcodeUIInterface Interface. |
|
4 | + * |
|
5 | + * @package BrightNucleus\Shortcode |
|
6 | + * @author Alain Schlesser <[email protected]> |
|
7 | + * @license GPL-2.0+ |
|
8 | + * @link http://www.brightnucleus.com/ |
|
9 | + * @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |