PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 2.6.4
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v2.6.4
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | inc/layout/registry.php +7 -117 trunk → 2.6.4 View file →
@@ -23,9 +23,9 @@
23 23 * Supported component types.
24 24 *
25 25 * @var array
26 26 */
27 - private static $supported_component_types = [ 'layout', 'section','block','page','header','footer','templates' ];
27 + private static $supported_component_types = [ 'layout', 'section','block','page' ];
28 28
29 29 /**
30 30 * Required keys for components.
31 31 *
@@ -62,29 +62,8 @@
62 62 */
63 63 private static $pages = [];
64 64
65 65 /**
66 - * Holds the registered headers.
67 - *
68 - * @var array
69 - */
70 - private static $headers = [];
71 -
72 - /**
73 - * Holds the registered footers.
74 - *
75 - * @var array
76 - */
77 - private static $footers = [];
78 -
79 - /**
80 - * Holds the registered templates.
81 - *
82 - * @var array
83 - */
84 - private static $templates = [];
85 -
86 - /**
87 66 * The Component_Registry object.
88 67 *
89 68 * @var object Component_Registry
90 69 */
@@ -150,35 +129,13 @@
150 129 }
151 130 self::$blocks[ $data['key'] ] = $data;
152 131 break;
153 132
154 - case 'page':
155 - if ( ! empty( self::$pages[ $data['key'] ] ) ) {
156 - /* translators: %s: The component's unique key. */
157 - throw new InvalidArgumentException( sprintf( esc_html__( 'The %s section is already registered.', 'blockspare' ), $data['key'] ) );
158 - }
159 - self::$pages[ $data['key'] ] = $data;
160 - break;
161 - case 'header':
162 - if ( ! empty( self::$headers[ $data['key'] ] ) ) {
163 - /* translators: %s: The component's unique key. */
164 - throw new InvalidArgumentException( sprintf( esc_html__( 'The %s section is already registered.', 'blockspare' ), $data['key'] ) );
165 - }
166 - self::$pages[ $data['key'] ] = $data;
167 - break;
168 - case 'footer':
169 - if ( ! empty( self::$footers[ $data['key'] ] ) ) {
170 - /* translators: %s: The component's unique key. */
171 - throw new InvalidArgumentException( sprintf( esc_html__( 'The %s section is already registered.', 'blockspare' ), $data['key'] ) );
172 - }
173 - self::$pages[ $data['key'] ] = $data;
174 - break;
175 -
176 - case 'templates':
177 - if ( ! empty( self::$templates[ $data['key'] ] ) ) {
133 + case 'page':
134 + if ( ! empty( self::$pages[ $data['key'] ] ) ) {
178 135 /* translators: %s: The component's unique key. */
179 136 throw new InvalidArgumentException( sprintf( esc_html__( 'The %s section is already registered.', 'blockspare' ), $data['key'] ) );
180 - }
137 + }
181 138 self::$pages[ $data['key'] ] = $data;
182 139 break;
183 140
184 141 default:
@@ -234,37 +191,14 @@
234 191 }
235 192 unset( self::$blocks[ $key ] );
236 193 break;
237 194
238 - case 'page':
239 - if ( empty( self::$pages[ $key ] ) ) {
240 - /* translators: The requested components unique key. */
241 - throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
242 - }
243 - unset( self::$pages[ $key ] );
244 - break;
245 - case 'header':
246 - if ( empty( self::$headers[ $key ] ) ) {
247 - /* translators: The requested components unique key. */
248 - throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
249 - }
250 - unset( self::$headers[ $key ] );
251 - break;
252 -
253 - case 'footer':
254 - if ( empty( self::$footers[ $key ] ) ) {
255 - /* translators: The requested components unique key. */
256 - throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
257 - }
258 - unset( self::$footers[ $key ] );
259 - break;
260 -
261 - case 'templates':
262 - if ( empty( self::$templates[ $key ] ) ) {
195 + case 'page':
196 + if ( empty( self::$pages[ $key ] ) ) {
263 197 /* translators: The requested components unique key. */
264 198 throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
265 199 }
266 - unset( self::$templates[ $key ] );
200 + unset( self::$pages[ $key ] );
267 201 break;
268 202 }
269 203
270 204 }
@@ -314,30 +248,9 @@
314 248 /* translators: The requested components unique key. */
315 249 throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
316 250 }
317 251 return self::$pages[ $key ];
318 -
319 - case 'header':
320 - if ( empty( self::$headers[ $key ] ) ) {
321 - /* translators: The requested components unique key. */
322 - throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
323 - }
324 - return self::$headers[ $key ];
325 252
326 - case 'footer':
327 - if ( empty( self::$footers[ $key ] ) ) {
328 - /* translators: The requested components unique key. */
329 - throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
330 - }
331 - return self::$footers[ $key ];
332 -
333 - case 'templates':
334 - if ( empty( self::$templates[ $key ] ) ) {
335 - /* translators: The requested components unique key. */
336 - throw new Exception( sprintf( esc_html__( 'The %s section is not registered.', 'blockspare' ), $key ) );
337 - }
338 - return self::$templates[ $key ];
339 -
340 253 default:
341 254 /* translators: This function name. Will always be Blockspare\Layouts\Component_Registry::get(). */
342 255 throw new InvalidArgumentException( sprintf( esc_html__( 'You must supply a valid component type in %s.', 'blockspare' ), __METHOD__ ) );
343 256 }
@@ -377,29 +290,6 @@
377 290 * @return array
378 291 */
379 292 public static function pages() {
380 293 return self::$pages;
381 - }
382 -
383 - /**
384 - * Returns the registered headers.
385 - *
386 - * @return array
387 - */
388 - public static function headers() {
389 - return self::$headers;
390 - }
391 -
392 - /**
393 - * Returns the registered footers.
394 - *
395 - * @return array
396 - */
397 - public static function footers() {
398 - return self::$footers;
399 - }
400 -
401 -
402 - public static function templates() {
403 - return self::$templates;
404 294 }
405 295 }