| @@ -99,12 +99,9 @@ | ||
| 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 | - ), | |
| 103 | + 'hide_on_screen_size' => '', | |
| 107 | 104 | 'closable' => true, |
| 108 | 105 | ); |
| 109 | 106 | $box = $this; |
| 110 | 107 | |
| @@ -165,9 +162,9 @@ | ||
| 165 | 162 | |
| 166 | 163 | /** |
| 167 | 164 | * Get the content of this box |
| 168 | 165 | * |
| 169 | - * @return string | |
| 166 | + * @return mixed|void | |
| 170 | 167 | */ |
| 171 | 168 | public function get_content() { |
| 172 | 169 | $content = $this->content; |
| 173 | 170 | $box = $this; |
| @@ -181,8 +178,24 @@ | ||
| 181 | 178 | $content = apply_filters( 'boxzilla_box_content', $content, $box ); |
| 182 | 179 | return $content; |
| 183 | 180 | } |
| 184 | 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 | + | |
| 185 | 198 | /** |
| 186 | 199 | * Get options object for JS script. |
| 187 | 200 | * |
| 188 | 201 | * @return array |
| @@ -200,17 +213,8 @@ | ||
| 200 | 213 | $trigger['value'] = $this->options[ 'trigger_' . $this->options['trigger'] ]; |
| 201 | 214 | } |
| 202 | 215 | } |
| 203 | 216 | |
| 204 | - // build screenWidthCondition object (or null) | |
| 205 | - $screen_width_condition = null; | |
| 206 | - if( $box->options['screen_size_condition']['value'] > 0 ) { | |
| 207 | - $screen_width_condition = array( | |
| 208 | - 'condition' => $box->options['screen_size_condition']['condition'], | |
| 209 | - 'value' => intval( $box->options['screen_size_condition']['value'] ), | |
| 210 | - ); | |
| 211 | - } | |
| 212 | - | |
| 213 | 217 | $client_options = array( |
| 214 | 218 | 'id' => $box->ID, |
| 215 | 219 | 'icon' => $box->get_close_icon(), |
| 216 | 220 | 'content' => $box->get_content(), |
| @@ -222,9 +226,9 @@ | ||
| 222 | 226 | 'dismissed' => absint( $box->options['cookie']['dismissed'] ), |
| 223 | 227 | ), |
| 224 | 228 | 'rehide' => (bool) $box->options['auto_hide'], |
| 225 | 229 | 'position' => $box->options['css']['position'], |
| 226 | - 'screenWidthCondition' => $screen_width_condition, | |
| 230 | + 'minimumScreenWidth' => $box->get_minimum_screen_size(), | |
| 227 | 231 | 'closable' => $box->options['closable'], |
| 228 | 232 | 'post' => array( |
| 229 | 233 | 'id' => $this->post->ID, |
| 230 | 234 | 'title' => $this->post->post_title, |