Version Description
Implemented a new button "Add sections with Nimble Builder" when editing posts and pages.
=
Download this release
Release Info
Developer | nikeo |
Plugin | Nimble Page Builder |
Version | 1.7.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.5 to 1.7.6
- assets/admin/css/nimble-admin.css +36 -1
- assets/admin/js/nimble-gutenberg.js +71 -0
- inc/admin/nimble-admin.php +105 -1
- inc/sektions/ccat-sektions.php +51 -12
- nimble-builder.php +2 -2
- readme.txt +6 -3
assets/admin/css/nimble-admin.css
CHANGED
@@ -266,4 +266,39 @@ a.czr-rating-link:hover {
|
|
266 |
.wp-core-ui #presscustomizr-dashboard .hu-go-pro-btn.no-bg-btn:focus {
|
267 |
color: #fff;
|
268 |
background: #e99723;
|
269 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
.wp-core-ui #presscustomizr-dashboard .hu-go-pro-btn.no-bg-btn:focus {
|
267 |
color: #fff;
|
268 |
background: #e99723;
|
269 |
+
}
|
270 |
+
|
271 |
+
|
272 |
+
/* BUTTON "EDIT WITH NIMBLE" when editing posts and pages
|
273 |
+
Introduced for https://github.com/presscustomizr/nimble-builder/issues/449
|
274 |
+
*/
|
275 |
+
/* Gutenberg editor style */
|
276 |
+
body .block-editor #sek-edit-with-nimble {
|
277 |
+
margin: 2px;
|
278 |
+
height: 33px;
|
279 |
+
font-size: 13px;
|
280 |
+
line-height: 1;
|
281 |
+
position: relative;
|
282 |
+
}
|
283 |
+
body .block-editor #sek-edit-with-nimble .sek-nimble-icon img {
|
284 |
+
width: 24px;
|
285 |
+
top: 3px;
|
286 |
+
left: 8px;
|
287 |
+
position: absolute;
|
288 |
+
}
|
289 |
+
|
290 |
+
body .block-editor .sek-nimble-admin-bar-title {
|
291 |
+
padding-left: 22px;
|
292 |
+
}
|
293 |
+
/* Classic editor style */
|
294 |
+
#sek-edit-with-nimble .sek-nimble-icon img {
|
295 |
+
width: 28px;
|
296 |
+
position: relative;
|
297 |
+
top: 8px;
|
298 |
+
/*left: 8px;*/
|
299 |
+
}
|
300 |
+
#sek-edit-with-nimble.classic-ed {
|
301 |
+
position: relative;
|
302 |
+
padding: 0 15px!important;
|
303 |
+
margin: 10px 0!important;
|
304 |
+
}
|
assets/admin/js/nimble-gutenberg.js
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Introduced for https://github.com/presscustomizr/nimble-builder/issues/449
|
2 |
+
(function ($) {
|
3 |
+
var button_printed = false,
|
4 |
+
_callback = function () {
|
5 |
+
if ( button_printed )
|
6 |
+
return;
|
7 |
+
if ( $('#editor').find('.edit-post-header-toolbar').length > 0 ) {
|
8 |
+
var html = $($('#sek-edit-with-nb').html());
|
9 |
+
$('#editor').find('.edit-post-header-toolbar').append( html );
|
10 |
+
button_printed = true;
|
11 |
+
// unsubscribe the listener
|
12 |
+
// documented here : https://developer.wordpress.org/block-editor/packages/packages-data/#subscribe
|
13 |
+
wp.data.subscribe(_callback)();
|
14 |
+
}
|
15 |
+
};
|
16 |
+
|
17 |
+
// PRINT THE BUTTON WHEN element .edit-post-header-toolbar has been rendered
|
18 |
+
// wp.data.subscribe() documented here : https://developer.wordpress.org/block-editor/packages/packages-data/#subscribe
|
19 |
+
// Given a listener function, the function will be called any time the state value
|
20 |
+
// of one of the registered stores has changed. This function returns a unsubscribe
|
21 |
+
// function used to stop the subscription.
|
22 |
+
wp.data.subscribe(_callback);
|
23 |
+
|
24 |
+
// ATTACH EVENT LISTENER
|
25 |
+
// with delegation
|
26 |
+
// When editing an existing post, the customizer url is rendered server side in the data-cust-url='' attribute
|
27 |
+
// @see inc/admin/nimble-admin.php => sek_print_nb_btn_edit_with()
|
28 |
+
//
|
29 |
+
// When creating a new post, the customizer url is generated with an ajax call
|
30 |
+
$('body').on( 'click', '#sek-edit-with-nimble', function(evt) {
|
31 |
+
evt.preventDefault();
|
32 |
+
var _url = $(this).data('cust-url'),
|
33 |
+
attempts = 0,
|
34 |
+
_openCustomizer = function( customizer_url ) {
|
35 |
+
// We don't want to enter in an infinite loop, that's why the number of attempts is limited to 5 if isSavingPost()
|
36 |
+
if ( wp.data.select('core/editor').isSavingPost() && attempts < 5 ) {
|
37 |
+
_.delay(function () {
|
38 |
+
self._openCustomizer();
|
39 |
+
attempts++;
|
40 |
+
}, 300 );
|
41 |
+
} else {
|
42 |
+
location.href = customizer_url;
|
43 |
+
}
|
44 |
+
};
|
45 |
+
|
46 |
+
if ( _.isEmpty( _url ) ) {
|
47 |
+
// for new post, the url is empty, let's generate it server side with an ajax call
|
48 |
+
var post_id = wp.data.select('core/editor').getCurrentPostId();
|
49 |
+
wp.ajax.post( 'sek_get_customize_url_for_nimble_edit_button', {
|
50 |
+
nimble_edit_post_id : post_id
|
51 |
+
}).done( function( resp ) {
|
52 |
+
_openCustomizer( resp );
|
53 |
+
}).fail( function( resp ) {
|
54 |
+
// If the ajax request fails, let's save the draft with a Nimble Builder title, and refresh the page, so the url is generated server side on next load.
|
55 |
+
var post_title = wp.data.select('core/editor').getEditedPostAttribute('title');
|
56 |
+
if ( !post_title ) {
|
57 |
+
wp.data.dispatch('core/editor').editPost({ title: 'Nimble Builder #' + post_id });
|
58 |
+
}
|
59 |
+
wp.data.dispatch('core/editor').savePost();
|
60 |
+
_.delay(function () {
|
61 |
+
// off the javascript pop up warning if post not saved yet
|
62 |
+
$( window ).off( 'beforeunload' );
|
63 |
+
location.href = location.href;
|
64 |
+
}, 300 );
|
65 |
+
});
|
66 |
+
} else {
|
67 |
+
_openCustomizer( _url );
|
68 |
+
}
|
69 |
+
});//.on( 'click'
|
70 |
+
|
71 |
+
})(jQuery);
|
inc/admin/nimble-admin.php
CHANGED
@@ -490,7 +490,7 @@ function sek_nimble_dashboard_callback_fn() {
|
|
490 |
<div class="nimble-db-wrapper">
|
491 |
<div class="nimble-db-header">
|
492 |
<div class="nimble-logo-version">
|
493 |
-
<div class="nimble-logo"><div class="sek-nimble-icon" title="Add sections in live preview with
|
494 |
<div class="nimble-version">
|
495 |
<span class="nimble-version-text"><?php _e('Nimble Builder', 'nimble-builder'); ?> v<?php echo NIMBLE_VERSION; ?></span>
|
496 |
<?php if ( sek_is_presscustomizr_theme( $theme_name ) ) : ?>
|
@@ -567,3 +567,107 @@ function sek_nimble_dashboard_callback_fn() {
|
|
567 |
</div>
|
568 |
<?php
|
569 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
<div class="nimble-db-wrapper">
|
491 |
<div class="nimble-db-header">
|
492 |
<div class="nimble-logo-version">
|
493 |
+
<div class="nimble-logo"><div class="sek-nimble-icon" title="<?php _e('Add sections in live preview with Nimble Builder', 'nimble-builder' );?>"><img src="<?php echo NIMBLE_BASE_URL.'/assets/img/nimble/nimble_icon.svg?ver='.NIMBLE_VERSION; ?>" alt="Nimble Builder"></div></div>
|
494 |
<div class="nimble-version">
|
495 |
<span class="nimble-version-text"><?php _e('Nimble Builder', 'nimble-builder'); ?> v<?php echo NIMBLE_VERSION; ?></span>
|
496 |
<?php if ( sek_is_presscustomizr_theme( $theme_name ) ) : ?>
|
567 |
</div>
|
568 |
<?php
|
569 |
}
|
570 |
+
add_action( 'edit_form_after_title', '\Nimble\sek_print_edit_with_nimble_btn_for_classic_editor' );
|
571 |
+
function sek_print_edit_with_nimble_btn_for_classic_editor( $post ) {
|
572 |
+
if ( did_action( 'enqueue_block_editor_assets' ) ) {
|
573 |
+
return;
|
574 |
+
}
|
575 |
+
if ( ! sek_current_user_can_edit( $post->ID ) ) {
|
576 |
+
return;
|
577 |
+
}
|
578 |
+
sek_print_nb_btn_edit_with_nimble( 'classic' );
|
579 |
+
}
|
580 |
+
add_action( 'enqueue_block_editor_assets', '\Nimble\sek_enqueue_js_asset_for_gutenberg_edit_button');
|
581 |
+
function sek_enqueue_js_asset_for_gutenberg_edit_button() {
|
582 |
+
wp_enqueue_script(
|
583 |
+
'nb-gutenberg',
|
584 |
+
sprintf(
|
585 |
+
'%1$s/assets/admin/js/%2$s' ,
|
586 |
+
NIMBLE_BASE_URL,
|
587 |
+
'nimble-gutenberg.js'
|
588 |
+
),
|
589 |
+
array('jquery'),
|
590 |
+
NIMBLE_ASSETS_VERSION,
|
591 |
+
true
|
592 |
+
);
|
593 |
+
}
|
594 |
+
add_action( 'admin_footer', '\Nimble\sek_print_js_for_nimble_edit_btn' );
|
595 |
+
function sek_print_js_for_nimble_edit_btn() {
|
596 |
+
?>
|
597 |
+
<?php if ( did_action( 'enqueue_block_editor_assets' ) ) : ?>
|
598 |
+
<?php // Only printed when Gutenberg editor is enabled ?>
|
599 |
+
<script id="sek-edit-with-nb" type="text/html">
|
600 |
+
<?php sek_print_nb_btn_edit_with_nimble( 'gutenberg' ); ?>
|
601 |
+
</script>
|
602 |
+
<?php else : ?>
|
603 |
+
<?php // Only printed when Gutenberg editor is NOT enabled ?>
|
604 |
+
<script type="text/javascript">
|
605 |
+
(function ($) {
|
606 |
+
$('body').on( 'click', '#sek-edit-with-nimble', function(evt) {
|
607 |
+
evt.preventDefault();
|
608 |
+
var _url = $(this).data('cust-url');
|
609 |
+
|
610 |
+
if ( _.isEmpty( _url ) ) {
|
611 |
+
var post_id = $('#post_ID').val();
|
612 |
+
wp.ajax.post( 'sek_get_customize_url_for_nimble_edit_button', {
|
613 |
+
nimble_edit_post_id : post_id
|
614 |
+
}).done( function( resp ) {
|
615 |
+
location.href = resp;
|
616 |
+
}).fail( function( resp ) {
|
617 |
+
_.delay(function () {
|
618 |
+
$( window ).off( 'beforeunload' );
|
619 |
+
location.href = location.href; //wp-admin/post.php?post=70&action=edit
|
620 |
+
}, 300 );
|
621 |
+
});
|
622 |
+
} else {
|
623 |
+
location.href = _url;
|
624 |
+
}
|
625 |
+
});
|
626 |
+
})(jQuery);
|
627 |
+
</script>
|
628 |
+
<?php endif; ?>
|
629 |
+
<?php
|
630 |
+
}
|
631 |
+
function sek_print_nb_btn_edit_with_nimble( $editor_type ) {
|
632 |
+
$customize_url = sek_get_customize_url_when_is_admin();
|
633 |
+
if ( ! empty( $customize_url ) ) {
|
634 |
+
$customize_url = add_query_arg(
|
635 |
+
array( 'autofocus' => array( 'section' => '__content_picker__' ) ),
|
636 |
+
$customize_url
|
637 |
+
);
|
638 |
+
}
|
639 |
+
$btn_css_classes = 'classic' === $editor_type ? 'button button-primary button-hero classic-ed' : 'button button-primary button-large guten-ed';
|
640 |
+
?>
|
641 |
+
<button id="sek-edit-with-nimble" type="button" class="<?php echo $btn_css_classes; ?>" data-cust-url="<?php echo esc_url( $customize_url ); ?>">
|
642 |
+
<?php //_e( 'Edit with Nimble Builder', 'text_doma' ); ?>
|
643 |
+
<?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>',
|
644 |
+
NIMBLE_BASE_URL.'/assets/img/nimble/nimble_icon.svg?ver='.NIMBLE_VERSION,
|
645 |
+
__('Add sections with Nimble Builder','nimble-builder'),
|
646 |
+
__('Add sections in live preview with Nimble Builder', 'nimble-builder')
|
647 |
+
); ?>
|
648 |
+
</button>
|
649 |
+
<?php
|
650 |
+
}
|
651 |
+
function sek_current_user_can_edit( $post_id = 0 ) {
|
652 |
+
$post = get_post( $post_id );
|
653 |
+
|
654 |
+
if ( ! $post ) {
|
655 |
+
return false;
|
656 |
+
}
|
657 |
+
if ( 'trash' === get_post_status( $post_id ) ) {
|
658 |
+
return false;
|
659 |
+
}
|
660 |
+
$post_type_object = get_post_type_object( $post->post_type );
|
661 |
+
|
662 |
+
if ( ! isset( $post_type_object->cap->edit_post ) ) {
|
663 |
+
return false;
|
664 |
+
}
|
665 |
+
$edit_cap = $post_type_object->cap->edit_post;
|
666 |
+
if ( ! current_user_can( $edit_cap, $post_id ) ) {
|
667 |
+
return false;
|
668 |
+
}
|
669 |
+
if ( get_option( 'page_for_posts' ) === $post_id ) {
|
670 |
+
return false;
|
671 |
+
}
|
672 |
+
return true;
|
673 |
+
}
|
inc/sektions/ccat-sektions.php
CHANGED
@@ -2316,8 +2316,7 @@ function sek_add_customize_link() {
|
|
2316 |
if ( !is_admin_bar_showing() )
|
2317 |
return;
|
2318 |
|
2319 |
-
$
|
2320 |
-
$customize_url = sek_get_customize_url_when_is_admin( $return_customize_url );
|
2321 |
} else {
|
2322 |
global $wp_customize;
|
2323 |
// Don't show if the user cannot edit a given customize_changeset post currently being previewed.
|
@@ -2348,7 +2347,7 @@ function sek_add_customize_link() {
|
|
2348 |
'title' => sprintf( '<span class="sek-nimble-icon" title="%3$s"><img src="%1$s" alt="%2$s"/><span class="sek-nimble-admin-bar-title">%4$s</span></span>',
|
2349 |
NIMBLE_BASE_URL.'/assets/img/nimble/nimble_icon.svg?ver='.NIMBLE_VERSION,
|
2350 |
__('Nimble Builder','nimble-builder'),
|
2351 |
-
__('Add sections in live preview with
|
2352 |
__( 'Nimble Builder', 'nimble-builder' )
|
2353 |
),
|
2354 |
'href' => $customize_url,
|
@@ -2360,7 +2359,7 @@ function sek_add_customize_link() {
|
|
2360 |
|
2361 |
// returns a customize link when is_admin() for posts and terms
|
2362 |
// inspired from wp-includes/admin-bar.php#wp_admin_bar_edit_menu()
|
2363 |
-
function sek_get_customize_url_when_is_admin( $
|
2364 |
global $tag, $user_id;
|
2365 |
|
2366 |
$customize_url = '';
|
@@ -2403,11 +2402,14 @@ function sek_get_customize_url_when_is_admin( $return_customize_url ) {
|
|
2403 |
{
|
2404 |
$customize_url = $view_link;
|
2405 |
}
|
|
|
2406 |
if ( ! empty( $customize_url ) ) {
|
|
|
2407 |
$customize_url = add_query_arg( 'url', urlencode( $customize_url ), $return_customize_url );
|
2408 |
}
|
2409 |
return $customize_url;
|
2410 |
}
|
|
|
2411 |
?><?php
|
2412 |
// fired @wp_loaded
|
2413 |
// Note : if fired @plugins_loaded, invoking wp_update_post() generates php notices
|
@@ -12893,6 +12895,11 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
|
|
12893 |
|
12894 |
add_action( 'wp_ajax_sek_postpone_feedback', array( $this, 'sek_postpone_feedback_notification' ) );
|
12895 |
|
|
|
|
|
|
|
|
|
|
|
12896 |
|
12897 |
// This is the list of accepted actions
|
12898 |
$this -> ajax_action_map = array(
|
@@ -13384,18 +13391,50 @@ if ( ! class_exists( 'SEK_Front_Ajax' ) ) :
|
|
13384 |
// INSPIRED FROM CORE DISMISS POINTER MECHANISM
|
13385 |
// @see wp-admin/includes/ajax-actions.php
|
13386 |
function sek_postpone_feedback_notification() {
|
13387 |
-
|
13388 |
|
13389 |
-
|
13390 |
-
|
13391 |
-
|
13392 |
-
|
13393 |
-
|
13394 |
-
|
13395 |
-
|
13396 |
}
|
13397 |
|
13398 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13399 |
|
13400 |
// hook : 'wp_ajax_sek_get_preview_ui_element'
|
13401 |
/*function sek_get_ui_content_for_injection( $params ) {
|
2316 |
if ( !is_admin_bar_showing() )
|
2317 |
return;
|
2318 |
|
2319 |
+
$customize_url = sek_get_customize_url_when_is_admin();
|
|
|
2320 |
} else {
|
2321 |
global $wp_customize;
|
2322 |
// Don't show if the user cannot edit a given customize_changeset post currently being previewed.
|
2347 |
'title' => sprintf( '<span class="sek-nimble-icon" title="%3$s"><img src="%1$s" alt="%2$s"/><span class="sek-nimble-admin-bar-title">%4$s</span></span>',
|
2348 |
NIMBLE_BASE_URL.'/assets/img/nimble/nimble_icon.svg?ver='.NIMBLE_VERSION,
|
2349 |
__('Nimble Builder','nimble-builder'),
|
2350 |
+
__('Add sections in live preview with Nimble Builder', 'nimble-builder'),
|
2351 |
__( 'Nimble Builder', 'nimble-builder' )
|
2352 |
),
|
2353 |
'href' => $customize_url,
|
2359 |
|
2360 |
// returns a customize link when is_admin() for posts and terms
|
2361 |
// inspired from wp-includes/admin-bar.php#wp_admin_bar_edit_menu()
|
2362 |
+
function sek_get_customize_url_when_is_admin( $ajax_server_request_uri = '') {
|
2363 |
global $tag, $user_id;
|
2364 |
|
2365 |
$customize_url = '';
|
2402 |
{
|
2403 |
$customize_url = $view_link;
|
2404 |
}
|
2405 |
+
|
2406 |
if ( ! empty( $customize_url ) ) {
|
2407 |
+
$return_customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), wp_customize_url() );
|
2408 |
$customize_url = add_query_arg( 'url', urlencode( $customize_url ), $return_customize_url );
|
2409 |
}
|
2410 |
return $customize_url;
|
2411 |
}
|
2412 |
+
|
2413 |
?><?php
|
2414 |
// fired @wp_loaded
|
2415 |
// Note : if fired @plugins_loaded, invoking wp_update_post() generates php notices
|
12895 |
|
12896 |
add_action( 'wp_ajax_sek_postpone_feedback', array( $this, 'sek_postpone_feedback_notification' ) );
|
12897 |
|
12898 |
+
// Returns the customize url for the edit button when using Gutenberg editor
|
12899 |
+
// implemented for https://github.com/presscustomizr/nimble-builder/issues/449
|
12900 |
+
// @see assets/admin/js/nimble-gutenberg.js
|
12901 |
+
add_action( 'wp_ajax_sek_get_customize_url_for_nimble_edit_button', array( $this, 'sek_get_customize_url_for_nimble_edit_button' ) );
|
12902 |
+
|
12903 |
|
12904 |
// This is the list of accepted actions
|
12905 |
$this -> ajax_action_map = array(
|
13391 |
// INSPIRED FROM CORE DISMISS POINTER MECHANISM
|
13392 |
// @see wp-admin/includes/ajax-actions.php
|
13393 |
function sek_postpone_feedback_notification() {
|
13394 |
+
$this->sek_do_ajax_pre_checks( array( 'check_nonce' => true ) );
|
13395 |
|
13396 |
+
if ( !isset( $_POST['transient_duration_in_days'] ) ||!is_numeric( $_POST['transient_duration_in_days'] ) ) {
|
13397 |
+
$transient_duration = 7 * DAY_IN_SECONDS;
|
13398 |
+
} else {
|
13399 |
+
$transient_duration = $_POST['transient_duration_in_days'] * DAY_IN_SECONDS;
|
13400 |
+
}
|
13401 |
+
set_transient( NIMBLE_FEEDBACK_NOTICE_ID, 'maybe_later', $transient_duration );
|
13402 |
+
wp_die( 1 );
|
13403 |
}
|
13404 |
|
13405 |
|
13406 |
+
////////////////////////////////////////////////////////////////
|
13407 |
+
// USED TO PRINT THE BUTTON EDIT WITH NIMBLE ON POSTS AND PAGES
|
13408 |
+
// when using Gutenberg editor
|
13409 |
+
// implemented for https://github.com/presscustomizr/nimble-builder/issues/449
|
13410 |
+
function sek_get_customize_url_for_nimble_edit_button() {
|
13411 |
+
$this->sek_do_ajax_pre_checks( array( 'check_nonce' => false ) );
|
13412 |
+
|
13413 |
+
if ( ! isset( $_POST['nimble_edit_post_id'] ) || empty( $_POST['nimble_edit_post_id'] ) ) {
|
13414 |
+
wp_send_json_error( __CLASS__ . '::' . __FUNCTION__ . ' => missing post_id' );
|
13415 |
+
}
|
13416 |
+
|
13417 |
+
$post_id = $_POST['nimble_edit_post_id'];
|
13418 |
+
|
13419 |
+
// Build customize_url
|
13420 |
+
// @see function sek_get_customize_url_when_is_admin()
|
13421 |
+
$ajax_server_request_uri = "/wp-admin/post.php?post={$post_id}&action=edit";
|
13422 |
+
$customize_url = get_permalink( $post_id );
|
13423 |
+
$return_customize_url = add_query_arg(
|
13424 |
+
'return',
|
13425 |
+
urlencode(
|
13426 |
+
remove_query_arg( wp_removable_query_args(), wp_unslash( $ajax_server_request_uri ) )
|
13427 |
+
),
|
13428 |
+
wp_customize_url()
|
13429 |
+
);
|
13430 |
+
$customize_url = add_query_arg( 'url', urlencode( $customize_url ), $return_customize_url );
|
13431 |
+
$customize_url = add_query_arg(
|
13432 |
+
array( 'autofocus' => array( 'section' => '__content_picker__' ) ),
|
13433 |
+
$customize_url
|
13434 |
+
);
|
13435 |
+
|
13436 |
+
wp_send_json_success( $customize_url );
|
13437 |
+
}
|
13438 |
|
13439 |
// hook : 'wp_ajax_sek_get_preview_ui_element'
|
13440 |
/*function sek_get_ui_content_for_injection( $params ) {
|
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.7.
|
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.7.
|
17 |
if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
|
18 |
if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
|
19 |
if ( !defined( 'NIMBLE_BASE_URL' ) ) { define( 'NIMBLE_BASE_URL' , plugins_url( NIMBLE_DIR_NAME ) ); }
|
2 |
/**
|
3 |
* Plugin Name: Nimble Page Builder
|
4 |
* Description: Powerful drag and drop page builder using the native WordPress customizer.
|
5 |
+
* Version: 1.7.6
|
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.7.6";
|
17 |
if ( !defined( "NIMBLE_VERSION" ) ) { define( "NIMBLE_VERSION", $current_version ); }
|
18 |
if ( !defined( 'NIMBLE_DIR_NAME' ) ) { define( 'NIMBLE_DIR_NAME' , basename( dirname( __FILE__ ) ) ); }
|
19 |
if ( !defined( 'NIMBLE_BASE_URL' ) ) { define( 'NIMBLE_BASE_URL' , plugins_url( NIMBLE_DIR_NAME ) ); }
|
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.1
|
9 |
-
Stable tag: 1.7.
|
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
|
@@ -109,10 +109,13 @@ Nimble builder works with any WordPress theme. If you experience any problem wit
|
|
109 |
7. **Theme** : try to switch to another WordPress theme, like the default WordPress theme. If you use a child theme, activate the parent theme instead.
|
110 |
|
111 |
== Upgrade Notice ==
|
112 |
-
= 1.7.
|
113 |
-
|
114 |
|
115 |
== Changelog ==
|
|
|
|
|
|
|
116 |
= 1.7.5 : May 21st 2019 =
|
117 |
* improved : performance improvements on the first load of the live customizer
|
118 |
|
6 |
Requires at least: 4.7
|
7 |
Requires PHP: 5.4
|
8 |
Tested up to: 5.2.1
|
9 |
+
Stable tag: 1.7.6
|
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
|
109 |
7. **Theme** : try to switch to another WordPress theme, like the default WordPress theme. If you use a child theme, activate the parent theme instead.
|
110 |
|
111 |
== Upgrade Notice ==
|
112 |
+
= 1.7.6 =
|
113 |
+
Implemented a new button "Add sections with Nimble Builder" when editing posts and pages.
|
114 |
|
115 |
== Changelog ==
|
116 |
+
= 1.7.6 : May 27th 2019 =
|
117 |
+
* added : Implemented a new button "Add sections with Nimble Builder" when editing posts and pages.
|
118 |
+
|
119 |
= 1.7.5 : May 21st 2019 =
|
120 |
* improved : performance improvements on the first load of the live customizer
|
121 |
|