PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.9
Boxzilla – WordPress Popup Builder v3.1.9
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | src/class-box.php +33 -5 3.03.1.9 View file →
@@ -30,8 +30,13 @@
30 30 * @var bool
31 31 */
32 32 public $enabled = false;
33 33
34 + /**
35 + * @var WP_Post
36 + */
37 + private $post;
38 +
34 39 /**
35 40 * @param WP_Post|int $post
36 41 */
37 42 public function __construct( $post ) {
@@ -40,8 +45,11 @@
40 45 if( ! $post instanceof WP_Post ) {
41 46 $post = get_post( $post );
42 47 }
43 48
49 + // store ref to post
50 + $this->post = $post;
51 +
44 52 // store ID in property for quick access
45 53 $this->ID = $post->ID;
46 54
47 55 // store title in property
@@ -74,12 +82,18 @@
74 82 'border_style' => '',
75 83 'position' => 'bottom-right',
76 84 ),
77 85 'rules' => array(
78 - 0 => array('condition' => '', 'value' => '')
86 + 0 => array(
87 + 'condition' => '',
88 + 'value' => '',
89 + ),
79 90 ),
80 91 'rules_comparision' => 'any',
81 - 'cookie' => 0,
92 + 'cookie' => array(
93 + 'triggered' => 0,
94 + 'dismissed' => 0,
95 + ),
82 96 'trigger' => 'percentage',
83 97 'trigger_percentage' => 65,
84 98 'trigger_element' => '',
85 99 'trigger_time_on_site' => 0,
@@ -180,16 +194,22 @@
180 194
181 195 return $minimum_screen_size;
182 196 }
183 197
198 + /**
199 + * Get options object for JS script.
200 + *
201 + * @return array
202 + */
184 203 public function get_client_options() {
185 204 $box = $this;
186 205
187 206 $trigger = false;
188 207 if( $box->options['trigger'] ) {
208 + $trigger = array(
209 + 'method' => $this->options['trigger']
210 + );
189 211
190 - $trigger = array( 'method' => $this->options['trigger'] );
191 -
192 212 if( isset( $this->options[ 'trigger_' . $this->options['trigger'] ] ) ) {
193 213 $trigger['value'] = $this->options[ 'trigger_' . $this->options['trigger'] ];
194 214 }
195 215 }
@@ -200,13 +220,21 @@
200 220 'content' => $box->get_content(),
201 221 'css' => array_filter( $box->options['css'] ),
202 222 'trigger' => $trigger,
203 223 'animation' => $box->options['animation'],
204 - 'cookieTime' => absint( $box->options['cookie'] ),
224 + 'cookie' => array(
225 + 'triggered' => absint( $box->options['cookie']['triggered'] ),
226 + 'dismissed' => absint( $box->options['cookie']['dismissed'] ),
227 + ),
205 228 'rehide' => (bool) $box->options['auto_hide'],
206 229 'position' => $box->options['css']['position'],
207 230 'minimumScreenWidth' => $box->get_minimum_screen_size(),
208 231 'closable' => $box->options['closable'],
232 + 'post' => array(
233 + 'id' => $this->post->ID,
234 + 'title' => $this->post->post_title,
235 + 'slug' => $this->post->post_name,
236 + ),
209 237 );
210 238
211 239 /**
212 240 * Filter the final options for the JS Boxzilla client.