| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.1.1 Free | |
| 4 | + * @version 2.0.12 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2022 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2023 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core; |
| @@ -27,9 +27,17 @@ | ||
| 27 | 27 | |
| 28 | 28 | add_action('enqueue_block_editor_assets', [$this, 'blocks_assets']); |
| 29 | 29 | |
| 30 | 30 | // Register categories |
| 31 | - add_filter('block_categories_all', [$this, 'register_categories'], 10, 2); | |
| 31 | + global $wp_version; | |
| 32 | + if (version_compare($wp_version, '5.8', '>=')) | |
| 33 | + { | |
| 34 | + add_action('block_categories_all', [$this, 'register_categories'], 10, 2); | |
| 35 | + } | |
| 36 | + else | |
| 37 | + { | |
| 38 | + add_action('block_categories', [$this, 'register_categories'], 10, 2); | |
| 39 | + } | |
| 32 | 40 | |
| 33 | 41 | $this->register_blocks(); |
| 34 | 42 | } |
| 35 | 43 | |
| @@ -79,9 +87,9 @@ | ||
| 79 | 87 | $ds = DIRECTORY_SEPARATOR; |
| 80 | 88 | |
| 81 | 89 | $base_dir = implode($ds, [__DIR__, 'Blocks']); |
| 82 | 90 | |
| 83 | - $files = array_diff(scandir($base_dir), ['.', '..', 'index.php', 'Block.php']); | |
| 91 | + $files = array_diff(scandir($base_dir), ['.', '..', '.DS_Store', 'index.php', 'Block.php']); | |
| 84 | 92 | |
| 85 | 93 | $namespace = '\FireBox\Core\Blocks\\'; |
| 86 | 94 | |
| 87 | 95 | foreach ($files as $item) |