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 -36 3.1.183.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,27 +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 -
184 - $replacements = array(
185 - '[boxzilla_close]' => $close_link, // accept underscore and dash here for consistency with other shortcode
186 - '[boxzilla-close]' => $close_link,
187 - '[/boxzilla_close]' => '</a>',
188 - '[/boxzilla-close]' => '</a>',
189 - );
190 -
191 - $content = str_replace( array_keys( $replacements ), array_values( $replacements ), $content );
192 -
193 - /**
172 + /**
194 173 * Filters the HTML for the box content
195 174 *
196 175 * @param string $content
197 176 * @param Box $box
@@ -199,8 +178,24 @@
199 178 $content = apply_filters( 'boxzilla_box_content', $content, $box );
200 179 return $content;
201 180 }
202 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 +
203 198 /**
204 199 * Get options object for JS script.
205 200 *
206 201 * @return array
@@ -218,17 +213,8 @@
218 213 $trigger['value'] = $this->options[ 'trigger_' . $this->options['trigger'] ];
219 214 }
220 215 }
221 216
222 - // build screenWidthCondition object (or null)
223 - $screen_width_condition = null;
224 - if( $box->options['screen_size_condition']['value'] > 0 ) {
225 - $screen_width_condition = array(
226 - 'condition' => $box->options['screen_size_condition']['condition'],
227 - 'value' => intval( $box->options['screen_size_condition']['value'] ),
228 - );
229 - }
230 -
231 217 $client_options = array(
232 218 'id' => $box->ID,
233 219 'icon' => $box->get_close_icon(),
234 220 'content' => $box->get_content(),
@@ -240,10 +226,10 @@
240 226 'dismissed' => absint( $box->options['cookie']['dismissed'] ),
241 227 ),
242 228 'rehide' => (bool) $box->options['auto_hide'],
243 229 'position' => $box->options['css']['position'],
244 - 'screenWidthCondition' => $screen_width_condition,
245 - 'closable' => !!$box->options['closable'],
230 + 'minimumScreenWidth' => $box->get_minimum_screen_size(),
231 + 'closable' => $box->options['closable'],
246 232 'post' => array(
247 233 'id' => $this->post->ID,
248 234 'title' => $this->post->post_title,
249 235 'slug' => $this->post->post_name,