PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.3
Boxzilla – WordPress Popup Builder v3.1.3
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/admin/class-admin.php +26 -10 3.03.1.3 View file →
@@ -32,10 +32,11 @@
32 32 /**
33 33 * Initialise the all admin related stuff
34 34 */
35 35 public function init() {
36 +
36 37 // Load the plugin textdomain
37 - load_plugin_textdomain( 'boxzilla', null, $this->plugin->dir() . '/languages' );
38 + load_plugin_textdomain( 'boxzilla', null, basename( $this->plugin->dir() ) . '/languages' );
38 39
39 40 // action hooks
40 41 $this->add_hooks();
41 42 $this->run_migrations();
@@ -44,23 +45,36 @@
44 45 /**
45 46 * Add necessary hooks
46 47 */
47 48 protected function add_hooks() {
48 -
49 49 add_action( 'admin_init', array( $this, 'lazy_add_hooks' ) );
50 50 add_action( 'admin_init', array( $this, 'register' ) );
51 51 add_action( 'admin_menu', array( $this, 'menu' ) );
52 -
52 + add_action( 'admin_notices', array( $this, 'notices' ) );
53 53 add_action( 'save_post_boxzilla-box', array( $this, 'save_box_options' ), 20, 2 );
54 54 add_action( 'trashed_post', array( $this, 'flush_rules' ) );
55 55 add_action( 'untrashed_post', array( $this, 'flush_rules' ) );
56 + }
56 57
57 - // if a premium add-on is installed, instantiate dependencies
58 - if ( count( $this->boxzilla['plugins'] ) > 0 ) {
59 - $this->boxzilla['license_manager']->add_hooks();
60 - $this->boxzilla['update_manager']->add_hooks();
61 - $this->boxzilla['api_authenticator']->add_hooks();
58 + /**
59 + * All logic for admin notices lives here.
60 + */
61 + public function notices() {
62 + global $pagenow,
63 + $current_screen;
64 +
65 + if( ( $pagenow === 'plugins.php' || ( $current_screen && $current_screen->post_type === 'boxzilla-box' ) )
66 + && current_user_can( 'install_plugins' )
67 + && is_plugin_active( 'scroll-triggered-boxes/index.php' ) ) {
68 +
69 + $url = wp_nonce_url( 'plugins.php?action=deactivate&plugin=scroll-triggered-boxes/index.php', 'deactivate-plugin_' . 'scroll-triggered-boxes/index.php' );
70 + ?>
71 + <div class="notice notice-info">
72 + <p><?php printf( __( 'Awesome, you are using Boxzilla! You can now safely <a href="%s">deactivate the Scroll Triggered Boxes plugin</a>.', 'boxzilla' ), $url ); ?></p>
73 + </div>
74 + <?php
62 75 }
76 +
63 77 }
64 78
65 79 /**
66 80 * Checks current version against stored version & runs necessary update routines.
@@ -475,8 +489,9 @@
475 489 * @param array $rule
476 490 * @return array The sanitized rule array
477 491 */
478 492 public function sanitize_box_rule( $rule) {
493 +
479 494 $rule['value'] = trim( $rule['value'] );
480 495
481 496 // convert to array
482 497 $rule['value'] = explode( ',', trim( $rule['value'], ',' ) );
@@ -552,9 +567,10 @@
552 567 $opts = array_replace_recursive( $defaults, $opts );
553 568
554 569 $opts['rules'] = array_map( array( $this, 'sanitize_box_rule' ), $opts['rules'] );
555 570 $opts['css'] = $this->sanitize_box_css( $opts['css'] );
556 - $opts['cookie'] = absint( $opts['cookie'] );
571 + $opts['cookie']['triggered'] = absint( $opts['cookie']['triggered'] );
572 + $opts['cookie']['dismissed'] = absint( $opts['cookie']['dismissed'] );
557 573 $opts['trigger'] = sanitize_text_field( $opts['trigger'] );
558 574 $opts['trigger_percentage'] = absint( $opts['trigger_percentage'] );
559 575 $opts['trigger_element'] = sanitize_text_field( $opts['trigger_element'] );
560 576
@@ -634,9 +650,9 @@
634 650 $box_meta = get_post_meta( $box->ID, 'boxzilla_options', true );
635 651
636 652 // add box rules to all rules
637 653 $rules[ $box->ID ] = $box_meta['rules'];
638 - $rules[ $box->ID ]['comparision'] = $box_meta['rules_comparision'];
654 + $rules[ $box->ID ]['comparision'] = isset( $box_meta['rules_comparision'] ) ? $box_meta['rules_comparision'] : 'any';
639 655
640 656 }
641 657
642 658 }