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 +15 -17 3.1.113.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 }
@@ -614,9 +613,9 @@
614 613 *
615 614 * @return array
616 615 */
617 616 public function add_plugin_settings_link( $links, $slug ) {
618 - if ( $slug !== $this->plugin->slug() ) {
617 + if ( $slug !== $this->plugin->slug() || ! is_array( $links ) ) {
619 618 return $links;
620 619 }
621 620
622 621 $settings_link = '<a href="' . admin_url( 'edit.php?post_type=boxzilla-box' ) . '">' . __( 'Boxes' ) . '</a>';
@@ -654,9 +653,9 @@
654 653 public function flush_rules( $post_id ) {
655 654
656 655 // only act on our own post type
657 656 $post = get_post( $post_id );
658 - if ( $post instanceof WP_Post && $post->post_type !== 'boxzilla-box' ) {
657 + if ( ! $post instanceof WP_Post || $post->post_type !== 'boxzilla-box' ) {
659 658 return;
660 659 }
661 660
662 661 // get all published boxes
@@ -694,14 +693,13 @@
694 693 *
695 694 * @return array
696 695 */
697 696 protected function fetch_extensions() {
698 -
697 +
699 698 $extensions = get_transient( 'boxzilla_remote_extensions' );
700 699 if ( $extensions ) {
701 700 return $extensions;
702 701 }
703 -
704 702 $request = wp_remote_get( 'https://api.boxzillaplugin.com/v1/plugins' );
705 703
706 704 if ( is_wp_error( $request ) ) {
707 705 return array();
@@ -710,9 +708,9 @@
710 708 $response = wp_remote_retrieve_body( $request );
711 709 $response = json_decode( $response );
712 710
713 711 if ( is_array( $response->data ) ) {
714 - set_transient( 'boxzilla_remote_extensions', $response->data, HOUR_IN_SECONDS );
712 + set_transient( 'boxzilla_remote_extensions', $response->data, 24 * HOUR_IN_SECONDS );
715 713
716 714 return $response->data;
717 715 }
718 716