PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.39
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.39
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/FB/Boxes.php +53 -30 1.0.132.1.39 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.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 © 2022 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;
@@ -21,31 +21,8 @@
21 21
22 22 class Boxes
23 23 {
24 24 /**
25 - * A box instance
26 - *
27 - * @var Box
28 - */
29 - protected $box;
30 -
31 - /**
32 - * Factory
33 - *
34 - * @var Factory
35 - */
36 - protected $factory;
37 -
38 - public function __construct($box = null, $factory = null)
39 - {
40 - if (!$factory)
41 - {
42 - $factory = new \FPFramework\Base\Factory();
43 - }
44 - $this->factory = $factory;
45 - }
46 -
47 - /**
48 25 * Render boxes
49 26 *
50 27 * @return string
51 28 */
@@ -68,16 +45,62 @@
68 45 */
69 46 public function renderAll($boxes)
70 47 {
71 48 $html = '';
72 -
73 - foreach ($boxes as $box)
49 +
50 + if ($boxes instanceof \WP_Query)
74 51 {
75 - $this->prepare($box);
52 + if (!$boxes->have_posts())
53 + {
54 + return;
55 + }
56 +
57 + // Backup global state
58 + global $post, $authordata;
59 + $originalPost = $post;
60 + $originalAuthorData = $authordata;
61 +
62 + // Setup the post data for our custom query
63 + while ($boxes->have_posts())
64 + {
65 + $boxes->the_post();
76 66
77 - $html .= $this->get_output($box);
67 + global $post;
68 +
69 + $this->prepare($post);
70 +
71 + // If the mode is embed, abort.
72 + if ($post->params->get('mode') == 'embed')
73 + {
74 + continue;
75 + }
76 +
77 + $html .= $this->get_output($post);
78 + }
79 +
80 + // Reset post data
81 + wp_reset_postdata();
82 +
83 + // Restore global state
84 + $post = $originalPost;
85 + $authordata = $originalAuthorData;
78 86 }
87 + else if (is_array($boxes))
88 + {
89 + foreach ($boxes as $box)
90 + {
91 + $this->prepare($box);
92 +
93 + // If the mode is embed, abort.
94 + if ($box->params->get('mode') == 'embed')
95 + {
96 + continue;
97 + }
79 98
99 + $html .= $this->get_output($box);
100 + }
101 + }
102 +
80 103 return $html;
81 104 }
82 105
83 106 /**
@@ -112,7 +135,7 @@
112 135 {
113 136 return '';
114 137 }
115 138
116 - return firebox()->box->render($box);
139 + return firebox()->box->setBox($box)->render();
117 140 }
118 141 }