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 +22 -30 3.1.173.1.9 View file →
@@ -99,14 +99,10 @@
99 99 'trigger_time_on_site' => 0,
100 100 'trigger_time_on_page' => 0,
101 101 'animation' => 'fade',
102 102 'auto_hide' => 0,
103 - 'screen_size_condition' => array(
104 - 'condition' => 'larger',
105 - 'value' => 0,
106 - ),
107 - 'closable' => 1,
108 - 'show_close_icon' => 1,
103 + 'hide_on_screen_size' => '',
104 + 'closable' => true,
109 105 );
110 106 $box = $this;
111 107
112 108 $options = get_post_meta( $this->ID, 'boxzilla_options', true );
@@ -111,9 +107,8 @@
111 107
112 108 $options = get_post_meta( $this->ID, 'boxzilla_options', true );
113 109 $options = is_array( $options ) ? $options : array();
114 110
115 -
116 111 // merge options with default options
117 112 $options = array_replace_recursive( $defaults, $options );
118 113
119 114 // allow others to filter the final array of options
@@ -150,12 +145,8 @@
150 145 * @return string
151 146 */
152 147 public function get_close_icon() {
153 148
154 - if( ! $this->options['show_close_icon'] ) {
155 - return '';
156 - }
157 -
158 149 $box = $this;
159 150 $html = '×';
160 151
161 152 /**
@@ -171,21 +162,15 @@
171 162
172 163 /**
173 164 * Get the content of this box
174 165 *
175 - * @return string
166 + * @return mixed|void
176 167 */
177 168 public function get_content() {
178 169 $content = $this->content;
179 170 $box = $this;
180 171
181 - // replace boxzilla specific shortcodes
182 - $close_link = sprintf('<a href="javascript:Boxzilla.dismiss(%d);">', $this->ID );
183 - $content = str_replace( '[boxzilla-close]', $close_link, $content );
184 - $content = str_replace( '[/boxzilla-close]', '</a>', $content );
185 -
186 -
187 - /**
172 + /**
188 173 * Filters the HTML for the box content
189 174 *
190 175 * @param string $content
191 176 * @param Box $box
@@ -193,8 +178,24 @@
193 178 $content = apply_filters( 'boxzilla_box_content', $content, $box );
194 179 return $content;
195 180 }
196 181
182 + /**
183 + * Get the minimum allowed screen size for this box
184 + *
185 + * @return int
186 + */
187 + public function get_minimum_screen_size() {
188 +
189 + if( $this->options['hide_on_screen_size'] > 0 ) {
190 + $minimum_screen_size = absint( $this->options['hide_on_screen_size'] );
191 + } else {
192 + $minimum_screen_size = 0;
193 + }
194 +
195 + return $minimum_screen_size;
196 + }
197 +
197 198 /**
198 199 * Get options object for JS script.
199 200 *
200 201 * @return array
@@ -212,17 +213,8 @@
212 213 $trigger['value'] = $this->options[ 'trigger_' . $this->options['trigger'] ];
213 214 }
214 215 }
215 216
216 - // build screenWidthCondition object (or null)
217 - $screen_width_condition = null;
218 - if( $box->options['screen_size_condition']['value'] > 0 ) {
219 - $screen_width_condition = array(
220 - 'condition' => $box->options['screen_size_condition']['condition'],
221 - 'value' => intval( $box->options['screen_size_condition']['value'] ),
222 - );
223 - }
224 -
225 217 $client_options = array(
226 218 'id' => $box->ID,
227 219 'icon' => $box->get_close_icon(),
228 220 'content' => $box->get_content(),
@@ -234,10 +226,10 @@
234 226 'dismissed' => absint( $box->options['cookie']['dismissed'] ),
235 227 ),
236 228 'rehide' => (bool) $box->options['auto_hide'],
237 229 'position' => $box->options['css']['position'],
238 - 'screenWidthCondition' => $screen_width_condition,
239 - 'closable' => !!$box->options['closable'],
230 + 'minimumScreenWidth' => $box->get_minimum_screen_size(),
231 + 'closable' => $box->options['closable'],
240 232 'post' => array(
241 233 'id' => $this->post->ID,
242 234 'title' => $this->post->post_title,
243 235 'slug' => $this->post->post_name,