@@ -11,11 +11,11 @@ |
||
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 | |
14 | -use Assert; |
|
15 | -use BrightNucleus\Config\ConfigInterface; |
|
16 | -use BrightNucleus\Config\ConfigTrait; |
|
17 | -use BrightNucleus\Dependency\DependencyManagerInterface; |
|
18 | -use BrightNucleus\Exception\DomainException; |
|
14 | +use Assert; |
|
15 | +use BrightNucleus\Config\ConfigInterface; |
|
16 | +use BrightNucleus\Config\ConfigTrait; |
|
17 | +use BrightNucleus\Dependency\DependencyManagerInterface; |
|
18 | +use BrightNucleus\Exception\DomainException; |
|
19 | 19 | use BrightNucleus\Exception\RuntimeException; |
20 | 20 | |
21 | 21 | /** |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | $config_key = null |
86 | 86 | ) { |
87 | 87 | |
88 | - Assert\that( $shortcode_tag )->string()->notEmpty(); |
|
88 | + Assert\that($shortcode_tag)->string()->notEmpty(); |
|
89 | 89 | |
90 | - $this->processConfig( $config, $config_key ); |
|
90 | + $this->processConfig($config, $config_key); |
|
91 | 91 | |
92 | 92 | $this->shortcode_tag = $shortcode_tag; |
93 | 93 | $this->atts_parser = $atts_parser; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * (Not used with Shortcode class) |
104 | 104 | * @return void |
105 | 105 | */ |
106 | - public function register( $args = null ) { |
|
107 | - \add_shortcode( $this->get_tag(), [ $this, 'render' ] ); |
|
106 | + public function register($args = null) { |
|
107 | + \add_shortcode($this->get_tag(), [$this, 'render']); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * @param string|null $content Content between enclosing shortcodes. |
131 | 131 | * @return string The shortcode's HTML output. |
132 | 132 | */ |
133 | - public function render( $atts, $content = null ) { |
|
134 | - $atts = $this->atts_parser->parse_atts( $atts ); |
|
133 | + public function render($atts, $content = null) { |
|
134 | + $atts = $this->atts_parser->parse_atts($atts); |
|
135 | 135 | |
136 | - $this->dependencies->enqueue( $atts ); |
|
136 | + $this->dependencies->enqueue($atts); |
|
137 | 137 | |
138 | - if ( ! $this->hasConfigKey( 'view' ) ) { |
|
138 | + if ( ! $this->hasConfigKey('view')) { |
|
139 | 139 | return ''; |
140 | 140 | } |
141 | - $view = $this->getConfigKey( 'view' ); |
|
141 | + $view = $this->getConfigKey('view'); |
|
142 | 142 | |
143 | - Assert\that( $view )->string()->notEmpty()->file(); |
|
143 | + Assert\that($view)->string()->notEmpty()->file(); |
|
144 | 144 | |
145 | 145 | ob_start(); |
146 | - include( $this->config['view'] ); |
|
146 | + include($this->config['view']); |
|
147 | 147 | |
148 | 148 | return ob_get_clean(); |
149 | 149 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 | |
14 | -use BrightNucleus\Config\ConfigInterface; |
|
15 | -use BrightNucleus\Config\ConfigTrait; |
|
14 | +use BrightNucleus\Config\ConfigInterface; |
|
15 | +use BrightNucleus\Config\ConfigTrait; |
|
16 | 16 | use BrightNucleus\Dependency\DependencyManagerInterface; |
17 | 17 | |
18 | 18 | /** |
@@ -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 Alain Schlesser, Bright NucleusInterface |
|
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 Alain Schlesser, Bright NucleusInterface |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | /* |
39 | 39 | * Default classes that are used when omitted from the config. |
40 | 40 | */ |
41 | - const DEFAULT_SHORTCODE = __NAMESPACE__ . '\Shortcode'; |
|
42 | - const DEFAULT_SHORTCODE_ATTS_PARSER = __NAMESPACE__ . '\ShortcodeAttsParser'; |
|
43 | - const DEFAULT_SHORTCODE_UI = __NAMESPACE__ . '\ShortcodeUI'; |
|
41 | + const DEFAULT_SHORTCODE = __NAMESPACE__.'\Shortcode'; |
|
42 | + const DEFAULT_SHORTCODE_ATTS_PARSER = __NAMESPACE__.'\ShortcodeAttsParser'; |
|
43 | + const DEFAULT_SHORTCODE_UI = __NAMESPACE__.'\ShortcodeUI'; |
|
44 | 44 | |
45 | 45 | /* |
46 | 46 | * The names of the configuration keys. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @var ShortcodeInterface[] |
59 | 59 | */ |
60 | - protected $shortcodes = [ ]; |
|
60 | + protected $shortcodes = []; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Collection of DependencyManagerInterface objects. |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @var DependencyManagerInterface[] |
68 | 68 | */ |
69 | - protected $dependencies = [ ]; |
|
69 | + protected $dependencies = []; |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Collection of ShortcodeUIInterface objects. |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @var ShortcodeUIInterface[] |
77 | 77 | */ |
78 | - protected $shortcode_uis = [ ]; |
|
78 | + protected $shortcode_uis = []; |
|
79 | 79 | |
80 | 80 | public function __construct( |
81 | 81 | ConfigInterface $config, |
82 | 82 | $config_key = null, |
83 | 83 | DependencyManagerInterface $dependencies |
84 | 84 | ) { |
85 | - $this->processConfig( $config, $config_key ); |
|
85 | + $this->processConfig($config, $config_key); |
|
86 | 86 | |
87 | - if ( ! $this->hasConfigKey( self::KEY_TAGS ) ) { |
|
87 | + if ( ! $this->hasConfigKey(self::KEY_TAGS)) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function init_shortcodes() { |
102 | 102 | |
103 | - foreach ( $this->getConfigKey( self::KEY_TAGS ) as $tag => $config ) { |
|
104 | - $this->init_shortcode( $tag ); |
|
103 | + foreach ($this->getConfigKey(self::KEY_TAGS) as $tag => $config) { |
|
104 | + $this->init_shortcode($tag); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -112,21 +112,21 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param string $tag The tag of the shortcode to register. |
114 | 114 | */ |
115 | - protected function init_shortcode( $tag ) { |
|
116 | - $config_key = $this->get_config_key( $tag ); |
|
117 | - $shortcode_class = $this->get_shortcode_class( $tag ); |
|
118 | - $shortcode_atts_parser = $this->get_shortcode_atts_parser_class( $tag ); |
|
115 | + protected function init_shortcode($tag) { |
|
116 | + $config_key = $this->get_config_key($tag); |
|
117 | + $shortcode_class = $this->get_shortcode_class($tag); |
|
118 | + $shortcode_atts_parser = $this->get_shortcode_atts_parser_class($tag); |
|
119 | 119 | |
120 | 120 | $this->shortcodes[] = new $shortcode_class( |
121 | 121 | $tag, |
122 | - new $shortcode_atts_parser( $tag, $this->config, $config_key ), |
|
122 | + new $shortcode_atts_parser($tag, $this->config, $config_key), |
|
123 | 123 | $this->dependencies, |
124 | 124 | $this->config, |
125 | 125 | $config_key |
126 | 126 | ); |
127 | 127 | |
128 | - if ( $this->hasConfigKey( self::KEY_TAGS, $tag, self::KEY_UI ) ) { |
|
129 | - $this->init_shortcode_ui( $tag ); |
|
128 | + if ($this->hasConfigKey(self::KEY_TAGS, $tag, self::KEY_UI)) { |
|
129 | + $this->init_shortcode_ui($tag); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $tag The shortcode tag to get the config key for. |
139 | 139 | * @return string Configuration key. |
140 | 140 | */ |
141 | - protected function get_config_key( $tag ) { |
|
142 | - return self::KEY_TAGS . self::CONFIG_SEPARATOR . $tag; |
|
141 | + protected function get_config_key($tag) { |
|
142 | + return self::KEY_TAGS.self::CONFIG_SEPARATOR.$tag; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * @param string $tag Shortcode tag to get the class for. |
151 | 151 | * @return string Class name of the Shortcode. |
152 | 152 | */ |
153 | - protected function get_shortcode_class( $tag ) { |
|
154 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_CLASS ]; |
|
155 | - $shortcode_class = $this->hasConfigKey( $key ) |
|
156 | - ? $this->getConfigKey( $key ) |
|
153 | + protected function get_shortcode_class($tag) { |
|
154 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_CLASS]; |
|
155 | + $shortcode_class = $this->hasConfigKey($key) |
|
156 | + ? $this->getConfigKey($key) |
|
157 | 157 | : self::DEFAULT_SHORTCODE; |
158 | 158 | return $shortcode_class; |
159 | 159 | } |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @param string $tag Shortcode tag to get the class for. |
168 | 168 | * @return string Class name of the ShortcodeAttsParser. |
169 | 169 | */ |
170 | - protected function get_shortcode_atts_parser_class( $tag ) { |
|
171 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_ATTS_PARSER ]; |
|
172 | - $atts_parser = $this->hasConfigKey( $key ) |
|
173 | - ? $this->getConfigKey( $key ) |
|
170 | + protected function get_shortcode_atts_parser_class($tag) { |
|
171 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_ATTS_PARSER]; |
|
172 | + $atts_parser = $this->hasConfigKey($key) |
|
173 | + ? $this->getConfigKey($key) |
|
174 | 174 | : self::DEFAULT_SHORTCODE_ATTS_PARSER; |
175 | 175 | return $atts_parser; |
176 | 176 | } |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @param string $tag The tag of the shortcode to register the UI for. |
184 | 184 | */ |
185 | - protected function init_shortcode_ui( $tag ) { |
|
186 | - $shortcode_ui_class = $this->get_shortcode_ui_class( $tag ); |
|
185 | + protected function init_shortcode_ui($tag) { |
|
186 | + $shortcode_ui_class = $this->get_shortcode_ui_class($tag); |
|
187 | 187 | |
188 | 188 | $this->shortcode_uis[] = new $shortcode_ui_class( |
189 | 189 | $tag, |
190 | 190 | $this->dependencies, |
191 | 191 | $this->config, |
192 | - $this->get_config_key( $tag ) |
|
192 | + $this->get_config_key($tag) |
|
193 | 193 | ); |
194 | 194 | } |
195 | 195 | |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | * @param string $tag Configuration settings. |
202 | 202 | * @return string Class name of the ShortcodeUI. |
203 | 203 | */ |
204 | - protected function get_shortcode_ui_class( $tag ) { |
|
205 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_UI ]; |
|
206 | - $ui_class = $this->hasConfigKey( $key ) |
|
207 | - ? $this->getConfigKey( $key ) |
|
204 | + protected function get_shortcode_ui_class($tag) { |
|
205 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_UI]; |
|
206 | + $ui_class = $this->hasConfigKey($key) |
|
207 | + ? $this->getConfigKey($key) |
|
208 | 208 | : self::DEFAULT_SHORTCODE_UI; |
209 | 209 | return $ui_class; |
210 | 210 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @return void |
218 | 218 | */ |
219 | 219 | public function register() { |
220 | - array_walk( $this->shortcodes, function ( $shortcode ) { |
|
220 | + array_walk($this->shortcodes, function($shortcode) { |
|
221 | 221 | /** @var ShortcodeInterface $shortcode */ |
222 | 222 | $shortcode->register(); |
223 | 223 | } ); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // This hook only gets fired when Shortcode UI plugin is active. |
226 | 226 | \add_action( |
227 | 227 | 'register_shortcode_ui', |
228 | - [ $this, 'register_shortcode_ui', ] |
|
228 | + [$this, 'register_shortcode_ui', ] |
|
229 | 229 | ); |
230 | 230 | } |
231 | 231 | |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function register_shortcode_ui() { |
238 | 238 | $template = $this->get_page_template(); |
239 | - $context = [ 'page_template' => $template ]; |
|
239 | + $context = ['page_template' => $template]; |
|
240 | 240 | |
241 | - array_walk( $this->shortcode_uis, |
|
242 | - function ( $shortcode_ui ) use ( $context ) { |
|
241 | + array_walk($this->shortcode_uis, |
|
242 | + function($shortcode_ui) use ($context) { |
|
243 | 243 | /** @var ShortcodeUIInterface $shortcode_ui */ |
244 | - $shortcode_ui->register( $context ); |
|
244 | + $shortcode_ui->register($context); |
|
245 | 245 | } |
246 | 246 | ); |
247 | 247 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | protected function get_page_template() { |
257 | 257 | $template = str_replace( |
258 | - \trailingslashit( \get_stylesheet_directory() ), |
|
258 | + \trailingslashit(\get_stylesheet_directory()), |
|
259 | 259 | '', |
260 | 260 | \get_page_template() |
261 | 261 | ); |
@@ -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 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 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $config_key = null |
56 | 56 | ) { |
57 | 57 | |
58 | - $this->processConfig( $config, $config_key ); |
|
58 | + $this->processConfig($config, $config_key); |
|
59 | 59 | $this->shortcode = $shortcode; |
60 | 60 | } |
61 | 61 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * @param array $atts Attributes passed to the shortcode. |
68 | 68 | * @return array Validated attributes of the shortcode. |
69 | 69 | */ |
70 | - public function parse_atts( $atts ) { |
|
70 | + public function parse_atts($atts) { |
|
71 | 71 | $atts = \shortcode_atts( |
72 | 72 | $this->default_atts(), |
73 | - $this->validated_atts( $atts ), |
|
73 | + $this->validated_atts($atts), |
|
74 | 74 | $this->shortcode->get_tag() |
75 | 75 | ); |
76 | 76 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | $atts = array(); |
90 | 90 | |
91 | - if ( array_key_exists( 'atts', $this->config ) ) { |
|
92 | - array_walk( $this->config['atts'], |
|
93 | - function ( $att_properties, $att_label ) use ( &$atts ) { |
|
94 | - $atts[ $att_label ] = $att_properties['default']; |
|
91 | + if (array_key_exists('atts', $this->config)) { |
|
92 | + array_walk($this->config['atts'], |
|
93 | + function($att_properties, $att_label) use (&$atts) { |
|
94 | + $atts[$att_label] = $att_properties['default']; |
|
95 | 95 | } |
96 | 96 | ); |
97 | 97 | } |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | * @param array $atts Attributes that were passed to the shortcode. |
109 | 109 | * @return array Validated attributes. |
110 | 110 | */ |
111 | - protected function validated_atts( $atts ) { |
|
111 | + protected function validated_atts($atts) { |
|
112 | 112 | |
113 | - if ( array_key_exists( 'atts', $this->config ) ) { |
|
114 | - array_walk( $this->config['atts'], |
|
115 | - function ( $att_properties, $att_label ) use ( &$atts ) { |
|
116 | - if ( array_key_exists( $att_label, $atts ) ) { |
|
113 | + if (array_key_exists('atts', $this->config)) { |
|
114 | + array_walk($this->config['atts'], |
|
115 | + function($att_properties, $att_label) use (&$atts) { |
|
116 | + if (array_key_exists($att_label, $atts)) { |
|
117 | 117 | $validate_function = $att_properties['validate']; |
118 | - $atts[ $att_label ] = $validate_function( $atts[ $att_label ] ); |
|
118 | + $atts[$att_label] = $validate_function($atts[$att_label]); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | ); |
@@ -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 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 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -29,5 +29,5 @@ |
||
29 | 29 | * @param array $atts Attributes passed to the shortcode. |
30 | 30 | * @return array Validated attributes of the shortcode. |
31 | 31 | */ |
32 | - public function parse_atts( $atts ); |
|
32 | + public function parse_atts($atts); |
|
33 | 33 | } |
@@ -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 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 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param string|null $content Content between enclosing shortcodes. |
34 | 34 | * @return string The shortcode's HTML output. |
35 | 35 | */ |
36 | - public function render( $atts, $content = null ); |
|
36 | + public function render($atts, $content = null); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Get the shortcode tag. |
@@ -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 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 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | ConfigInterface $config, |
64 | 64 | DependencyManagerInterface $dependencies |
65 | 65 | ) { |
66 | - Assert\that( $shortcode_tag )->string()->notEmpty(); |
|
66 | + Assert\that($shortcode_tag)->string()->notEmpty(); |
|
67 | 67 | |
68 | - $this->processConfig( $config ); |
|
68 | + $this->processConfig($config); |
|
69 | 69 | |
70 | 70 | $this->shortcode_tag = $shortcode_tag; |
71 | 71 | $this->dependencies = $dependencies; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @param mixed $context Data about the context in which the call is made. |
80 | 80 | * @return void |
81 | 81 | */ |
82 | - public function register( $context = null ) { |
|
83 | - if ( ! $this->is_needed() ) { |
|
82 | + public function register($context = null) { |
|
83 | + if ( ! $this->is_needed()) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | * @param mixed $context Data about the context in which the call is made. |
99 | 99 | * @return boolean Whether the shortcode is needed or not. |
100 | 100 | */ |
101 | - protected function is_needed( $context = null ) { |
|
101 | + protected function is_needed($context = null) { |
|
102 | 102 | |
103 | - $is_needed = $this->hasConfigKey( 'is_needed' ) |
|
104 | - ? $this->getConfigKey( 'is_needed' ) |
|
103 | + $is_needed = $this->hasConfigKey('is_needed') |
|
104 | + ? $this->getConfigKey('is_needed') |
|
105 | 105 | : false; |
106 | 106 | |
107 | 107 | // Return true if a callable 'is_needed' evaluates to true. |
108 | - if ( is_callable( $is_needed ) && $is_needed( $context ) ) { |
|
108 | + if (is_callable($is_needed) && $is_needed($context)) { |
|
109 | 109 | return true; |
110 | 110 | } |
111 | 111 |
@@ -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 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 Alain Schlesser, Bright Nucleus |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | namespace BrightNucleus\Shortcode; |
13 | 13 |