PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.0.6
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.0.6
3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 122 releases
← All changes | Inc/Core/Blocks/FireBox.php +30 -82 1.0.22.0.6 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.2 Free
4 + * @version 2.0.6 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 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\Blocks;
@@ -15,105 +15,53 @@
15 15 {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 -class FireBox
19 +class FireBox extends Block
20 20 {
21 - public function __construct()
22 - {
23 - if (!$this->canRun())
24 - {
25 - return;
26 - }
27 -
28 - // set custom gutenberg block category
29 - add_filter('block_categories', [$this, 'set_custom_block_category'], 10, 2);
30 -
31 - // load gutenberg block js
32 - add_action('admin_enqueue_scripts', [$this, 'registerMedia']);
33 -
34 - // register gutenberg block type
35 - register_block_type('fireplugins/firebox', array(
36 - 'editor_script' => 'fb-gutenberg-block',
37 - ));
38 - }
39 -
40 21 /**
41 - * Whether we can run
22 + * Keep the old namespace for this block.
23 + */
24 + protected $namespace = 'fireplugins';
25 +
26 + /**
27 + * Block identifier.
42 28 *
43 - * @return boolean
29 + * @var string
44 30 */
45 - private function canRun()
46 - {
47 - if (!current_user_can('manage_options') || !current_user_can('edit_posts') || !current_user_can('edit_pages'))
48 - {
49 - return false;
50 - }
31 + protected $name = 'firebox';
51 32
52 - global $pagenow;
53 - if (!in_array($pagenow, ['post.php', 'post-new.php', 'index.php']))
54 - {
55 - return false;
56 - }
57 -
58 - return true;
59 - }
60 -
61 33 /**
62 - * Adds custom gutenberg block category
34 + * Block script.
63 35 *
64 - * @param array $categories
65 - * @param object $post
36 + * @var string
37 + */
38 + protected $editor_script = 'fb-block-firebox';
39 +
40 + /**
41 + * Keywords that will be used in search results.
66 42 *
67 - * @return array
43 + * @var array
68 44 */
69 - public function set_custom_block_category($categories, $post)
70 - {
71 - // check fireplugins does not exist
72 - foreach ($categories as $cat)
73 - {
74 - if ($cat['slug'] == 'fireplugins')
75 - {
76 - return $categories;
77 - }
78 - }
45 + protected $keywords = [
46 + 'popup',
47 + 'pop up',
48 + 'optin',
49 + 'box'
50 + ];
79 51
80 - return array_merge(
81 - $categories,
82 - array(
83 - array(
84 - 'slug' => 'fireplugins',
85 - 'title' => fpframework()->_('FPF_NAME')
86 - ),
87 - )
88 - );
89 - }
90 -
91 52 /**
92 - * Adds block media
53 + * Registers block assets.
93 54 *
94 55 * @return void
95 56 */
96 - public function registerMedia()
57 + public function assets()
97 58 {
98 - // load gutenberg block js
99 59 wp_register_script(
100 - 'fb-gutenberg-block',
101 - FBOX_MEDIA_ADMIN_URL . 'js/fb_gutenberg_block.js',
60 + 'fb-block-firebox',
61 + FBOX_MEDIA_ADMIN_URL . 'js/blocks/firebox.js',
102 62 ['wp-i18n', 'wp-blocks', 'wp-editor', 'wp-components', 'wp-api-fetch'],
103 63 FBOX_VERSION,
104 - false
64 + true
105 65 );
106 - wp_enqueue_script( 'fb-gutenberg-block' );
107 -
108 - // load gutenberg block button extend js
109 - wp_register_script(
110 - 'fb-admin-block-button-extend',
111 - FBOX_MEDIA_ADMIN_URL . 'js/fb_block_button_extend.js',
112 - [],
113 - FBOX_VERSION,
114 - false
115 - );
116 - wp_enqueue_script( 'fb-admin-block-button-extend' );
117 66 }
118 -
119 67 }