PluginProbe
Boxzilla – WordPress Popup Builder / 3.2
Boxzilla – WordPress Popup Builder v3.2
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 +16 -17 3.1.103.2 View file →
@@ -155,10 +155,11 @@
155 155 * @param $column
156 156 * @param $post_id
157 157 */
158 158 public function post_type_column_content( $column, $post_id ) {
159 - if ( method_exists( $this, 'post_type_column_' . $column . '_content' ) ) {
160 - call_user_func( array( $this, 'post_type_column_' . $column . '_content' ), $post_id );
159 + $method_name = 'post_type_column_' . $column . '_content';
160 + if ( method_exists( $this, $method_name ) ) {
161 + call_user_func( array( $this, $method_name ), $post_id );
161 162 }
162 163 }
163 164
164 165 /**
@@ -236,9 +237,9 @@
236 237 /**
237 238 * Shows the extensions page
238 239 */
239 240 public function show_extensions_page() {
240 - $extensions = $this->fetch_extensions();
241 + $extensions = $this->fetch_extensions();
241 242 require __DIR__ . '/views/extensions.php';
242 243 }
243 244
244 245 /**
@@ -292,9 +293,8 @@
292 293 return false;
293 294 }
294 295
295 296 if ( $screen->base === 'edit' && $screen->post_type === 'boxzilla-box' ) {
296 - // load stylesheets
297 297 wp_enqueue_style( 'boxzilla-admin' );
298 298 }
299 299
300 300 if ( $screen->base === 'post' && $screen->post_type === 'boxzilla-box' ) {
@@ -303,16 +303,16 @@
303 303
304 304 // load scripts
305 305 wp_enqueue_script( 'boxzilla-admin' );
306 306
307 - wp_localize_script( 'boxzilla-admin' ,'boxzilla_i18n', array(
308 - 'enterCommaSeparatedValues' => __( 'Enter a comma-separated list of values.', 'boxzilla' ),
309 - 'enterCommaSeparatedPosts' => __( "Enter a comma-separated list of post slugs or post ID's..", 'boxzilla' ),
310 - 'enterCommaSeparatedPages' => __( "Enter a comma-separated list of page slugs or page ID's..", 'boxzilla' ),
311 - 'enterCommaSeparatedPostTypes' => __( "Enter a comma-separated list of post types..", 'boxzilla' ),
312 - 'enterCommaSeparatedRelativeUrls' => __( "Enter a comma-separated list of relative URL's, eg /contact/", 'boxzilla' ),
313 - )
307 + $data = array(
308 + 'enterCommaSeparatedValues' => __( 'Enter a comma-separated list of values.', 'boxzilla' ),
309 + 'enterCommaSeparatedPosts' => __( "Enter a comma-separated list of post slugs or post ID's..", 'boxzilla' ),
310 + 'enterCommaSeparatedPages' => __( "Enter a comma-separated list of page slugs or page ID's..", 'boxzilla' ),
311 + 'enterCommaSeparatedPostTypes' => __( "Enter a comma-separated list of post types..", 'boxzilla' ),
312 + 'enterCommaSeparatedRelativeUrls' => __( "Enter a comma-separated list of relative URL's, eg /contact/", 'boxzilla' ),
314 313 );
314 + wp_localize_script( 'boxzilla-admin' ,'boxzilla_i18n', $data );
315 315
316 316 // load stylesheets
317 317 wp_enqueue_style( 'boxzilla-admin' );
318 318
@@ -320,9 +320,8 @@
320 320 do_action( 'boxzilla_load_admin_assets' );
321 321 }
322 322
323 323 if ( isset( $_GET['page'] ) && $_GET['page'] === 'boxzilla-settings' ) {
324 - // load stylesheets
325 324 wp_enqueue_style( 'boxzilla-admin' );
326 325 }
327 326
328 327 }
@@ -600,8 +599,9 @@
600 599 $opts['cookie']['dismissed'] = absint( $opts['cookie']['dismissed'] );
601 600 $opts['trigger'] = sanitize_text_field( $opts['trigger'] );
602 601 $opts['trigger_percentage'] = absint( $opts['trigger_percentage'] );
603 602 $opts['trigger_element'] = sanitize_text_field( $opts['trigger_element'] );
603 + $opts['screen_size_condition']['value'] = intval( $opts['screen_size_condition']['value'] );
604 604
605 605 return $opts;
606 606 }
607 607
@@ -613,9 +613,9 @@
613 613 *
614 614 * @return array
615 615 */
616 616 public function add_plugin_settings_link( $links, $slug ) {
617 - if ( $slug !== $this->plugin->slug() ) {
617 + if ( $slug !== $this->plugin->slug() || ! is_array( $links ) ) {
618 618 return $links;
619 619 }
620 620
621 621 $settings_link = '<a href="' . admin_url( 'edit.php?post_type=boxzilla-box' ) . '">' . __( 'Boxes' ) . '</a>';
@@ -653,9 +653,9 @@
653 653 public function flush_rules( $post_id ) {
654 654
655 655 // only act on our own post type
656 656 $post = get_post( $post_id );
657 - if ( $post instanceof WP_Post && $post->post_type !== 'boxzilla-box' ) {
657 + if ( ! $post instanceof WP_Post || $post->post_type !== 'boxzilla-box' ) {
658 658 return;
659 659 }
660 660
661 661 // get all published boxes
@@ -693,14 +693,13 @@
693 693 *
694 694 * @return array
695 695 */
696 696 protected function fetch_extensions() {
697 -
697 +
698 698 $extensions = get_transient( 'boxzilla_remote_extensions' );
699 699 if ( $extensions ) {
700 700 return $extensions;
701 701 }
702 -
703 702 $request = wp_remote_get( 'https://api.boxzillaplugin.com/v1/plugins' );
704 703
705 704 if ( is_wp_error( $request ) ) {
706 705 return array();
@@ -709,9 +708,9 @@
709 708 $response = wp_remote_retrieve_body( $request );
710 709 $response = json_decode( $response );
711 710
712 711 if ( is_array( $response->data ) ) {
713 - set_transient( 'boxzilla_remote_extensions', $response->data, HOUR_IN_SECONDS );
712 + set_transient( 'boxzilla_remote_extensions', $response->data, 24 * HOUR_IN_SECONDS );
714 713
715 714 return $response->data;
716 715 }
717 716