Nimble Page Builder - Version 1.8.19

Version Description

Added informations in relevant admin screens when the current post/page has been built with Nimble.

=

Download this release

Release Info

Developer nikeo
Plugin Icon 128x128 Nimble Page Builder
Version 1.8.19
Comparing to
See all releases

Code changes from version 1.8.18 to 1.8.19

inc/admin/nimble-admin.php CHANGED
@@ -624,7 +624,6 @@ function sek_print_js_for_nimble_edit_btn() {
624
  $('body').on( 'click', '#sek-edit-with-nimble', function(evt) {
625
  evt.preventDefault();
626
  var _url = $(this).data('cust-url');
627
-
628
  if ( _.isEmpty( _url ) ) {
629
  var post_id = $('#post_ID').val();
630
  wp.ajax.post( 'sek_get_customize_url_for_nimble_edit_button', {
@@ -647,7 +646,9 @@ function sek_print_js_for_nimble_edit_btn() {
647
  <?php
648
  }
649
  function sek_print_nb_btn_edit_with_nimble( $editor_type ) {
650
- $customize_url = sek_get_customize_url_when_is_admin();
 
 
651
  if ( ! empty( $customize_url ) ) {
652
  $customize_url = add_query_arg(
653
  array( 'autofocus' => array( 'section' => '__content_picker__' ) ),
@@ -660,7 +661,7 @@ function sek_print_nb_btn_edit_with_nimble( $editor_type ) {
660
  <?php //_e( 'Edit with Nimble Builder', 'text_doma' ); ?>
661
  <?php printf( '<span class="sek-nimble-icon" title="%3$s"><img src="%1$s" alt="%2$s"/><span class="sek-nimble-admin-bar-title">%2$s</span><span class="sek-nimble-mobile-admin-bar-title">%3$s</span></span>',
662
  NIMBLE_BASE_URL.'/assets/img/nimble/nimble_icon.svg?ver='.NIMBLE_VERSION,
663
- __('Build with Nimble Builder','nimble-builder'),
664
  __('Build','nimble-builder'),
665
  __('Build sections in live preview with Nimble Builder', 'nimble-builder')
666
  ); ?>
@@ -689,4 +690,24 @@ function sek_current_user_can_edit( $post_id = 0 ) {
689
  return false;
690
  }
691
  return true;
692
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  $('body').on( 'click', '#sek-edit-with-nimble', function(evt) {
625
  evt.preventDefault();
626
  var _url = $(this).data('cust-url');
 
627
  if ( _.isEmpty( _url ) ) {
628
  var post_id = $('#post_ID').val();
629
  wp.ajax.post( 'sek_get_customize_url_for_nimble_edit_button', {
646
  <?php
647
  }
648
  function sek_print_nb_btn_edit_with_nimble( $editor_type ) {
649
+ $post = get_post();
650
+ $manually_built_skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . 'post_' . $post->post_type . '_' . $post->ID );
651
+ $customize_url = sek_get_customize_url_when_is_admin( $post );
652
  if ( ! empty( $customize_url ) ) {
653
  $customize_url = add_query_arg(
654
  array( 'autofocus' => array( 'section' => '__content_picker__' ) ),
661
  <?php //_e( 'Edit with Nimble Builder', 'text_doma' ); ?>
662
  <?php printf( '<span class="sek-nimble-icon" title="%3$s"><img src="%1$s" alt="%2$s"/><span class="sek-nimble-admin-bar-title">%2$s</span><span class="sek-nimble-mobile-admin-bar-title">%3$s</span></span>',
663
  NIMBLE_BASE_URL.'/assets/img/nimble/nimble_icon.svg?ver='.NIMBLE_VERSION,
664
+ sek_local_skope_has_nimble_sections( $manually_built_skope_id ) ? __('Continue building with Nimble','nimble-builder') : __('Build with Nimble Builder','nimble-builder'),
665
  __('Build','nimble-builder'),
666
  __('Build sections in live preview with Nimble Builder', 'nimble-builder')
667
  ); ?>
690
  return false;
691
  }
692
  return true;
693
+ }
694
+ add_filter( 'display_post_states', '\Nimble\sek_add_nimble_post_state', 10, 2 );
695
+ function sek_add_nimble_post_state( $post_states, $post ) {
696
+ $manually_built_skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . 'post_' . $post->post_type . '_' . $post->ID );
697
+ if ( $post && current_user_can( 'edit_post', $post->ID ) && sek_local_skope_has_nimble_sections( $manually_built_skope_id ) ) {
698
+ $post_states['nimble'] = __( 'Nimble Builder', 'nimble-builder' );
699
+ }
700
+ return $post_states;
701
+ }
702
+ add_filter( 'post_row_actions', '\Nimble\sek_filter_post_row_actions', 11, 2 );
703
+ add_filter( 'page_row_actions', '\Nimble\sek_filter_post_row_actions', 11, 2 );
704
+ function sek_filter_post_row_actions( $actions, $post ) {
705
+ $manually_built_skope_id = strtolower( NIMBLE_SKOPE_ID_PREFIX . 'post_' . $post->post_type . '_' . $post->ID );
706
+ if ( $post && current_user_can( 'edit_post', $post->ID ) && sek_local_skope_has_nimble_sections( $manually_built_skope_id ) ) {
707
+ $actions['edit_with_nimble_builder'] = sprintf( '<a href="%1$s" title="%2$s">%2$s</a>',
708
+ sek_get_customize_url_for_post_id( $post->ID ),
709
+ __( 'Edit with Nimble Builder', 'nimble-builder' )
710
+ );
711
+ }
712
+ return $actions;
713
+ }
inc/sektions/ccat-sektions.php CHANGED
@@ -165,7 +165,7 @@ function sek_get_default_location_model( $skope_id = null ) {
165
  //@return string
166
  function sek_get_seks_setting_id( $skope_id = '' ) {
167
  if ( empty( $skope_id ) ) {
168
- sek_error_log( 'sek_get_seks_setting_id => empty skope id or location => collection setting id impossible to build' );
169
  }
170
  return NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . "[{$skope_id}]";
171
  }
@@ -180,6 +180,18 @@ function sek_has_global_sections() {
180
  }
181
 
182
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
 
185
 
@@ -2457,13 +2469,12 @@ function sek_add_customize_link() {
2457
 
2458
  // returns a customize link when is_admin() for posts and terms
2459
  // inspired from wp-includes/admin-bar.php#wp_admin_bar_edit_menu()
2460
- function sek_get_customize_url_when_is_admin( $ajax_server_request_uri = '') {
 
2461
  global $tag, $user_id;
2462
-
2463
  $customize_url = '';
2464
-
2465
  $current_screen = get_current_screen();
2466
- $post = get_post();
2467
 
2468
  // July 2019 => Don't display the admin button in post and pages, where we already have the edit button next to the post title
2469
  // if ( 'post' == $current_screen->base
@@ -2511,6 +2522,28 @@ function sek_get_customize_url_when_is_admin( $ajax_server_request_uri = '') {
2511
  return $customize_url;
2512
  }
2513
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2514
  ?><?php
2515
  // fired @wp_loaded
2516
  // Note : if fired @plugins_loaded, invoking wp_update_post() generates php notices
@@ -15779,21 +15812,8 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
15779
 
15780
  // Build customize_url
15781
  // @see function sek_get_customize_url_when_is_admin()
15782
- $ajax_server_request_uri = "/wp-admin/post.php?post={$post_id}&action=edit";
15783
- $customize_url = get_permalink( $post_id );
15784
- $return_customize_url = add_query_arg(
15785
- 'return',
15786
- urlencode(
15787
- remove_query_arg( wp_removable_query_args(), wp_unslash( $ajax_server_request_uri ) )
15788
- ),
15789
- wp_customize_url()
15790
- );
15791
- $customize_url = add_query_arg( 'url', urlencode( $customize_url ), $return_customize_url );
15792
- $customize_url = add_query_arg(
15793
- array( 'autofocus' => array( 'section' => '__content_picker__' ) ),
15794
- $customize_url
15795
- );
15796
-
15797
  wp_send_json_success( $customize_url );
15798
  }
15799
 
165
  //@return string
166
  function sek_get_seks_setting_id( $skope_id = '' ) {
167
  if ( empty( $skope_id ) ) {
168
+ sek_error_log( __FUNCTION__ . ' => empty skope id or location => collection setting id impossible to build' );
169
  }
170
  return NIMBLE_OPT_PREFIX_FOR_SEKTION_COLLECTION . "[{$skope_id}]";
171
  }
180
  }
181
 
182
 
183
+ // @return bool
184
+ // added for https://github.com/presscustomizr/nimble-builder/issues/436
185
+ // initially used to determine if a post or a page has been customized with Nimble Builder => if so, we add an edit link in the post/page list
186
+ // when used in admin, the skope_id must be provided
187
+ function sek_local_skope_has_nimble_sections( $skope_id = '' ) {
188
+ if ( empty( $skope_id ) ) {
189
+ sek_error_log( __FUNCTION__ . ' => missing skope id' );
190
+ return false;
191
+ }
192
+ $post = sek_get_seks_post( $skope_id );
193
+ return $post ? true : false;
194
+ }
195
 
196
 
197
 
2469
 
2470
  // returns a customize link when is_admin() for posts and terms
2471
  // inspired from wp-includes/admin-bar.php#wp_admin_bar_edit_menu()
2472
+ // @param $post is a post object
2473
+ function sek_get_customize_url_when_is_admin( $post = null ) {
2474
  global $tag, $user_id;
 
2475
  $customize_url = '';
 
2476
  $current_screen = get_current_screen();
2477
+ $post = is_null( $post ) ? get_post() : $post;
2478
 
2479
  // July 2019 => Don't display the admin button in post and pages, where we already have the edit button next to the post title
2480
  // if ( 'post' == $current_screen->base
2522
  return $customize_url;
2523
  }
2524
 
2525
+ // introduced for https://github.com/presscustomizr/nimble-builder/issues/436
2526
+ function sek_get_customize_url_for_post_id( $post_id, $return_url = '' ) {
2527
+ // Build customize_url
2528
+ // @see function sek_get_customize_url_when_is_admin()
2529
+ $customize_url = get_permalink( $post_id );
2530
+ $return_url = empty( $return_url ) ? $customize_url : $return_url;
2531
+ $return_customize_url = add_query_arg(
2532
+ 'return',
2533
+ urlencode(
2534
+ remove_query_arg( wp_removable_query_args(), wp_unslash( $return_url ) )
2535
+ ),
2536
+ wp_customize_url()
2537
+ );
2538
+ $customize_url = add_query_arg( 'url', urlencode( $customize_url ), $return_customize_url );
2539
+ $customize_url = add_query_arg(
2540
+ array( 'autofocus' => array( 'section' => '__content_picker__' ) ),
2541
+ $customize_url
2542
+ );
2543
+
2544
+ return $customize_url;
2545
+ }
2546
+
2547
  ?><?php
2548
  // fired @wp_loaded
2549
  // Note : if fired @plugins_loaded, invoking wp_update_post() generates php notices
15812
 
15813
  // Build customize_url
15814
  // @see function sek_get_customize_url_when_is_admin()
15815
+ $return_url_after_customization = '';//"/wp-admin/post.php?post={$post_id}&action=edit";
15816
+ $customize_url = sek_get_customize_url_for_post_id( $post_id, $return_url_after_customization );
 
 
 
 
 
 
 
 
 
 
 
 
 
15817
  wp_send_json_success( $customize_url );
15818
  }
15819
 
nimble-builder.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Nimble Page Builder
4
  * Description: Powerful drag and drop page builder using the native WordPress customizer.
5
- * Version: 1.8.18
6
  * Text Domain: nimble-builder
7
  * Author: Press Customizr
8
  * Author URI: https://nimblebuilder.com/?utm_source=wp-plugins&utm_medium=wp-dashboard&utm_campaign=author-uri
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  /* ------------------------------------------------------------------------- *
14
  * CONSTANTS
15
  /* ------------------------------------------------------------------------- */
16
- $current_version = "1.8.18";
17
 
18
  if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
19
  if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
2
  /**
3
  * Plugin Name: Nimble Page Builder
4
  * Description: Powerful drag and drop page builder using the native WordPress customizer.
5
+ * Version: 1.8.19
6
  * Text Domain: nimble-builder
7
  * Author: Press Customizr
8
  * Author URI: https://nimblebuilder.com/?utm_source=wp-plugins&utm_medium=wp-dashboard&utm_campaign=author-uri
13
  /* ------------------------------------------------------------------------- *
14
  * CONSTANTS
15
  /* ------------------------------------------------------------------------- */
16
+ $current_version = "1.8.19";
17
 
18
  if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
19
  if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: page builder, visual editor, customizer, drag and drop, header, footer, la
6
  Requires at least: 4.7
7
  Requires PHP: 5.4
8
  Tested up to: 5.2.2
9
- Stable tag: 1.8.18
10
  License: GPLv3
11
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8FMNQPU36U27J&source=url
@@ -120,10 +120,13 @@ We have also published a detailed [troubleshooting guide for Nimble Builder](htt
120
  If you can't troubleshoot your issue, please open a new thread in [Nimble Builder support forum](https://wordpress.org/support/plugin/nimble-builder/).
121
 
122
  == Upgrade Notice ==
123
- = 1.8.17 =
124
- Fixed : using Nimble generated Html structure in a module content can break the UI generation in the preview frame when customizing.
125
 
126
  == Changelog ==
 
 
 
127
  = 1.8.18 : September 3rd 2019 =
128
  * fixed : using Nimble generated Html structure in a module content can break the UI generation in the preview frame when customizing.
129
 
6
  Requires at least: 4.7
7
  Requires PHP: 5.4
8
  Tested up to: 5.2.2
9
+ Stable tag: 1.8.19
10
  License: GPLv3
11
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8FMNQPU36U27J&source=url
120
  If you can't troubleshoot your issue, please open a new thread in [Nimble Builder support forum](https://wordpress.org/support/plugin/nimble-builder/).
121
 
122
  == Upgrade Notice ==
123
+ = 1.8.19 =
124
+ Added informations in relevant admin screens when the current post/page has been built with Nimble.
125
 
126
  == Changelog ==
127
+ = 1.8.19 : September 4th 2019 =
128
+ * added : informations in relevant admin screens when the current post/page has been built with Nimble.
129
+
130
  = 1.8.18 : September 3rd 2019 =
131
  * fixed : using Nimble generated Html structure in a module content can break the UI generation in the preview frame when customizing.
132