| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.39 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2025 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\FB; |
| @@ -19,46 +19,13 @@ | ||
| 19 | 19 | class BoxBlocksParser |
| 20 | 20 | { |
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | - add_filter('render_block', [$this, 'parse_block'], 10, 2); | |
| 24 | - } | |
| 23 | + add_filter('render_block', [$this, 'maybe_load_block_extension_script'], 10, 2); | |
| 25 | 24 | |
| 26 | - /** | |
| 27 | - * Single entry point for all render_block work on this class. Bails immediately | |
| 28 | - * when the block carries none of our FireBox attributes, before any preg_ / | |
| 29 | - * get_post_type() work runs for every block on the page. | |
| 30 | - * | |
| 31 | - * @param string $block_content | |
| 32 | - * @param array $block | |
| 33 | - * | |
| 34 | - * @return string | |
| 35 | - */ | |
| 36 | - public function parse_block($block_content, $block) | |
| 37 | - { | |
| 38 | - if (empty($block['attrs']) || !$this->hasFireBoxAttrs($block['attrs'])) | |
| 39 | - { | |
| 40 | - return $block_content; | |
| 41 | - } | |
| 42 | - | |
| 43 | - $block_content = $this->maybe_load_block_extension_script($block_content, $block); | |
| 44 | - $block_content = $this->modify_block_output($block_content, $block); | |
| 45 | - | |
| 46 | - return $block_content; | |
| 25 | + add_filter('render_block', [$this, 'modify_block_output'], 10, 2); | |
| 47 | 26 | } |
| 48 | 27 | |
| 49 | - /** | |
| 50 | - * Whether the block's attributes contain any FireBox-specific key. | |
| 51 | - * | |
| 52 | - * @param array $attrs | |
| 53 | - * | |
| 54 | - * @return bool | |
| 55 | - */ | |
| 56 | - private function hasFireBoxAttrs($attrs) | |
| 57 | - { | |
| 58 | - return isset($attrs['dataFBoxOnClick']) || isset($attrs['dataFBoxOnClickURLAddParameters']); | |
| 59 | - } | |
| 60 | - | |
| 61 | 28 | public function maybe_load_block_extension_script($block_content, $block) |
| 62 | 29 | { |
| 63 | 30 | if (isset($block['attrs']['dataFBoxOnClick']) && in_array($block['attrs']['dataFBoxOnClick'], ['copy_clipboard', 'download_file'])) |
| 64 | 31 | { |
| @@ -82,12 +49,12 @@ | ||
| 82 | 49 | |
| 83 | 50 | /** |
| 84 | 51 | * Filters the block output by appending out custom data attributes |
| 85 | 52 | * on our supported blocks |
| 86 | - * | |
| 53 | + * | |
| 87 | 54 | * @param string $block_content |
| 88 | 55 | * @param array $block |
| 89 | - * | |
| 56 | + * | |
| 90 | 57 | * @return string |
| 91 | 58 | */ |
| 92 | 59 | public function modify_block_output($block_content, $block) |
| 93 | 60 | { |