@@ -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. |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | ConfigInterface $config, |
95 | 95 | DependencyManagerInterface $dependencies |
96 | 96 | ) { |
97 | - $this->processConfig( $config ); |
|
97 | + $this->processConfig($config); |
|
98 | 98 | |
99 | - if ( ! $this->hasConfigKey( self::KEY_TAGS ) ) { |
|
99 | + if ( ! $this->hasConfigKey(self::KEY_TAGS)) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function init_shortcodes() { |
114 | 114 | |
115 | - foreach ( $this->getConfigKey( self::KEY_TAGS ) as $tag => $config ) { |
|
116 | - $this->init_shortcode( $tag ); |
|
115 | + foreach ($this->getConfigKey(self::KEY_TAGS) as $tag => $config) { |
|
116 | + $this->init_shortcode($tag); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $tag The tag of the shortcode to register. |
126 | 126 | */ |
127 | - protected function init_shortcode( $tag ) { |
|
128 | - $shortcode_class = $this->get_shortcode_class( $tag ); |
|
129 | - $shortcode_atts_parser = $this->get_shortcode_atts_parser_class( $tag ); |
|
127 | + protected function init_shortcode($tag) { |
|
128 | + $shortcode_class = $this->get_shortcode_class($tag); |
|
129 | + $shortcode_atts_parser = $this->get_shortcode_atts_parser_class($tag); |
|
130 | 130 | |
131 | 131 | $atts_parser = new $shortcode_atts_parser( |
132 | - $this->config->getSubConfig( self::KEY_TAGS, $tag ) |
|
132 | + $this->config->getSubConfig(self::KEY_TAGS, $tag) |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | $this->shortcodes[] = new $shortcode_class( |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | $this->dependencies |
140 | 140 | ); |
141 | 141 | |
142 | - if ( $this->hasConfigKey( self::KEY_TAGS, $tag, self::KEY_UI ) ) { |
|
143 | - $this->init_shortcode_ui( $tag ); |
|
142 | + if ($this->hasConfigKey(self::KEY_TAGS, $tag, self::KEY_UI)) { |
|
143 | + $this->init_shortcode_ui($tag); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | * @param string $tag Shortcode tag to get the class for. |
153 | 153 | * @return string Class name of the Shortcode. |
154 | 154 | */ |
155 | - protected function get_shortcode_class( $tag ) { |
|
156 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_CLASS ]; |
|
157 | - $shortcode_class = $this->hasConfigKey( $key ) |
|
158 | - ? $this->getConfigKey( $key ) |
|
155 | + protected function get_shortcode_class($tag) { |
|
156 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_CLASS]; |
|
157 | + $shortcode_class = $this->hasConfigKey($key) |
|
158 | + ? $this->getConfigKey($key) |
|
159 | 159 | : self::DEFAULT_SHORTCODE; |
160 | 160 | return $shortcode_class; |
161 | 161 | } |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | * @param string $tag Shortcode tag to get the class for. |
170 | 170 | * @return string Class name of the ShortcodeAttsParser. |
171 | 171 | */ |
172 | - protected function get_shortcode_atts_parser_class( $tag ) { |
|
173 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_ATTS_PARSER ]; |
|
174 | - $atts_parser = $this->hasConfigKey( $key ) |
|
175 | - ? $this->getConfigKey( $key ) |
|
172 | + protected function get_shortcode_atts_parser_class($tag) { |
|
173 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_ATTS_PARSER]; |
|
174 | + $atts_parser = $this->hasConfigKey($key) |
|
175 | + ? $this->getConfigKey($key) |
|
176 | 176 | : self::DEFAULT_SHORTCODE_ATTS_PARSER; |
177 | 177 | return $atts_parser; |
178 | 178 | } |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @param string $tag The tag of the shortcode to register the UI for. |
186 | 186 | */ |
187 | - protected function init_shortcode_ui( $tag ) { |
|
188 | - $shortcode_ui_class = $this->get_shortcode_ui_class( $tag ); |
|
187 | + protected function init_shortcode_ui($tag) { |
|
188 | + $shortcode_ui_class = $this->get_shortcode_ui_class($tag); |
|
189 | 189 | |
190 | 190 | $this->shortcode_uis[] = new $shortcode_ui_class( |
191 | 191 | $tag, |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | * @param string $tag Configuration settings. |
203 | 203 | * @return string Class name of the ShortcodeUI. |
204 | 204 | */ |
205 | - protected function get_shortcode_ui_class( $tag ) { |
|
206 | - $key = [ self::KEY_TAGS, $tag, self::KEY_CUSTOM_UI ]; |
|
207 | - $ui_class = $this->hasConfigKey( $key ) |
|
208 | - ? $this->getConfigKey( $key ) |
|
205 | + protected function get_shortcode_ui_class($tag) { |
|
206 | + $key = [self::KEY_TAGS, $tag, self::KEY_CUSTOM_UI]; |
|
207 | + $ui_class = $this->hasConfigKey($key) |
|
208 | + ? $this->getConfigKey($key) |
|
209 | 209 | : self::DEFAULT_SHORTCODE_UI; |
210 | 210 | return $ui_class; |
211 | 211 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @return void |
219 | 219 | */ |
220 | 220 | public function register() { |
221 | - array_walk( $this->shortcodes, function ( $shortcode ) { |
|
221 | + array_walk($this->shortcodes, function($shortcode) { |
|
222 | 222 | /** @var ShortcodeInterface $shortcode */ |
223 | 223 | $shortcode->register(); |
224 | 224 | } ); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // This hook only gets fired when Shortcode UI plugin is active. |
227 | 227 | \add_action( |
228 | 228 | 'register_shortcode_ui', |
229 | - [ $this, 'register_shortcode_ui', ] |
|
229 | + [$this, 'register_shortcode_ui', ] |
|
230 | 230 | ); |
231 | 231 | } |
232 | 232 | |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function register_shortcode_ui() { |
239 | 239 | $template = $this->get_page_template(); |
240 | - $context = [ 'page_template' => $template ]; |
|
240 | + $context = ['page_template' => $template]; |
|
241 | 241 | |
242 | - array_walk( $this->shortcode_uis, |
|
243 | - function ( $shortcode_ui ) use ( $context ) { |
|
242 | + array_walk($this->shortcode_uis, |
|
243 | + function($shortcode_ui) use ($context) { |
|
244 | 244 | /** @var ShortcodeUIInterface $shortcode_ui */ |
245 | - $shortcode_ui->register( $context ); |
|
245 | + $shortcode_ui->register($context); |
|
246 | 246 | } |
247 | 247 | ); |
248 | 248 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | protected function get_page_template() { |
258 | 258 | $template = str_replace( |
259 | - \trailingslashit( \get_stylesheet_directory() ), |
|
259 | + \trailingslashit(\get_stylesheet_directory()), |
|
260 | 260 | '', |
261 | 261 | \get_page_template() |
262 | 262 | ); |