| @@ -126,8 +126,10 @@ | ||
| 126 | 126 | break; |
| 127 | 127 | |
| 128 | 128 | case 'is_single': |
| 129 | 129 | case 'is_post': |
| 130 | + // convert to empty string if array with just empty string in it | |
| 131 | + $value = ( $value === array( '' ) ) ? '' : $value; | |
| 130 | 132 | $matched = is_single( $value ); |
| 131 | 133 | break; |
| 132 | 134 | |
| 133 | 135 | case 'is_post_in_category': |
| @@ -175,9 +177,9 @@ | ||
| 175 | 177 | foreach( $rules as $box_id => $box_rules ) { |
| 176 | 178 | |
| 177 | 179 | $matched = false; |
| 178 | 180 | $comparision = isset( $box_rules['comparision'] ) ? $box_rules['comparision'] : 'any'; |
| 179 | - | |
| 181 | + | |
| 180 | 182 | // loop through all rules for all boxes |
| 181 | 183 | foreach ( $box_rules as $rule ) { |
| 182 | 184 | |
| 183 | 185 | // skip faulty values (and comparision rule) |
| @@ -233,19 +235,10 @@ | ||
| 233 | 235 | * Load plugin styles |
| 234 | 236 | */ |
| 235 | 237 | public function load_assets() { |
| 236 | 238 | $pre_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 239 | + wp_enqueue_script('boxzilla', $this->plugin->url('/assets/js/script' . $pre_suffix . '.js' ), array(), $this->plugin->version(), true ); | |
| 237 | 240 | |
| 238 | - // stylesheets | |
| 239 | - wp_register_style( 'boxzilla', $this->plugin->url( '/assets/css/styles' . $pre_suffix . '.css' ), array(), $this->plugin->version() ); | |
| 240 | - | |
| 241 | - // scripts | |
| 242 | - wp_register_script( 'boxzilla',$this->plugin->url( '/assets/js/script' . $pre_suffix . '.js' ), array( 'jquery' ), $this->plugin->version(), true ); | |
| 243 | - | |
| 244 | - // Finally, enqueue style. | |
| 245 | - wp_enqueue_style( 'boxzilla' ); | |
| 246 | - wp_enqueue_script( 'boxzilla' ); | |
| 247 | - | |
| 248 | 241 | $this->pass_box_options(); |
| 249 | 242 | |
| 250 | 243 | do_action( 'boxzilla_load_assets', $this ); |
| 251 | 244 | } |
| @@ -293,9 +286,9 @@ | ||
| 293 | 286 | $plugin_options = $this->options; |
| 294 | 287 | $boxes = $this->get_matched_boxes(); |
| 295 | 288 | |
| 296 | 289 | $data = array( |
| 297 | - 'testMode' => (boolean) $plugin_options['test_mode'], | |
| 290 | + 'testMode' => (bool) $plugin_options['test_mode'], | |
| 298 | 291 | 'boxes' => array_map( function(Box $box) { return $box->get_client_options(); }, $boxes ), |
| 299 | 292 | ); |
| 300 | 293 | |
| 301 | 294 | wp_localize_script( 'boxzilla', 'boxzilla_options', $data ); |