@@ -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 | - * 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 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 |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * attributes. |
38 | 38 | * @throws RuntimeException If the config could not be processed. |
39 | 39 | */ |
40 | - public function __construct( ConfigInterface $config ) { |
|
41 | - $this->processConfig( $config ); |
|
40 | + public function __construct(ConfigInterface $config) { |
|
41 | + $this->processConfig($config); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param string $tag Tag of the shortcode. |
51 | 51 | * @return array Validated attributes of the shortcode. |
52 | 52 | */ |
53 | - public function parse_atts( $atts, $tag ) { |
|
53 | + public function parse_atts($atts, $tag) { |
|
54 | 54 | $atts = \shortcode_atts( |
55 | 55 | $this->default_atts(), |
56 | - $this->validated_atts( (array) $atts ), |
|
56 | + $this->validated_atts((array) $atts), |
|
57 | 57 | $tag |
58 | 58 | ); |
59 | 59 | |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | |
72 | 72 | $atts = array(); |
73 | 73 | |
74 | - if ( ! $this->hasConfigKey( 'atts' ) ) { |
|
74 | + if ( ! $this->hasConfigKey('atts')) { |
|
75 | 75 | return $atts; |
76 | 76 | } |
77 | 77 | |
78 | - $atts_config = $this->getConfigKey( 'atts' ); |
|
79 | - array_walk( $atts_config, |
|
80 | - function ( $att_properties, $att_label ) use ( &$atts ) { |
|
81 | - $atts[ $att_label ] = $att_properties['default']; |
|
78 | + $atts_config = $this->getConfigKey('atts'); |
|
79 | + array_walk($atts_config, |
|
80 | + function($att_properties, $att_label) use (&$atts) { |
|
81 | + $atts[$att_label] = $att_properties['default']; |
|
82 | 82 | } |
83 | 83 | ); |
84 | 84 | |
@@ -94,18 +94,18 @@ discard block |
||
94 | 94 | * @param array $atts Attributes that were passed to the shortcode. |
95 | 95 | * @return array Validated attributes. |
96 | 96 | */ |
97 | - protected function validated_atts( $atts ) { |
|
97 | + protected function validated_atts($atts) { |
|
98 | 98 | |
99 | - if ( ! $this->hasConfigKey( 'atts' ) ) { |
|
99 | + if ( ! $this->hasConfigKey('atts')) { |
|
100 | 100 | return $atts; |
101 | 101 | } |
102 | 102 | |
103 | - $atts_config = $this->getConfigKey( 'atts' ); |
|
104 | - array_walk( $atts_config, |
|
105 | - function ( $att_properties, $att_label ) use ( &$atts ) { |
|
106 | - if ( array_key_exists( $att_label, $atts ) ) { |
|
103 | + $atts_config = $this->getConfigKey('atts'); |
|
104 | + array_walk($atts_config, |
|
105 | + function($att_properties, $att_label) use (&$atts) { |
|
106 | + if (array_key_exists($att_label, $atts)) { |
|
107 | 107 | $validate_function = $att_properties['validate']; |
108 | - $atts[ $att_label ] = $validate_function( $atts[ $att_label ] ); |
|
108 | + $atts[$att_label] = $validate_function($atts[$att_label]); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | ); |
@@ -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 |
@@ -30,5 +30,5 @@ |
||
30 | 30 | * @param string $tag Tag of the shortcode. |
31 | 31 | * @return array Validated attributes of the shortcode. |
32 | 32 | */ |
33 | - public function parse_atts( $atts, $tag ); |
|
33 | + public function parse_atts($atts, $tag); |
|
34 | 34 | } |
@@ -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 |
@@ -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 | * DependencyManagerInterface implementation. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @var ShortcodeUIInterface[] |
77 | 77 | */ |
78 | - protected $shortcode_uis = [ ]; |
|
78 | + protected $shortcode_uis = []; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Instantiate a ShortcodeManager object. |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ConfigInterface $config, |
93 | 93 | DependencyManager $dependencies = null |
94 | 94 | ) { |
95 | - $this->processConfig( $config ); |
|
95 | + $this->processConfig($config); |
|
96 | 96 | $this->dependencies = $dependencies; |
97 | 97 | |
98 | 98 | $this->init_shortcodes(); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @since 0.1.0 |
105 | 105 | */ |
106 | 106 | public function init_shortcodes() { |
107 | - foreach ( $this->getConfigKeys() as $tag ) { |
|
108 | - $this->init_shortcode( $tag ); |
|
107 | + foreach ($this->getConfigKeys() as $tag) { |
|
108 | + $this->init_shortcode($tag); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -116,22 +116,22 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param string $tag The tag of the shortcode to register. |
118 | 118 | */ |
119 | - protected function init_shortcode( $tag ) { |
|
120 | - $shortcode_class = $this->get_shortcode_class( $tag ); |
|
121 | - $shortcode_atts_parser = $this->get_shortcode_atts_parser_class( $tag ); |
|
119 | + protected function init_shortcode($tag) { |
|
120 | + $shortcode_class = $this->get_shortcode_class($tag); |
|
121 | + $shortcode_atts_parser = $this->get_shortcode_atts_parser_class($tag); |
|
122 | 122 | |
123 | 123 | $atts_parser = new $shortcode_atts_parser( |
124 | - $this->config->getSubConfig( $tag ) |
|
124 | + $this->config->getSubConfig($tag) |
|
125 | 125 | ); |
126 | 126 | $this->shortcodes[] = new $shortcode_class( |
127 | 127 | $tag, |
128 | - $this->config->getSubConfig( $tag ), |
|
128 | + $this->config->getSubConfig($tag), |
|
129 | 129 | $atts_parser, |
130 | 130 | $this->dependencies |
131 | 131 | ); |
132 | 132 | |
133 | - if ( $this->hasConfigKey( $tag, self::KEY_UI ) ) { |
|
134 | - $this->init_shortcode_ui( $tag ); |
|
133 | + if ($this->hasConfigKey($tag, self::KEY_UI)) { |
|
134 | + $this->init_shortcode_ui($tag); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | * @param string $tag Shortcode tag to get the class for. |
144 | 144 | * @return string Class name of the Shortcode. |
145 | 145 | */ |
146 | - protected function get_shortcode_class( $tag ) { |
|
147 | - $shortcode_class = $this->hasConfigKey( $tag, self::KEY_CUSTOM_CLASS ) |
|
148 | - ? $this->getConfigKey( $tag, self::KEY_CUSTOM_CLASS ) |
|
146 | + protected function get_shortcode_class($tag) { |
|
147 | + $shortcode_class = $this->hasConfigKey($tag, self::KEY_CUSTOM_CLASS) |
|
148 | + ? $this->getConfigKey($tag, self::KEY_CUSTOM_CLASS) |
|
149 | 149 | : self::DEFAULT_SHORTCODE; |
150 | 150 | return $shortcode_class; |
151 | 151 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @param string $tag Shortcode tag to get the class for. |
160 | 160 | * @return string Class name of the ShortcodeAttsParser. |
161 | 161 | */ |
162 | - protected function get_shortcode_atts_parser_class( $tag ) { |
|
163 | - $atts_parser = $this->hasConfigKey( $tag, self::KEY_CUSTOM_ATTS_PARSER ) |
|
164 | - ? $this->getConfigKey( $tag, self::KEY_CUSTOM_ATTS_PARSER ) |
|
162 | + protected function get_shortcode_atts_parser_class($tag) { |
|
163 | + $atts_parser = $this->hasConfigKey($tag, self::KEY_CUSTOM_ATTS_PARSER) |
|
164 | + ? $this->getConfigKey($tag, self::KEY_CUSTOM_ATTS_PARSER) |
|
165 | 165 | : self::DEFAULT_SHORTCODE_ATTS_PARSER; |
166 | 166 | return $atts_parser; |
167 | 167 | } |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @param string $tag The tag of the shortcode to register the UI for. |
175 | 175 | */ |
176 | - protected function init_shortcode_ui( $tag ) { |
|
177 | - $shortcode_ui_class = $this->get_shortcode_ui_class( $tag ); |
|
176 | + protected function init_shortcode_ui($tag) { |
|
177 | + $shortcode_ui_class = $this->get_shortcode_ui_class($tag); |
|
178 | 178 | |
179 | 179 | $this->shortcode_uis[] = new $shortcode_ui_class( |
180 | 180 | $tag, |
181 | - $this->config->getSubConfig( $tag, self::KEY_UI ), |
|
181 | + $this->config->getSubConfig($tag, self::KEY_UI), |
|
182 | 182 | $this->dependencies |
183 | 183 | ); |
184 | 184 | } |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | * @param string $tag Configuration settings. |
192 | 192 | * @return string Class name of the ShortcodeUI. |
193 | 193 | */ |
194 | - protected function get_shortcode_ui_class( $tag ) { |
|
195 | - $ui_class = $this->hasConfigKey( $tag, self::KEY_CUSTOM_UI ) |
|
196 | - ? $this->getConfigKey( $tag, self::KEY_CUSTOM_UI ) |
|
194 | + protected function get_shortcode_ui_class($tag) { |
|
195 | + $ui_class = $this->hasConfigKey($tag, self::KEY_CUSTOM_UI) |
|
196 | + ? $this->getConfigKey($tag, self::KEY_CUSTOM_UI) |
|
197 | 197 | : self::DEFAULT_SHORTCODE_UI; |
198 | 198 | return $ui_class; |
199 | 199 | } |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | * @param mixed $context Optional. Context information to pass to shortcode. |
207 | 207 | * @return void |
208 | 208 | */ |
209 | - public function register( $context = null ) { |
|
210 | - $context = $this->validate_context( $context ); |
|
209 | + public function register($context = null) { |
|
210 | + $context = $this->validate_context($context); |
|
211 | 211 | $context['page_template'] = $this->get_page_template(); |
212 | 212 | |
213 | - array_walk( $this->shortcodes, |
|
214 | - function ( $shortcode ) use ( $context ) { |
|
213 | + array_walk($this->shortcodes, |
|
214 | + function($shortcode) use ($context) { |
|
215 | 215 | /** @var ShortcodeInterface $shortcode */ |
216 | - $shortcode->register( $context ); |
|
216 | + $shortcode->register($context); |
|
217 | 217 | } ); |
218 | 218 | |
219 | 219 | // This hook only gets fired when Shortcode UI plugin is active. |
220 | 220 | \add_action( |
221 | 221 | 'register_shortcode_ui', |
222 | - [ $this, 'register_shortcode_ui', ] |
|
222 | + [$this, 'register_shortcode_ui', ] |
|
223 | 223 | ); |
224 | 224 | } |
225 | 225 | |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param mixed $context The context as passed in by WordPress. |
232 | 232 | * @return array Validated context. |
233 | 233 | */ |
234 | - protected function validate_context( $context ) { |
|
235 | - if ( is_string( $context ) ) { |
|
236 | - return [ 'wp_context' => $context ]; |
|
234 | + protected function validate_context($context) { |
|
235 | + if (is_string($context)) { |
|
236 | + return ['wp_context' => $context]; |
|
237 | 237 | } |
238 | 238 | return (array) $context; |
239 | 239 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | protected function get_page_template() { |
249 | 249 | $template = str_replace( |
250 | - \trailingslashit( \get_stylesheet_directory() ), |
|
250 | + \trailingslashit(\get_stylesheet_directory()), |
|
251 | 251 | '', |
252 | 252 | \get_page_template() |
253 | 253 | ); |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function register_shortcode_ui() { |
263 | 263 | $template = $this->get_page_template(); |
264 | - $context = [ 'page_template' => $template ]; |
|
264 | + $context = ['page_template' => $template]; |
|
265 | 265 | |
266 | - array_walk( $this->shortcode_uis, |
|
267 | - function ( $shortcode_ui ) use ( $context ) { |
|
266 | + array_walk($this->shortcode_uis, |
|
267 | + function($shortcode_ui) use ($context) { |
|
268 | 268 | /** @var ShortcodeUIInterface $shortcode_ui */ |
269 | - $shortcode_ui->register( $context ); |
|
269 | + $shortcode_ui->register($context); |
|
270 | 270 | } |
271 | 271 | ); |
272 | 272 | } |
@@ -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 |
@@ -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,15 +98,15 @@ discard block |
||
98 | 98 | * @param mixed $context Data about the context in which the call is made. |
99 | 99 | * @return boolean Whether the shortcode UI 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 ) ) { |
|
109 | - return $is_needed( $context ); |
|
108 | + if (is_callable($is_needed)) { |
|
109 | + return $is_needed($context); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return (bool) $is_needed; |
@@ -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 |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | DependencyManager $dependencies = null |
91 | 91 | ) { |
92 | 92 | |
93 | - Assert\that( $shortcode_tag )->string()->notEmpty(); |
|
93 | + Assert\that($shortcode_tag)->string()->notEmpty(); |
|
94 | 94 | |
95 | - $this->processConfig( $config ); |
|
95 | + $this->processConfig($config); |
|
96 | 96 | |
97 | 97 | $this->shortcode_tag = $shortcode_tag; |
98 | 98 | $this->atts_parser = $atts_parser; |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | * @param mixed $context Optional. Arguments to pass on to the Registrable. |
108 | 108 | * @return void |
109 | 109 | */ |
110 | - public function register( $context = null ) { |
|
111 | - if ( ! $this->is_needed( $context ) ) { |
|
110 | + public function register($context = null) { |
|
111 | + if ( ! $this->is_needed($context)) { |
|
112 | 112 | return; |
113 | 113 | } |
114 | 114 | $this->context = $context; |
115 | 115 | |
116 | - \add_shortcode( $this->get_tag(), [ $this, 'render' ] ); |
|
116 | + \add_shortcode($this->get_tag(), [$this, 'render']); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | * @param mixed $context Data about the context in which the call is made. |
125 | 125 | * @return boolean Whether the shortcode is needed or not. |
126 | 126 | */ |
127 | - protected function is_needed( $context = null ) { |
|
127 | + protected function is_needed($context = null) { |
|
128 | 128 | |
129 | - $is_needed = $this->hasConfigKey( 'is_needed' ) |
|
130 | - ? $this->getConfigKey( 'is_needed' ) |
|
129 | + $is_needed = $this->hasConfigKey('is_needed') |
|
130 | + ? $this->getConfigKey('is_needed') |
|
131 | 131 | : false; |
132 | 132 | |
133 | - if ( is_callable( $is_needed ) ) { |
|
134 | - return $is_needed( $context ); |
|
133 | + if (is_callable($is_needed)) { |
|
134 | + return $is_needed($context); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return (bool) $is_needed; |
@@ -163,23 +163,23 @@ discard block |
||
163 | 163 | * render. |
164 | 164 | * @return string The shortcode's HTML output. |
165 | 165 | */ |
166 | - public function render( $atts, $content = null, $tag = null ) { |
|
166 | + public function render($atts, $content = null, $tag = null) { |
|
167 | 167 | $context = $this->context; |
168 | - $atts = $this->atts_parser->parse_atts( $atts, $this->get_tag() ); |
|
168 | + $atts = $this->atts_parser->parse_atts($atts, $this->get_tag()); |
|
169 | 169 | |
170 | - if ( $this->dependencies ) { |
|
171 | - $this->dependencies->enqueue( $atts ); |
|
170 | + if ($this->dependencies) { |
|
171 | + $this->dependencies->enqueue($atts); |
|
172 | 172 | } |
173 | 173 | |
174 | - if ( ! $this->hasConfigKey( 'view' ) ) { |
|
174 | + if ( ! $this->hasConfigKey('view')) { |
|
175 | 175 | return ''; |
176 | 176 | } |
177 | - $view = $this->getConfigKey( 'view' ); |
|
177 | + $view = $this->getConfigKey('view'); |
|
178 | 178 | |
179 | - Assert\that( $view )->string()->notEmpty()->file(); |
|
179 | + Assert\that($view)->string()->notEmpty()->file(); |
|
180 | 180 | |
181 | 181 | ob_start(); |
182 | - include( $this->config['view'] ); |
|
182 | + include($this->config['view']); |
|
183 | 183 | |
184 | 184 | return ob_get_clean(); |
185 | 185 | } |