Version Description
- Includes security updates
- Fixes bug where posts not appearing when filtering by a non top-level hierarchical taxonomy. Allows order sorting while the list is filtered (not parent order)
- Adds ability to save and synchronize post type archive menu items when using menu sync
Download this release
Release Info
Developer | kylephillips |
Plugin | Nested Pages |
Version | 3.1.12 |
Comparing to | |
See all releases |
Code changes from version 3.1.11 to 3.1.12
- app/Entities/AdminMenu/AdminSubmenuExpander.php +2 -2
- app/Entities/Confirmation/TrashConfirmation.php +6 -6
- app/Entities/Confirmation/TrashRestoredConfirmation.php +1 -1
- app/Entities/Listing/Listing.php +10 -5
- app/Entities/Listing/ListingRepository.php +7 -2
- app/Entities/PluginIntegration/WPML.php +2 -1
- app/Entities/Post/PostCloner.php +1 -0
- app/Entities/Post/PostDataFactory.php +7 -0
- app/Entities/Post/PostFactory.php +2 -0
- app/Entities/Post/PostUpdateRepository.php +43 -13
- app/Form/Listeners/ClonePost.php +1 -0
- app/Form/Listeners/NewMenuItem.php +6 -0
- app/Form/Listeners/ResetUserPreferences.php +1 -0
- app/Form/Listeners/Sort.php +2 -1
- app/Form/Listeners/TrashWithChildren.php +3 -1
- app/NestedPages.php +1 -1
- app/Redirects.php +2 -2
- app/Views/forms/link-form.php +9 -4
- app/Views/forms/quickedit-post.php +7 -7
- app/Views/listing.php +4 -4
- app/Views/partials/bulk-edit.php +4 -4
- app/Views/partials/row.php +9 -9
- app/Views/partials/tool-list.php +5 -5
- app/Views/settings/partials/nav-menu-settings.php +1 -1
- app/Views/settings/settings-general.php +3 -3
- app/Views/settings/settings-posttypes.php +13 -13
- assets/js/lib/nestedpages.nesting.js +6 -4
- assets/js/nestedpages.js +6 -4
- assets/js/nestedpages.min.js +1 -1
- nestedpages.php +1 -1
- readme.txt +7 -2
app/Entities/AdminMenu/AdminSubmenuExpander.php
CHANGED
@@ -51,7 +51,7 @@ class AdminSubmenuExpander
|
|
51 |
{
|
52 |
$name = ( $type->name == 'page' ) ? '' : '-' . $type->name;
|
53 |
if ( ($this->page->id == $type->name) && ($this->page->action == 'add') ){
|
54 |
-
echo '<script>jQuery(document).ready(function(){jQuery("#toplevel_page_nestedpages' .
|
55 |
}
|
56 |
}
|
57 |
|
@@ -62,7 +62,7 @@ class AdminSubmenuExpander
|
|
62 |
{
|
63 |
$name = ( $type->name == 'page' ) ? '' : '-' . $type->name;
|
64 |
if ( ($this->page->id == $type->name) && ($this->page->base == 'post') ){
|
65 |
-
echo '<script>jQuery(document).ready(function(){jQuery("#toplevel_page_nestedpages' .
|
66 |
}
|
67 |
}
|
68 |
|
51 |
{
|
52 |
$name = ( $type->name == 'page' ) ? '' : '-' . $type->name;
|
53 |
if ( ($this->page->id == $type->name) && ($this->page->action == 'add') ){
|
54 |
+
echo '<script>jQuery(document).ready(function(){jQuery("#toplevel_page_nestedpages' . esc_html($name) . '").removeClass("wp-not-current-submenu").addClass("wp-has-current-submenu").addClass("wp-menu-open");jQuery("#toplevel_page_nestedpages' . esc_html($name) . ' a:first").addClass("wp-has-current-submenu");var addnew = jQuery("#toplevel_page_nestedpages ul li:nth-child(3)");jQuery(addnew).addClass("current");jQuery(addnew).children("a").addClass("current");});</script>';
|
55 |
}
|
56 |
}
|
57 |
|
62 |
{
|
63 |
$name = ( $type->name == 'page' ) ? '' : '-' . $type->name;
|
64 |
if ( ($this->page->id == $type->name) && ($this->page->base == 'post') ){
|
65 |
+
echo '<script>jQuery(document).ready(function(){jQuery("#toplevel_page_nestedpages' . esc_html($name) . '").removeClass("wp-not-current-submenu").addClass("wp-has-current-submenu").addClass("wp-menu-open");jQuery("#toplevel_page_nestedpages' . esc_html($name) . ' a:first").addClass("wp-has-current-submenu");var addnew = jQuery("#toplevel_page_nestedpages ul li");jQuery(addnew).removeClass("current");jQuery(addnew).children("a").removeClass("current");});</script>';
|
66 |
}
|
67 |
}
|
68 |
|
app/Entities/Confirmation/TrashConfirmation.php
CHANGED
@@ -12,22 +12,22 @@ class TrashConfirmation implements ConfirmationInterface
|
|
12 |
|
13 |
// Show number of Links (np-redirect) Deleted if applicable
|
14 |
if ( isset($_GET['link_ids']) ) :
|
15 |
-
$links_trashed = ( explode(',', $_GET['link_ids']) );
|
16 |
$number_trashed = count($links_trashed);
|
17 |
-
$out .= sprintf(
|
18 |
endif;
|
19 |
|
20 |
// Post(s) Moved to Trash
|
21 |
if ( isset($_GET['ids']) ) :
|
22 |
-
$trashed = ( explode(',', $_GET['ids']) );
|
23 |
$post_type = get_post_type($trashed[0]);
|
24 |
$post_type_object = get_post_type_object($post_type);
|
25 |
$out .= ( count($trashed) > 1 )
|
26 |
-
? sprintf(__('%d %s moved to the trash.'), count($trashed),
|
27 |
-
: wp_kses(sprintf('<strong>%s</strong> moved to the trash.', get_the_title($trashed[0])), ['strong' => []] );
|
28 |
// Undo Link
|
29 |
if ( current_user_can('delete_pages') ) {
|
30 |
-
$ids = preg_replace( '/[^0-9,]/', '', $_GET['ids'] );
|
31 |
$out .= ' <a href="' . wp_nonce_url( admin_url( 'edit.php?&post_type=' . esc_attr($post_type) . '&doaction=undo'. '&action=untrash&ids=' . esc_attr($ids) ), 'bulk-posts') . '">' . __( 'Undo' ) . "</a>";
|
32 |
}
|
33 |
endif;
|
12 |
|
13 |
// Show number of Links (np-redirect) Deleted if applicable
|
14 |
if ( isset($_GET['link_ids']) ) :
|
15 |
+
$links_trashed = ( explode(',', sanitize_text_field($_GET['link_ids'])) );
|
16 |
$number_trashed = count($links_trashed);
|
17 |
+
$out .= sprintf( esc_html( _n( '%d Link Removed.', '%d Links Removed.', $number_trashed, 'wp-nested-pages' ) ), $number_trashed );
|
18 |
endif;
|
19 |
|
20 |
// Post(s) Moved to Trash
|
21 |
if ( isset($_GET['ids']) ) :
|
22 |
+
$trashed = ( explode(',', sanitize_text_field($_GET['ids'])) );
|
23 |
$post_type = get_post_type($trashed[0]);
|
24 |
$post_type_object = get_post_type_object($post_type);
|
25 |
$out .= ( count($trashed) > 1 )
|
26 |
+
? sprintf(__('%d %s moved to the trash.'), count($trashed), esc_html($post_type_object->labels->name))
|
27 |
+
: wp_kses(sprintf(__('<strong>%s</strong> moved to the trash.', 'wp-nested-pages'), get_the_title($trashed[0])), ['strong' => []] );
|
28 |
// Undo Link
|
29 |
if ( current_user_can('delete_pages') ) {
|
30 |
+
$ids = preg_replace( '/[^0-9,]/', '', sanitize_text_field($_GET['ids']) );
|
31 |
$out .= ' <a href="' . wp_nonce_url( admin_url( 'edit.php?&post_type=' . esc_attr($post_type) . '&doaction=undo'. '&action=untrash&ids=' . esc_attr($ids) ), 'bulk-posts') . '">' . __( 'Undo' ) . "</a>";
|
32 |
}
|
33 |
endif;
|
app/Entities/Confirmation/TrashRestoredConfirmation.php
CHANGED
@@ -9,6 +9,6 @@ class TrashRestoredConfirmation implements ConfirmationInterface
|
|
9 |
public function setMessage()
|
10 |
{
|
11 |
$count = intval(sanitize_text_field($_GET['untrashed']));
|
12 |
-
return sprintf(
|
13 |
}
|
14 |
}
|
9 |
public function setMessage()
|
10 |
{
|
11 |
$count = intval(sanitize_text_field($_GET['untrashed']));
|
12 |
+
return sprintf( esc_html( _n( '%d item restored from trash.', '%d items restored from trash.', $count, 'wp-nested-pages' ) ), $count );
|
13 |
}
|
14 |
}
|
app/Entities/Listing/Listing.php
CHANGED
@@ -163,7 +163,7 @@ class Listing
|
|
163 |
private function pageURL()
|
164 |
{
|
165 |
$base = ( $this->post_type->name == 'post' ) ? admin_url('edit.php') : admin_url('admin.php');
|
166 |
-
return $base . '?page=' . $_GET['page'];
|
167 |
}
|
168 |
|
169 |
/**
|
@@ -364,7 +364,12 @@ class Listing
|
|
364 |
$wpml_current_language = null;
|
365 |
if ( $wpml ) $wpml_current_language = $this->integrations->plugins->wpml->getCurrentLanguage();
|
366 |
|
367 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
368 |
$pages = get_page_children($parent, $this->all_posts);
|
369 |
if ( !$pages ) return;
|
370 |
$parent_status = get_post_status($parent);
|
@@ -379,7 +384,7 @@ class Listing
|
|
379 |
|
380 |
foreach($pages as $page) :
|
381 |
|
382 |
-
if ( $page->post_parent !== $parent && !$this->listing_repo->isSearch() ) continue;
|
383 |
$count++;
|
384 |
|
385 |
global $post;
|
@@ -437,11 +442,11 @@ class Listing
|
|
437 |
|
438 |
endif; // trash status
|
439 |
|
440 |
-
if ( !$this->listing_repo->isSearch() ) $this->listPostLevel($page->ID, $count, $level);
|
441 |
|
442 |
if ( $this->post->status !== 'trash' ) echo '</li>';
|
443 |
|
444 |
-
if ( $this->publishedChildrenCount($this->post) > 0 && !$this->listing_repo->isSearch() &&
|
445 |
|
446 |
endforeach; // Loop
|
447 |
|
163 |
private function pageURL()
|
164 |
{
|
165 |
$base = ( $this->post_type->name == 'post' ) ? admin_url('edit.php') : admin_url('admin.php');
|
166 |
+
return $base . '?page=' . sanitize_text_field($_GET['page']);
|
167 |
}
|
168 |
|
169 |
/**
|
364 |
$wpml_current_language = null;
|
365 |
if ( $wpml ) $wpml_current_language = $this->integrations->plugins->wpml->getCurrentLanguage();
|
366 |
|
367 |
+
if ( $this->listing_repo->isFiltered() ){
|
368 |
+
$parent_status = null;
|
369 |
+
$pages = $this->all_posts;
|
370 |
+
$level++;
|
371 |
+
echo '<ol class="sortable nplist visible filtered">';
|
372 |
+
} elseif ( !$this->listing_repo->isSearch() ) {
|
373 |
$pages = get_page_children($parent, $this->all_posts);
|
374 |
if ( !$pages ) return;
|
375 |
$parent_status = get_post_status($parent);
|
384 |
|
385 |
foreach($pages as $page) :
|
386 |
|
387 |
+
if ( $page->post_parent !== $parent && !$this->listing_repo->isSearch() && !$this->listing_repo->isFiltered() ) continue;
|
388 |
$count++;
|
389 |
|
390 |
global $post;
|
442 |
|
443 |
endif; // trash status
|
444 |
|
445 |
+
if ( !$this->listing_repo->isSearch() && !$this->listing_repo->isFiltered() ) $this->listPostLevel($page->ID, $count, $level);
|
446 |
|
447 |
if ( $this->post->status !== 'trash' ) echo '</li>';
|
448 |
|
449 |
+
if ( $this->publishedChildrenCount($this->post) > 0 && !$this->listing_repo->isSearch() && !$this->listing_repo->isFiltered() ) echo '</ol>';
|
450 |
|
451 |
endforeach; // Loop
|
452 |
|
app/Entities/Listing/ListingRepository.php
CHANGED
@@ -134,7 +134,12 @@ class ListingRepository
|
|
134 |
*/
|
135 |
public function isFiltered()
|
136 |
{
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
/**
|
@@ -148,7 +153,7 @@ class ListingRepository
|
|
148 |
if ( $initial_orderby ) $ordered = true;
|
149 |
}
|
150 |
if ( $ordered && isset($_GET['orderby']) && $_GET['orderby'] == 'menu_order' && !isset($_GET['order']) ) $ordered = false;
|
151 |
-
//
|
152 |
if ( isset($_GET['orderby']) && $_GET['orderby'] == 'menu_order' && isset($_GET['order']) && $_GET['order'] == 'ASC' ) $ordered = false;
|
153 |
return $ordered;
|
154 |
}
|
134 |
*/
|
135 |
public function isFiltered()
|
136 |
{
|
137 |
+
$taxonomies = get_taxonomies();
|
138 |
+
$tax_filtered = false;
|
139 |
+
foreach ( $taxonomies as $tax ){
|
140 |
+
if ( isset($_GET[$tax]) && $_GET[$tax] !== '' ) $tax_filtered = true;
|
141 |
+
}
|
142 |
+
return ( (isset($_GET['category']) && $_GET['category'] !== "all") || $tax_filtered ) ? true : false;
|
143 |
}
|
144 |
|
145 |
/**
|
153 |
if ( $initial_orderby ) $ordered = true;
|
154 |
}
|
155 |
if ( $ordered && isset($_GET['orderby']) && $_GET['orderby'] == 'menu_order' && !isset($_GET['order']) ) $ordered = false;
|
156 |
+
// Enables nesting if sorted by menu order in ascending order
|
157 |
if ( isset($_GET['orderby']) && $_GET['orderby'] == 'menu_order' && isset($_GET['order']) && $_GET['order'] == 'ASC' ) $ordered = false;
|
158 |
return $ordered;
|
159 |
}
|
app/Entities/PluginIntegration/WPML.php
CHANGED
@@ -130,7 +130,8 @@ class WPML
|
|
130 |
$translations = $this->getAllTranslations($post['id']);
|
131 |
foreach ( $translations as $lang_code => $post_info ) :
|
132 |
$translation_post_id = $post_info->element_id;
|
133 |
-
$
|
|
|
134 |
$query = "UPDATE $wpdb->posts SET menu_order = '$order', post_parent = '$translated_parent' WHERE ID = '$translation_post_id'";
|
135 |
$wpdb->query( $query );
|
136 |
endforeach;
|
130 |
$translations = $this->getAllTranslations($post['id']);
|
131 |
foreach ( $translations as $lang_code => $post_info ) :
|
132 |
$translation_post_id = $post_info->element_id;
|
133 |
+
$parent_translations = $this->getAllTranslations($post_parent);
|
134 |
+
$translated_parent = ( isset($parent_translations[$lang_code]) ) ? $parent_translations[$lang_code]->element_id : 0;
|
135 |
$query = "UPDATE $wpdb->posts SET menu_order = '$order', post_parent = '$translated_parent' WHERE ID = '$translation_post_id'";
|
136 |
$wpdb->query( $query );
|
137 |
endforeach;
|
app/Entities/Post/PostCloner.php
CHANGED
@@ -45,6 +45,7 @@ class PostCloner
|
|
45 |
*/
|
46 |
public function clonePost($id, $quantity = 1, $status = 'publish', $author = null)
|
47 |
{
|
|
|
48 |
$this->original_id = $id;
|
49 |
$this->original_post = get_post( $id );
|
50 |
$this->clone_options['quantity'] = $quantity;
|
45 |
*/
|
46 |
public function clonePost($id, $quantity = 1, $status = 'publish', $author = null)
|
47 |
{
|
48 |
+
if ( !current_user_can('edit_post', $id) ) return;
|
49 |
$this->original_id = $id;
|
50 |
$this->original_post = get_post( $id );
|
51 |
$this->clone_options['quantity'] = $quantity;
|
app/Entities/Post/PostDataFactory.php
CHANGED
@@ -97,6 +97,13 @@ class PostDataFactory
|
|
97 |
return;
|
98 |
}
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$id = $this->post_data->nav_object_id;
|
101 |
$this->post_data->nav_original_link = get_the_permalink($id);
|
102 |
$this->post_data->nav_original_title = get_the_title($id);
|
97 |
return;
|
98 |
}
|
99 |
|
100 |
+
if ( $this->post_data->nav_type && $this->post_data->nav_type == 'post_type_archive' ){
|
101 |
+
$post_type = get_post_type_object($this->post_data->nav_object);
|
102 |
+
$this->post_data->nav_original_link = get_post_type_archive_link($this->post_data->nav_object);
|
103 |
+
$this->post_data->nav_original_title = sprintf(__('%s (Archive)', 'wp-nested-pages'), $post_type->labels->name);
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
$id = $this->post_data->nav_object_id;
|
108 |
$this->post_data->nav_original_link = get_the_permalink($id);
|
109 |
$this->post_data->nav_original_title = get_the_title($id);
|
app/Entities/Post/PostFactory.php
CHANGED
@@ -39,6 +39,7 @@ class PostFactory
|
|
39 |
*/
|
40 |
public function createChildPosts($data)
|
41 |
{
|
|
|
42 |
$post_type = sanitize_text_field($data['post_type']);
|
43 |
|
44 |
// Set the initial menu order
|
@@ -74,6 +75,7 @@ class PostFactory
|
|
74 |
*/
|
75 |
public function createBeforeAfterPosts($data)
|
76 |
{
|
|
|
77 |
global $wpdb;
|
78 |
$menu_order = 0;
|
79 |
$parent = false;
|
39 |
*/
|
40 |
public function createChildPosts($data)
|
41 |
{
|
42 |
+
if ( !current_user_can('publish_posts') ) return;
|
43 |
$post_type = sanitize_text_field($data['post_type']);
|
44 |
|
45 |
// Set the initial menu order
|
75 |
*/
|
76 |
public function createBeforeAfterPosts($data)
|
77 |
{
|
78 |
+
if ( !current_user_can('publish_posts') ) return;
|
79 |
global $wpdb;
|
80 |
$menu_order = 0;
|
81 |
$parent = false;
|
app/Entities/Post/PostUpdateRepository.php
CHANGED
@@ -45,8 +45,9 @@ class PostUpdateRepository
|
|
45 |
* @param int parent
|
46 |
* @since 1.0
|
47 |
*/
|
48 |
-
public function updateOrder($posts, $parent = 0)
|
49 |
{
|
|
|
50 |
$this->validation->validatePostIDs($posts);
|
51 |
global $wpdb;
|
52 |
foreach( $posts as $key => $post )
|
@@ -56,19 +57,31 @@ class PostUpdateRepository
|
|
56 |
$original_modifed_date_gmt = get_post_modified_time('Y-m-d H:i:s', true, $post_id);
|
57 |
|
58 |
// Reset the modified date to the last modified date
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
$wpdb->query( $query );
|
71 |
-
do_action('nestedpages_post_order_updated', $post_id, $parent, $key);
|
72 |
|
73 |
if ( isset($post['children']) ) $this->updateOrder($post['children'], $post_id);
|
74 |
}
|
@@ -84,6 +97,7 @@ class PostUpdateRepository
|
|
84 |
*/
|
85 |
public function updatePost($data, $append_taxonomies = false)
|
86 |
{
|
|
|
87 |
$updated_post = [
|
88 |
'ID' => sanitize_text_field($data['post_id'])
|
89 |
];
|
@@ -157,7 +171,7 @@ class PostUpdateRepository
|
|
157 |
*/
|
158 |
public function updateTemplate($data)
|
159 |
{
|
160 |
-
if ( isset($data['page_template']) ){
|
161 |
$template = sanitize_text_field($data['page_template']);
|
162 |
update_post_meta(
|
163 |
$data['post_id'],
|
@@ -174,6 +188,7 @@ class PostUpdateRepository
|
|
174 |
*/
|
175 |
public function updateNavStatus($data)
|
176 |
{
|
|
|
177 |
$status = ( isset($data['nav_status']) && $data['nav_status'] == 'hide' ) ? 'hide' : 'show';
|
178 |
$id = ( isset($data['post_id']) ) ? $data['post_id'] : $this->new_id;
|
179 |
update_post_meta(
|
@@ -190,6 +205,7 @@ class PostUpdateRepository
|
|
190 |
*/
|
191 |
private function updateNestedPagesStatus($data)
|
192 |
{
|
|
|
193 |
if ( $this->post_type_repo->standardFieldDisabled('hide_in_np', sanitize_text_field($data['post_type'])) ) return;
|
194 |
|
195 |
$status = ( isset($data['nested_pages_status']) && $data['nested_pages_status'] == 'hide' ) ? 'hide' : 'show';
|
@@ -208,6 +224,7 @@ class PostUpdateRepository
|
|
208 |
*/
|
209 |
private function updateNavTitle($data)
|
210 |
{
|
|
|
211 |
if ( isset($data['np_nav_title']) ){
|
212 |
$title = sanitize_text_field($data['np_nav_title']);
|
213 |
update_post_meta(
|
@@ -225,6 +242,7 @@ class PostUpdateRepository
|
|
225 |
*/
|
226 |
private function updateNavCSS($data)
|
227 |
{
|
|
|
228 |
if ( isset($data['np_nav_css_classes']) ){
|
229 |
$css_classes = sanitize_text_field($data['np_nav_css_classes']);
|
230 |
update_post_meta(
|
@@ -242,6 +260,7 @@ class PostUpdateRepository
|
|
242 |
*/
|
243 |
private function updateTitleAttribute($data)
|
244 |
{
|
|
|
245 |
if ( isset($data['np_title_attribute']) ){
|
246 |
$title_attr = sanitize_text_field($data['np_title_attribute']);
|
247 |
update_post_meta(
|
@@ -261,6 +280,7 @@ class PostUpdateRepository
|
|
261 |
foreach ( $data as $key => $value ){
|
262 |
if ( strpos($key, 'np_custom_') !== false) {
|
263 |
$field_key = str_replace('np_custom_', '', $key);
|
|
|
264 |
update_post_meta(
|
265 |
$data['post_id'],
|
266 |
$field_key,
|
@@ -277,6 +297,7 @@ class PostUpdateRepository
|
|
277 |
*/
|
278 |
private function updateCategories($data, $append_taxonomies = false)
|
279 |
{
|
|
|
280 |
if ( isset($data['post_category']) )
|
281 |
{
|
282 |
$this->validation->validateIntegerArray($data['post_category']);
|
@@ -295,6 +316,7 @@ class PostUpdateRepository
|
|
295 |
*/
|
296 |
private function updateTaxonomies($data, $append_taxonomies)
|
297 |
{
|
|
|
298 |
if ( isset($data['tax_input']) ) {
|
299 |
foreach ( $data['tax_input'] as $taxonomy => $term_ids ){
|
300 |
$tax = get_taxonomy($taxonomy);
|
@@ -315,6 +337,7 @@ class PostUpdateRepository
|
|
315 |
*/
|
316 |
private function updateHierarchicalTaxonomies($data, $taxonomy, $term_ids, $append_taxonomies)
|
317 |
{
|
|
|
318 |
$terms = [];
|
319 |
foreach ( $term_ids as $term ){
|
320 |
if ( $term !== 0 ) $terms[] = (int) $term;
|
@@ -329,6 +352,7 @@ class PostUpdateRepository
|
|
329 |
*/
|
330 |
private function updateFlatTaxonomy($data, $taxonomy, $terms, $append_taxonomies)
|
331 |
{
|
|
|
332 |
$terms = explode(',', sanitize_text_field($terms));
|
333 |
$new_terms = array();
|
334 |
foreach($terms as $term)
|
@@ -345,6 +369,7 @@ class PostUpdateRepository
|
|
345 |
*/
|
346 |
private function updateLinkTarget($data)
|
347 |
{
|
|
|
348 |
$link_target = ( isset($data['link_target']) && $data['link_target'] == "_blank" ) ? "_blank" : "";
|
349 |
$id = ( isset($data['post_id']) ) ? $data['post_id'] : $this->new_id;
|
350 |
update_post_meta(
|
@@ -361,6 +386,7 @@ class PostUpdateRepository
|
|
361 |
*/
|
362 |
private function updateSticky($data)
|
363 |
{
|
|
|
364 |
if ( $this->post_type_repo->standardFieldDisabled('sticky', sanitize_text_field($data['post_type'])) ) return;
|
365 |
$sticky_posts = get_option('sticky_posts');
|
366 |
if ( isset($data['sticky']) && $data['sticky'] ){
|
@@ -381,6 +407,7 @@ class PostUpdateRepository
|
|
381 |
*/
|
382 |
private function updateMenuMeta($data)
|
383 |
{
|
|
|
384 |
$id = ( isset($data['post_id']) ) ? $data['post_id'] : $this->new_id;
|
385 |
$link_target = ( isset($data['linkTarget']) ) ? "_blank" : "";
|
386 |
update_post_meta($id, '_np_link_target', $link_target);
|
@@ -408,6 +435,7 @@ class PostUpdateRepository
|
|
408 |
*/
|
409 |
public function updateRedirect($data)
|
410 |
{
|
|
|
411 |
$menu_order = isset($data['menu_order']) ? $data['menu_order'] : 0;
|
412 |
$updated_post = [
|
413 |
'ID' => sanitize_text_field($data['post_id']),
|
@@ -433,6 +461,7 @@ class PostUpdateRepository
|
|
433 |
*/
|
434 |
public function saveRedirect($data)
|
435 |
{
|
|
|
436 |
$new_link = [
|
437 |
'post_title' => sanitize_text_field($data['menuTitle']),
|
438 |
'post_status' => sanitize_text_field('publish'),
|
@@ -457,6 +486,7 @@ class PostUpdateRepository
|
|
457 |
*/
|
458 |
public function updateFromMenuItem($data)
|
459 |
{
|
|
|
460 |
$updated_post = [
|
461 |
'ID' => sanitize_text_field($data['post_id']),
|
462 |
'menu_order' => sanitize_text_field($data['menu_order']),
|
45 |
* @param int parent
|
46 |
* @since 1.0
|
47 |
*/
|
48 |
+
public function updateOrder($posts, $parent = 0, $filtered = false)
|
49 |
{
|
50 |
+
if ( !current_user_can('manage_options') ) return;
|
51 |
$this->validation->validatePostIDs($posts);
|
52 |
global $wpdb;
|
53 |
foreach( $posts as $key => $post )
|
57 |
$original_modifed_date_gmt = get_post_modified_time('Y-m-d H:i:s', true, $post_id);
|
58 |
|
59 |
// Reset the modified date to the last modified date
|
60 |
+
if ( !$filtered ) :
|
61 |
+
$query = $wpdb->prepare(
|
62 |
+
"UPDATE $wpdb->posts
|
63 |
+
SET menu_order = '%d', post_parent = '%d', post_modified = '%s', post_modified_gmt = '%s'
|
64 |
+
WHERE ID = '%d'",
|
65 |
+
intval($key),
|
66 |
+
intval($parent),
|
67 |
+
$original_modifed_date,
|
68 |
+
$original_modifed_date_gmt,
|
69 |
+
intval($post_id)
|
70 |
+
);
|
71 |
+
else : // The posts are filtered, don't update the parent
|
72 |
+
$query = $wpdb->prepare(
|
73 |
+
"UPDATE $wpdb->posts
|
74 |
+
SET menu_order = '%d', post_modified = '%s', post_modified_gmt = '%s'
|
75 |
+
WHERE ID = '%d'",
|
76 |
+
intval($key),
|
77 |
+
$original_modifed_date,
|
78 |
+
$original_modifed_date_gmt,
|
79 |
+
intval($post_id)
|
80 |
+
);
|
81 |
+
endif;
|
82 |
|
83 |
$wpdb->query( $query );
|
84 |
+
do_action('nestedpages_post_order_updated', $post_id, $parent, $key, $filtered);
|
85 |
|
86 |
if ( isset($post['children']) ) $this->updateOrder($post['children'], $post_id);
|
87 |
}
|
97 |
*/
|
98 |
public function updatePost($data, $append_taxonomies = false)
|
99 |
{
|
100 |
+
if ( !current_user_can( 'edit_post', $data['post_id'] ) ) return false;
|
101 |
$updated_post = [
|
102 |
'ID' => sanitize_text_field($data['post_id'])
|
103 |
];
|
171 |
*/
|
172 |
public function updateTemplate($data)
|
173 |
{
|
174 |
+
if ( isset($data['page_template']) && current_user_can('edit_post_meta', $data['post_id'], '_wp_page_template') ){
|
175 |
$template = sanitize_text_field($data['page_template']);
|
176 |
update_post_meta(
|
177 |
$data['post_id'],
|
188 |
*/
|
189 |
public function updateNavStatus($data)
|
190 |
{
|
191 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], '_np_nav_status') ) return;
|
192 |
$status = ( isset($data['nav_status']) && $data['nav_status'] == 'hide' ) ? 'hide' : 'show';
|
193 |
$id = ( isset($data['post_id']) ) ? $data['post_id'] : $this->new_id;
|
194 |
update_post_meta(
|
205 |
*/
|
206 |
private function updateNestedPagesStatus($data)
|
207 |
{
|
208 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], '_nested_pages_status') ) return;
|
209 |
if ( $this->post_type_repo->standardFieldDisabled('hide_in_np', sanitize_text_field($data['post_type'])) ) return;
|
210 |
|
211 |
$status = ( isset($data['nested_pages_status']) && $data['nested_pages_status'] == 'hide' ) ? 'hide' : 'show';
|
224 |
*/
|
225 |
private function updateNavTitle($data)
|
226 |
{
|
227 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], '_np_nav_title') ) return;
|
228 |
if ( isset($data['np_nav_title']) ){
|
229 |
$title = sanitize_text_field($data['np_nav_title']);
|
230 |
update_post_meta(
|
242 |
*/
|
243 |
private function updateNavCSS($data)
|
244 |
{
|
245 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], '_np_nav_css_classes') ) return;
|
246 |
if ( isset($data['np_nav_css_classes']) ){
|
247 |
$css_classes = sanitize_text_field($data['np_nav_css_classes']);
|
248 |
update_post_meta(
|
260 |
*/
|
261 |
private function updateTitleAttribute($data)
|
262 |
{
|
263 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], '_np_title_attribute') ) return;
|
264 |
if ( isset($data['np_title_attribute']) ){
|
265 |
$title_attr = sanitize_text_field($data['np_title_attribute']);
|
266 |
update_post_meta(
|
280 |
foreach ( $data as $key => $value ){
|
281 |
if ( strpos($key, 'np_custom_') !== false) {
|
282 |
$field_key = str_replace('np_custom_', '', $key);
|
283 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], $field_key) ) continue;
|
284 |
update_post_meta(
|
285 |
$data['post_id'],
|
286 |
$field_key,
|
297 |
*/
|
298 |
private function updateCategories($data, $append_taxonomies = false)
|
299 |
{
|
300 |
+
if ( !current_user_can('edit_post', $data['post_id']) ) return;
|
301 |
if ( isset($data['post_category']) )
|
302 |
{
|
303 |
$this->validation->validateIntegerArray($data['post_category']);
|
316 |
*/
|
317 |
private function updateTaxonomies($data, $append_taxonomies)
|
318 |
{
|
319 |
+
if ( !current_user_can('edit_post', $data['post_id']) ) return;
|
320 |
if ( isset($data['tax_input']) ) {
|
321 |
foreach ( $data['tax_input'] as $taxonomy => $term_ids ){
|
322 |
$tax = get_taxonomy($taxonomy);
|
337 |
*/
|
338 |
private function updateHierarchicalTaxonomies($data, $taxonomy, $term_ids, $append_taxonomies)
|
339 |
{
|
340 |
+
if ( !current_user_can('edit_post', $data['post_id']) ) return;
|
341 |
$terms = [];
|
342 |
foreach ( $term_ids as $term ){
|
343 |
if ( $term !== 0 ) $terms[] = (int) $term;
|
352 |
*/
|
353 |
private function updateFlatTaxonomy($data, $taxonomy, $terms, $append_taxonomies)
|
354 |
{
|
355 |
+
if ( !current_user_can('edit_post', $data['post_id']) ) return;
|
356 |
$terms = explode(',', sanitize_text_field($terms));
|
357 |
$new_terms = array();
|
358 |
foreach($terms as $term)
|
369 |
*/
|
370 |
private function updateLinkTarget($data)
|
371 |
{
|
372 |
+
if ( !current_user_can('edit_post_meta', $data['post_id'], '_np_link_target') ) return;
|
373 |
$link_target = ( isset($data['link_target']) && $data['link_target'] == "_blank" ) ? "_blank" : "";
|
374 |
$id = ( isset($data['post_id']) ) ? $data['post_id'] : $this->new_id;
|
375 |
update_post_meta(
|
386 |
*/
|
387 |
private function updateSticky($data)
|
388 |
{
|
389 |
+
if ( !current_user_can('manage_options') ) return;
|
390 |
if ( $this->post_type_repo->standardFieldDisabled('sticky', sanitize_text_field($data['post_type'])) ) return;
|
391 |
$sticky_posts = get_option('sticky_posts');
|
392 |
if ( isset($data['sticky']) && $data['sticky'] ){
|
407 |
*/
|
408 |
private function updateMenuMeta($data)
|
409 |
{
|
410 |
+
if ( !current_user_can( 'edit_post', $data['post_id'] ) ) return false;
|
411 |
$id = ( isset($data['post_id']) ) ? $data['post_id'] : $this->new_id;
|
412 |
$link_target = ( isset($data['linkTarget']) ) ? "_blank" : "";
|
413 |
update_post_meta($id, '_np_link_target', $link_target);
|
435 |
*/
|
436 |
public function updateRedirect($data)
|
437 |
{
|
438 |
+
if ( !current_user_can( 'edit_post', $data['post_id'] ) ) return false;
|
439 |
$menu_order = isset($data['menu_order']) ? $data['menu_order'] : 0;
|
440 |
$updated_post = [
|
441 |
'ID' => sanitize_text_field($data['post_id']),
|
461 |
*/
|
462 |
public function saveRedirect($data)
|
463 |
{
|
464 |
+
if ( !current_user_can('manage_options') ) return;
|
465 |
$new_link = [
|
466 |
'post_title' => sanitize_text_field($data['menuTitle']),
|
467 |
'post_status' => sanitize_text_field('publish'),
|
486 |
*/
|
487 |
public function updateFromMenuItem($data)
|
488 |
{
|
489 |
+
if ( !current_user_can( 'edit_post', $data['post_id'] ) ) return false;
|
490 |
$updated_post = [
|
491 |
'ID' => sanitize_text_field($data['post_id']),
|
492 |
'menu_order' => sanitize_text_field($data['menu_order']),
|
app/Form/Listeners/ClonePost.php
CHANGED
@@ -23,6 +23,7 @@ class ClonePost extends BaseHandler
|
|
23 |
parent::__construct();
|
24 |
$this->cloner = new PostCloner;
|
25 |
$this->setPostID();
|
|
|
26 |
$this->clonePost();
|
27 |
}
|
28 |
|
23 |
parent::__construct();
|
24 |
$this->cloner = new PostCloner;
|
25 |
$this->setPostID();
|
26 |
+
if ( !current_user_can('edit_post', $this->data['post_id']) ) return;
|
27 |
$this->clonePost();
|
28 |
}
|
29 |
|
app/Form/Listeners/NewMenuItem.php
CHANGED
@@ -12,6 +12,7 @@ class NewMenuItem extends BaseHandler
|
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
|
|
15 |
$this->validateFields();
|
16 |
$this->saveRedirect();
|
17 |
$this->syncMenu();
|
@@ -68,6 +69,11 @@ class NewMenuItem extends BaseHandler
|
|
68 |
$this->data['post']['original_title'] = $term->name;
|
69 |
return;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
71 |
$id = $this->data['post']['objectId'];
|
72 |
$this->data['post']['original_link'] = get_the_permalink($id);
|
73 |
$this->data['post']['original_title'] = get_the_title($id);
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
15 |
+
if ( !current_user_can('publish_posts') ) return;
|
16 |
$this->validateFields();
|
17 |
$this->saveRedirect();
|
18 |
$this->syncMenu();
|
69 |
$this->data['post']['original_title'] = $term->name;
|
70 |
return;
|
71 |
}
|
72 |
+
if ( $type == 'post_type_archive' ){
|
73 |
+
$this->data['post']['original_link'] = get_post_type_archive_link($this->data['post']['objectType']);
|
74 |
+
$this->data['post']['original_title'] = sanitize_text_field($this->data['post']['menuTitle']);
|
75 |
+
return;
|
76 |
+
}
|
77 |
$id = $this->data['post']['objectId'];
|
78 |
$this->data['post']['original_link'] = get_the_permalink($id);
|
79 |
$this->data['post']['original_title'] = get_the_title($id);
|
app/Form/Listeners/ResetUserPreferences.php
CHANGED
@@ -11,6 +11,7 @@ class ResetUserPreferences extends BaseHandler
|
|
11 |
|
12 |
private function reset()
|
13 |
{
|
|
|
14 |
global $wpdb;
|
15 |
$wpdb->delete($wpdb->usermeta, ['meta_key' => 'np_visible_posts']);
|
16 |
return wp_send_json(['status' => 'success']);
|
11 |
|
12 |
private function reset()
|
13 |
{
|
14 |
+
if ( !current_user_can('manage_options') ) return;
|
15 |
global $wpdb;
|
16 |
$wpdb->delete($wpdb->usermeta, ['meta_key' => 'np_visible_posts']);
|
17 |
return wp_send_json(['status' => 'success']);
|
app/Form/Listeners/Sort.php
CHANGED
@@ -24,7 +24,8 @@ class Sort extends BaseHandler
|
|
24 |
private function updateOrder()
|
25 |
{
|
26 |
$posts = $this->data['list'];
|
27 |
-
$
|
|
|
28 |
if ( $order ){
|
29 |
if ( $this->integrations->plugins->wpml->installed ) $this->integrations->plugins->wpml->syncPostOrder($posts);
|
30 |
$this->response = ['status' => 'success', 'message' => __('Page order successfully updated.','wp-nested-pages') ];
|
24 |
private function updateOrder()
|
25 |
{
|
26 |
$posts = $this->data['list'];
|
27 |
+
$filtered = ( isset($this->data['filtered']) && $this->data['filtered'] == 'true' ) ? true : false;
|
28 |
+
$order = $this->post_update_repo->updateOrder($posts, 0, $filtered);
|
29 |
if ( $order ){
|
30 |
if ( $this->integrations->plugins->wpml->installed ) $this->integrations->plugins->wpml->syncPostOrder($posts);
|
31 |
$this->response = ['status' => 'success', 'message' => __('Page order successfully updated.','wp-nested-pages') ];
|
app/Form/Listeners/TrashWithChildren.php
CHANGED
@@ -83,7 +83,9 @@ class TrashWithChildren extends BaseHandler
|
|
83 |
private function trashPosts()
|
84 |
{
|
85 |
foreach ( $this->trash_ids as $post_id ){
|
86 |
-
|
|
|
|
|
87 |
}
|
88 |
}
|
89 |
|
83 |
private function trashPosts()
|
84 |
{
|
85 |
foreach ( $this->trash_ids as $post_id ){
|
86 |
+
$post_type = get_post_type($post_id);
|
87 |
+
$capability = ( $post_type == 'page' ) ? 'delete_page' : 'delete_posts';
|
88 |
+
if ( current_user_can( $capability, get_the_id() ) ) wp_trash_post($post_id);
|
89 |
}
|
90 |
}
|
91 |
|
app/NestedPages.php
CHANGED
@@ -12,7 +12,7 @@ class NestedPages
|
|
12 |
$np_env = 'live';
|
13 |
|
14 |
global $np_version;
|
15 |
-
$np_version = '3.1.
|
16 |
|
17 |
if ( is_admin() ) $app = new NestedPages\Bootstrap;
|
18 |
if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
|
12 |
$np_env = 'live';
|
13 |
|
14 |
global $np_version;
|
15 |
+
$np_version = '3.1.12';
|
16 |
|
17 |
if ( is_admin() ) $app = new NestedPages\Bootstrap;
|
18 |
if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
|
app/Redirects.php
CHANGED
@@ -30,7 +30,7 @@ class Redirects
|
|
30 |
'page' => 'nestedpages',
|
31 |
'trashed' => true
|
32 |
);
|
33 |
-
if ( isset($_GET['ids']) ) $query_args['ids'] = urlencode($_GET['ids']);
|
34 |
$redirect = add_query_arg(['page'=>'nestedpages', 'trashed' => true ]);
|
35 |
wp_redirect($redirect);
|
36 |
exit();
|
@@ -50,7 +50,7 @@ class Redirects
|
|
50 |
(!isset($_GET['bulk'])) &&
|
51 |
$this->arePagesNested()
|
52 |
){
|
53 |
-
$redirect = add_query_arg(['page'=>'nestedpages', 'untrashed' => true, 'untrashed' => urlencode($_GET['untrashed']) ]);
|
54 |
wp_redirect($redirect);
|
55 |
exit();
|
56 |
}
|
30 |
'page' => 'nestedpages',
|
31 |
'trashed' => true
|
32 |
);
|
33 |
+
if ( isset($_GET['ids']) ) $query_args['ids'] = urlencode(sanitize_text_field($_GET['ids']));
|
34 |
$redirect = add_query_arg(['page'=>'nestedpages', 'trashed' => true ]);
|
35 |
wp_redirect($redirect);
|
36 |
exit();
|
50 |
(!isset($_GET['bulk'])) &&
|
51 |
$this->arePagesNested()
|
52 |
){
|
53 |
+
$redirect = add_query_arg(['page'=>'nestedpages', 'untrashed' => true, 'untrashed' => urlencode(sanitize_text_field($_GET['untrashed'])) ]);
|
54 |
wp_redirect($redirect);
|
55 |
exit();
|
56 |
}
|
app/Views/forms/link-form.php
CHANGED
@@ -23,7 +23,7 @@ $can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
|
23 |
foreach ( $this->listing_repo->postTypes() as $name => $type ) {
|
24 |
$recent_posts = $this->listing_repo->recentPosts($name);
|
25 |
if ( !$recent_posts ) continue;
|
26 |
-
$out = '<li><a href="#" data-np-menu-accordion-item>' .
|
27 |
$out .= '<ul>';
|
28 |
$out .= '<li class="np-menu-search"><input type="text" data-np-menu-search data-search-type="post_type" data-search-object="' . esc_attr($name) . '" placeholder="' . __('Search', 'wp-nested-pages') . ' ' . esc_attr($type->labels->name) . '" />';
|
29 |
$out .= '<div class="np-default-loading np-menu-search-loading">';
|
@@ -33,8 +33,13 @@ $can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
|
33 |
ob_end_clean();
|
34 |
$out .= '</div>';
|
35 |
$out .= '<div class="np-menu-search-noresults">' . __('No Results', 'wp-nested-pages') . '</div></li>';
|
|
|
|
|
|
|
|
|
|
|
36 |
foreach ( $recent_posts as $post ){
|
37 |
-
$out .= '<li data-default-result><a href="#" data-np-menu-object="' . esc_attr($name) . '" data-np-menu-type="post_type" data-np-menu-objectid="' . esc_attr($post->ID) . '" data-np-permalink="' . get_the_permalink($post->ID) . '" data-np-object-name="' . esc_attr($type->labels->singular_name) . '" data-np-menu-selection>' .
|
38 |
}
|
39 |
$out .= '</ul>';
|
40 |
$out .= '</li>';
|
@@ -47,11 +52,11 @@ $can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
|
47 |
foreach ( $this->listing_repo->taxonomies() as $name => $taxonomy ) {
|
48 |
$terms = $this->listing_repo->terms($name);
|
49 |
if ( !$terms ) continue;
|
50 |
-
$out = '<li><a href="#" data-np-menu-accordion-item>' .
|
51 |
$out .= '<ul>';
|
52 |
$out .= '<li class="np-menu-search"><input type="text" data-np-menu-search data-search-type="taxonomy" data-search-object="' . esc_attr($name) . '" placeholder="' . __('Search', 'wp-nested-pages') . ' ' . esc_attr($taxonomy->labels->name) . '" /><div class="np-menu-search-loading"></div><div class="np-menu-search-noresults">' . __('No Results', 'wp-nested-pages') . '</div></li>';
|
53 |
foreach ( $terms as $term ){
|
54 |
-
$out .= '<li data-default-result><a href="#" data-np-menu-object="' . esc_attr($name) . '" data-np-menu-type="taxonomy" data-np-menu-objectid="' . esc_attr($term->term_id) . '" data-np-permalink="' . esc_attr(get_term_link($term)) . '" data-np-object-name="' . esc_attr($taxonomy->labels->name) . '" data-np-menu-selection>' .
|
55 |
}
|
56 |
$out .= '</ul>';
|
57 |
$out .= '</li>';
|
23 |
foreach ( $this->listing_repo->postTypes() as $name => $type ) {
|
24 |
$recent_posts = $this->listing_repo->recentPosts($name);
|
25 |
if ( !$recent_posts ) continue;
|
26 |
+
$out = '<li><a href="#" data-np-menu-accordion-item>' . esc_html($type->labels->name) . '</a>';
|
27 |
$out .= '<ul>';
|
28 |
$out .= '<li class="np-menu-search"><input type="text" data-np-menu-search data-search-type="post_type" data-search-object="' . esc_attr($name) . '" placeholder="' . __('Search', 'wp-nested-pages') . ' ' . esc_attr($type->labels->name) . '" />';
|
29 |
$out .= '<div class="np-default-loading np-menu-search-loading">';
|
33 |
ob_end_clean();
|
34 |
$out .= '</div>';
|
35 |
$out .= '<div class="np-menu-search-noresults">' . __('No Results', 'wp-nested-pages') . '</div></li>';
|
36 |
+
|
37 |
+
if ( $type->has_archive ) :
|
38 |
+
$out .= '<li data-default-result class="post-type-archive"><a href="#" data-np-menu-object="' . esc_attr($name) . '" data-np-menu-type="post_type_archive" data-np-object-name="' . sprintf(__('%s (Archive)'), esc_attr($type->labels->name)) . '" data-np-permalink="' . get_post_type_archive_link($name) . '" data-np-menu-selection>' . sprintf(__('%s (Archive)', 'wp-nested-pages'), esc_html($type->labels->name)) . '</a></li>';
|
39 |
+
endif;
|
40 |
+
|
41 |
foreach ( $recent_posts as $post ){
|
42 |
+
$out .= '<li data-default-result><a href="#" data-np-menu-object="' . esc_attr($name) . '" data-np-menu-type="post_type" data-np-menu-objectid="' . esc_attr($post->ID) . '" data-np-permalink="' . get_the_permalink($post->ID) . '" data-np-object-name="' . esc_attr($type->labels->singular_name) . '" data-np-menu-selection>' . esc_html($post->post_title) . '</a></li>';
|
43 |
}
|
44 |
$out .= '</ul>';
|
45 |
$out .= '</li>';
|
52 |
foreach ( $this->listing_repo->taxonomies() as $name => $taxonomy ) {
|
53 |
$terms = $this->listing_repo->terms($name);
|
54 |
if ( !$terms ) continue;
|
55 |
+
$out = '<li><a href="#" data-np-menu-accordion-item>' . esc_html($taxonomy->labels->name) . '</a>';
|
56 |
$out .= '<ul>';
|
57 |
$out .= '<li class="np-menu-search"><input type="text" data-np-menu-search data-search-type="taxonomy" data-search-object="' . esc_attr($name) . '" placeholder="' . __('Search', 'wp-nested-pages') . ' ' . esc_attr($taxonomy->labels->name) . '" /><div class="np-menu-search-loading"></div><div class="np-menu-search-noresults">' . __('No Results', 'wp-nested-pages') . '</div></li>';
|
58 |
foreach ( $terms as $term ){
|
59 |
+
$out .= '<li data-default-result><a href="#" data-np-menu-object="' . esc_attr($name) . '" data-np-menu-type="taxonomy" data-np-menu-objectid="' . esc_attr($term->term_id) . '" data-np-permalink="' . esc_attr(get_term_link($term)) . '" data-np-object-name="' . esc_attr($taxonomy->labels->name) . '" data-np-menu-selection>' . esc_html($term->name) . '</a></li>';
|
60 |
}
|
61 |
$out .= '</ul>';
|
62 |
$out .= '</li>';
|
app/Views/forms/quickedit-post.php
CHANGED
@@ -18,12 +18,12 @@ $has_menu_options = ( $this->user->canSortPosts($this->post_type->name) && $this
|
|
18 |
<h3><?php _e('Quick Edit', 'wp-nested-pages'); ?><span class="page_id"></span></h3>
|
19 |
<div class="np-quickedit-error" style="clear:both;display:none;"></div>
|
20 |
<ul class="np-tabs">
|
21 |
-
<li class="active"><a href="#" data-np-tab-group="quick-edit" data-np-tab-toggle="post-info"><?php
|
22 |
<?php if ( $has_taxonomies ) : ?>
|
23 |
-
<li><a href="#" data-np-tab-group="quick-edit" data-np-tab-toggle="taxonomies"><?php
|
24 |
<?php endif; ?>
|
25 |
<?php if ( $has_menu_options ) : ?>
|
26 |
-
<li><a href="#" data-np-tab-group="quick-edit" data-np-tab-toggle="menu-options"><?php
|
27 |
<?php endif; ?>
|
28 |
</ul>
|
29 |
</div>
|
@@ -69,7 +69,7 @@ $has_menu_options = ( $this->user->canSortPosts($this->post_type->name) && $this
|
|
69 |
</div>
|
70 |
<?php else : ?>
|
71 |
<div>
|
72 |
-
<label><?php _e( 'Date' ); ?></label>
|
73 |
<div class="dates"><?php touch_time( 1, 1, 0, 1 ); ?></div>
|
74 |
</div>
|
75 |
<?php endif; endif; ?>
|
@@ -204,7 +204,7 @@ $has_menu_options = ( $this->user->canSortPosts($this->post_type->name) && $this
|
|
204 |
if ( !$disabled ) :
|
205 |
?>
|
206 |
<div class="np-taxonomy">
|
207 |
-
<span class="title"><?php
|
208 |
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
|
209 |
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
|
210 |
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
|
@@ -221,8 +221,8 @@ $has_menu_options = ( $this->user->canSortPosts($this->post_type->name) && $this
|
|
221 |
if ( !$disabled ) :
|
222 |
?>
|
223 |
<div class="np-taxonomy">
|
224 |
-
<span class="title"><?php
|
225 |
-
<textarea id="<?php
|
226 |
</div><!-- .np-taxonomy -->
|
227 |
<?php
|
228 |
endif;
|
18 |
<h3><?php _e('Quick Edit', 'wp-nested-pages'); ?><span class="page_id"></span></h3>
|
19 |
<div class="np-quickedit-error" style="clear:both;display:none;"></div>
|
20 |
<ul class="np-tabs">
|
21 |
+
<li class="active"><a href="#" data-np-tab-group="quick-edit" data-np-tab-toggle="post-info"><?php esc_html_e($this->post_type->labels->singular_name); ?></a></li>
|
22 |
<?php if ( $has_taxonomies ) : ?>
|
23 |
+
<li><a href="#" data-np-tab-group="quick-edit" data-np-tab-toggle="taxonomies"><?php esc_html_e('Taxonomies', 'wp-nested-pages'); ?></a></li>
|
24 |
<?php endif; ?>
|
25 |
<?php if ( $has_menu_options ) : ?>
|
26 |
+
<li><a href="#" data-np-tab-group="quick-edit" data-np-tab-toggle="menu-options"><?php esc_html_e('Menu Options', 'wp-nested-pages'); ?></a></li>
|
27 |
<?php endif; ?>
|
28 |
</ul>
|
29 |
</div>
|
69 |
</div>
|
70 |
<?php else : ?>
|
71 |
<div>
|
72 |
+
<label><?php _e( 'Date', 'wp-nested-pages' ); ?></label>
|
73 |
<div class="dates"><?php touch_time( 1, 1, 0, 1 ); ?></div>
|
74 |
</div>
|
75 |
<?php endif; endif; ?>
|
204 |
if ( !$disabled ) :
|
205 |
?>
|
206 |
<div class="np-taxonomy">
|
207 |
+
<span class="title"><?php esc_html_e( $taxonomy->labels->name ) ?></span>
|
208 |
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
|
209 |
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
|
210 |
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
|
221 |
if ( !$disabled ) :
|
222 |
?>
|
223 |
<div class="np-taxonomy">
|
224 |
+
<span class="title"><?php esc_html_e( $taxonomy->labels->name ) ?></span>
|
225 |
+
<textarea id="<?php esc_attr_e($taxonomy->name); ?>-quickedit" cols="22" rows="1" name="tax_input[<?php esc_attr_e( $taxonomy->name )?>]" class="tax_input_<?php esc_attr_e( $taxonomy->name )?>" data-autotag data-taxonomy="<?php esc_attr_e($taxonomy->name); ?>"></textarea>
|
226 |
</div><!-- .np-taxonomy -->
|
227 |
<?php
|
228 |
endif;
|
app/Views/listing.php
CHANGED
@@ -10,16 +10,16 @@ endif;
|
|
10 |
<div class="wrap nestedpages <?php if ( $dark_mode ) echo 'np-dark-mode'; ?>">
|
11 |
<div class="nestedpages-listing-title">
|
12 |
<h1 class="wp-heading-inline">
|
13 |
-
<?php echo apply_filters('nestedpages_page_title',
|
14 |
</h1>
|
15 |
|
16 |
<?php if ( $this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name) ) : ?>
|
17 |
<a href="<?php echo $this->post_type_repo->addNewPostLink($this->post_type->name); ?>" class="page-title-action">
|
18 |
-
<?php echo apply_filters('nestedpages_add_new_text',
|
19 |
</a>
|
20 |
<?php endif; ?>
|
21 |
|
22 |
-
<?php if ( ($this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name)) && !$this->listing_repo->isSearch() && $wpml_pages ) : ?>
|
23 |
<a href="#" class="open-bulk-modal page-title-action" title="<?php _e('Add Multiple', 'wp-nested-pages'); ?>" data-parentid="0" data-nestedpages-modal-toggle="np-bulk-modal">
|
24 |
<?php echo apply_filters('nestedpages_add_multiple_text', esc_html__('Add Multiple', 'wp-nested-pages'), $this->post_type); ?>
|
25 |
</a>
|
@@ -59,7 +59,7 @@ endif;
|
|
59 |
<input type="checkbox" name="np_sync_menu" class="np-sync-menu" value="sync" <?php if ( get_option('nestedpages_menusync') == 'sync' ) echo 'checked'; ?>/>
|
60 |
<?php
|
61 |
esc_html_e('Sync Menu', 'wp-nested-pages');
|
62 |
-
if ( $wpml ) echo ' (' .
|
63 |
?>
|
64 |
</label>
|
65 |
<?php else : ?>
|
10 |
<div class="wrap nestedpages <?php if ( $dark_mode ) echo 'np-dark-mode'; ?>">
|
11 |
<div class="nestedpages-listing-title">
|
12 |
<h1 class="wp-heading-inline">
|
13 |
+
<?php echo apply_filters('nestedpages_page_title', esc_html($this->post_type->labels->name), $this->post_type); ?>
|
14 |
</h1>
|
15 |
|
16 |
<?php if ( $this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name) ) : ?>
|
17 |
<a href="<?php echo $this->post_type_repo->addNewPostLink($this->post_type->name); ?>" class="page-title-action">
|
18 |
+
<?php echo apply_filters('nestedpages_add_new_text', esc_html($this->post_type->labels->add_new), $this->post_type); ?>
|
19 |
</a>
|
20 |
<?php endif; ?>
|
21 |
|
22 |
+
<?php if ( ($this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name)) && !$this->listing_repo->isSearch() && $wpml_pages && !$this->listing_repo->isFiltered() ) : ?>
|
23 |
<a href="#" class="open-bulk-modal page-title-action" title="<?php _e('Add Multiple', 'wp-nested-pages'); ?>" data-parentid="0" data-nestedpages-modal-toggle="np-bulk-modal">
|
24 |
<?php echo apply_filters('nestedpages_add_multiple_text', esc_html__('Add Multiple', 'wp-nested-pages'), $this->post_type); ?>
|
25 |
</a>
|
59 |
<input type="checkbox" name="np_sync_menu" class="np-sync-menu" value="sync" <?php if ( get_option('nestedpages_menusync') == 'sync' ) echo 'checked'; ?>/>
|
60 |
<?php
|
61 |
esc_html_e('Sync Menu', 'wp-nested-pages');
|
62 |
+
if ( $wpml ) echo ' (' . esc_html($this->integrations->plugins->wpml->getCurrentLanguage('name')) . ')';
|
63 |
?>
|
64 |
</label>
|
65 |
<?php else : ?>
|
app/Views/partials/bulk-edit.php
CHANGED
@@ -123,9 +123,9 @@
|
|
123 |
<div class="np-taxonomies">
|
124 |
<?php foreach ( $this->h_taxonomies as $taxonomy ) : ?>
|
125 |
<div class="np-taxonomy">
|
126 |
-
<span class="title"><?php
|
127 |
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
|
128 |
-
<ul class="cat-checklist <?php
|
129 |
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
|
130 |
</ul>
|
131 |
</div><!-- .np-taxonomy -->
|
@@ -133,8 +133,8 @@
|
|
133 |
|
134 |
<?php foreach ( $this->f_taxonomies as $taxonomy ) : ?>
|
135 |
<div class="np-taxonomy">
|
136 |
-
<span class="title"><?php
|
137 |
-
<textarea id="<?php
|
138 |
</div><!-- .np-taxonomy -->
|
139 |
<?php endforeach; ?>
|
140 |
</div><!-- .taxonomies -->
|
123 |
<div class="np-taxonomies">
|
124 |
<?php foreach ( $this->h_taxonomies as $taxonomy ) : ?>
|
125 |
<div class="np-taxonomy">
|
126 |
+
<span class="title"><?php esc_html_e( $taxonomy->labels->name ) ?></span>
|
127 |
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
|
128 |
+
<ul class="cat-checklist <?php esc_attr_e( $taxonomy->name )?>-checklist">
|
129 |
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
|
130 |
</ul>
|
131 |
</div><!-- .np-taxonomy -->
|
133 |
|
134 |
<?php foreach ( $this->f_taxonomies as $taxonomy ) : ?>
|
135 |
<div class="np-taxonomy">
|
136 |
+
<span class="title"><?php esc_html_e( $taxonomy->labels->name ) ?></span>
|
137 |
+
<textarea id="<?php esc_attr_e($taxonomy->name); ?>" cols="22" rows="1" name="tax_input[<?php esc_attr_e( $taxonomy->name )?>]" class="tax_input_<?php esc_attr_e( $taxonomy->name )?>" data-autotag data-taxonomy="<?php esc_attr_e($taxonomy->name); ?>"></textarea>
|
138 |
</div><!-- .np-taxonomy -->
|
139 |
<?php endforeach; ?>
|
140 |
</div><!-- .taxonomies -->
|
app/Views/partials/row.php
CHANGED
@@ -60,7 +60,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
60 |
$u = get_userdata($user);
|
61 |
echo '<span class="locked">';
|
62 |
echo ' <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>';
|
63 |
-
echo '<em> ' . sprintf(__('%s currently editing', 'wp-nested-pages'),
|
64 |
} elseif ( !$this->integrations->plugins->editorial_access_manager->hasAccess($this->post->id) ){
|
65 |
echo '<span class="locked">';
|
66 |
echo ' <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>';
|
@@ -95,7 +95,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
95 |
|
96 |
<?php
|
97 |
if ( $this->integrations->plugins->yoast->installed ){
|
98 |
-
echo '<span class="np-seo-indicator ' .
|
99 |
}
|
100 |
?>
|
101 |
|
@@ -141,7 +141,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
141 |
// Link
|
142 |
if ( !$this->settings->menusDisabled() && !$this->integrations->plugins->wpml->installed && in_array('add_child_link', $this->post_type_settings->row_actions) && $include_link_dropdown ) : ?>
|
143 |
<li>
|
144 |
-
<a href="#" class="open-redirect-modal" data-parentid="<?php
|
145 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="primary" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>
|
146 |
<?php _e('Add Child Link', 'wp-nested-pages'); ?></a>
|
147 |
</li>
|
@@ -149,7 +149,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
149 |
|
150 |
<?php if ( in_array('add_child_page', $this->post_type_settings->row_actions) ) : ?>
|
151 |
<li>
|
152 |
-
<a href="#" class="add-new-child" data-id="<?php
|
153 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path class="primary" d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
154 |
<?php echo sprintf(__('Add Child %s', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a>
|
155 |
</li>
|
@@ -161,7 +161,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
161 |
|
162 |
<?php if ( in_array('insert_before', $this->post_type_settings->row_actions) ) : ?>
|
163 |
<li>
|
164 |
-
<a href="#" data-insert-before="<?php
|
165 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path class="primary" d="M8 11h3v10h2V11h3l-4-4-4 4zM4 3v2h16V3H4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
166 |
<?php printf(esc_html__('Insert %s Before', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a>
|
167 |
</li>
|
@@ -169,7 +169,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
169 |
|
170 |
<?php if ( in_array('insert_after', $this->post_type_settings->row_actions) ) : ?>
|
171 |
<li>
|
172 |
-
<a href="#" data-insert-after="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php
|
173 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path class="primary" d="M16 13h-3V3h-2v10H8l4 4 4-4zM4 19v2h16v-2H4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
174 |
<?php printf(esc_html__('Insert %s After', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a>
|
175 |
</li>
|
@@ -205,7 +205,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
205 |
|
206 |
<?php if ( current_user_can('edit_pages') && current_user_can('edit_posts') && $wpml_pages && in_array('clone', $this->post_type_settings->row_actions) ) : ?>
|
207 |
<li>
|
208 |
-
<a href="#" class="clone-post" data-id="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php
|
209 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path class="primary" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"/></svg>
|
210 |
<?php _e('Clone', 'wp-nested-pages'); ?></a>
|
211 |
</li>
|
@@ -264,7 +264,7 @@ if ( !$wpml ) $wpml_pages = true;
|
|
264 |
if ( in_array('view', $this->post_type_settings->row_actions) ) :
|
265 |
if ( $this->post->status == 'publish' ) :
|
266 |
$link = apply_filters('nestedpages_view_link', get_the_permalink(), $this->post);
|
267 |
-
$link = ( $this->post_type->name == 'page' ) ? apply_filters('page_link', $link, $this->post) : apply_filters('post_link', $link, $this->post);
|
268 |
?>
|
269 |
<a href="<?php echo $link; ?>" class="np-btn np-view-button" target="_blank">
|
270 |
<?php echo apply_filters('nestedpages_view_link_text', __('View', 'wp-nested-pages'), $this->post); ?>
|
@@ -328,4 +328,4 @@ if ( !$wpml ) $wpml_pages = true;
|
|
328 |
<div class="np-bulk-checkbox">
|
329 |
<input type="checkbox" name="nestedpages_bulk[]" value="<?php echo esc_attr($this->post->id); ?>" data-np-bulk-checkbox="<?php echo esc_attr($this->post->title); ?>" data-np-post-type="<?php echo esc_attr($this->post->post_type); ?>" />
|
330 |
</div>
|
331 |
-
</div><!-- .row -->
|
60 |
$u = get_userdata($user);
|
61 |
echo '<span class="locked">';
|
62 |
echo ' <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>';
|
63 |
+
echo '<em> ' . sprintf(__('%s currently editing', 'wp-nested-pages'), esc_html($u->display_name)) . '</em></span>';
|
64 |
} elseif ( !$this->integrations->plugins->editorial_access_manager->hasAccess($this->post->id) ){
|
65 |
echo '<span class="locked">';
|
66 |
echo ' <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>';
|
95 |
|
96 |
<?php
|
97 |
if ( $this->integrations->plugins->yoast->installed ){
|
98 |
+
echo '<span class="np-seo-indicator ' . esc_html($this->post->score) . '"></span>';
|
99 |
}
|
100 |
?>
|
101 |
|
141 |
// Link
|
142 |
if ( !$this->settings->menusDisabled() && !$this->integrations->plugins->wpml->installed && in_array('add_child_link', $this->post_type_settings->row_actions) && $include_link_dropdown ) : ?>
|
143 |
<li>
|
144 |
+
<a href="#" class="open-redirect-modal" data-parentid="<?php esc_attr_e($this->post->id); ?>">
|
145 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="primary" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>
|
146 |
<?php _e('Add Child Link', 'wp-nested-pages'); ?></a>
|
147 |
</li>
|
149 |
|
150 |
<?php if ( in_array('add_child_page', $this->post_type_settings->row_actions) ) : ?>
|
151 |
<li>
|
152 |
+
<a href="#" class="add-new-child" data-id="<?php esc_attr_e(get_the_id()); ?>" data-parentname="<?php esc_html_e($this->post->title); ?>">
|
153 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path class="primary" d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
154 |
<?php echo sprintf(__('Add Child %s', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a>
|
155 |
</li>
|
161 |
|
162 |
<?php if ( in_array('insert_before', $this->post_type_settings->row_actions) ) : ?>
|
163 |
<li>
|
164 |
+
<a href="#" data-insert-before="<?php esc_attr_e(get_the_id()); ?>" data-parentname="<?php esc_html_e($this->post->title); ?>">
|
165 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path class="primary" d="M8 11h3v10h2V11h3l-4-4-4 4zM4 3v2h16V3H4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
166 |
<?php printf(esc_html__('Insert %s Before', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a>
|
167 |
</li>
|
169 |
|
170 |
<?php if ( in_array('insert_after', $this->post_type_settings->row_actions) ) : ?>
|
171 |
<li>
|
172 |
+
<a href="#" data-insert-after="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php esc_html_e($this->post->title); ?>">
|
173 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path class="primary" d="M16 13h-3V3h-2v10H8l4 4 4-4zM4 19v2h16v-2H4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
174 |
<?php printf(esc_html__('Insert %s After', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a>
|
175 |
</li>
|
205 |
|
206 |
<?php if ( current_user_can('edit_pages') && current_user_can('edit_posts') && $wpml_pages && in_array('clone', $this->post_type_settings->row_actions) ) : ?>
|
207 |
<li>
|
208 |
+
<a href="#" class="clone-post" data-id="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php esc_html_e($this->post->title); ?>">
|
209 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path class="primary" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"/></svg>
|
210 |
<?php _e('Clone', 'wp-nested-pages'); ?></a>
|
211 |
</li>
|
264 |
if ( in_array('view', $this->post_type_settings->row_actions) ) :
|
265 |
if ( $this->post->status == 'publish' ) :
|
266 |
$link = apply_filters('nestedpages_view_link', get_the_permalink(), $this->post);
|
267 |
+
$link = ( $this->post_type->name == 'page' ) ? apply_filters('page_link', $link, $this->post->ID) : apply_filters('post_link', $link, $this->post);
|
268 |
?>
|
269 |
<a href="<?php echo $link; ?>" class="np-btn np-view-button" target="_blank">
|
270 |
<?php echo apply_filters('nestedpages_view_link_text', __('View', 'wp-nested-pages'), $this->post); ?>
|
328 |
<div class="np-bulk-checkbox">
|
329 |
<input type="checkbox" name="nestedpages_bulk[]" value="<?php echo esc_attr($this->post->id); ?>" data-np-bulk-checkbox="<?php echo esc_attr($this->post->title); ?>" data-np-post-type="<?php echo esc_attr($this->post->post_type); ?>" />
|
330 |
</div>
|
331 |
+
</div><!-- .row -->
|
app/Views/partials/tool-list.php
CHANGED
@@ -67,7 +67,7 @@ if ( $wpml && $current_lang ) $searchLabel .= ' (' . $this->integrations->plugin
|
|
67 |
foreach( $users as $user ){
|
68 |
$out .= '<option value="' . $user->ID . '"';
|
69 |
if ( isset($_GET['author']) && ($_GET['author'] == $user->ID) ) $out .= ' selected';
|
70 |
-
$out .= '>' .
|
71 |
}
|
72 |
echo $out;
|
73 |
?>
|
@@ -92,7 +92,7 @@ if ( $wpml && $current_lang ) $searchLabel .= ' (' . $this->integrations->plugin
|
|
92 |
$out .= '<option value="' . $key . '"';
|
93 |
if ( $default_order_by && $default_order_by == $key ) $out .= ' selected';
|
94 |
if ( isset($_GET['orderby']) && ($_GET['orderby'] == $key) ) $out .= ' selected';
|
95 |
-
$out .= '>' .
|
96 |
}
|
97 |
echo $out;
|
98 |
?>
|
@@ -116,7 +116,7 @@ if ( $wpml && $current_lang ) $searchLabel .= ' (' . $this->integrations->plugin
|
|
116 |
$out .= '<option value="' . esc_attr($key) . '"';
|
117 |
if ( $default_order && $default_order == $key ) $out .= ' selected';
|
118 |
if ( isset($_GET['order']) && ($_GET['order'] == $key) ) $out .= ' selected';
|
119 |
-
$out .= '>' .
|
120 |
}
|
121 |
echo $out;
|
122 |
?>
|
@@ -161,12 +161,12 @@ if ( $wpml && $current_lang ) $searchLabel .= ' (' . $this->integrations->plugin
|
|
161 |
<select id="np_category" name="np_category" class="nestedpages-sort">
|
162 |
<?php
|
163 |
$tax = get_taxonomy('category');
|
164 |
-
$out = '<option value="all">' . __('All ', 'wp-nested-pages') .
|
165 |
$terms = get_terms('category');
|
166 |
foreach( $terms as $term ){
|
167 |
$out .= '<option value="' . esc_attr($term->term_id) . '"';
|
168 |
if ( isset($_GET['category']) && ($_GET['category'] == $term->term_id) ) $out .= ' selected';
|
169 |
-
$out .= '>' .
|
170 |
}
|
171 |
echo $out;
|
172 |
?>
|
67 |
foreach( $users as $user ){
|
68 |
$out .= '<option value="' . $user->ID . '"';
|
69 |
if ( isset($_GET['author']) && ($_GET['author'] == $user->ID) ) $out .= ' selected';
|
70 |
+
$out .= '>' . esc_html($user->display_name) . '</option>';
|
71 |
}
|
72 |
echo $out;
|
73 |
?>
|
92 |
$out .= '<option value="' . $key . '"';
|
93 |
if ( $default_order_by && $default_order_by == $key ) $out .= ' selected';
|
94 |
if ( isset($_GET['orderby']) && ($_GET['orderby'] == $key) ) $out .= ' selected';
|
95 |
+
$out .= '>' . esc_html($option) . '</option>';
|
96 |
}
|
97 |
echo $out;
|
98 |
?>
|
116 |
$out .= '<option value="' . esc_attr($key) . '"';
|
117 |
if ( $default_order && $default_order == $key ) $out .= ' selected';
|
118 |
if ( isset($_GET['order']) && ($_GET['order'] == $key) ) $out .= ' selected';
|
119 |
+
$out .= '>' . esc_html($option) . '</option>';
|
120 |
}
|
121 |
echo $out;
|
122 |
?>
|
161 |
<select id="np_category" name="np_category" class="nestedpages-sort">
|
162 |
<?php
|
163 |
$tax = get_taxonomy('category');
|
164 |
+
$out = '<option value="all">' . __('All ', 'wp-nested-pages') . esc_html($tax->labels->name) . '</option>';
|
165 |
$terms = get_terms('category');
|
166 |
foreach( $terms as $term ){
|
167 |
$out .= '<option value="' . esc_attr($term->term_id) . '"';
|
168 |
if ( isset($_GET['category']) && ($_GET['category'] == $term->term_id) ) $out .= ' selected';
|
169 |
+
$out .= '>' . esc_html($term->name) . '</option>';
|
170 |
}
|
171 |
echo $out;
|
172 |
?>
|
app/Views/settings/partials/nav-menu-settings.php
CHANGED
@@ -43,7 +43,7 @@ foreach ( $this->admin_menu_settings->roles as $role ) :
|
|
43 |
?>
|
44 |
<button class="button button-small details-button" data-np-remove-separator-button><?php _e('Remove', 'wp-nested-pages'); ?></button>
|
45 |
<?php else : ?>
|
46 |
-
<input type="text" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][label]" value="<?php if ( $item_data['custom_label'] ) echo $item_data['custom_label']; ?>" placeholder="<?php
|
47 |
<button class="button button-small details-button" data-np-extra-options-button><?php _e('Details', 'wp-nested-pages');?></button>
|
48 |
<?php endif; ?>
|
49 |
</p>
|
43 |
?>
|
44 |
<button class="button button-small details-button" data-np-remove-separator-button><?php _e('Remove', 'wp-nested-pages'); ?></button>
|
45 |
<?php else : ?>
|
46 |
+
<input type="text" name="nestedpages_admin[nav_menu_options][<?php echo $role['name']; ?>][<?php echo $item_data['id']; ?>][label]" value="<?php if ( $item_data['custom_label'] ) echo $item_data['custom_label']; ?>" placeholder="<?php esc_html_e($item_data['original_text']); ?>" class="menu-title-field" />
|
47 |
<button class="button button-small details-button" data-np-extra-options-button><?php _e('Details', 'wp-nested-pages');?></button>
|
48 |
<?php endif; ?>
|
49 |
</p>
|
app/Views/settings/settings-general.php
CHANGED
@@ -55,7 +55,7 @@ $sync_status = ( $this->settings->menuSyncEnabled() ) ? __('Currently Enabled',
|
|
55 |
<p data-menu-enabled-option data-menu-hide-checkbox>
|
56 |
<label>
|
57 |
<input type="checkbox" name="nestedpages_ui[hide_menu_sync]" value="true" <?php if ( $this->settings->hideMenuSync() ) echo 'checked'; ?> />
|
58 |
-
<?php printf(__('Hide Menu Sync Checkbox (%s)', 'wp-nested-pages'),
|
59 |
</label>
|
60 |
</p>
|
61 |
<p data-menu-enabled-option data-menu-private>
|
@@ -95,7 +95,7 @@ $sync_status = ( $this->settings->menuSyncEnabled() ) ? __('Currently Enabled',
|
|
95 |
<?php foreach ( $this->user_repo->allRoles() as $role ) : ?>
|
96 |
<label>
|
97 |
<input type="checkbox" name="nestedpages_allowsorting[]" value="<?php echo $role['name']; ?>" <?php if ( in_array($role['name'], $allowsorting) ) echo 'checked'; ?> >
|
98 |
-
<?php echo
|
99 |
</label>
|
100 |
<br />
|
101 |
<?php endforeach; ?>
|
@@ -119,7 +119,7 @@ $sync_status = ( $this->settings->menuSyncEnabled() ) ? __('Currently Enabled',
|
|
119 |
if ( is_array($allowsortview) && in_array($role['name'], $allowsortview) ) $checked = true;
|
120 |
?>
|
121 |
<input type="checkbox" name="nestedpages_allowsortview[]" value="<?php echo $role['name']; ?>" <?php if ( $checked ) echo 'checked'; ?> >
|
122 |
-
<?php echo
|
123 |
</label>
|
124 |
<br />
|
125 |
<?php endforeach; ?>
|
55 |
<p data-menu-enabled-option data-menu-hide-checkbox>
|
56 |
<label>
|
57 |
<input type="checkbox" name="nestedpages_ui[hide_menu_sync]" value="true" <?php if ( $this->settings->hideMenuSync() ) echo 'checked'; ?> />
|
58 |
+
<?php printf(__('Hide Menu Sync Checkbox (%s)', 'wp-nested-pages'), esc_html($sync_status)); ?>
|
59 |
</label>
|
60 |
</p>
|
61 |
<p data-menu-enabled-option data-menu-private>
|
95 |
<?php foreach ( $this->user_repo->allRoles() as $role ) : ?>
|
96 |
<label>
|
97 |
<input type="checkbox" name="nestedpages_allowsorting[]" value="<?php echo $role['name']; ?>" <?php if ( in_array($role['name'], $allowsorting) ) echo 'checked'; ?> >
|
98 |
+
<?php echo esc_html($role['label']); ?>
|
99 |
</label>
|
100 |
<br />
|
101 |
<?php endforeach; ?>
|
119 |
if ( is_array($allowsortview) && in_array($role['name'], $allowsortview) ) $checked = true;
|
120 |
?>
|
121 |
<input type="checkbox" name="nestedpages_allowsortview[]" value="<?php echo $role['name']; ?>" <?php if ( $checked ) echo 'checked'; ?> >
|
122 |
+
<?php echo esc_html($role['label']); ?>
|
123 |
</label>
|
124 |
<br />
|
125 |
<?php endforeach; ?>
|
app/Views/settings/settings-posttypes.php
CHANGED
@@ -16,8 +16,8 @@ settings_fields( 'nestedpages-posttypes' );
|
|
16 |
<label for="post-type-<?php echo $type->name; ?>">
|
17 |
<?php
|
18 |
echo ( $type->hierarchical )
|
19 |
-
? wp_kses(sprintf(__('%s <em>(Hierarchical)</em>', 'wp-nested-pages'),
|
20 |
-
:
|
21 |
?>
|
22 |
</label>
|
23 |
<a href="#" class="button" data-toggle-nestedpages-pt-settings><?php _e('Settings', 'wp-nested-pages'); ?></a>
|
@@ -31,7 +31,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
31 |
<?php _e('Replace the default top-level item with the nested view link.', 'wp-nested-pages'); ?></p>
|
32 |
</div>
|
33 |
<div class="field">
|
34 |
-
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][replace_menu]" value="true" <?php if ( $type->replace_menu ) echo 'checked'; ?> /><?php printf(__('Replace Default %s Menu', 'wp-nested-pages'),
|
35 |
</div><!-- .field -->
|
36 |
</div><!-- .row -->
|
37 |
</li>
|
@@ -42,7 +42,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
42 |
<?php _e('If the default menu is replaced, a link to the default view will be added. Select this to remove the link', 'wp-nested-pages'); ?>
|
43 |
</div>
|
44 |
<div class="field">
|
45 |
-
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][hide_default]" value="true" <?php if ( $type->hide_default ) echo 'checked'; ?> /><?php printf(__('Hide Default %s Link', 'wp-nested-pages'),
|
46 |
</div>
|
47 |
</div><!-- .row -->
|
48 |
</li>
|
@@ -65,7 +65,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
65 |
<?php _e('To disable nesting on hierarchical post types, select this option.', 'wp-nested-pages'); ?></p>
|
66 |
</div>
|
67 |
<div class="field">
|
68 |
-
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][disable_nesting]" value="true" <?php if ( $type->disable_nesting ) echo 'checked '; ?>/><?php printf(__('Disable Nesting for %s', 'wp-nested-pages'),
|
69 |
</div>
|
70 |
</div><!-- .row -->
|
71 |
</li>
|
@@ -100,7 +100,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
100 |
<div class="nestedpages-page-search-results" data-nestedpages-search-results>
|
101 |
<ul>
|
102 |
<?php foreach($recent_pages as $page) : ?>
|
103 |
-
<li><a href="#" data-assignment-page-id="<?php echo esc_attr($page->ID); ?>" data-assignment-page-title="<?php
|
104 |
<?php endforeach; ?>
|
105 |
</ul>
|
106 |
</div><!-- .nestedpages-page-search-results -->
|
@@ -127,7 +127,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
127 |
<?php _e('Note: Thumbnail width is displayed at a maximum of 80px in the nested pages view. The image is scaled proportionally.', 'wp-nested-pages'); ?></p>
|
128 |
</div>
|
129 |
<div class="field">
|
130 |
-
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][thumbnails][display]" value="true" <?php if ( $thumbnails_enabled ) echo 'checked'; ?> data-enable-thumbnails /><?php printf(__('Display Thumbnails for %s', 'wp-nested-pages'),
|
131 |
|
132 |
<div class="thumbnail-options" data-thumbnail-options <?php if ( !$thumbnails_enabled ) echo 'style="display:none;"'; ?>>
|
133 |
<label><?php _e('Thumbnail Source', 'wp-nested-pages'); ?></label>
|
@@ -136,7 +136,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
136 |
foreach ( $thumbnail_sizes as $size ){
|
137 |
echo '<option value="' . esc_attr($size) . '"';
|
138 |
if ( $size == $thumbnail_source ) echo ' selected';
|
139 |
-
echo '>' .
|
140 |
}
|
141 |
?>
|
142 |
</select>
|
@@ -203,7 +203,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
203 |
$out .= '<input type="checkbox" name="nestedpages_posttypes[' . esc_attr($type->name) . '][standard_fields][standard][' . esc_attr($name) . ']" value="true"';
|
204 |
if ( $name == 'hide_taxonomies' ) $out .= ' data-hide-taxonomies';
|
205 |
if ( $this->post_type_repo->fieldEnabled($type->name, 'standard', $name, 'standard_fields') ) $out .= ' checked';
|
206 |
-
$out .= ' />' .
|
207 |
$out .= '</label>';
|
208 |
$out .= '</li>';
|
209 |
else : // Taxonomies
|
@@ -215,7 +215,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
215 |
$out .= '<label>';
|
216 |
$out .= '<input type="checkbox" name="nestedpages_posttypes[' . esc_attr($type->name) . '][standard_fields][standard][taxonomies][' . esc_attr($tax_name) . ']" value="true"';
|
217 |
if ( $disabled ) $out .= ' checked';
|
218 |
-
$out .= ' />' .
|
219 |
$out .= '</label>';
|
220 |
$out .= '</li>';
|
221 |
endforeach;
|
@@ -253,7 +253,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
253 |
$out .= '<label>';
|
254 |
$out .= '<input type="checkbox" name="nestedpages_posttypes[' . esc_attr($type)->name . '][custom_fields][acf][' . esc_attr($field['key']) . ']" value="' . esc_attr($field['type']) . '"';
|
255 |
if ( $this->post_type_repo->fieldEnabled($type->name, 'acf', $field['key']) ) $out .= ' checked';
|
256 |
-
$out .= '/>' .
|
257 |
$out .= '</label>';
|
258 |
$out .= '</li>';
|
259 |
}
|
@@ -303,7 +303,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
303 |
foreach ( $options as $key => $option ){
|
304 |
$out .= '<option value="' . $key . '"';
|
305 |
if ( $this->post_type_repo->defaultSortOption($type->name, 'orderby') == $key) $out .= ' selected';
|
306 |
-
$out .= '>' .
|
307 |
}
|
308 |
echo $out;
|
309 |
?>
|
@@ -326,7 +326,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
326 |
foreach ( $options as $key => $option ){
|
327 |
$out .= '<option value="' . $key . '"';
|
328 |
if ( $this->post_type_repo->defaultSortOption($type->name, 'initial_order') == $key) $out .= ' selected';
|
329 |
-
$out .= '>' .
|
330 |
}
|
331 |
echo $out;
|
332 |
?>
|
16 |
<label for="post-type-<?php echo $type->name; ?>">
|
17 |
<?php
|
18 |
echo ( $type->hierarchical )
|
19 |
+
? wp_kses(sprintf(__('%s <em>(Hierarchical)</em>', 'wp-nested-pages'), esc_html($type->label)), ['em' => []])
|
20 |
+
: esc_html($type->label);
|
21 |
?>
|
22 |
</label>
|
23 |
<a href="#" class="button" data-toggle-nestedpages-pt-settings><?php _e('Settings', 'wp-nested-pages'); ?></a>
|
31 |
<?php _e('Replace the default top-level item with the nested view link.', 'wp-nested-pages'); ?></p>
|
32 |
</div>
|
33 |
<div class="field">
|
34 |
+
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][replace_menu]" value="true" <?php if ( $type->replace_menu ) echo 'checked'; ?> /><?php printf(__('Replace Default %s Menu', 'wp-nested-pages'), esc_html($type->label)); ?></label>
|
35 |
</div><!-- .field -->
|
36 |
</div><!-- .row -->
|
37 |
</li>
|
42 |
<?php _e('If the default menu is replaced, a link to the default view will be added. Select this to remove the link', 'wp-nested-pages'); ?>
|
43 |
</div>
|
44 |
<div class="field">
|
45 |
+
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][hide_default]" value="true" <?php if ( $type->hide_default ) echo 'checked'; ?> /><?php printf(__('Hide Default %s Link', 'wp-nested-pages'), esc_html($type->label)); ?></label>
|
46 |
</div>
|
47 |
</div><!-- .row -->
|
48 |
</li>
|
65 |
<?php _e('To disable nesting on hierarchical post types, select this option.', 'wp-nested-pages'); ?></p>
|
66 |
</div>
|
67 |
<div class="field">
|
68 |
+
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][disable_nesting]" value="true" <?php if ( $type->disable_nesting ) echo 'checked '; ?>/><?php printf(__('Disable Nesting for %s', 'wp-nested-pages'), esc_html($type->label)); ?></label>
|
69 |
</div>
|
70 |
</div><!-- .row -->
|
71 |
</li>
|
100 |
<div class="nestedpages-page-search-results" data-nestedpages-search-results>
|
101 |
<ul>
|
102 |
<?php foreach($recent_pages as $page) : ?>
|
103 |
+
<li><a href="#" data-assignment-page-id="<?php echo esc_attr($page->ID); ?>" data-assignment-page-title="<?php esc_html_e($page->post_title); ?>"><?php esc_html_e($page->post_title); ?></a></li>
|
104 |
<?php endforeach; ?>
|
105 |
</ul>
|
106 |
</div><!-- .nestedpages-page-search-results -->
|
127 |
<?php _e('Note: Thumbnail width is displayed at a maximum of 80px in the nested pages view. The image is scaled proportionally.', 'wp-nested-pages'); ?></p>
|
128 |
</div>
|
129 |
<div class="field">
|
130 |
+
<label><input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][thumbnails][display]" value="true" <?php if ( $thumbnails_enabled ) echo 'checked'; ?> data-enable-thumbnails /><?php printf(__('Display Thumbnails for %s', 'wp-nested-pages'), esc_html($type->label)); ?></label>
|
131 |
|
132 |
<div class="thumbnail-options" data-thumbnail-options <?php if ( !$thumbnails_enabled ) echo 'style="display:none;"'; ?>>
|
133 |
<label><?php _e('Thumbnail Source', 'wp-nested-pages'); ?></label>
|
136 |
foreach ( $thumbnail_sizes as $size ){
|
137 |
echo '<option value="' . esc_attr($size) . '"';
|
138 |
if ( $size == $thumbnail_source ) echo ' selected';
|
139 |
+
echo '>' . esc_html($size) . '</option>';
|
140 |
}
|
141 |
?>
|
142 |
</select>
|
203 |
$out .= '<input type="checkbox" name="nestedpages_posttypes[' . esc_attr($type->name) . '][standard_fields][standard][' . esc_attr($name) . ']" value="true"';
|
204 |
if ( $name == 'hide_taxonomies' ) $out .= ' data-hide-taxonomies';
|
205 |
if ( $this->post_type_repo->fieldEnabled($type->name, 'standard', $name, 'standard_fields') ) $out .= ' checked';
|
206 |
+
$out .= ' />' . esc_html($label);
|
207 |
$out .= '</label>';
|
208 |
$out .= '</li>';
|
209 |
else : // Taxonomies
|
215 |
$out .= '<label>';
|
216 |
$out .= '<input type="checkbox" name="nestedpages_posttypes[' . esc_attr($type->name) . '][standard_fields][standard][taxonomies][' . esc_attr($tax_name) . ']" value="true"';
|
217 |
if ( $disabled ) $out .= ' checked';
|
218 |
+
$out .= ' />' . esc_html($tax_label);
|
219 |
$out .= '</label>';
|
220 |
$out .= '</li>';
|
221 |
endforeach;
|
253 |
$out .= '<label>';
|
254 |
$out .= '<input type="checkbox" name="nestedpages_posttypes[' . esc_attr($type)->name . '][custom_fields][acf][' . esc_attr($field['key']) . ']" value="' . esc_attr($field['type']) . '"';
|
255 |
if ( $this->post_type_repo->fieldEnabled($type->name, 'acf', $field['key']) ) $out .= ' checked';
|
256 |
+
$out .= '/>' . esc_html($field['label']) . ' (' . esc_html($field['type']) . ')';
|
257 |
$out .= '</label>';
|
258 |
$out .= '</li>';
|
259 |
}
|
303 |
foreach ( $options as $key => $option ){
|
304 |
$out .= '<option value="' . $key . '"';
|
305 |
if ( $this->post_type_repo->defaultSortOption($type->name, 'orderby') == $key) $out .= ' selected';
|
306 |
+
$out .= '>' . esc_html($option) . '</option>';
|
307 |
}
|
308 |
echo $out;
|
309 |
?>
|
326 |
foreach ( $options as $key => $option ){
|
327 |
$out .= '<option value="' . $key . '"';
|
328 |
if ( $this->post_type_repo->defaultSortOption($type->name, 'initial_order') == $key) $out .= ' selected';
|
329 |
+
$out .= '>' . esc_html($option) . '</option>';
|
330 |
}
|
331 |
echo $out;
|
332 |
?>
|
assets/js/lib/nestedpages.nesting.js
CHANGED
@@ -85,17 +85,18 @@ NestedPages.Nesting = function()
|
|
85 |
// Sync Nesting
|
86 |
plugin.syncNesting = function(manual, callback)
|
87 |
{
|
88 |
-
var list
|
|
|
89 |
|
90 |
if ( nestedpages.manual_order_sync === '1' && !manual) return;
|
91 |
$(NestedPages.selectors.errorDiv).hide();
|
92 |
$(NestedPages.selectors.loadingIndicator).show();
|
93 |
-
|
|
|
94 |
list = $(NestedPages.selectors.sortable).nestedSortable('toHierarchy', {startDepthCount: 0});
|
95 |
} else {
|
96 |
list = plugin.setNestingArray();
|
97 |
}
|
98 |
-
|
99 |
plugin.disableNesting();
|
100 |
|
101 |
var syncmenu = NestedPages.jsData.syncmenu;
|
@@ -110,7 +111,8 @@ NestedPages.Nesting = function()
|
|
110 |
nonce : NestedPages.jsData.nonce,
|
111 |
list : list,
|
112 |
post_type : NestedPages.jsData.posttype,
|
113 |
-
syncmenu : syncmenu
|
|
|
114 |
},
|
115 |
success: function(data, callback){
|
116 |
plugin.initializeSortable();
|
85 |
// Sync Nesting
|
86 |
plugin.syncNesting = function(manual, callback)
|
87 |
{
|
88 |
+
var list,
|
89 |
+
filtered;
|
90 |
|
91 |
if ( nestedpages.manual_order_sync === '1' && !manual) return;
|
92 |
$(NestedPages.selectors.errorDiv).hide();
|
93 |
$(NestedPages.selectors.loadingIndicator).show();
|
94 |
+
filtered = ( $(NestedPages.selectors.lists).first().hasClass('filtered') ) ? true : false;
|
95 |
+
if ( NestedPages.jsData.nestable && !filtered ){
|
96 |
list = $(NestedPages.selectors.sortable).nestedSortable('toHierarchy', {startDepthCount: 0});
|
97 |
} else {
|
98 |
list = plugin.setNestingArray();
|
99 |
}
|
|
|
100 |
plugin.disableNesting();
|
101 |
|
102 |
var syncmenu = NestedPages.jsData.syncmenu;
|
111 |
nonce : NestedPages.jsData.nonce,
|
112 |
list : list,
|
113 |
post_type : NestedPages.jsData.posttype,
|
114 |
+
syncmenu : syncmenu,
|
115 |
+
filtered : filtered
|
116 |
},
|
117 |
success: function(data, callback){
|
118 |
plugin.initializeSortable();
|
assets/js/nestedpages.js
CHANGED
@@ -1027,17 +1027,18 @@ NestedPages.Nesting = function()
|
|
1027 |
// Sync Nesting
|
1028 |
plugin.syncNesting = function(manual, callback)
|
1029 |
{
|
1030 |
-
var list
|
|
|
1031 |
|
1032 |
if ( nestedpages.manual_order_sync === '1' && !manual) return;
|
1033 |
$(NestedPages.selectors.errorDiv).hide();
|
1034 |
$(NestedPages.selectors.loadingIndicator).show();
|
1035 |
-
|
|
|
1036 |
list = $(NestedPages.selectors.sortable).nestedSortable('toHierarchy', {startDepthCount: 0});
|
1037 |
} else {
|
1038 |
list = plugin.setNestingArray();
|
1039 |
}
|
1040 |
-
|
1041 |
plugin.disableNesting();
|
1042 |
|
1043 |
var syncmenu = NestedPages.jsData.syncmenu;
|
@@ -1052,7 +1053,8 @@ NestedPages.Nesting = function()
|
|
1052 |
nonce : NestedPages.jsData.nonce,
|
1053 |
list : list,
|
1054 |
post_type : NestedPages.jsData.posttype,
|
1055 |
-
syncmenu : syncmenu
|
|
|
1056 |
},
|
1057 |
success: function(data, callback){
|
1058 |
plugin.initializeSortable();
|
1027 |
// Sync Nesting
|
1028 |
plugin.syncNesting = function(manual, callback)
|
1029 |
{
|
1030 |
+
var list,
|
1031 |
+
filtered;
|
1032 |
|
1033 |
if ( nestedpages.manual_order_sync === '1' && !manual) return;
|
1034 |
$(NestedPages.selectors.errorDiv).hide();
|
1035 |
$(NestedPages.selectors.loadingIndicator).show();
|
1036 |
+
filtered = ( $(NestedPages.selectors.lists).first().hasClass('filtered') ) ? true : false;
|
1037 |
+
if ( NestedPages.jsData.nestable && !filtered ){
|
1038 |
list = $(NestedPages.selectors.sortable).nestedSortable('toHierarchy', {startDepthCount: 0});
|
1039 |
} else {
|
1040 |
list = plugin.setNestingArray();
|
1041 |
}
|
|
|
1042 |
plugin.disableNesting();
|
1043 |
|
1044 |
var syncmenu = NestedPages.jsData.syncmenu;
|
1053 |
nonce : NestedPages.jsData.nonce,
|
1054 |
list : list,
|
1055 |
post_type : NestedPages.jsData.posttype,
|
1056 |
+
syncmenu : syncmenu,
|
1057 |
+
filtered : filtered
|
1058 |
},
|
1059 |
success: function(data, callback){
|
1060 |
plugin.initializeSortable();
|
assets/js/nestedpages.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(NestedPages=NestedPages||{}).Formatter=function(){var s=this,i=jQuery;s.updateSubMenuToggle=function(){for(var e=i(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a=e[t],s=i(a).parent(".row").parent("li");if(0<i(s).children("ol").length){if(i(s).children("ol").find("li.page-row").length<1){i(s).children("ol").hide();continue}var n='<div class="child-toggle-spacer"></div>';n+='<a href="#"',0<i(s).children("ol:visible").length&&(n+=' class="open"'),n+='><span class="np-icon-arrow"></span></a>',i(a).html(n),0<i(s).children("ol").children(".np-hide").length&&0===i(s).children("ol").children(".np-hide.shown").length?i(a).find("a").hide():0<i(s).children("ol").children(".np-hide").length&&0<i(s).children("ol").children(".np-hide.shown").length&&i(a).find("a").show()}else i(a).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){i(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),i.each(i(NestedPages.selectors.lists),function(){i(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){s.setIndent()},s.setIndent=function(){var n="1"===nestedpages.non_indent?20:30,o="1"===nestedpages.non_indent?".row-inner":".child-toggle";i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;if(NestedPages.jsData.sortable||(s=10),0<a){s=a*n+s;i(this).find(o).css("padding-left",s+"px")}else NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.setClassicIndent=function(){i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;if(NestedPages.jsData.sortable||(s=10),0<a){s=20*a+s;i(this).find(".row-inner").css("padding-left",s+"px")}else NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){if(NestedPages.jsData.nestable){var t=40*i(e.placeholder).parents("ol").length-40,a=i(NestedPages.selectors.sortable).width()-t;i(e.placeholder).width(a).css("margin-left",t+"px")}s.updateListVisibility(e)},s.updateListVisibility=function(e){var t=i(e.placeholder).parent("ol");i(t).is(":visible")||(i(t).addClass("nplist"),i(t).show())},s.removeQuickEdit=function(){i(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),i(".sortable .quick-edit").remove(),i(".row").show()},s.showQuickEdit=function(){i("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){i(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){i(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){i(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){i(NestedPages.selectors.ajaxError).find("p").text(e),i(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){i(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=i(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=i(e).width(),a=i(e).height();i.each(i(NestedPages.selectors.thumbnailContainerLink),function(){i(this).width(t),i(this).height(a)})}},(NestedPages=NestedPages||{}).Dropdowns=function(){var t=this,a=jQuery;return t.dropdown="",t.activeBtn="",t.activeContent="",t.toggleBtn="[data-dropdown-toggle]",t.dropdownContainer="[data-dropdown]",t.dropdownContent="[data-dropdown-content]",t.selectors={caret_up:"icon-arrow_drop_up",caret_down:"icon-arrow_drop_down"},t.bindEvents=function(){a(document).on("click",t.toggleBtn,function(e){e.preventDefault(),t.activeBtn=a(this),t.dropdown=a(this).parents(t.dropdownContainer),t.toggleDropdown()}),a(document).on("click",function(e){t.closeDropdowns(e.target)}),a(document).on("dropdown-opened",function(e,t){0<a(t).parents(NestedPages.selectors.row).length&&a(t).parents(NestedPages.selectors.row).addClass("active")}),a(document).on("dropdown-closed",function(){a(NestedPages.selectors.row).removeClass("active")})},t.toggleDropdown=function(){a("."+t.selectors.caret_up).attr("class",t.selectors.caret_down);var e=a(t.dropdown).find(t.dropdownContent);if(t.activeContent=e,a(e).hasClass("active"))return a(e).removeClass("active"),a(t.activeBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),void a(document).trigger("dropdown-closed",e);t.setPositioning(),a(t.toggleBtn).removeClass("active"),a(t.dropdownContent).removeClass("active"),a(e).addClass("active"),a(t.activeBtn).find("."+t.selectors.caret_down).attr("class",t.selectors.caret_up),a(t.activeBtn).addClass("active"),a(document).trigger("dropdown-opened",e)},t.setPositioning=function(){var e=a(t.activeBtn).outerHeight();a(t.activeContent).css("top",e+"px")},t.closeDropdowns=function(e){0===a(e).parents(t.dropdownContainer).length&&(a(t.dropdownContent).removeClass("active"),a(t.toggleBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),a(document).trigger("dropdown-closed",void 0))},t.bindEvents()},(NestedPages=NestedPages||{}).Modals=function(){var a=this,s=jQuery;return a.activeBtn="",a.activeModal="",a.modalOpen=!1,a.selectors={toggleBtn:"[data-nestedpages-modal-toggle]",backdrop:"[data-nestedpages-modal-backdrop]",closeBtn:"[data-nestedpages-modal-close]",title:"data-nestedpages-modal-title",content:"data-nestedpages-modal-content"},a.bindEvents=function(){s(document).on("click",a.selectors.toggleBtn,function(e){e.preventDefault(),a.activeBtn=s(this),a.openModal()}),s(document).on("click",a.selectors.closeBtn,function(e){e.preventDefault(),a.closeModals()}),s(document).on("open-modal-manual",function(e,t){a.activeModal=s('[data-nestedpages-modal="'+t+'"]'),a.openModal()}),s(document).on("close-modal-manual",function(e){a.closeModals()}),s(document).on("click",a.selectors.backdrop,function(e){a.closeModals()}),s(document).ready(function(){a.checkHash()})},a.openModal=function(){if(a.modalOpen)a.closeModals();else{if(0<s(a.activeBtn).length){var e=s(a.activeBtn).attr("data-nestedpages-modal-toggle");a.activeModal=s('*[data-nestedpages-modal="'+e+'"]')}s(a.activeModal).addClass("active"),a.modalOpen=!0,a.populateModal(),s(document).trigger("open-modal",[a.activeBtn,a.activeModal])}},a.closeModals=function(){a.modalOpen=!1,s("[data-nestedpages-modal]").removeClass("active"),a.activeModal="",a.activeBtn=""},a.populateModal=function(){var e=s(a.activeBtn).attr(a.selectors.title);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-title]").text(e);var t=s(a.activeBtn).attr(a.selectors.content);void 0!==t&&""!==t&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(t)},a.checkHash=function(){if(window.location.hash&&"#modal"===window.location.hash.substring(0,6)){var e=window.location.hash.substring(7);a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal()}},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var s=this,n=jQuery;return s.activeCheckbox="",s.selectors={checkbox:"[data-np-check-all]"},s.bindEvents=function(){n(document).on("change",s.selectors.checkbox,function(){s.activeCheckbox=n(this),s.toggleCheckboxes()}),n(document).on("change","input[type=checkbox]",function(){s.checkAllStatus(n(this))})},s.init=function(){s.bindEvents()},s.toggleCheckboxes=function(){var t=!!n(s.activeCheckbox).is(":checked"),e=n(s.activeCheckbox).attr("data-np-check-all"),a=n('*[name="'+e+'"]');n.each(a,function(){var e=n(this).parents(NestedPages.selectors.rows);n(this).prop("checked",t),n(e).hasClass("np-hide")&&!n(e).is(":visible")&&n(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),s.toggleCheckAll()},s.toggleCheckAll=function(){var e=n(s.activeCheckbox).attr("data-np-check-all"),t=n('*[name="'+e+'"]').length;t=t-n(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+n(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length;var a=n('*[name="'+e+'"]:checked').length;if(t==a)return n(s.activeCheckbox).prop("checked",!0),void n(s.activeCheckbox).removeClass("check-all-partial");0<a?n(s.activeCheckbox).addClass("check-all-partial"):(n(s.activeCheckbox).attr("checked",!1),n(s.activeCheckbox).removeClass("check-all-partial"))},s.checkAllStatus=function(e){var t=n(e).attr("name"),a=n('*[data-np-check-all="'+t+'"]');0!==a.length&&(s.activeCheckbox=n(a)[0],s.toggleCheckAll())},s.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var o=this,i=jQuery;return o.selectedNumber=0,o.selectedLinks=[],o.selectedPosts=[],o.init=function(){o.bindEvents()},o.bindEvents=function(){i(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){o.toggleBulkForm()}),i(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===i("select[name=np_bulk_action]").val()&&(e.preventDefault(),o.toggleBulkEdit(!0))}),i(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();var t=i(this).siblings("input[type=hidden]").val();o.uncheckBulkItem(t)}),i(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),o.uncheckAllBulkItems()})},o.toggleBulkForm=function(){var a=!1,s="",n="";if(o.selectedPosts=[],o.selectedLinks=[],i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){if(i(this).is(":checked")){var e=i(this).parents(NestedPages.selectors.rows);if(a=!0,i(this).parent("div").hasClass("np-check-all")||i(e).hasClass("post-type-np-redirect")||(s+=i(this).val()+","),i(e).hasClass("post-type-np-redirect")&&(n+=i(this).val()+",",o.selectedLinks.push(i(this).val())),"np-redirect"!==i(this).attr("data-np-post-type")&&!i(this).parent("div").hasClass("np-check-all")){var t=[];t.title=i(this).attr("data-np-bulk-checkbox"),t.id=i(this).val(),o.selectedPosts.push(t)}}}),o.setBulkEditPosts(),o.toggleEditOption(),o.toggleLinkCountAlert(),a)return i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkActionsIds).val(s),i(NestedPages.selectors.bulkActionRedirectIds).val(n),void o.setSelectedNumber();i(NestedPages.selectors.bulkActionsIds).val(""),i(NestedPages.selectors.bulkActionsForm).hide()},o.setBulkEditPosts=function(){for(var e="",t=0;t<o.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>×</a>',e+=o.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+o.selectedPosts[t].id+'"></li>';i(NestedPages.selectors.bulkEditTitles).html(e)},o.uncheckBulkItem=function(e){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).val()==e&&i(this).prop("checked",!1).change()}),0===i(NestedPages.selectors.bulkEditRemoveItem).length&&o.toggleBulkEdit(!1)},o.uncheckAllBulkItems=function(){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).prop("checked",!1).change()}),o.toggleBulkEdit(!1)},o.setSelectedNumber=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option").first();i(t).text(nestedpages.bulk_actions+" ("+e+")")},o.toggleEditOption=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return i(t).prop("disabled",!0),i(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void o.toggleBulkEdit(!1);i(t).prop("disabled",!1)},o.toggleBulkEdit=function(e){if(o.toggleLinkCountAlert(),e)return o.disableParentOptions(),i(NestedPages.selectors.bulkEditForm).show(),i(NestedPages.selectors.bulkActionsForm).hide(),void o.setWPSuggest();i(NestedPages.selectors.bulkEditForm).hide(),i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),i(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),o.resetBulkEditFields()},o.toggleLinkCountAlert=function(){0!==o.selectedLinks.length?i(NestedPages.selectors.bulkEditLinkCount).parent("div").show():i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},o.disableParentOptions=function(){for(var e=i(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<o.selectedPosts.length;t++)i(e).find("option[value="+o.selectedPosts[t].id+"]").attr("disabled",!0)},o.setWPSuggest=function(){var e=i(NestedPages.selectors.bulkEditForm).find("[data-autotag]");i.each(e,function(e,t){var a=i(this).attr("data-taxonomy");i(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},o.resetBulkEditFields=function(){var e=i(NestedPages.selectors.bulkEditForm).find("select");i.each(e,function(){i(this).find("option").first().prop("selected",!0),i(this).find("option").removeAttr("disabled")});var t=i(NestedPages.selectors.bulkEditForm).find(".cat-checklist");i.each(t,function(){i(this).find("input[type=checkbox]").prop("checked",!1)})},o.init()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,a=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){a(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var t=0;a.each(a(NestedPages.selectors.bulkActionsCheckbox),function(){if(a(this).is(":checked")){if(a(this).parent("div").hasClass("np-check-all"))return;var e=a(this).closest(".page-row");a(e).is(":visible")||t++}}),t<1?a(NestedPages.selectors.hiddenItemCountParent).hide():(a(NestedPages.selectors.hiddenItemCount).text(t),a(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var a=this,n=jQuery;return a.formatter=new NestedPages.Formatter,a.bindEvents=function(){n(document).on("click",NestedPages.selectors.childToggleLink,function(e){e.preventDefault(),a.toggleSingleMenu(n(this))}),n(document).on("click",NestedPages.selectors.toggleAll,function(e){e.preventDefault(),a.toggleAllMenus()})},a.toggleSingleMenu=function(e){var t=n(e).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");n(e).toggleClass("open"),n(t).toggle(),a.formatter.setBorders(),a.formatter.setNestedMargins(),a.syncUserToggles()},a.toggleAllMenus=function(){var e=NestedPages.selectors.toggleAll;if("closed"===n(e).attr("data-toggle"))return n(NestedPages.selectors.lists).show(),n(e).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),n(NestedPages.selectors.childToggle+" a").addClass("open"),a.formatter.setBorders(),void a.syncUserToggles();n(NestedPages.selectors.lists).not(n(NestedPages.selectors.lists)[0]).hide(),n(e).attr("data-toggle","closed").text(NestedPages.jsData.expandText),n(NestedPages.selectors.childToggle+" a").removeClass("open"),a.formatter.setBorders(),a.syncUserToggles()},a.visibleRowIDs=function(){var s=[],e=n(NestedPages.selectors.rows+":visible");return n.each(e,function(e,t){var a=n(this).attr("id");s.push(a.replace("menuItem_",""))}),s},a.syncUserToggles=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:a.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},a.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var a=this,s=jQuery;return a.activeButton="",a.formatter=new NestedPages.Formatter,a.init=function(){a.bindEvents()},a.bindEvents=function(){s(document).on("click",NestedPages.selectors.toggleHidden,function(e){e.preventDefault(),a.activeButton=s(this),a.toggleHidden()}),s(document).on("click",NestedPages.selectors.toggleStatus,function(e){e.preventDefault(),a.toggleStatus(s(this))})},a.toggleHidden=function(){var e=s(a.activeButton),t=s(e).attr("href");if("#show"==t)return s(e).attr("href","#hide").text(NestedPages.jsData.showHiddenText),s(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),a.formatter.updateSubMenuToggle(),void a.formatter.setBorders();"#hide"==t&&(s(e).attr("href","#show").text(NestedPages.jsData.hideHiddenText),s(NestedPages.selectors.hiddenRows).addClass("shown").show(),a.formatter.updateSubMenuToggle(),a.formatter.setBorders())},a.toggleStatus=function(e){var t=s(e).attr("href");t=t.substring(1),s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),"draft"==t&&(s(NestedPages.selectors.syncCheckbox).attr("disabled",!0),s("."+t).addClass("nested-visible")),"all"!=t?(s(NestedPages.selectors.rows).hide(),s("."+t).show()):s(NestedPages.selectors.rows).show()},a.init()},(NestedPages=NestedPages||{}).Nesting=function(){var n=this,o=jQuery;n.formatter=new NestedPages.Formatter,n.initializeSortable=function(){if(!NestedPages.jsData.nestable)return n.initializeSortableFlat();o(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",tabSize:56,isAllowed:function(e,t,a){return!(o(t).hasClass("post-type-np-redirect")&&!o(a).hasClass("post-type-np-redirect"))},start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})},n.initializeSortableFlat=function(){var e=o(NestedPages.selectors.lists).not(NestedPages.selectors.notSortable);o.each(e,function(){o(this).sortable({items:">"+NestedPages.selectors.rows,handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",forcePlaceholderSize:!0,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){n.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){n.formatter.updateSubMenuToggle(),n.formatter.setBorders(),n.formatter.setNestedMargins()},100),n.syncNesting()}})})},n.disableNesting=function(){o(NestedPages.selectors.sortable).sortable("destroy")},n.syncNesting=function(e,t){var a;if("1"!==nestedpages.manual_order_sync||e){o(NestedPages.selectors.errorDiv).hide(),o(NestedPages.selectors.loadingIndicator).show(),a=NestedPages.jsData.nestable?o(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):n.setNestingArray(),n.disableNesting();var s=NestedPages.jsData.syncmenu;"1"===nestedpages.manual_menu_sync&&(s="nosync"),o.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:a,post_type:NestedPages.jsData.posttype,syncmenu:s},success:function(e,t){if(n.initializeSortable(),"error"===e.status)o(NestedPages.selectors.errorDiv).text(e.message).show(),o(NestedPages.selectors.loadingIndicator).hide();else{if(t&&"function"==typeof t)return void t();o(NestedPages.selectors.loadingIndicator).hide()}}})}},n.setNestingArray=function(e){return ret=[],o(NestedPages.selectors.lists).first().children("li.page-row").each(function(){var e=n.recursiveNesting(this);ret.push(e)}),ret},n.recursiveNesting=function(e){var t,a=o(e).attr("id");if(a)return a=a.replace("menuItem_",""),t={id:a},0<o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).length&&(t.children=[],o(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).each(function(){var e=n.recursiveNesting(this);t.children.push(e)})),t}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.init=function(){t.bindEvents()},t.bindEvents=function(){e(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&t.syncSetting()}),e(document).on("change",NestedPages.selectors.syncCheckbox,function(){t.syncSetting()})},t.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==e(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=e(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",e.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncMenu,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:NestedPages.jsData.syncmenu},success:function(e){"error"===e.status&&t.formatter.showAjaxError(e.message)},error:function(e){console.log(e)}}))},t.bindEvents()},(NestedPages=NestedPages||{}).NewPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.parent_id=0,r.posts="",r.form="",r.bindEvents=function(){d(document).on("open-modal",function(e,t,a){var s=d(t).attr("data-nestedpages-modal-toggle");void 0!==s&&"np-bulk-modal"==s&&r.openModal()}),d(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),d(document).on("click",NestedPages.selectors.newPageSubmitButton,function(e){e.preventDefault(),r.submitForm(d(this))}),d(document).on("click",NestedPages.selectors.newPageTitle,function(e){e.preventDefault(),r.addTitleField(d(this))}),d(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(e){e.preventDefault(),r.removeTitleField(d(this))}),d(document).on("click",NestedPages.selectors.addChildButton,function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click",NestedPages.selectors.cancelNewChildButton,function(e){e.preventDefault(),r.cancelNewPage()}),d(document).on("click","["+NestedPages.selectors.newBeforeButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click","["+NestedPages.selectors.newAfterButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("keydown",function(e){27===e.keyCode&&(r.cancelNewPage(),d(document).click())})},r.openModal=function(){var e=d(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);d(e).addClass("in-modal"),d(NestedPages.selectors.newPageModal).find(".modal-body").html(e),d(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),d(NestedPages.selectors.newPageModal).find(".page_parent_id").val(r.parent_id),d(e).find(".np_title").first().focus(),d(e).find(NestedPages.selectors.newPageTitle).first().prop("tabindex","2")},r.openQuickEdit=function(e){var t=d(e).attr(NestedPages.selectors.newBeforeButton);t=void 0!==t&&""!==t&&t;var a=d(e).attr(NestedPages.selectors.newAfterButton);a=void 0!==a&&""!==a&&a;var s=d(e).closest(NestedPages.selectors.row).parent("li"),n=d(NestedPages.selectors.newPageFormContainer).clone();if(0<d(s).children("ol").length){var o=d(s).children("ol");d(n).insertBefore(o)}else d(n).appendTo(s);d(n).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(n).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),t||a||d(n).find(".page_parent_id").val(d(e).attr("data-id")),t&&(d(n).find(".page_before_id").val(t),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),a&&(d(n).find(".page_after_id").val(a),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(n).show(),d(n).find(".np_title").focus(),d(n).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},r.cancelNewPage=function(){r.formatter.removeQuickEdit(),d(NestedPages.selectors.newChildError).hide(),d(NestedPages.selectors.newPageModal).find(".modal-body").empty(),d(NestedPages.selectors.sortable).find(".new-child").remove(),d(NestedPages.selectors.row).show()},r.addTitleField=function(e){var t=d(e).parents("form"),a=d(e).siblings(".new-page-titles").children("li").length+1,s='<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg><div class="form-control new-child-row"><label>'+NestedPages.jsData.titleText+'</label><div><input type="text" name="post_title[]" class="np_title" placeholder="'+NestedPages.jsData.titleText+'" value="" tabindex="'+a+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';d(e).siblings(".new-page-titles").append(s);d(t).find(".np_title").last().focus(),d(t).find(NestedPages.selectors.newPageTitle).prop("tabindex",a++),d(".new-page-titles").sortable({items:"li",handle:".handle"}),r.toggleAddEditButton(t)},r.removeTitleField=function(e){var t=d(e).parents("form");d(e).parents(".new-child-row").parent("li").remove(),r.toggleAddEditButton(t)},r.submitForm=function(e){r.toggleLoading(!0),r.form=d(e).parents("form");var a=!!d(e).hasClass("add-edit"),t=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(t=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(t=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+t+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){if("error"===e.status)return r.toggleLoading(!1),void d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show();if(!0==a){var t=e.new_pages[0].edit_link;return t=t.replace(/&/g,"&"),void window.location.replace(t)}r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()},error:function(e){console.log(e),r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},r.addPosts=function(){var e=d(r.form).find(".page_before_id").val();e=""!==e&&e;var t=d(r.form).find(".page_after_id").val();t=""!==t&&t;var a=d(r.form).parent(".new-child").parent(".page-row");if(0!==d(a).children("ol").length||e||t||d(a).append('<ol class="nplist"></ol>'),d(r.form).hasClass("in-modal"))var s=d(".nplist.sortable li.page-row:first");else s=d(a).children("ol");for(i=0;i<r.posts.length;i++)r.appendRows(s,r.posts[i],e,t);e||t||d(s).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n='<li id="menuItem_'+t.id+'" class="page-row';if("publish"===t.status&&(n+=" published"),n+='">',NestedPages.jsData.hierarchical?(n+='<div class="row">',n+='<div class="child-toggle"></div>'):(n+='<div class="row non-hierarchical">',n+='<div class="non-hierarchical-spacer"></div>'),n+='<div class="row-inner">',n+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',n+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',n+='<a href="'+t.edit_link+'" class="page-link page-title">',n+='<span class="title">'+t.title+"</span>","Publish"!==t.status?n+='<span class="status">('+t.status+")</span>":n+='<span class="status"></span>',n+='<span class="nav-status">',"hide"===t.np_nav_status&&(n+=" "+nestedpages.hidden),n+="</span>",n+='<span class="edit-indicator">Edit</span>',n+="</a>",NestedPages.jsData.hierarchical||(n+='<div class="np-post-columns">',n+='<ul class="np-post-info">',n+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",n+="<li>"+t.date_formatted+"</li>",n+="</ul>",n+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(n+='<span class="np-seo-indicator na"></span>'),n+='<div class="action-buttons">',n+='<div class="nestedpages-dropdown" data-dropdown><a href="#" class="np-btn has-icon toggle" data-dropdown-toggle><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></a><ul class="nestedpages-dropdown-content" data-dropdown-content>',n+='<li><a href="#" class="open-redirect-modal" data-parentid="'+t.id+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'+nestedpages.add_link+"</a></li>",n+='<li><a href="#" class="add-new-child" data-id="'+t.id+'" data-parentname="'+t.title+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'+nestedpages.add_child_short+"</a></li>",n+="</ul></div>",n+='<a href="#" class="np-btn np-quick-edit" data-id="'+t.id+'" data-template="'+t.page_template+'" data-title="'+t.title+'" data-slug="'+t.slug+'" data-commentstatus="closed" data-status="'+t.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+t.author+'" data-template="'+t.template+'" data-month="'+t.month+'" data-day="'+t.day+'" data-year="'+t.year+'" data-hour="'+t.hour+'" data-minute="'+t.minute+'" data-datepicker="'+t.datepicker+'" data-time="'+t.time+'" data-formattedtime="'+t.formattedtime+'" data-ampm="'+t.ampm+'">'+nestedpages.quick_edit+"</a>",n+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",n+='<a href="'+t.delete_link+'" class="np-btn np-btn-trash"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-remove"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" class="icon"/><path d="M0 0h24v24H0z" fill="none"/></svg></a>',n+="</div>\x3c!-- .action-buttons --\x3e",n+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",n+="</li>",a){var o=r.findRowById(a);d(n).insertBefore(o)}else if(s){o=r.findRowById(s);d(n).insertAfter(o)}else d(e).append(n)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){var t=d(e).find(".np_title").length;t<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<t?d(NestedPages.selectors.newPageSubmitButton+".add-edit").hide():d(NestedPages.selectors.newPageSubmitButton+".add-edit").show())},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var l=this,c=jQuery;return l.formatter=new NestedPages.Formatter,l.button="",l.initialData="",l.parent_li="",l.form="",l.flatTerms="",l.termNames="",l.saveButton="",l.newData="",l.row="",l.bindEvents=function(){c(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),l.button=c(this),l.openForm()}),c(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),l.formatter.removeQuickEdit()}),c(document).on("change",".keep_private",function(){this.checked?c(".post_password").val("").prop("readonly",!0):c(".post_password").prop("readonly",!1)}),c(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),l.saveButton=c(this),l.save()}),c(document).on("keydown",function(e){27===e.keyCode&&l.formatter.removeQuickEdit()})},l.openForm=function(){l.setInitialData(),l.createForm(),l.populateForm(),l.populateFlatTaxonomies()},l.setInitialData=function(){l.initialData={id:c(l.button).attr("data-id"),title:c(l.button).attr("data-title"),slug:c(l.button).attr("data-slug"),author:c(l.button).attr("data-author"),cs:c(l.button).attr("data-commentstatus"),status:c(l.button).attr("data-status"),template:c(l.button).attr("data-template"),month:c(l.button).attr("data-month"),day:c(l.button).attr("data-day"),year:c(l.button).attr("data-year"),hour:c(l.button).attr("data-hour"),minute:c(l.button).attr("data-minute"),navstatus:c(l.button).attr("data-navstatus"),npstatus:c(l.button).attr("data-np-status"),navtitle:c(l.button).attr("data-navtitle"),navtitleattr:c(l.button).attr("data-navtitleattr"),navcss:c(l.button).attr("data-navcss"),linktarget:c(l.button).attr("data-linktarget"),password:c(l.button).attr("data-password"),datepicker:c(l.button).attr("data-datepicker"),time:c(l.button).attr("data-formattedtime"),timeTwentyFour:c(l.button).attr("data-time"),ampm:c(l.button).attr("data-ampm"),timeFormat:c(l.button).attr("data-timeformat"),sticky:c(l.button).attr("data-sticky")};var e=c(l.button)[0].attributes;c.each(e,function(e,t){t.name.includes("data-npcustom")&&(l.initialData[t.name]=t.value)}),l.initialData.h_taxonomies=[],l.initialData.f_taxonomies=[],l.parent_li=c(l.button).closest(NestedPages.selectors.row).parent("li");var t=c(l.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&l.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&l.initialData.f_taxonomies.push(t[i])},l.createForm=function(){if(l.form=c(NestedPages.selectors.quickEditPostForm).clone(),0<c(l.parent_li).children("ol").length){var e=c(l.parent_li).children("ol");c(l.form).insertBefore(e)}else c(l.form).appendTo(l.parent_li);c(l.form).siblings(NestedPages.selectors.row).hide(),c(l.form).show()},l.populateForm=function(){for(var e in c(l.form).find(".page_id").html("<em>ID:</em> "+l.initialData.id),c(l.form).find(".np_id").val(l.initialData.id),c(l.form).find(".np_title").val(l.initialData.title),c(l.form).find(".np_slug").val(l.initialData.slug),c(l.form).find(".np_author select").val(l.initialData.author),c(l.form).find(".np_status").val(l.initialData.status),c(l.form).find(".np_nav_title").val(l.initialData.navtitle),c(l.form).find(".np_title_attribute").val(l.initialData.navtitleattr),c(l.form).find(".np_nav_css_classes").val(l.initialData.navcss),c(l.form).find(".post_password").val(l.initialData.password),c(l.form).find(".np_publish_date").val(l.initialData.datepicker),"open"===l.initialData.cs&&c(l.form).find(".np_cs").attr("checked","checked"),""!==l.initialData.template?c(l.form).find(".np_template").val(l.initialData.template):c(l.form).find(".np_template").val("default"),"private"===l.initialData.status&&(c(l.form).find(".post_password").attr("readonly",!0),c(l.form).find(".keep_private").attr("checked",!0)),"hide"===l.initialData.npstatus?c(l.form).find(".nested_pages_status").attr("checked","checked"):c(l.form).find(".nested_pages_status").removeAttr("checked"),"hide"===l.initialData.navstatus?c(l.form).find(".np_nav_status").attr("checked","checked"):c(l.form).find(".np_nav_status").attr("checked",!1),"_blank"===l.initialData.linktarget?c(l.form).find(".link_target").attr("checked","checked"):c(l.form).find(".link_target").attr("checked",!1),"private"===l.initialData.status&&c(l.form).find(".np_status").val("publish"),"sticky"===l.initialData.sticky?c(l.form).find(".np-sticky").attr("checked","checked"):c(l.form).find(".np-sticky").removeAttr("checked"),"H:i"===l.initialData.timeFormat?c(l.form).find(".np_time").val(l.initialData.timeTwentyFour):(c(l.form).find(".np_time").val(l.initialData.time),c(l.form).find(".np_ampm").val(l.initialData.ampm),c(l.form).find('select[name="mm"]').val(l.initialData.month),c(l.form).find('input[name="jj"]').val(l.initialData.day),c(l.form).find('input[name="aa"]').val(l.initialData.year),c(l.form).find('input[name="hh"]').val(l.initialData.hour),c(l.form).find('input[name="mn"]').val(l.initialData.minute)),l.initialData)if(e.includes("npcustom")&&l.initialData.hasOwnProperty(e)){var t=e.replace("data-npcustom-","");t=t.toLowerCase(),c(l.form).find('[data-np-custom-field="'+t+'"]').val(l.initialData[e])}if(l.populateFlatTaxonomies(),l.initialData.hasOwnProperty("h_taxonomies")){var a=l.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];c(l.form).find(s).attr("checked","checked")}}var n=c(l.form).find(".np_datepicker");c.each(n,function(){var e=c(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){c("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),l.formatter.showQuickEdit(),c(l.form).show()},l.populateFlatTaxonomies=function(){l.initialData.hasOwnProperty("f_taxonomies")&&(l.createTaxonomyObject(),l.getTermNames(),l.setWPSuggest())},l.createTaxonomyObject=function(){var e={};for(i=0;i<l.initialData.f_taxonomies.length;i++){var t=l.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),n=a.splice(s+1);n=n.join("-");var o=t.split("-").splice(0,s);o.shift("inf");var r=o.join("-");r in e||(e[r]=[]),e[r].push(n)}l.flatTerms=e},l.getTermNames=function(){c.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:l.flatTerms},success:function(e){l.termNames=e.terms,l.populateFlatTaxonomyFields()}})},l.populateFlatTaxonomyFields=function(){l.termNames&&c.each(l.termNames,function(e,t){var a=c("#"+e+"-quickedit");c(a).val(t.join(","))})},l.setWPSuggest=function(){var e=c(l.form).find("[data-autotag]");c.each(e,function(e,t){var a=c(this).attr("data-taxonomy");c(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},l.save=function(){l.toggleLoading(!0),c.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:c(l.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(l.toggleLoading(!1),c(l.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(l.toggleLoading(!1),l.newData=e.post_data,l.updatePostRow())},error:function(e){console.log(e)}})},l.updatePostRow=function(){l.row=c(l.button).parents(".row-inner"),c(l.row).find(".title").text(l.newData.post_title),c(l.row).find(".np-view-button").attr("href",l.newData.permalink);var e=c(l.row).find(".status");if("publish"!==l.newData._status&&"future"!==l.newData._status){var t=nestedpages.post_statuses[l.newData._status].label;c(e).text("("+t+")")}else c(e).text("");if("private"===l.newData.keep_private&&c(e).text(nestedpages.private),""!==l.newData.post_password&&void 0!==l.newData.post_password){var a=c(e).text();a+=' <span class="locked">',a+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',a+="</span>",c(e).html(a)}var s=c(l.row).find(".nav-status");"hide"==l.newData.nav_status?c(s).text("(Hidden)"):c(s).text("");var n=c(l.row).parent("li");"hide"==l.newData.np_status?(c(n).addClass("np-hide"),c(l.row).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(c(n).removeClass("np-hide"),c(l.row).find(".status-np-hidden").remove());var o=c(l.row).find(".sticky");"sticky"==l.newData.sticky?c(o).show():c(o).hide(),NestedPages.jsData.hierarchical||c(l.row).find(".np-author-display").text(l.newData.author_name);var i=c(l.row).find(NestedPages.selectors.quickEditOpen);for(var r in c(i).attr("data-id",l.newData.post_id),c(i).attr("data-template",l.newData.page_template),c(i).attr("data-title",l.newData.post_title),c(i).attr("data-slug",l.newData.post_name),c(i).attr("data-commentstatus",l.newData.comment_status),c(i).attr("data-status",l.newData._status),c(i).attr("data-sticky",l.newData.sticky),"private"===l.newData.keep_private&&c(i).attr("data-status","private"),c(i).attr("data-author",l.newData.post_author),c(i).attr("data-np-status",l.newData.np_status),c(i).attr("data-password",l.newData.post_password),c(i).attr("data-navstatus",l.newData.nav_status),c(i).attr("data-navtitle",l.newData.np_nav_title),c(i).attr("data-linktarget",l.newData.link_target),c(i).attr("data-navtitleattr",l.newData.np_title_attribute),c(i).attr("data-navcss",l.newData.np_nav_css_classes),c(i).attr("data-month",l.newData.mm),c(i).attr("data-day",l.newData.jj),c(i).attr("data-year",l.newData.aa),c(i).attr("data-hour",l.newData.hh),c(i).attr("data-minute",l.newData.mn),c(i).attr("data-datepicker",l.newData.np_date),c(i).attr("data-time",l.newData.np_time),c(i).attr("data-formattedtime",l.newData.np_time),c(i).attr("data-ampm",l.newData.np_ampm),l.newData)if(r.includes("np_custom")&&l.newData.hasOwnProperty(r)){var d=r.replace("np_custom_","data-npcustom-");c(i).attr(d,l.newData[r])}l.removeTaxonomyClasses(),l.addCategoryClasses(),l.addHierarchicalClasses(),l.addFlatClasses(),l.addStatusClass(),l.formatter.removeQuickEdit(),l.formatter.flashRow(l.row)},l.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)c(l.row).removeClass(e[i]);c(l.row).addClass(l.newData._status)},l.removeTaxonomyClasses=function(){taxonomies=[];var e=c(l.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&c(l.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&c(l.row).removeClass(e[i])},l.addCategoryClasses=function(){if(l.newData.hasOwnProperty("post_category")){var e=l.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];c(l.row).addClass(t)}}},l.addHierarchicalClasses=function(){if(l.newData.hasOwnProperty("tax_input")){var e=l.newData.tax_input;c.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];c(l.row).addClass(a)}})}},l.addFlatClasses=function(){if(l.newData.hasOwnProperty("flat_tax")){var e=l.newData.flat_tax;c.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];c(l.row).addClass(a)}})}},l.toggleLoading=function(e){if(e)return c(NestedPages.selectors.quickEditErrorDiv).hide(),c(l.saveButton).attr("disabled","disabled"),void c(NestedPages.selectors.quickEditLoadingIndicator).show();c(l.saveButton).attr("disabled",!1),c(NestedPages.selectors.quickEditLoadingIndicator).hide()},l.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var o=this,i=jQuery;return o.formatter=new NestedPages.Formatter,o.button="",o.postData="",o.newPostData="",o.form="",o.bindEvents=function(){i(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),o.formatter.removeQuickEdit(),o.button=i(this),o.openQuickEdit()}),i(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),o.submitForm()}),i(document).on("keydown",function(e){27===e.keyCode&&o.formatter.removeQuickEdit()})},o.openQuickEdit=function(){o.setData(),o.createForm(),o.populateForm()},o.setData=function(){o.postData={id:i(o.button).attr("data-id"),url:i(o.button).attr("data-url"),title:i(o.button).attr("data-title"),status:i(o.button).attr("data-status"),navstatus:i(o.button).attr("data-navstatus"),npstatus:i(o.button).attr("data-np-status"),linktarget:i(o.button).attr("data-linktarget"),parentid:i(o.button).attr("data-parentid"),navtitleattr:i(o.button).attr("data-navtitleattr"),navcss:i(o.button).attr("data-navcss"),navtype:i(o.button).attr("data-nav-type"),navobject:i(o.button).attr("data-nav-object"),navobjectid:i(o.button).attr("data-nav-object-id"),navoriginallink:i(o.button).attr("data-nav-original-link"),navoriginaltitle:i(o.button).attr("data-nav-original-title")}},o.createForm=function(){var e=i(o.button).closest(NestedPages.selectors.row).parent("li");if(o.form=i(NestedPages.selectors.quickEditLinkForm).clone(),0<i(e).children("ol").length){var t=i(e).children("ol");i(o.form).insertBefore(t)}else i(o.form).appendTo(e);i(o.form).siblings(NestedPages.selectors.row).hide()},o.populateForm=function(){if(i(o.form).find(".np_id").val(o.postData.id),i(o.form).find(".np_title").val(o.postData.title),i(o.form).find(".np_author select").val(o.postData.author),i(o.form).find(".np_status").val(o.postData.status),i(o.form).find(".np_content").val(o.postData.url),i(o.form).find(".np_parent_id").val(o.postData.parentid),i(o.form).find(".np_title_attribute").val(o.postData.navtitleattr),i(o.form).find(".np_nav_css_classes").val(o.postData.navcss),"hide"===o.postData.npstatus?i(o.form).find(".np_status").prop("checked","checked"):i(o.form).find(".np_status").removeAttr("checked"),"hide"===o.postData.navstatus?i(o.form).find(".np_nav_status").prop("checked","checked"):i(o.form).find(".np_nav_status").removeAttr("checked"),"_blank"===o.postData.linktarget?i(o.form).find(".link_target").prop("checked","checked"):i(o.form).find(".link_target").removeAttr("checked"),"custom"!==o.postData.navobject&&""!==o.postData.navobject){var e='<div class="form-control original-link">Original: <a href="'+o.postData.navoriginallink+'" target="_blank">'+o.postData.navoriginaltitle+"</a></div>";i(o.form).find("[data-url-field]").remove(),i(e).insertAfter(i(o.form).find("h3")),i(o.form).find("[data-np-menu-object-input]").val(o.postData.navobject),i(o.form).find("[data-np-menu-objectid-input]").val(o.postData.navobjectid),i(o.form).find("[data-np-menu-type-input]").val(o.postData.navtype),i(o.form).find("h3").text("Link: "+o.postData.navoriginaltitle)}else i(o.form).find("h3").text("Link"),i(o.form).find("[data-np-menu-object-input]").val("custom"),i(o.form).find("[data-np-menu-type-input]").val("custom");o.formatter.showQuickEdit(),i(o.form).show()},o.submitForm=function(){o.toggleLoading(!0),i.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:i(o.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(o.toggleLoading(!1),o.newPostData=e.post_data,o.updateRow())},error:function(e){o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},o.updateRow=function(){var e=i(o.form).siblings(".row");i(e).find(".title").html(o.newPostData.post_title+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>');var t=i(e).find(".status");"publish"!==o.newPostData._status&&"future"!==o.newPostData._status?i(t).text("("+o.newPostData._status+")"):i(t).text("");var a=i(e).find(".nav-status");"hide"==o.newPostData.nav_status?i(a).text("("+NestedPages.jsData.hiddenText+")"):i(a).text("");var s=i(e).parent("li");"hide"==o.newPostData.np_status?(i(s).addClass("np-hide"),i(e).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(i(s).removeClass("np-hide"),i(e).find(".status-np-hidden").remove());var n=i(e).find(NestedPages.selectors.quickEditButtonLink);i(n).attr("data-id",o.newPostData.post_id),i(n).attr("data-title",o.newPostData.post_title),i(n).attr("data-url",o.newPostData.post_content),i(n).attr("data-status",o.newPostData._status),i(n).attr("data-navstatus",o.newPostData.nav_status),i(n).attr("data-np-status",o.newPostData.np_status),i(n).attr("data-linkTarget",o.newPostData.linkTarget),i(n).attr("data-navtitleattr",o.newPostData.titleAttribute),i(n).attr("data-navcss",o.newPostData.cssClasses),o.formatter.removeQuickEdit(),o.formatter.flashRow(e)},o.toggleLoading=function(e){if(i(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return i(NestedPages.selectors.quickEditErrorDiv).hide(),i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void i(NestedPages.selectors.quickEditLoadingIndicator).show();i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),i(NestedPages.selectors.quickEditLoadingIndicator).hide()},o.bindEvents()},(NestedPages=NestedPages||{}).Clone=function(){var t=this,a=jQuery;return t.parent_id="",t.parent_title="",t.parentLi=null,t.formatter=new NestedPages.Formatter,t.bindEvents=function(){a(document).on("click",NestedPages.selectors.cloneButton,function(e){e.preventDefault(),t.parent_id=a(this).attr("data-id"),t.parent_title=a(this).attr("data-parentname"),t.parentLi=a(this).parent(".row").parent(".page-row").parent(".npList"),t.openModal()}),a(document).on("click",NestedPages.selectors.confirmClone,function(e){e.preventDefault(),t.clone()})},t.openModal=function(){a("#"+NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(t.parent_title),a(document).trigger("open-modal-manual",NestedPages.selectors.cloneModal)},t.clone=function(){t.toggleLoading(!0),a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:t.parent_id,quantity:a(NestedPages.selectors.cloneQuantity).val(),status:a(NestedPages.selectors.cloneStatus).val(),author:a(NestedPages.selectors.cloneAuthor).find("select").val(),nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(e){t.toggleLoading(!1),a(document).trigger("close-modal-manual"),location.reload()}})},t.toggleLoading=function(e){if(e)return a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void a(NestedPages.selectors.confirmClone).attr("disabled","disabled");a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),a(NestedPages.selectors.confirmClone).attr("disabled",!1)},t.bindEvents()},(NestedPages=NestedPages||{}).Tabs=function(){var r=this,d=jQuery;return r.selectors={tabToggle:"data-np-tab-toggle",tabPane:"data-np-tab-pane",tabGroup:"data-np-tab-group"},r.bindEvents=function(){d(document).on("click","["+r.selectors.tabToggle+"]",function(e){e.preventDefault(),r.toggleTabs(d(this))})},r.toggleTabs=function(e){for(var t=d(e).attr(r.selectors.tabGroup),a=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabPane+"]"),s=d(e).attr(r.selectors.tabToggle),n=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabToggle+"]"),o=[],i=0;i<n.length;i++)o[i]=d(n[i]).parent("li")[0];d(a).hide(),d(n).removeClass("active"),d(o).removeClass("active"),d.each(a,function(){d(this).attr(r.selectors.tabPane)==s&&d(this).show()}),d.each(n,function(){d(this).attr(r.selectors.tabToggle)==s&&(d(this).addClass("active"),d(this).parent("li").addClass("active"))}),d(document).trigger("tabs-changed",[s,t,e])},r.bindEvents()},jQuery(document).ready(function(){new NestedPages.Factory}),(NestedPages=NestedPages||{}).selectors={childToggle:".child-toggle",childToggleLink:".child-toggle a",toggleAll:".nestedpages-toggleall",toggleHidden:".np-toggle-hidden",toggleStatus:".np-toggle-publish",lists:".nplist",rows:".page-row",row:".row",sortable:".sortable",notSortable:".no-sort",handle:".handle",published:".published",hiddenRows:".np-hide",errorDiv:"#np-error",loadingIndicator:"#nested-loading",syncCheckbox:".np-sync-menu",syncForm:".np-sync-menu-cont",ajaxError:"[data-nestedpages-error]",trashWithChildrenButton:"[data-nestedpages-trash-children]",toggleEditButtons:".np-toggle-edit",bulkActionsHeader:".nestedpages-list-header",bulkActionsForm:"[data-np-bulk-form]",bulkActionsCheckbox:"[data-np-bulk-checkbox]",bulkActionsIds:"[data-np-bulk-ids]",bulkActionRedirectIds:"[data-np-bulk-redirect-ids]",hiddenItemCount:"[data-np-hidden-count]",hiddenItemCountParent:"[data-np-hidden-count-parent]",bulkEditForm:"[data-np-bulk-edit-form]",bulkEditTitles:"[data-np-bulk-titles]",bulkEditRemoveItem:"[data-np-remove-bulk-item]",bulkEditCancel:"[data-np-cancel-bulk-edit]",bulkEditLinkCount:"[data-bulk-edit-link-count]",quickEditOverlay:".np-inline-overlay",quickEditLoadingIndicator:".np-qe-loading",quickEditErrorDiv:".np-quickedit-error",quickEditCancel:".np-cancel-quickedit",quickEditButtonLink:".np-quick-edit-redirect",quickEditLinkForm:".quick-edit-form-redirect",quickEditLinkSaveButton:".np-save-quickedit-redirect",quickEditOpen:".np-quick-edit",quickEditPostForm:".quick-edit-form",quickEditSaveButton:".np-save-quickedit",openLinkModal:".open-redirect-modal",linkModal:"np-link-modal",saveLink:".np-save-link",linkLoadingIndicator:".np-link-loading",linkErrorDiv:".np-new-link-error",linkForm:".np-new-link-form",linkDeleteButton:"[data-np-confirm-delete]",linkDeleteConfirmationButton:"[data-delete-confirmation]",linkDeleteConfirmationModal:"np-delete-confirmation-modal",linkDeleteConfirmationModalText:"[data-np-link-delete-text]",openPageModal:".open-bulk-modal",newPageModal:"#np-bulk-modal",newPageFormContainer:".new-child-form",newPageForm:".np-new-child-form",newPageSubmitButton:".np-save-newchild",newPageTitle:".add-new-child-row",newPageRemoveTitle:".np-remove-child",addChildButton:".add-new-child",newChildError:".np-newchild-error",cancelNewChildButton:".np-cancel-newchild",newBeforeButton:"data-insert-before",newAfterButton:"data-insert-after",cloneButton:".clone-post",confirmClone:"[data-confirm-clone]",cloneModal:"np-clone-modal",cloneQuantity:"[data-clone-quantity]",cloneStatus:"[data-clone-status]",cloneAuthor:"[data-clone-author]",tabButtonParent:"[data-np-tabs]",tabButton:"[data-np-tab]",tabContent:"[data-np-tab-pane]",thumbnailContainer:".np-thumbnail",thumbnailContainerLink:".np-thumbnail.link",manualMenuSync:"[data-np-manual-menu-sync]",manualOrderSync:"[data-np-manual-order-sync]"},NestedPages.cssClasses={noborder:"no-border"},NestedPages.jsData={ajaxurl:ajaxurl,nonce:nestedpages.np_nonce,allPostTypes:nestedpages.post_types,syncmenu:"nosync",posttype:"",nestable:!0,sortable:!0,hierarchical:!0,expandText:nestedpages.expand_text,collapseText:nestedpages.collapse_text,showHiddenText:nestedpages.show_hidden,hideHiddenText:nestedpages.hide_hidden,quickEditText:nestedpages.quick_edit,hiddenText:nestedpages.hidden,titleText:nestedpages.title},NestedPages.formActions={syncToggles:"npnestToggle",syncNesting:"npsort",syncMenu:"npsyncMenu",newPage:"npnewChild",newBeforeAfter:"npnewBeforeAfter",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations",resetSettings:"npresetSettings",resetUserPrefs:"npresetUserPreferences",resetAdminMenuSettings:"npresetAdminMenuSettings",trashWithChildren:"nptrashWithChildren"},NestedPages.Factory=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.dropdowns=new NestedPages.Dropdowns,t.modals=new NestedPages.Modals,t.checkAll=new NestedPages.CheckAll,t.bulkActions=new NestedPages.BulkActions,t.menuToggle=new NestedPages.MenuToggle,t.pageToggle=new NestedPages.PageToggle,t.nesting=new NestedPages.Nesting,t.syncMenuSetting=new NestedPages.SyncMenuSetting,t.newPage=new NestedPages.NewPost,t.quickEditLink=new NestedPages.QuickEditLink,t.quickEditPost=new NestedPages.QuickEditPost,t.clone=new NestedPages.Clone,t.tabs=new NestedPages.Tabs,t.menuLinks=new NestedPages.MenuLinks,t.hiddenItemCount=new NestedPages.HiddenItemCount,t.confirmDelete=new NestedPages.ConfirmDelete,t.manualSync=new NestedPages.ManualSync,t.postSearch=new NestedPages.PostSearch,t.postMove=new NestedPages.MovePost,t.wpml=new NestedPages.Wpml,t.trashWithChildren=new NestedPages.TrashWithChildren,t.init=function(){nestedpages.settings_page||(t.bindEvents(),t.setPostType(),t.setMenuSync(),t.setNestable(),t.setSortable(),t.formatter.updateSubMenuToggle(),t.formatter.setBorders(),t.formatter.setNestedMargins(),t.nesting.initializeSortable())},t.bindEvents=function(){e(document).on("click",NestedPages.selectors.quickEditOverlay,function(e){t.formatter.removeQuickEdit(),t.newPage.cancelNewPage()}),e(document).ready(function(){t.formatter.hideAjaxError(),t.formatter.sizeLinkThumbnails()})},t.setNestable=function(){var a=!1;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&(!0===t.hierarchical&&(a=!0),!0===t.disable_nesting&&(a=!1))}),NestedPages.jsData.nestable=a},t.setSortable=function(){var a=!0;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&void 0!==t.disable_sorting&&""!==t.disable_sorting&&"true"===t.disable_sorting&&(a=!1)}),NestedPages.jsData.sortable=a},t.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=e(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},t.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},t.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var a=this,s=jQuery;return a.typeButton="",a.post="",a.formatter=new NestedPages.Formatter,a.selectors={form:"[data-np-menu-item-form]",typeSelect:"[data-np-menu-selection]",accordion:"[data-np-menu-accordion]",accordionItem:"[data-np-menu-accordion-item]",formPlaceholder:".np-menu-link-object-placeholder",formDetails:".np-menu-link-details",searchResults:"[data-np-search-result]",defaultResults:"[data-default-result]",originalLink:"[data-np-original-link]",saveButton:"[data-np-save-link]",urlInputCont:"[data-np-menu-url-cont]",errorDiv:"[data-np-error]"},a.fields={object:"[data-np-menu-object-input]",objectid:"[data-np-menu-objectid-input]",itemType:"[data-np-menu-type-input]",url:"[data-np-menu-url]",navigationLabel:"[data-np-menu-navigation-label]",titleAttribute:"[data-np-menu-title-attr]",cssClasses:"[data-np-menu-css-classes]",npStatus:"[data-np-menu-np-status]",linkTarget:"[data-np-menu-link-target]",menuTitle:"[data-np-menu-title]",parentPostType:"[data-np-menu-parent-post-type]"},a.search=new NestedPages.MenuSearch,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.openLinkModal,function(e){e.preventDefault(),a.postParent=s(this).attr("data-parentid"),s(a.selectors.form).find(".parent_id").val(s(this).attr("data-parentid")),a.openModal()}),s(document).on("click",a.selectors.accordionItem,function(e){e.preventDefault(),a.accordion(s(this))}),s(document).on("click",a.selectors.typeSelect,function(e){e.preventDefault(),a.typeButton=s(this),a.setLinkType()}),s(document).on("keyup",a.fields.navigationLabel,function(){a.updateTitle()}),s(document).on("click",a.selectors.saveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&s(document).trigger("close-modal-manual")})},a.openModal=function(){s(NestedPages.selectors.linkErrorDiv).hide(),s(NestedPages.selectors.linkModal).find("input").val(""),s(NestedPages.selectors.linkModal).find(".parent_id").val(a.postParent),a.clearForm(),s(a.selectors.accordion).find("ul").hide(),s(a.selectors.typeSelect).removeClass("active"),s(document).trigger("open-modal-manual",NestedPages.selectors.linkModal)},a.accordion=function(e){a.clearForm();var t=s(e).siblings("ul");if(s(t).is(":visible"))return s(e).removeClass("active"),void s(t).slideUp("fast");s(a.selectors.accordionItem).removeClass("active"),s(e).addClass("active"),s(e).parents(a.selectors.accordion).find("ul").slideUp("fast"),s(t).slideDown("fast")},a.setLinkType=function(){s(a.typeButton).hasClass("active")?a.clearForm():(s(a.typeButton).hasClass("np-custom-link")&&(s(a.selectors.accordionItem).removeClass("active"),s(a.selectors.accordion).find("ul").slideUp("fast")),s(a.selectors.formPlaceholder).hide(),a.populateForm())},a.populateForm=function(){s(a.selectors.saveButton).show(),s(a.selectors.typeSelect).removeClass("active"),s(a.typeButton).addClass("active"),s(a.fields.menuTitle).text(s(a.typeButton).text()).val(s(a.typeButton).text()),s(a.selectors.form).find("h3").find("em").text(s(a.typeButton).attr("data-np-object-name")),""!==s(a.typeButton).attr("data-np-permalink")?(s(a.selectors.form).find(a.selectors.urlInputCont).hide(),s(a.selectors.form).find(a.selectors.originalLink).html('<a href="'+s(a.typeButton).attr("data-np-permalink")+'">'+s(a.typeButton).text()+"</a>"),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").show()):(s(a.selectors.form).find(a.selectors.urlInputCont).show(),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").hide()),s(a.fields.object).val(s(a.typeButton).attr("data-np-menu-object")),s(a.fields.objectid).val(s(a.typeButton).attr("data-np-menu-objectid")),s(a.fields.itemType).val(s(a.typeButton).attr("data-np-menu-type")),s(a.selectors.formDetails).show()},a.clearForm=function(){s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.saveButton).hide(),s(a.selectors.formDetails).hide(),s(a.selectors.formPlaceholder).show(),s(a.selectors.form).find("input").not(".parent_id").not(".parent-post-type").val(""),s(a.selectors.form).find(a.fields.linkTarget).val("_blank"),s(a.selectors.form).find('input[type="checkbox"]').attr("checked",!1),s(a.selectors.typeSelect).removeClass("active"),a.search.toggleLoading(!1),s(a.selectors.searchResults).remove(),s(a.selectors.defaultResults).show()},a.updateTitle=function(){var e=s(a.fields.navigationLabel).val(),t=s(a.selectors.form).find("h3").find("span");""!==e?(s(a.fields.menuTitle).val(e),s(t).text(e)):(s(a.fields.menuTitle).val(s(a.typeButton).text()),s(t).text(s(a.typeButton).text()))},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:s(a.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(e){a.toggleLoading(!1),"error"!==e.status?(a.post=e.post_data,a.createRow()):s(a.selectors.form).find(a.selectors.errorDiv).text(e.message).show()},error:function(e){console.log(e)}})},a.createRow=function(){var e='<li id="menuItem_'+a.post.id+'" class="page-row published';e+='">',e+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner">',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',e+='<a href="'+a.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+a.post.menuTitle+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></span>',e+='</a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',e+='data-id="'+a.post.id+'"',e+='data-parentid="'+a.post.parent_id+'"',e+='data-title="'+a.post.menuTitle+'" ',e+='data-url="'+a.post.url+'" ',e+='data-status="publish" ',e+='data-np-status="show" ',e+='data-navstatus="show" ',e+='data-navcss="'+a.post.cssClasses+'" ',e+='data-navtitleattr="'+a.post.titleAttribute+'" ',e+='data-nav-type="'+a.post.menuType+'" ',e+='data-nav-object="'+a.post.objectType+'" ',e+='data-nav-object-id="'+a.post.objectId+'" ',e+='data-nav-original-link="'+a.post.original_link+'" ',e+='data-nav-original-title="'+a.post.original_title+'" ',e+='data-linktarget="'+a.post.link_target+'">',e+=NestedPages.jsData.quickEditText,e+="</a>",e+='<a href="'+a.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',e+="</div></div></div></li>","0"===a.post.parent_id?s(".nplist:first li:first").after(e):a.appendChildRow(e),s(document).trigger("close-modal-manual"),a.row=s("#menuItem_"+a.post.id).find(".row"),a.formatter.flashRow(a.row)},a.appendChildRow=function(e){var t=s("#menuItem_"+a.post.parent_id);0===s(t).children("ol").length?(e='<ol class="sortable nplist" style="display:block;">'+e+"</ol>",s(t).append(e)):s(t).find("ol:first").prepend(e),a.formatter.updateSubMenuToggle()},a.toggleLoading=function(e){if(e)return s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void s(a.selectors.saveButton).attr("disabled","disabled");s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),s(a.selectors.saveButton).attr("disabled",!1)},a.bindEvents()},(NestedPages=NestedPages||{}).MenuSearch=function(){var s=this,n=jQuery;return s.selectors={searchForms:"*[data-np-menu-search]",defaultResults:"[data-default-result]",loadingIndicator:".np-menu-search-loading",noResults:".np-menu-search-noresults",searchType:"data-search-type",searchObject:"data-search-object",searchResults:"[data-np-search-result]"},s.activeForm="",s.results="",s.defaultResults="",s.searchType="",s.searchObject="",s.init=function(){s.bindEvents()},s.bindEvents=function(){n(document).on("keyup",s.selectors.searchForms,function(){s.activeForm=n(this),n(s.selectors.searchResults).remove(),s.performSearch()})},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){s.searchType=n(s.activeForm).attr(s.selectors.searchType),s.searchObject=n(s.activeForm).attr(s.selectors.searchObject),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:n(s.activeForm).val(),searchType:s.searchType,searchObject:s.searchObject},success:function(e){console.log(e),e.results?(s.results=e.results,s.toggleLoading(!1),"post_type"===s.searchType?s.appendPosts():s.appendTaxonomies()):(s.toggleLoading(!1),n(s.activeForm).siblings(s.selectors.noResults).show())}})},s.appendPosts=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.ID+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.singular_name+'" data-np-menu-selection>'+t.post_title+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.appendTaxonomies=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.term_id+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.taxonomy+'" data-np-menu-selection>'+t.name+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).siblings(s.selectors.loadingIndicator);n(s.selectors.noResults).hide(),e?n(t).show():n(t).hide()},s.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPages,NestedPagesTrash=function(){var t=this,a=jQuery;return t.trashButton=".np-empty-trash",t.confirmButton=".np-trash-confirm",t.warningModal="#np-trash-modal",t.errorAlert="#np-error",t.loadingIndicator="#nested-loading",t.trashLinks=".np-trash-links",t.postType=a("#np-trash-posttype").val(),t.nonce=nestedpages.np_nonce,t.formAction="npEmptyTrash",t.bindEvents=function(){a(document).on("click",t.confirmButton,function(e){e.preventDefault(),t.confirmEmpty()})},t.confirmEmpty=function(){t.loading(!0),a(document).trigger("close-modal-manual"),a(t.errorAlert).hide(),t.emptyTrash()},t.emptyTrash=function(){a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:t.formAction,nonce:t.nonce,posttype:t.postType},success:function(e){t.loading(!1),"error"===e.status?a(t.errorAlert).text(e.message).show():(a(t.trashLinks).hide(),a(".notice-dismiss").click())}})},t.loading=function(e){e?a(t.loadingIndicator).show():a(t.loadingIndicator).hide()},t.bindEvents()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var t=this,a=jQuery;return t.deleteLink="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.linkDeleteButton,function(e){e.preventDefault(),t.confirmSingle(a(this))}),a(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(e){e.preventDefault(),a(this).hasClass("bulk")?t.deleteMultiple():t.deleteSingle()}),a(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){t.confirmMultiple(e)})},t.confirmSingle=function(e){t.deleteLink=a(e).attr("href"),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),a(document).trigger("open-modal-manual",NestedPages.selectors.linkDeleteConfirmationModal)},t.confirmMultiple=function(e){"trash"===a('select[name="np_bulk_action"]').val()&&""!==a(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),a(document).trigger("open-modal-manual",[NestedPages.selectors.linkDeleteConfirmationModal]))},t.deleteMultiple=function(){a(NestedPages.selectors.bulkActionsForm)[0].submit()},t.deleteSingle=function(){window.location.replace(t.deleteLink)},t.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var t=this,a=jQuery;return t.activeBtn="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.manualMenuSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncMenu()}),a(document).on("click",NestedPages.selectors.manualOrderSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncOrder()})},t.syncMenu=function(){t.loading(!0),a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.manualMenuSync,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:"sync"},success:function(e){"error"===e.status?(a(NestedPages.selectors.errorDiv).text(e.message).show(),a(NestedPages.selectors.loadingIndicator).hide()):t.loading(!1)}})},t.syncOrder=function(){t.loading(!0),(new NestedPages.Nesting).syncNesting(!0,t.loading(!1))},t.loading=function(e){if(e)return a(t.activeBtn).addClass("disabled"),void a(NestedPages.selectors.loadingIndicator).show();a(t.activeBtn).removeClass("disabled"),a(NestedPages.selectors.loadingIndicator).hide()},t.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var s=this,n=jQuery;return s.selectors={input:"data-nestedpages-post-search",form:"data-nestedpages-post-search-form",loadingIndicator:"data-nestedpages-loading",noResults:"data-nestedpages-no-results",results:"data-nestedpages-search-results"},s.changed=!1,s.activeInput="",s.results="",s.defaultResults="",s.postType="",s.activeForm="",s.bindEvents=function(){n("["+s.selectors.input+"]").on("input",function(){if(s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val())return n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults();s.query()})},s.setDefaultResults=function(){s.defaultResults=n(s.activeForm).find("["+s.selectors.results+"]").html(),s.changed=!0},s.showDefaultResults=function(){n(s.activeForm).find("["+s.selectors.results+"]").html(s.defaultResults)},s.setOptions=function(){s.postType=n(s.activeInput).attr(s.selectors.input),s.activeForm=n(s.activeInput).parents("["+s.selectors.form+"]")},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){n(s.activeForm).find("["+s.selectors.results+"]").empty(),s.toggleLoading(!0),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:n(s.activeInput).val(),postType:s.postType},success:function(e){e.results?(s.results=e.results,s.loadResults(),s.toggleLoading(!1)):(s.toggleLoading(!1),n(s.activeForm).find("["+s.selectors.noResults+"]").show())}})},s.loadResults=function(){var a="<ul>";n.each(s.results,function(e,t){a+='<li><a href="#" data-assignment-page-id="'+t.ID+'" data-assignment-page-title="'+t.post_title+'">'+t.post_title+"</a></li>"}),a+="</ul>",n(s.activeForm).find("["+s.selectors.results+"]").html(a),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).find("["+s.selectors.loadingIndicator+"]"),a=n(s.activeForm).find("["+s.selectors.noResults+"]");n(a).hide(),e?n(t).show():n(t).hide()},s.bindEvents()},(NestedPages=NestedPages||{}).MovePost=function(){var a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.nesting=new NestedPages.Nesting,a.activeRow,a.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},a.bindEvents=function(){s(document).ready(function(){a.disableTopOnFirst(),a.disableBottomOnLast()}),s(document).on("click","["+a.selectors.moveToTop+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToTop())}),s(document).on("click","["+a.selectors.moveToBottom+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToBottom())})},a.moveToTop=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).find(NestedPages.selectors.rows).first();s(a.activeRow).insertBefore(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.moveToBottom=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).children(NestedPages.selectors.rows).last();s(a.activeRow).insertAfter(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.disableTopOnFirst=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToTop+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).first();s(e).find("["+a.selectors.moveToTop+"]").addClass("disabled")})},a.disableBottomOnLast=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToBottom+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).last();s(e).find("["+a.selectors.moveToBottom+"]").addClass("disabled")})},a.bindEvents()},(NestedPages=NestedPages||{}).TrashWithChildren=function(){var t=this,a=jQuery;return t.post_id="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.trashWithChildrenButton,function(e){e.preventDefault(),t.post_id=a(this).attr("data-post-id"),t.trash()})},t.trash=function(){a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.trashWithChildren,nonce:NestedPages.jsData.nonce,post_id:t.post_id,screen:nestedpages.current_page},success:function(e){window.location.replace(e.redirect)},error:function(e){console.log(e)}})},t.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var a=this,o=jQuery;return a.button=null,a.postData=null,a.modal=null,a.parent_li=null,a.formatter=new NestedPages.Formatter,a.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},a.bindEvents=function(){nestedpages.wpml&&o(document).on("click","["+a.selectors.translationsBtn+"]",function(e){e.preventDefault(),a.createTranslationsModal(o(this))})},a.createTranslationsModal=function(e){if(a.parent_li=o(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),a.button=o(a.parent_li).find(NestedPages.selectors.quickEditOpen),a.postData={id:o(a.button).attr("data-id"),title:o(a.button).attr("data-title"),slug:o(a.button).attr("data-slug")},a.modal=o("["+a.selectors.modal+"]").clone(),0<o(a.parent_li).children("ol").length){var t=o(a.parent_li).children("ol");o(a.modal).insertBefore(t)}else o(a.modal).appendTo(a.parent_li);o(a.modal).find("["+a.selectors.title+"]").text(a.postData.title),a.formatter.showQuickEdit(),o(a.modal).show(),a.getTranslationData()},a.getTranslationData=function(){o.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:a.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(a.postData.id),"success"===e.status?a.populateModal(e.translations):(o(a.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),a.toggleLoading(!1))}})},a.populateModal=function(s){var n="<tbody>";o.each(s,function(e,t){var a=s[e];n+="<tr>",n+='<td><img src="'+a.country_flag_url+'" alt="'+a.translated_name+'" /> '+a.translated_name+"</td>",n+="<td>",a.has_translation&&a.edit_link?n+='<a href="'+a.edit_link+'">'+a.translation.post_title+" ("+nestedpages.edit+")</a>":n+='<a href="'+a.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",n+="</td>",n+="</tr>"}),n+="</tbody>",o(a.modal).find("["+a.selectors.table+"]").html(n),a.toggleLoading(!1)},a.toggleLoading=function(e){e?o(a.modal).addClass("loading"):o(a.modal).removeClass("loading")},a.bindEvents()};
|
1 |
+
(NestedPages=NestedPages||{}).Formatter=function(){var s=this,i=jQuery;s.updateSubMenuToggle=function(){for(var e=i(NestedPages.selectors.childToggle),t=0;t<e.length;t++){var a=e[t],s=i(a).parent(".row").parent("li");if(0<i(s).children("ol").length){if(i(s).children("ol").find("li.page-row").length<1){i(s).children("ol").hide();continue}var n='<div class="child-toggle-spacer"></div>';n+='<a href="#"',0<i(s).children("ol:visible").length&&(n+=' class="open"'),n+='><span class="np-icon-arrow"></span></a>',i(a).html(n),0<i(s).children("ol").children(".np-hide").length&&0===i(s).children("ol").children(".np-hide.shown").length?i(a).find("a").hide():0<i(s).children("ol").children(".np-hide").length&&0<i(s).children("ol").children(".np-hide.shown").length&&i(a).find("a").show()}else i(a).empty().html('<div class="child-toggle-spacer"></div>')}},s.setBorders=function(){i(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),i.each(i(NestedPages.selectors.lists),function(){i(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},s.setNestedMargins=function(){s.setIndent()},s.setIndent=function(){var n="1"===nestedpages.non_indent?20:30,o="1"===nestedpages.non_indent?".row-inner":".child-toggle";i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;if(NestedPages.jsData.sortable||(s=10),0<a){s=a*n+s;i(this).find(o).css("padding-left",s+"px")}else NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.setClassicIndent=function(){i.each(i(NestedPages.selectors.lists),function(e,t){var a=i(this).parents(NestedPages.selectors.lists).length,s=0;if(NestedPages.jsData.sortable||(s=10),0<a){s=20*a+s;i(this).find(".row-inner").css("padding-left",s+"px")}else NestedPages.jsData.sortable&&!i(this).hasClass("no-sort")?i(this).find(".row-inner").css("padding-left","0px"):i(this).find(".row-inner").css("padding-left","10px")})},s.updatePlaceholderWidth=function(e){if(NestedPages.jsData.nestable){var t=40*i(e.placeholder).parents("ol").length-40,a=i(NestedPages.selectors.sortable).width()-t;i(e.placeholder).width(a).css("margin-left",t+"px")}s.updateListVisibility(e)},s.updateListVisibility=function(e){var t=i(e.placeholder).parent("ol");i(t).is(":visible")||(i(t).addClass("nplist"),i(t).show())},s.removeQuickEdit=function(){i(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),i(".sortable .quick-edit").remove(),i(".row").show()},s.showQuickEdit=function(){i("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){i(".np-inline-overlay").addClass("active")},50)},s.flashRow=function(e){i(e).addClass("np-updated"),s.setBorders(),setTimeout(function(){i(e).addClass("np-updated-show")},1500)},s.showAjaxError=function(e){i(NestedPages.selectors.ajaxError).find("p").text(e),i(NestedPages.selectors.ajaxError).show()},s.hideAjaxError=function(e){i(NestedPages.selectors.ajaxError).hide()},s.sizeLinkThumbnails=function(){var e=i(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),t=i(e).width(),a=i(e).height();i.each(i(NestedPages.selectors.thumbnailContainerLink),function(){i(this).width(t),i(this).height(a)})}},(NestedPages=NestedPages||{}).Dropdowns=function(){var t=this,a=jQuery;return t.dropdown="",t.activeBtn="",t.activeContent="",t.toggleBtn="[data-dropdown-toggle]",t.dropdownContainer="[data-dropdown]",t.dropdownContent="[data-dropdown-content]",t.selectors={caret_up:"icon-arrow_drop_up",caret_down:"icon-arrow_drop_down"},t.bindEvents=function(){a(document).on("click",t.toggleBtn,function(e){e.preventDefault(),t.activeBtn=a(this),t.dropdown=a(this).parents(t.dropdownContainer),t.toggleDropdown()}),a(document).on("click",function(e){t.closeDropdowns(e.target)}),a(document).on("dropdown-opened",function(e,t){0<a(t).parents(NestedPages.selectors.row).length&&a(t).parents(NestedPages.selectors.row).addClass("active")}),a(document).on("dropdown-closed",function(){a(NestedPages.selectors.row).removeClass("active")})},t.toggleDropdown=function(){a("."+t.selectors.caret_up).attr("class",t.selectors.caret_down);var e=a(t.dropdown).find(t.dropdownContent);if(t.activeContent=e,a(e).hasClass("active"))return a(e).removeClass("active"),a(t.activeBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),void a(document).trigger("dropdown-closed",e);t.setPositioning(),a(t.toggleBtn).removeClass("active"),a(t.dropdownContent).removeClass("active"),a(e).addClass("active"),a(t.activeBtn).find("."+t.selectors.caret_down).attr("class",t.selectors.caret_up),a(t.activeBtn).addClass("active"),a(document).trigger("dropdown-opened",e)},t.setPositioning=function(){var e=a(t.activeBtn).outerHeight();a(t.activeContent).css("top",e+"px")},t.closeDropdowns=function(e){0===a(e).parents(t.dropdownContainer).length&&(a(t.dropdownContent).removeClass("active"),a(t.toggleBtn).removeClass("active"),a(t.activeBtn).find("."+t.selectors.caret_up).attr("class",t.selectors.caret_down),a(document).trigger("dropdown-closed",void 0))},t.bindEvents()},(NestedPages=NestedPages||{}).Modals=function(){var a=this,s=jQuery;return a.activeBtn="",a.activeModal="",a.modalOpen=!1,a.selectors={toggleBtn:"[data-nestedpages-modal-toggle]",backdrop:"[data-nestedpages-modal-backdrop]",closeBtn:"[data-nestedpages-modal-close]",title:"data-nestedpages-modal-title",content:"data-nestedpages-modal-content"},a.bindEvents=function(){s(document).on("click",a.selectors.toggleBtn,function(e){e.preventDefault(),a.activeBtn=s(this),a.openModal()}),s(document).on("click",a.selectors.closeBtn,function(e){e.preventDefault(),a.closeModals()}),s(document).on("open-modal-manual",function(e,t){a.activeModal=s('[data-nestedpages-modal="'+t+'"]'),a.openModal()}),s(document).on("close-modal-manual",function(e){a.closeModals()}),s(document).on("click",a.selectors.backdrop,function(e){a.closeModals()}),s(document).ready(function(){a.checkHash()})},a.openModal=function(){if(a.modalOpen)a.closeModals();else{if(0<s(a.activeBtn).length){var e=s(a.activeBtn).attr("data-nestedpages-modal-toggle");a.activeModal=s('*[data-nestedpages-modal="'+e+'"]')}s(a.activeModal).addClass("active"),a.modalOpen=!0,a.populateModal(),s(document).trigger("open-modal",[a.activeBtn,a.activeModal])}},a.closeModals=function(){a.modalOpen=!1,s("[data-nestedpages-modal]").removeClass("active"),a.activeModal="",a.activeBtn=""},a.populateModal=function(){var e=s(a.activeBtn).attr(a.selectors.title);void 0!==e&&""!==e&&s(a.activeModal).find("[data-nestedpages-modal-title]").text(e);var t=s(a.activeBtn).attr(a.selectors.content);void 0!==t&&""!==t&&s(a.activeModal).find("[data-nestedpages-modal-content]").html(t)},a.checkHash=function(){if(window.location.hash&&"#modal"===window.location.hash.substring(0,6)){var e=window.location.hash.substring(7);a.activeModal=s('*[data-nestedpages-modal="'+e+'"]'),a.openModal()}},a.bindEvents()},(NestedPages=NestedPages||{}).CheckAll=function(){var s=this,n=jQuery;return s.activeCheckbox="",s.selectors={checkbox:"[data-np-check-all]"},s.bindEvents=function(){n(document).on("change",s.selectors.checkbox,function(){s.activeCheckbox=n(this),s.toggleCheckboxes()}),n(document).on("change","input[type=checkbox]",function(){s.checkAllStatus(n(this))})},s.init=function(){s.bindEvents()},s.toggleCheckboxes=function(){var t=!!n(s.activeCheckbox).is(":checked"),e=n(s.activeCheckbox).attr("data-np-check-all"),a=n('*[name="'+e+'"]');n.each(a,function(){var e=n(this).parents(NestedPages.selectors.rows);n(this).prop("checked",t),n(e).hasClass("np-hide")&&!n(e).is(":visible")&&n(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),s.toggleCheckAll()},s.toggleCheckAll=function(){var e=n(s.activeCheckbox).attr("data-np-check-all"),t=n('*[name="'+e+'"]').length;t=t-n(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+n(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length;var a=n('*[name="'+e+'"]:checked').length;if(t==a)return n(s.activeCheckbox).prop("checked",!0),void n(s.activeCheckbox).removeClass("check-all-partial");0<a?n(s.activeCheckbox).addClass("check-all-partial"):(n(s.activeCheckbox).attr("checked",!1),n(s.activeCheckbox).removeClass("check-all-partial"))},s.checkAllStatus=function(e){var t=n(e).attr("name"),a=n('*[data-np-check-all="'+t+'"]');0!==a.length&&(s.activeCheckbox=n(a)[0],s.toggleCheckAll())},s.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var o=this,i=jQuery;return o.selectedNumber=0,o.selectedLinks=[],o.selectedPosts=[],o.init=function(){o.bindEvents()},o.bindEvents=function(){i(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){o.toggleBulkForm()}),i(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){"edit"===i("select[name=np_bulk_action]").val()&&(e.preventDefault(),o.toggleBulkEdit(!0))}),i(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(e){e.preventDefault();var t=i(this).siblings("input[type=hidden]").val();o.uncheckBulkItem(t)}),i(document).on("click",NestedPages.selectors.bulkEditCancel,function(e){e.preventDefault(),o.uncheckAllBulkItems()})},o.toggleBulkForm=function(){var a=!1,s="",n="";if(o.selectedPosts=[],o.selectedLinks=[],i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){if(i(this).is(":checked")){var e=i(this).parents(NestedPages.selectors.rows);if(a=!0,i(this).parent("div").hasClass("np-check-all")||i(e).hasClass("post-type-np-redirect")||(s+=i(this).val()+","),i(e).hasClass("post-type-np-redirect")&&(n+=i(this).val()+",",o.selectedLinks.push(i(this).val())),"np-redirect"!==i(this).attr("data-np-post-type")&&!i(this).parent("div").hasClass("np-check-all")){var t=[];t.title=i(this).attr("data-np-bulk-checkbox"),t.id=i(this).val(),o.selectedPosts.push(t)}}}),o.setBulkEditPosts(),o.toggleEditOption(),o.toggleLinkCountAlert(),a)return i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkActionsIds).val(s),i(NestedPages.selectors.bulkActionRedirectIds).val(n),void o.setSelectedNumber();i(NestedPages.selectors.bulkActionsIds).val(""),i(NestedPages.selectors.bulkActionsForm).hide()},o.setBulkEditPosts=function(){for(var e="",t=0;t<o.selectedPosts.length;t++)e+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>×</a>',e+=o.selectedPosts[t].title,e+='<input type="hidden" name="post_ids[]" value="'+o.selectedPosts[t].id+'"></li>';i(NestedPages.selectors.bulkEditTitles).html(e)},o.uncheckBulkItem=function(e){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).val()==e&&i(this).prop("checked",!1).change()}),0===i(NestedPages.selectors.bulkEditRemoveItem).length&&o.toggleBulkEdit(!1)},o.uncheckAllBulkItems=function(){i.each(i(NestedPages.selectors.bulkActionsCheckbox),function(){i(this).prop("checked",!1).change()}),o.toggleBulkEdit(!1)},o.setSelectedNumber=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option").first();i(t).text(nestedpages.bulk_actions+" ("+e+")")},o.toggleEditOption=function(){var e=i(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,t=i(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===e)return i(t).prop("disabled",!0),i(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void o.toggleBulkEdit(!1);i(t).prop("disabled",!1)},o.toggleBulkEdit=function(e){if(o.toggleLinkCountAlert(),e)return o.disableParentOptions(),i(NestedPages.selectors.bulkEditForm).show(),i(NestedPages.selectors.bulkActionsForm).hide(),void o.setWPSuggest();i(NestedPages.selectors.bulkEditForm).hide(),i(NestedPages.selectors.bulkActionsForm).show(),i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),i(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),o.resetBulkEditFields()},o.toggleLinkCountAlert=function(){0!==o.selectedLinks.length?i(NestedPages.selectors.bulkEditLinkCount).parent("div").show():i(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},o.disableParentOptions=function(){for(var e=i(NestedPages.selectors.bulkEditForm).find("select[name=post_parent]"),t=0;t<o.selectedPosts.length;t++)i(e).find("option[value="+o.selectedPosts[t].id+"]").attr("disabled",!0)},o.setWPSuggest=function(){var e=i(NestedPages.selectors.bulkEditForm).find("[data-autotag]");i.each(e,function(e,t){var a=i(this).attr("data-taxonomy");i(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},o.resetBulkEditFields=function(){var e=i(NestedPages.selectors.bulkEditForm).find("select");i.each(e,function(){i(this).find("option").first().prop("selected",!0),i(this).find("option").removeAttr("disabled")});var t=i(NestedPages.selectors.bulkEditForm).find(".cat-checklist");i.each(t,function(){i(this).find("input[type=checkbox]").prop("checked",!1)})},o.init()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,a=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){a(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),a(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var t=0;a.each(a(NestedPages.selectors.bulkActionsCheckbox),function(){if(a(this).is(":checked")){if(a(this).parent("div").hasClass("np-check-all"))return;var e=a(this).closest(".page-row");a(e).is(":visible")||t++}}),t<1?a(NestedPages.selectors.hiddenItemCountParent).hide():(a(NestedPages.selectors.hiddenItemCount).text(t),a(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var a=this,n=jQuery;return a.formatter=new NestedPages.Formatter,a.bindEvents=function(){n(document).on("click",NestedPages.selectors.childToggleLink,function(e){e.preventDefault(),a.toggleSingleMenu(n(this))}),n(document).on("click",NestedPages.selectors.toggleAll,function(e){e.preventDefault(),a.toggleAllMenus()})},a.toggleSingleMenu=function(e){var t=n(e).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");n(e).toggleClass("open"),n(t).toggle(),a.formatter.setBorders(),a.formatter.setNestedMargins(),a.syncUserToggles()},a.toggleAllMenus=function(){var e=NestedPages.selectors.toggleAll;if("closed"===n(e).attr("data-toggle"))return n(NestedPages.selectors.lists).show(),n(e).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),n(NestedPages.selectors.childToggle+" a").addClass("open"),a.formatter.setBorders(),void a.syncUserToggles();n(NestedPages.selectors.lists).not(n(NestedPages.selectors.lists)[0]).hide(),n(e).attr("data-toggle","closed").text(NestedPages.jsData.expandText),n(NestedPages.selectors.childToggle+" a").removeClass("open"),a.formatter.setBorders(),a.syncUserToggles()},a.visibleRowIDs=function(){var s=[],e=n(NestedPages.selectors.rows+":visible");return n.each(e,function(e,t){var a=n(this).attr("id");s.push(a.replace("menuItem_",""))}),s},a.syncUserToggles=function(){n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:a.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},a.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var a=this,s=jQuery;return a.activeButton="",a.formatter=new NestedPages.Formatter,a.init=function(){a.bindEvents()},a.bindEvents=function(){s(document).on("click",NestedPages.selectors.toggleHidden,function(e){e.preventDefault(),a.activeButton=s(this),a.toggleHidden()}),s(document).on("click",NestedPages.selectors.toggleStatus,function(e){e.preventDefault(),a.toggleStatus(s(this))})},a.toggleHidden=function(){var e=s(a.activeButton),t=s(e).attr("href");if("#show"==t)return s(e).attr("href","#hide").text(NestedPages.jsData.showHiddenText),s(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),a.formatter.updateSubMenuToggle(),void a.formatter.setBorders();"#hide"==t&&(s(e).attr("href","#show").text(NestedPages.jsData.hideHiddenText),s(NestedPages.selectors.hiddenRows).addClass("shown").show(),a.formatter.updateSubMenuToggle(),a.formatter.setBorders())},a.toggleStatus=function(e){var t=s(e).attr("href");t=t.substring(1),s(NestedPages.selectors.syncCheckbox).attr("disabled",!1),s(NestedPages.selectors.toggleStatus).removeClass("active"),s(e).addClass("active"),"draft"==t&&(s(NestedPages.selectors.syncCheckbox).attr("disabled",!0),s("."+t).addClass("nested-visible")),"all"!=t?(s(NestedPages.selectors.rows).hide(),s("."+t).show()):s(NestedPages.selectors.rows).show()},a.init()},(NestedPages=NestedPages||{}).Nesting=function(){var o=this,i=jQuery;o.formatter=new NestedPages.Formatter,o.initializeSortable=function(){if(!NestedPages.jsData.nestable)return o.initializeSortableFlat();i(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",tabSize:56,isAllowed:function(e,t,a){return!(i(t).hasClass("post-type-np-redirect")&&!i(a).hasClass("post-type-np-redirect"))},start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){o.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){o.formatter.updateSubMenuToggle(),o.formatter.setBorders(),o.formatter.setNestedMargins()},100),o.syncNesting()}})},o.initializeSortableFlat=function(){var e=i(NestedPages.selectors.lists).not(NestedPages.selectors.notSortable);i.each(e,function(){i(this).sortable({items:">"+NestedPages.selectors.rows,handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",forcePlaceholderSize:!0,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(e,t){o.formatter.updatePlaceholderWidth(t)},stop:function(e,t){setTimeout(function(){o.formatter.updateSubMenuToggle(),o.formatter.setBorders(),o.formatter.setNestedMargins()},100),o.syncNesting()}})})},o.disableNesting=function(){i(NestedPages.selectors.sortable).sortable("destroy")},o.syncNesting=function(e,t){var a,s;if("1"!==nestedpages.manual_order_sync||e){i(NestedPages.selectors.errorDiv).hide(),i(NestedPages.selectors.loadingIndicator).show(),s=!!i(NestedPages.selectors.lists).first().hasClass("filtered"),a=NestedPages.jsData.nestable&&!s?i(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}):o.setNestingArray(),o.disableNesting();var n=NestedPages.jsData.syncmenu;"1"===nestedpages.manual_menu_sync&&(n="nosync"),i.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:a,post_type:NestedPages.jsData.posttype,syncmenu:n,filtered:s},success:function(e,t){if(o.initializeSortable(),"error"===e.status)i(NestedPages.selectors.errorDiv).text(e.message).show(),i(NestedPages.selectors.loadingIndicator).hide();else{if(t&&"function"==typeof t)return void t();i(NestedPages.selectors.loadingIndicator).hide()}}})}},o.setNestingArray=function(e){return ret=[],i(NestedPages.selectors.lists).first().children("li.page-row").each(function(){var e=o.recursiveNesting(this);ret.push(e)}),ret},o.recursiveNesting=function(e){var t,a=i(e).attr("id");if(a)return a=a.replace("menuItem_",""),t={id:a},0<i(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).length&&(t.children=[],i(e).children(NestedPages.selectors.lists).children(NestedPages.selectors.rows).each(function(){var e=o.recursiveNesting(this);t.children.push(e)})),t}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.init=function(){t.bindEvents()},t.bindEvents=function(){e(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&t.syncSetting()}),e(document).on("change",NestedPages.selectors.syncCheckbox,function(){t.syncSetting()})},t.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==e(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=e(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",e.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncMenu,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:NestedPages.jsData.syncmenu},success:function(e){"error"===e.status&&t.formatter.showAjaxError(e.message)},error:function(e){console.log(e)}}))},t.bindEvents()},(NestedPages=NestedPages||{}).NewPost=function(){var r=this,d=jQuery;return r.formatter=new NestedPages.Formatter,r.parent_id=0,r.posts="",r.form="",r.bindEvents=function(){d(document).on("open-modal",function(e,t,a){var s=d(t).attr("data-nestedpages-modal-toggle");void 0!==s&&"np-bulk-modal"==s&&r.openModal()}),d(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),d(document).on("click",NestedPages.selectors.newPageSubmitButton,function(e){e.preventDefault(),r.submitForm(d(this))}),d(document).on("click",NestedPages.selectors.newPageTitle,function(e){e.preventDefault(),r.addTitleField(d(this))}),d(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(e){e.preventDefault(),r.removeTitleField(d(this))}),d(document).on("click",NestedPages.selectors.addChildButton,function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click",NestedPages.selectors.cancelNewChildButton,function(e){e.preventDefault(),r.cancelNewPage()}),d(document).on("click","["+NestedPages.selectors.newBeforeButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("click","["+NestedPages.selectors.newAfterButton+"]",function(e){e.preventDefault(),r.openQuickEdit(d(this))}),d(document).on("keydown",function(e){27===e.keyCode&&(r.cancelNewPage(),d(document).click())})},r.openModal=function(){var e=d(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);d(e).addClass("in-modal"),d(NestedPages.selectors.newPageModal).find(".modal-body").html(e),d(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),d(NestedPages.selectors.newPageModal).find(".page_parent_id").val(r.parent_id),d(e).find(".np_title").first().focus(),d(e).find(NestedPages.selectors.newPageTitle).first().prop("tabindex","2")},r.openQuickEdit=function(e){var t=d(e).attr(NestedPages.selectors.newBeforeButton);t=void 0!==t&&""!==t&&t;var a=d(e).attr(NestedPages.selectors.newAfterButton);a=void 0!==a&&""!==a&&a;var s=d(e).closest(NestedPages.selectors.row).parent("li"),n=d(NestedPages.selectors.newPageFormContainer).clone();if(0<d(s).children("ol").length){var o=d(s).children("ol");d(n).insertBefore(o)}else d(n).appendTo(s);d(n).siblings(NestedPages.selectors.row).hide(),r.formatter.showQuickEdit(),d(n).find(".parent_name").html("<em>Parent:</em> "+d(e).attr("data-parentname")),t||a||d(n).find(".page_parent_id").val(d(e).attr("data-id")),t&&(d(n).find(".page_before_id").val(t),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_before+": "+d(e).attr("data-parentname"))),a&&(d(n).find(".page_after_id").val(a),d(n).find("[data-new-post-relation-title]").text(nestedpages.insert_after+": "+d(e).attr("data-parentname"))),d(n).show(),d(n).find(".np_title").focus(),d(n).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},r.cancelNewPage=function(){r.formatter.removeQuickEdit(),d(NestedPages.selectors.newChildError).hide(),d(NestedPages.selectors.newPageModal).find(".modal-body").empty(),d(NestedPages.selectors.sortable).find(".new-child").remove(),d(NestedPages.selectors.row).show()},r.addTitleField=function(e){var t=d(e).parents("form"),a=d(e).siblings(".new-page-titles").children("li").length+1,s='<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg><div class="form-control new-child-row"><label>'+NestedPages.jsData.titleText+'</label><div><input type="text" name="post_title[]" class="np_title" placeholder="'+NestedPages.jsData.titleText+'" value="" tabindex="'+a+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';d(e).siblings(".new-page-titles").append(s);d(t).find(".np_title").last().focus(),d(t).find(NestedPages.selectors.newPageTitle).prop("tabindex",a++),d(".new-page-titles").sortable({items:"li",handle:".handle"}),r.toggleAddEditButton(t)},r.removeTitleField=function(e){var t=d(e).parents("form");d(e).parents(".new-child-row").parent("li").remove(),r.toggleAddEditButton(t)},r.submitForm=function(e){r.toggleLoading(!0),r.form=d(e).parents("form");var a=!!d(e).hasClass("add-edit"),t=NestedPages.formActions.newPage;""!==d(r.form).find(".page_before_id").val()&&(t=NestedPages.formActions.newBeforeAfter),""!==d(r.form).find(".page_after_id").val()&&(t=NestedPages.formActions.newBeforeAfter),d.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:d(r.form).serialize()+"&action="+t+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){if("error"===e.status)return r.toggleLoading(!1),void d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show();if(!0==a){var t=e.new_pages[0].edit_link;return t=t.replace(/&/g,"&"),void window.location.replace(t)}r.toggleLoading(!1),r.posts=e.new_pages,r.addPosts()},error:function(e){console.log(e),r.toggleLoading(!1),d(r.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},r.addPosts=function(){var e=d(r.form).find(".page_before_id").val();e=""!==e&&e;var t=d(r.form).find(".page_after_id").val();t=""!==t&&t;var a=d(r.form).parent(".new-child").parent(".page-row");if(0!==d(a).children("ol").length||e||t||d(a).append('<ol class="nplist"></ol>'),d(r.form).hasClass("in-modal"))var s=d(".nplist.sortable li.page-row:first");else s=d(a).children("ol");for(i=0;i<r.posts.length;i++)r.appendRows(s,r.posts[i],e,t);e||t||d(s).show(),r.formatter.updateSubMenuToggle(),r.formatter.setNestedMargins(),r.cancelNewPage(),d(document).trigger("close-modal-manual")},r.appendRows=function(e,t,a,s){var n='<li id="menuItem_'+t.id+'" class="page-row';if("publish"===t.status&&(n+=" published"),n+='">',NestedPages.jsData.hierarchical?(n+='<div class="row">',n+='<div class="child-toggle"></div>'):(n+='<div class="row non-hierarchical">',n+='<div class="non-hierarchical-spacer"></div>'),n+='<div class="row-inner">',n+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',n+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',n+='<a href="'+t.edit_link+'" class="page-link page-title">',n+='<span class="title">'+t.title+"</span>","Publish"!==t.status?n+='<span class="status">('+t.status+")</span>":n+='<span class="status"></span>',n+='<span class="nav-status">',"hide"===t.np_nav_status&&(n+=" "+nestedpages.hidden),n+="</span>",n+='<span class="edit-indicator">Edit</span>',n+="</a>",NestedPages.jsData.hierarchical||(n+='<div class="np-post-columns">',n+='<ul class="np-post-info">',n+='<li><span class="np-author-display">'+t.author_formatted+"</span></li>",n+="<li>"+t.date_formatted+"</li>",n+="</ul>",n+="</div>"),d(".nplist").first().hasClass("has-yoast")&&(n+='<span class="np-seo-indicator na"></span>'),n+='<div class="action-buttons">',n+='<div class="nestedpages-dropdown" data-dropdown><a href="#" class="np-btn has-icon toggle" data-dropdown-toggle><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg></a><ul class="nestedpages-dropdown-content" data-dropdown-content>',n+='<li><a href="#" class="open-redirect-modal" data-parentid="'+t.id+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'+nestedpages.add_link+"</a></li>",n+='<li><a href="#" class="add-new-child" data-id="'+t.id+'" data-parentname="'+t.title+'"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'+nestedpages.add_child_short+"</a></li>",n+="</ul></div>",n+='<a href="#" class="np-btn np-quick-edit" data-id="'+t.id+'" data-template="'+t.page_template+'" data-title="'+t.title+'" data-slug="'+t.slug+'" data-commentstatus="closed" data-status="'+t.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+t.author+'" data-template="'+t.template+'" data-month="'+t.month+'" data-day="'+t.day+'" data-year="'+t.year+'" data-hour="'+t.hour+'" data-minute="'+t.minute+'" data-datepicker="'+t.datepicker+'" data-time="'+t.time+'" data-formattedtime="'+t.formattedtime+'" data-ampm="'+t.ampm+'">'+nestedpages.quick_edit+"</a>",n+='<a href="'+t.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",n+='<a href="'+t.delete_link+'" class="np-btn np-btn-trash"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-remove"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" class="icon"/><path d="M0 0h24v24H0z" fill="none"/></svg></a>',n+="</div>\x3c!-- .action-buttons --\x3e",n+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",n+="</li>",a){var o=r.findRowById(a);d(n).insertBefore(o)}else if(s){o=r.findRowById(s);d(n).insertAfter(o)}else d(e).append(n)},r.findRowById=function(e){return d(NestedPages.selectors.rows+"#menuItem_"+e)},r.toggleAddEditButton=function(e){var t=d(e).find(".np_title").length;t<1?d(NestedPages.selectors.newPageSubmitButton).hide():(d(NestedPages.selectors.newPageSubmitButton).show(),1<t?d(NestedPages.selectors.newPageSubmitButton+".add-edit").hide():d(NestedPages.selectors.newPageSubmitButton+".add-edit").show())},r.toggleLoading=function(e){if(e)return d(NestedPages.selectors.quickEditErrorDiv).hide(),d(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void d(NestedPages.selectors.quickEditLoadingIndicator).show();d(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),d(NestedPages.selectors.quickEditLoadingIndicator).hide()},r.bindEvents()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var l=this,c=jQuery;return l.formatter=new NestedPages.Formatter,l.button="",l.initialData="",l.parent_li="",l.form="",l.flatTerms="",l.termNames="",l.saveButton="",l.newData="",l.row="",l.bindEvents=function(){c(document).on("click",NestedPages.selectors.quickEditOpen,function(e){e.preventDefault(),l.button=c(this),l.openForm()}),c(document).on("click",NestedPages.selectors.quickEditCancel,function(e){e.preventDefault(),l.formatter.removeQuickEdit()}),c(document).on("change",".keep_private",function(){this.checked?c(".post_password").val("").prop("readonly",!0):c(".post_password").prop("readonly",!1)}),c(document).on("click",NestedPages.selectors.quickEditSaveButton,function(e){e.preventDefault(),l.saveButton=c(this),l.save()}),c(document).on("keydown",function(e){27===e.keyCode&&l.formatter.removeQuickEdit()})},l.openForm=function(){l.setInitialData(),l.createForm(),l.populateForm(),l.populateFlatTaxonomies()},l.setInitialData=function(){l.initialData={id:c(l.button).attr("data-id"),title:c(l.button).attr("data-title"),slug:c(l.button).attr("data-slug"),author:c(l.button).attr("data-author"),cs:c(l.button).attr("data-commentstatus"),status:c(l.button).attr("data-status"),template:c(l.button).attr("data-template"),month:c(l.button).attr("data-month"),day:c(l.button).attr("data-day"),year:c(l.button).attr("data-year"),hour:c(l.button).attr("data-hour"),minute:c(l.button).attr("data-minute"),navstatus:c(l.button).attr("data-navstatus"),npstatus:c(l.button).attr("data-np-status"),navtitle:c(l.button).attr("data-navtitle"),navtitleattr:c(l.button).attr("data-navtitleattr"),navcss:c(l.button).attr("data-navcss"),linktarget:c(l.button).attr("data-linktarget"),password:c(l.button).attr("data-password"),datepicker:c(l.button).attr("data-datepicker"),time:c(l.button).attr("data-formattedtime"),timeTwentyFour:c(l.button).attr("data-time"),ampm:c(l.button).attr("data-ampm"),timeFormat:c(l.button).attr("data-timeformat"),sticky:c(l.button).attr("data-sticky")};var e=c(l.button)[0].attributes;c.each(e,function(e,t){t.name.includes("data-npcustom")&&(l.initialData[t.name]=t.value)}),l.initialData.h_taxonomies=[],l.initialData.f_taxonomies=[],l.parent_li=c(l.button).closest(NestedPages.selectors.row).parent("li");var t=c(l.parent_li).attr("class").split(/\s+/);for(i=0;i<t.length;i++)"in-"===t[i].substring(0,3)&&l.initialData.h_taxonomies.push(t[i]),"inf-"===t[i].substring(0,4)&&l.initialData.f_taxonomies.push(t[i])},l.createForm=function(){if(l.form=c(NestedPages.selectors.quickEditPostForm).clone(),0<c(l.parent_li).children("ol").length){var e=c(l.parent_li).children("ol");c(l.form).insertBefore(e)}else c(l.form).appendTo(l.parent_li);c(l.form).siblings(NestedPages.selectors.row).hide(),c(l.form).show()},l.populateForm=function(){for(var e in c(l.form).find(".page_id").html("<em>ID:</em> "+l.initialData.id),c(l.form).find(".np_id").val(l.initialData.id),c(l.form).find(".np_title").val(l.initialData.title),c(l.form).find(".np_slug").val(l.initialData.slug),c(l.form).find(".np_author select").val(l.initialData.author),c(l.form).find(".np_status").val(l.initialData.status),c(l.form).find(".np_nav_title").val(l.initialData.navtitle),c(l.form).find(".np_title_attribute").val(l.initialData.navtitleattr),c(l.form).find(".np_nav_css_classes").val(l.initialData.navcss),c(l.form).find(".post_password").val(l.initialData.password),c(l.form).find(".np_publish_date").val(l.initialData.datepicker),"open"===l.initialData.cs&&c(l.form).find(".np_cs").attr("checked","checked"),""!==l.initialData.template?c(l.form).find(".np_template").val(l.initialData.template):c(l.form).find(".np_template").val("default"),"private"===l.initialData.status&&(c(l.form).find(".post_password").attr("readonly",!0),c(l.form).find(".keep_private").attr("checked",!0)),"hide"===l.initialData.npstatus?c(l.form).find(".nested_pages_status").attr("checked","checked"):c(l.form).find(".nested_pages_status").removeAttr("checked"),"hide"===l.initialData.navstatus?c(l.form).find(".np_nav_status").attr("checked","checked"):c(l.form).find(".np_nav_status").attr("checked",!1),"_blank"===l.initialData.linktarget?c(l.form).find(".link_target").attr("checked","checked"):c(l.form).find(".link_target").attr("checked",!1),"private"===l.initialData.status&&c(l.form).find(".np_status").val("publish"),"sticky"===l.initialData.sticky?c(l.form).find(".np-sticky").attr("checked","checked"):c(l.form).find(".np-sticky").removeAttr("checked"),"H:i"===l.initialData.timeFormat?c(l.form).find(".np_time").val(l.initialData.timeTwentyFour):(c(l.form).find(".np_time").val(l.initialData.time),c(l.form).find(".np_ampm").val(l.initialData.ampm),c(l.form).find('select[name="mm"]').val(l.initialData.month),c(l.form).find('input[name="jj"]').val(l.initialData.day),c(l.form).find('input[name="aa"]').val(l.initialData.year),c(l.form).find('input[name="hh"]').val(l.initialData.hour),c(l.form).find('input[name="mn"]').val(l.initialData.minute)),l.initialData)if(e.includes("npcustom")&&l.initialData.hasOwnProperty(e)){var t=e.replace("data-npcustom-","");t=t.toLowerCase(),c(l.form).find('[data-np-custom-field="'+t+'"]').val(l.initialData[e])}if(l.populateFlatTaxonomies(),l.initialData.hasOwnProperty("h_taxonomies")){var a=l.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];c(l.form).find(s).attr("checked","checked")}}var n=c(l.form).find(".np_datepicker");c.each(n,function(){var e=c(this);e.datepicker({dateFormat:e.attr("data-datepicker-format"),beforeShow:function(e,t){c("#ui-datepicker-div").addClass("nestedpages-datepicker")}})}),l.formatter.showQuickEdit(),c(l.form).show()},l.populateFlatTaxonomies=function(){l.initialData.hasOwnProperty("f_taxonomies")&&(l.createTaxonomyObject(),l.getTermNames(),l.setWPSuggest())},l.createTaxonomyObject=function(){var e={};for(i=0;i<l.initialData.f_taxonomies.length;i++){var t=l.initialData.f_taxonomies[i],a=t.split("-"),s=a.indexOf("nps"),n=a.splice(s+1);n=n.join("-");var o=t.split("-").splice(0,s);o.shift("inf");var r=o.join("-");r in e||(e[r]=[]),e[r].push(n)}l.flatTerms=e},l.getTermNames=function(){c.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:l.flatTerms},success:function(e){l.termNames=e.terms,l.populateFlatTaxonomyFields()}})},l.populateFlatTaxonomyFields=function(){l.termNames&&c.each(l.termNames,function(e,t){var a=c("#"+e+"-quickedit");c(a).val(t.join(","))})},l.setWPSuggest=function(){var e=c(l.form).find("[data-autotag]");c.each(e,function(e,t){var a=c(this).attr("data-taxonomy");c(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+a,{multiple:!0,multipleSep:","})})},l.save=function(){l.toggleLoading(!0),c.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:c(l.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(l.toggleLoading(!1),c(l.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(l.toggleLoading(!1),l.newData=e.post_data,l.updatePostRow())},error:function(e){console.log(e)}})},l.updatePostRow=function(){l.row=c(l.button).parents(".row-inner"),c(l.row).find(".title").text(l.newData.post_title),c(l.row).find(".np-view-button").attr("href",l.newData.permalink);var e=c(l.row).find(".status");if("publish"!==l.newData._status&&"future"!==l.newData._status){var t=nestedpages.post_statuses[l.newData._status].label;c(e).text("("+t+")")}else c(e).text("");if("private"===l.newData.keep_private&&c(e).text(nestedpages.private),""!==l.newData.post_password&&void 0!==l.newData.post_password){var a=c(e).text();a+=' <span class="locked">',a+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>',a+="</span>",c(e).html(a)}var s=c(l.row).find(".nav-status");"hide"==l.newData.nav_status?c(s).text("(Hidden)"):c(s).text("");var n=c(l.row).parent("li");"hide"==l.newData.np_status?(c(n).addClass("np-hide"),c(l.row).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(c(n).removeClass("np-hide"),c(l.row).find(".status-np-hidden").remove());var o=c(l.row).find(".sticky");"sticky"==l.newData.sticky?c(o).show():c(o).hide(),NestedPages.jsData.hierarchical||c(l.row).find(".np-author-display").text(l.newData.author_name);var i=c(l.row).find(NestedPages.selectors.quickEditOpen);for(var r in c(i).attr("data-id",l.newData.post_id),c(i).attr("data-template",l.newData.page_template),c(i).attr("data-title",l.newData.post_title),c(i).attr("data-slug",l.newData.post_name),c(i).attr("data-commentstatus",l.newData.comment_status),c(i).attr("data-status",l.newData._status),c(i).attr("data-sticky",l.newData.sticky),"private"===l.newData.keep_private&&c(i).attr("data-status","private"),c(i).attr("data-author",l.newData.post_author),c(i).attr("data-np-status",l.newData.np_status),c(i).attr("data-password",l.newData.post_password),c(i).attr("data-navstatus",l.newData.nav_status),c(i).attr("data-navtitle",l.newData.np_nav_title),c(i).attr("data-linktarget",l.newData.link_target),c(i).attr("data-navtitleattr",l.newData.np_title_attribute),c(i).attr("data-navcss",l.newData.np_nav_css_classes),c(i).attr("data-month",l.newData.mm),c(i).attr("data-day",l.newData.jj),c(i).attr("data-year",l.newData.aa),c(i).attr("data-hour",l.newData.hh),c(i).attr("data-minute",l.newData.mn),c(i).attr("data-datepicker",l.newData.np_date),c(i).attr("data-time",l.newData.np_time),c(i).attr("data-formattedtime",l.newData.np_time),c(i).attr("data-ampm",l.newData.np_ampm),l.newData)if(r.includes("np_custom")&&l.newData.hasOwnProperty(r)){var d=r.replace("np_custom_","data-npcustom-");c(i).attr(d,l.newData[r])}l.removeTaxonomyClasses(),l.addCategoryClasses(),l.addHierarchicalClasses(),l.addFlatClasses(),l.addStatusClass(),l.formatter.removeQuickEdit(),l.formatter.flashRow(l.row)},l.addStatusClass=function(){var e=["published","draft","pending","future"];for(i=0;i<e.length;i++)c(l.row).removeClass(e[i]);c(l.row).addClass(l.newData._status)},l.removeTaxonomyClasses=function(){taxonomies=[];var e=c(l.row).attr("class").split(/\s+/);for(i=0;i<e.length;i++)"in-"===e[i].substring(0,3)&&c(l.row).removeClass(e[i]),"inf-"===e[i].substring(0,4)&&c(l.row).removeClass(e[i])},l.addCategoryClasses=function(){if(l.newData.hasOwnProperty("post_category")){var e=l.newData.post_category;for(i=0;i<e.length;i++){var t="in-category-"+e[i];c(l.row).addClass(t)}}},l.addHierarchicalClasses=function(){if(l.newData.hasOwnProperty("tax_input")){var e=l.newData.tax_input;c.each(e,function(e,t){for(i=0;i<t.length;i++){var a="in-"+e+"-"+t[i];c(l.row).addClass(a)}})}},l.addFlatClasses=function(){if(l.newData.hasOwnProperty("flat_tax")){var e=l.newData.flat_tax;c.each(e,function(e,t){for(i=0;i<t.length;i++){var a="inf-"+e+"-nps-"+t[i];c(l.row).addClass(a)}})}},l.toggleLoading=function(e){if(e)return c(NestedPages.selectors.quickEditErrorDiv).hide(),c(l.saveButton).attr("disabled","disabled"),void c(NestedPages.selectors.quickEditLoadingIndicator).show();c(l.saveButton).attr("disabled",!1),c(NestedPages.selectors.quickEditLoadingIndicator).hide()},l.bindEvents()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var o=this,i=jQuery;return o.formatter=new NestedPages.Formatter,o.button="",o.postData="",o.newPostData="",o.form="",o.bindEvents=function(){i(document).on("click",NestedPages.selectors.quickEditButtonLink,function(e){e.preventDefault(),o.formatter.removeQuickEdit(),o.button=i(this),o.openQuickEdit()}),i(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(e){e.preventDefault(),o.submitForm()}),i(document).on("keydown",function(e){27===e.keyCode&&o.formatter.removeQuickEdit()})},o.openQuickEdit=function(){o.setData(),o.createForm(),o.populateForm()},o.setData=function(){o.postData={id:i(o.button).attr("data-id"),url:i(o.button).attr("data-url"),title:i(o.button).attr("data-title"),status:i(o.button).attr("data-status"),navstatus:i(o.button).attr("data-navstatus"),npstatus:i(o.button).attr("data-np-status"),linktarget:i(o.button).attr("data-linktarget"),parentid:i(o.button).attr("data-parentid"),navtitleattr:i(o.button).attr("data-navtitleattr"),navcss:i(o.button).attr("data-navcss"),navtype:i(o.button).attr("data-nav-type"),navobject:i(o.button).attr("data-nav-object"),navobjectid:i(o.button).attr("data-nav-object-id"),navoriginallink:i(o.button).attr("data-nav-original-link"),navoriginaltitle:i(o.button).attr("data-nav-original-title")}},o.createForm=function(){var e=i(o.button).closest(NestedPages.selectors.row).parent("li");if(o.form=i(NestedPages.selectors.quickEditLinkForm).clone(),0<i(e).children("ol").length){var t=i(e).children("ol");i(o.form).insertBefore(t)}else i(o.form).appendTo(e);i(o.form).siblings(NestedPages.selectors.row).hide()},o.populateForm=function(){if(i(o.form).find(".np_id").val(o.postData.id),i(o.form).find(".np_title").val(o.postData.title),i(o.form).find(".np_author select").val(o.postData.author),i(o.form).find(".np_status").val(o.postData.status),i(o.form).find(".np_content").val(o.postData.url),i(o.form).find(".np_parent_id").val(o.postData.parentid),i(o.form).find(".np_title_attribute").val(o.postData.navtitleattr),i(o.form).find(".np_nav_css_classes").val(o.postData.navcss),"hide"===o.postData.npstatus?i(o.form).find(".np_status").prop("checked","checked"):i(o.form).find(".np_status").removeAttr("checked"),"hide"===o.postData.navstatus?i(o.form).find(".np_nav_status").prop("checked","checked"):i(o.form).find(".np_nav_status").removeAttr("checked"),"_blank"===o.postData.linktarget?i(o.form).find(".link_target").prop("checked","checked"):i(o.form).find(".link_target").removeAttr("checked"),"custom"!==o.postData.navobject&&""!==o.postData.navobject){var e='<div class="form-control original-link">Original: <a href="'+o.postData.navoriginallink+'" target="_blank">'+o.postData.navoriginaltitle+"</a></div>";i(o.form).find("[data-url-field]").remove(),i(e).insertAfter(i(o.form).find("h3")),i(o.form).find("[data-np-menu-object-input]").val(o.postData.navobject),i(o.form).find("[data-np-menu-objectid-input]").val(o.postData.navobjectid),i(o.form).find("[data-np-menu-type-input]").val(o.postData.navtype),i(o.form).find("h3").text("Link: "+o.postData.navoriginaltitle)}else i(o.form).find("h3").text("Link"),i(o.form).find("[data-np-menu-object-input]").val("custom"),i(o.form).find("[data-np-menu-type-input]").val("custom");o.formatter.showQuickEdit(),i(o.form).show()},o.submitForm=function(){o.toggleLoading(!0),i.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:i(o.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(e){"error"===e.status?(o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show()):(o.toggleLoading(!1),o.newPostData=e.post_data,o.updateRow())},error:function(e){o.toggleLoading(!1),i(o.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},o.updateRow=function(){var e=i(o.form).siblings(".row");i(e).find(".title").html(o.newPostData.post_title+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>');var t=i(e).find(".status");"publish"!==o.newPostData._status&&"future"!==o.newPostData._status?i(t).text("("+o.newPostData._status+")"):i(t).text("");var a=i(e).find(".nav-status");"hide"==o.newPostData.nav_status?i(a).text("("+NestedPages.jsData.hiddenText+")"):i(a).text("");var s=i(e).parent("li");"hide"==o.newPostData.np_status?(i(s).addClass("np-hide"),i(e).find(".status").after('<svg class="row-status-icon status-np-hidden" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path class="icon" d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>')):(i(s).removeClass("np-hide"),i(e).find(".status-np-hidden").remove());var n=i(e).find(NestedPages.selectors.quickEditButtonLink);i(n).attr("data-id",o.newPostData.post_id),i(n).attr("data-title",o.newPostData.post_title),i(n).attr("data-url",o.newPostData.post_content),i(n).attr("data-status",o.newPostData._status),i(n).attr("data-navstatus",o.newPostData.nav_status),i(n).attr("data-np-status",o.newPostData.np_status),i(n).attr("data-linkTarget",o.newPostData.linkTarget),i(n).attr("data-navtitleattr",o.newPostData.titleAttribute),i(n).attr("data-navcss",o.newPostData.cssClasses),o.formatter.removeQuickEdit(),o.formatter.flashRow(e)},o.toggleLoading=function(e){if(i(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return i(NestedPages.selectors.quickEditErrorDiv).hide(),i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void i(NestedPages.selectors.quickEditLoadingIndicator).show();i(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),i(NestedPages.selectors.quickEditLoadingIndicator).hide()},o.bindEvents()},(NestedPages=NestedPages||{}).Clone=function(){var t=this,a=jQuery;return t.parent_id="",t.parent_title="",t.parentLi=null,t.formatter=new NestedPages.Formatter,t.bindEvents=function(){a(document).on("click",NestedPages.selectors.cloneButton,function(e){e.preventDefault(),t.parent_id=a(this).attr("data-id"),t.parent_title=a(this).attr("data-parentname"),t.parentLi=a(this).parent(".row").parent(".page-row").parent(".npList"),t.openModal()}),a(document).on("click",NestedPages.selectors.confirmClone,function(e){e.preventDefault(),t.clone()})},t.openModal=function(){a("#"+NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(t.parent_title),a(document).trigger("open-modal-manual",NestedPages.selectors.cloneModal)},t.clone=function(){t.toggleLoading(!0),a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:t.parent_id,quantity:a(NestedPages.selectors.cloneQuantity).val(),status:a(NestedPages.selectors.cloneStatus).val(),author:a(NestedPages.selectors.cloneAuthor).find("select").val(),nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(e){t.toggleLoading(!1),a(document).trigger("close-modal-manual"),location.reload()}})},t.toggleLoading=function(e){if(e)return a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void a(NestedPages.selectors.confirmClone).attr("disabled","disabled");a("#"+NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),a(NestedPages.selectors.confirmClone).attr("disabled",!1)},t.bindEvents()},(NestedPages=NestedPages||{}).Tabs=function(){var r=this,d=jQuery;return r.selectors={tabToggle:"data-np-tab-toggle",tabPane:"data-np-tab-pane",tabGroup:"data-np-tab-group"},r.bindEvents=function(){d(document).on("click","["+r.selectors.tabToggle+"]",function(e){e.preventDefault(),r.toggleTabs(d(this))})},r.toggleTabs=function(e){for(var t=d(e).attr(r.selectors.tabGroup),a=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabPane+"]"),s=d(e).attr(r.selectors.tabToggle),n=d("*["+r.selectors.tabGroup+"="+t+"]["+r.selectors.tabToggle+"]"),o=[],i=0;i<n.length;i++)o[i]=d(n[i]).parent("li")[0];d(a).hide(),d(n).removeClass("active"),d(o).removeClass("active"),d.each(a,function(){d(this).attr(r.selectors.tabPane)==s&&d(this).show()}),d.each(n,function(){d(this).attr(r.selectors.tabToggle)==s&&(d(this).addClass("active"),d(this).parent("li").addClass("active"))}),d(document).trigger("tabs-changed",[s,t,e])},r.bindEvents()},jQuery(document).ready(function(){new NestedPages.Factory}),(NestedPages=NestedPages||{}).selectors={childToggle:".child-toggle",childToggleLink:".child-toggle a",toggleAll:".nestedpages-toggleall",toggleHidden:".np-toggle-hidden",toggleStatus:".np-toggle-publish",lists:".nplist",rows:".page-row",row:".row",sortable:".sortable",notSortable:".no-sort",handle:".handle",published:".published",hiddenRows:".np-hide",errorDiv:"#np-error",loadingIndicator:"#nested-loading",syncCheckbox:".np-sync-menu",syncForm:".np-sync-menu-cont",ajaxError:"[data-nestedpages-error]",trashWithChildrenButton:"[data-nestedpages-trash-children]",toggleEditButtons:".np-toggle-edit",bulkActionsHeader:".nestedpages-list-header",bulkActionsForm:"[data-np-bulk-form]",bulkActionsCheckbox:"[data-np-bulk-checkbox]",bulkActionsIds:"[data-np-bulk-ids]",bulkActionRedirectIds:"[data-np-bulk-redirect-ids]",hiddenItemCount:"[data-np-hidden-count]",hiddenItemCountParent:"[data-np-hidden-count-parent]",bulkEditForm:"[data-np-bulk-edit-form]",bulkEditTitles:"[data-np-bulk-titles]",bulkEditRemoveItem:"[data-np-remove-bulk-item]",bulkEditCancel:"[data-np-cancel-bulk-edit]",bulkEditLinkCount:"[data-bulk-edit-link-count]",quickEditOverlay:".np-inline-overlay",quickEditLoadingIndicator:".np-qe-loading",quickEditErrorDiv:".np-quickedit-error",quickEditCancel:".np-cancel-quickedit",quickEditButtonLink:".np-quick-edit-redirect",quickEditLinkForm:".quick-edit-form-redirect",quickEditLinkSaveButton:".np-save-quickedit-redirect",quickEditOpen:".np-quick-edit",quickEditPostForm:".quick-edit-form",quickEditSaveButton:".np-save-quickedit",openLinkModal:".open-redirect-modal",linkModal:"np-link-modal",saveLink:".np-save-link",linkLoadingIndicator:".np-link-loading",linkErrorDiv:".np-new-link-error",linkForm:".np-new-link-form",linkDeleteButton:"[data-np-confirm-delete]",linkDeleteConfirmationButton:"[data-delete-confirmation]",linkDeleteConfirmationModal:"np-delete-confirmation-modal",linkDeleteConfirmationModalText:"[data-np-link-delete-text]",openPageModal:".open-bulk-modal",newPageModal:"#np-bulk-modal",newPageFormContainer:".new-child-form",newPageForm:".np-new-child-form",newPageSubmitButton:".np-save-newchild",newPageTitle:".add-new-child-row",newPageRemoveTitle:".np-remove-child",addChildButton:".add-new-child",newChildError:".np-newchild-error",cancelNewChildButton:".np-cancel-newchild",newBeforeButton:"data-insert-before",newAfterButton:"data-insert-after",cloneButton:".clone-post",confirmClone:"[data-confirm-clone]",cloneModal:"np-clone-modal",cloneQuantity:"[data-clone-quantity]",cloneStatus:"[data-clone-status]",cloneAuthor:"[data-clone-author]",tabButtonParent:"[data-np-tabs]",tabButton:"[data-np-tab]",tabContent:"[data-np-tab-pane]",thumbnailContainer:".np-thumbnail",thumbnailContainerLink:".np-thumbnail.link",manualMenuSync:"[data-np-manual-menu-sync]",manualOrderSync:"[data-np-manual-order-sync]"},NestedPages.cssClasses={noborder:"no-border"},NestedPages.jsData={ajaxurl:ajaxurl,nonce:nestedpages.np_nonce,allPostTypes:nestedpages.post_types,syncmenu:"nosync",posttype:"",nestable:!0,sortable:!0,hierarchical:!0,expandText:nestedpages.expand_text,collapseText:nestedpages.collapse_text,showHiddenText:nestedpages.show_hidden,hideHiddenText:nestedpages.hide_hidden,quickEditText:nestedpages.quick_edit,hiddenText:nestedpages.hidden,titleText:nestedpages.title},NestedPages.formActions={syncToggles:"npnestToggle",syncNesting:"npsort",syncMenu:"npsyncMenu",newPage:"npnewChild",newBeforeAfter:"npnewBeforeAfter",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations",resetSettings:"npresetSettings",resetUserPrefs:"npresetUserPreferences",resetAdminMenuSettings:"npresetAdminMenuSettings",trashWithChildren:"nptrashWithChildren"},NestedPages.Factory=function(){var t=this,e=jQuery;return t.formatter=new NestedPages.Formatter,t.dropdowns=new NestedPages.Dropdowns,t.modals=new NestedPages.Modals,t.checkAll=new NestedPages.CheckAll,t.bulkActions=new NestedPages.BulkActions,t.menuToggle=new NestedPages.MenuToggle,t.pageToggle=new NestedPages.PageToggle,t.nesting=new NestedPages.Nesting,t.syncMenuSetting=new NestedPages.SyncMenuSetting,t.newPage=new NestedPages.NewPost,t.quickEditLink=new NestedPages.QuickEditLink,t.quickEditPost=new NestedPages.QuickEditPost,t.clone=new NestedPages.Clone,t.tabs=new NestedPages.Tabs,t.menuLinks=new NestedPages.MenuLinks,t.hiddenItemCount=new NestedPages.HiddenItemCount,t.confirmDelete=new NestedPages.ConfirmDelete,t.manualSync=new NestedPages.ManualSync,t.postSearch=new NestedPages.PostSearch,t.postMove=new NestedPages.MovePost,t.wpml=new NestedPages.Wpml,t.trashWithChildren=new NestedPages.TrashWithChildren,t.init=function(){nestedpages.settings_page||(t.bindEvents(),t.setPostType(),t.setMenuSync(),t.setNestable(),t.setSortable(),t.formatter.updateSubMenuToggle(),t.formatter.setBorders(),t.formatter.setNestedMargins(),t.nesting.initializeSortable())},t.bindEvents=function(){e(document).on("click",NestedPages.selectors.quickEditOverlay,function(e){t.formatter.removeQuickEdit(),t.newPage.cancelNewPage()}),e(document).ready(function(){t.formatter.hideAjaxError(),t.formatter.sizeLinkThumbnails()})},t.setNestable=function(){var a=!1;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&(!0===t.hierarchical&&(a=!0),!0===t.disable_nesting&&(a=!1))}),NestedPages.jsData.nestable=a},t.setSortable=function(){var a=!0;e.each(NestedPages.jsData.allPostTypes,function(e,t){t.name===NestedPages.jsData.posttype&&void 0!==t.disable_sorting&&""!==t.disable_sorting&&"true"===t.disable_sorting&&(a=!1)}),NestedPages.jsData.sortable=a},t.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=e(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},t.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},t.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var a=this,s=jQuery;return a.typeButton="",a.post="",a.formatter=new NestedPages.Formatter,a.selectors={form:"[data-np-menu-item-form]",typeSelect:"[data-np-menu-selection]",accordion:"[data-np-menu-accordion]",accordionItem:"[data-np-menu-accordion-item]",formPlaceholder:".np-menu-link-object-placeholder",formDetails:".np-menu-link-details",searchResults:"[data-np-search-result]",defaultResults:"[data-default-result]",originalLink:"[data-np-original-link]",saveButton:"[data-np-save-link]",urlInputCont:"[data-np-menu-url-cont]",errorDiv:"[data-np-error]"},a.fields={object:"[data-np-menu-object-input]",objectid:"[data-np-menu-objectid-input]",itemType:"[data-np-menu-type-input]",url:"[data-np-menu-url]",navigationLabel:"[data-np-menu-navigation-label]",titleAttribute:"[data-np-menu-title-attr]",cssClasses:"[data-np-menu-css-classes]",npStatus:"[data-np-menu-np-status]",linkTarget:"[data-np-menu-link-target]",menuTitle:"[data-np-menu-title]",parentPostType:"[data-np-menu-parent-post-type]"},a.search=new NestedPages.MenuSearch,a.bindEvents=function(){s(document).on("click",NestedPages.selectors.openLinkModal,function(e){e.preventDefault(),a.postParent=s(this).attr("data-parentid"),s(a.selectors.form).find(".parent_id").val(s(this).attr("data-parentid")),a.openModal()}),s(document).on("click",a.selectors.accordionItem,function(e){e.preventDefault(),a.accordion(s(this))}),s(document).on("click",a.selectors.typeSelect,function(e){e.preventDefault(),a.typeButton=s(this),a.setLinkType()}),s(document).on("keyup",a.fields.navigationLabel,function(){a.updateTitle()}),s(document).on("click",a.selectors.saveButton,function(e){e.preventDefault(),a.submitForm()}),s(document).on("keydown",function(e){27===e.keyCode&&s(document).trigger("close-modal-manual")})},a.openModal=function(){s(NestedPages.selectors.linkErrorDiv).hide(),s(NestedPages.selectors.linkModal).find("input").val(""),s(NestedPages.selectors.linkModal).find(".parent_id").val(a.postParent),a.clearForm(),s(a.selectors.accordion).find("ul").hide(),s(a.selectors.typeSelect).removeClass("active"),s(document).trigger("open-modal-manual",NestedPages.selectors.linkModal)},a.accordion=function(e){a.clearForm();var t=s(e).siblings("ul");if(s(t).is(":visible"))return s(e).removeClass("active"),void s(t).slideUp("fast");s(a.selectors.accordionItem).removeClass("active"),s(e).addClass("active"),s(e).parents(a.selectors.accordion).find("ul").slideUp("fast"),s(t).slideDown("fast")},a.setLinkType=function(){s(a.typeButton).hasClass("active")?a.clearForm():(s(a.typeButton).hasClass("np-custom-link")&&(s(a.selectors.accordionItem).removeClass("active"),s(a.selectors.accordion).find("ul").slideUp("fast")),s(a.selectors.formPlaceholder).hide(),a.populateForm())},a.populateForm=function(){s(a.selectors.saveButton).show(),s(a.selectors.typeSelect).removeClass("active"),s(a.typeButton).addClass("active"),s(a.fields.menuTitle).text(s(a.typeButton).text()).val(s(a.typeButton).text()),s(a.selectors.form).find("h3").find("em").text(s(a.typeButton).attr("data-np-object-name")),""!==s(a.typeButton).attr("data-np-permalink")?(s(a.selectors.form).find(a.selectors.urlInputCont).hide(),s(a.selectors.form).find(a.selectors.originalLink).html('<a href="'+s(a.typeButton).attr("data-np-permalink")+'">'+s(a.typeButton).text()+"</a>"),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").show()):(s(a.selectors.form).find(a.selectors.urlInputCont).show(),s(a.selectors.form).find(a.selectors.originalLink).parent(".original-link").hide()),s(a.fields.object).val(s(a.typeButton).attr("data-np-menu-object")),s(a.fields.objectid).val(s(a.typeButton).attr("data-np-menu-objectid")),s(a.fields.itemType).val(s(a.typeButton).attr("data-np-menu-type")),s(a.selectors.formDetails).show()},a.clearForm=function(){s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.saveButton).hide(),s(a.selectors.formDetails).hide(),s(a.selectors.formPlaceholder).show(),s(a.selectors.form).find("input").not(".parent_id").not(".parent-post-type").val(""),s(a.selectors.form).find(a.fields.linkTarget).val("_blank"),s(a.selectors.form).find('input[type="checkbox"]').attr("checked",!1),s(a.selectors.typeSelect).removeClass("active"),a.search.toggleLoading(!1),s(a.selectors.searchResults).remove(),s(a.selectors.defaultResults).show()},a.updateTitle=function(){var e=s(a.fields.navigationLabel).val(),t=s(a.selectors.form).find("h3").find("span");""!==e?(s(a.fields.menuTitle).val(e),s(t).text(e)):(s(a.fields.menuTitle).val(s(a.typeButton).text()),s(t).text(s(a.typeButton).text()))},a.submitForm=function(){a.toggleLoading(!0),s.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:s(a.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(e){a.toggleLoading(!1),"error"!==e.status?(a.post=e.post_data,a.createRow()):s(a.selectors.form).find(a.selectors.errorDiv).text(e.message).show()},error:function(e){console.log(e)}})},a.createRow=function(){var e='<li id="menuItem_'+a.post.id+'" class="page-row published';e+='">',e+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner">',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="np-icon-sub-menu"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" class="arrow" /></svg>',e+='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="handle np-icon-menu"><path d="M0 0h24v24H0z" fill="none" /><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" class="bars" /></svg>',e+='<a href="'+a.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+a.post.menuTitle+' <svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path class="icon" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></span>',e+='</a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',e+='data-id="'+a.post.id+'"',e+='data-parentid="'+a.post.parent_id+'"',e+='data-title="'+a.post.menuTitle+'" ',e+='data-url="'+a.post.url+'" ',e+='data-status="publish" ',e+='data-np-status="show" ',e+='data-navstatus="show" ',e+='data-navcss="'+a.post.cssClasses+'" ',e+='data-navtitleattr="'+a.post.titleAttribute+'" ',e+='data-nav-type="'+a.post.menuType+'" ',e+='data-nav-object="'+a.post.objectType+'" ',e+='data-nav-object-id="'+a.post.objectId+'" ',e+='data-nav-original-link="'+a.post.original_link+'" ',e+='data-nav-original-title="'+a.post.original_title+'" ',e+='data-linktarget="'+a.post.link_target+'">',e+=NestedPages.jsData.quickEditText,e+="</a>",e+='<a href="'+a.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',e+="</div></div></div></li>","0"===a.post.parent_id?s(".nplist:first li:first").after(e):a.appendChildRow(e),s(document).trigger("close-modal-manual"),a.row=s("#menuItem_"+a.post.id).find(".row"),a.formatter.flashRow(a.row)},a.appendChildRow=function(e){var t=s("#menuItem_"+a.post.parent_id);0===s(t).children("ol").length?(e='<ol class="sortable nplist" style="display:block;">'+e+"</ol>",s(t).append(e)):s(t).find("ol:first").prepend(e),a.formatter.updateSubMenuToggle()},a.toggleLoading=function(e){if(e)return s(a.selectors.form).find(a.selectors.errorDiv).hide(),s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void s(a.selectors.saveButton).attr("disabled","disabled");s(a.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),s(a.selectors.saveButton).attr("disabled",!1)},a.bindEvents()},(NestedPages=NestedPages||{}).MenuSearch=function(){var s=this,n=jQuery;return s.selectors={searchForms:"*[data-np-menu-search]",defaultResults:"[data-default-result]",loadingIndicator:".np-menu-search-loading",noResults:".np-menu-search-noresults",searchType:"data-search-type",searchObject:"data-search-object",searchResults:"[data-np-search-result]"},s.activeForm="",s.results="",s.defaultResults="",s.searchType="",s.searchObject="",s.init=function(){s.bindEvents()},s.bindEvents=function(){n(document).on("keyup",s.selectors.searchForms,function(){s.activeForm=n(this),n(s.selectors.searchResults).remove(),s.performSearch()})},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){s.searchType=n(s.activeForm).attr(s.selectors.searchType),s.searchObject=n(s.activeForm).attr(s.selectors.searchObject),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:n(s.activeForm).val(),searchType:s.searchType,searchObject:s.searchObject},success:function(e){console.log(e),e.results?(s.results=e.results,s.toggleLoading(!1),"post_type"===s.searchType?s.appendPosts():s.appendTaxonomies()):(s.toggleLoading(!1),n(s.activeForm).siblings(s.selectors.noResults).show())}})},s.appendPosts=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.ID+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.singular_name+'" data-np-menu-selection>'+t.post_title+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.appendTaxonomies=function(){var a="";n.each(s.results,function(e,t){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+s.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+t.term_id+'" data-np-permalink="'+t.permalink+'" data-np-object-name="'+t.taxonomy+'" data-np-menu-selection>'+t.name+"</a></li>"}),n(a).insertAfter(n(s.activeForm).parent("li")),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).siblings(s.selectors.loadingIndicator);n(s.selectors.noResults).hide(),e?n(t).show():n(t).hide()},s.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPages,NestedPagesTrash=function(){var t=this,a=jQuery;return t.trashButton=".np-empty-trash",t.confirmButton=".np-trash-confirm",t.warningModal="#np-trash-modal",t.errorAlert="#np-error",t.loadingIndicator="#nested-loading",t.trashLinks=".np-trash-links",t.postType=a("#np-trash-posttype").val(),t.nonce=nestedpages.np_nonce,t.formAction="npEmptyTrash",t.bindEvents=function(){a(document).on("click",t.confirmButton,function(e){e.preventDefault(),t.confirmEmpty()})},t.confirmEmpty=function(){t.loading(!0),a(document).trigger("close-modal-manual"),a(t.errorAlert).hide(),t.emptyTrash()},t.emptyTrash=function(){a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:t.formAction,nonce:t.nonce,posttype:t.postType},success:function(e){t.loading(!1),"error"===e.status?a(t.errorAlert).text(e.message).show():(a(t.trashLinks).hide(),a(".notice-dismiss").click())}})},t.loading=function(e){e?a(t.loadingIndicator).show():a(t.loadingIndicator).hide()},t.bindEvents()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var t=this,a=jQuery;return t.deleteLink="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.linkDeleteButton,function(e){e.preventDefault(),t.confirmSingle(a(this))}),a(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(e){e.preventDefault(),a(this).hasClass("bulk")?t.deleteMultiple():t.deleteSingle()}),a(document).on("submit",NestedPages.selectors.bulkActionsForm,function(e){t.confirmMultiple(e)})},t.confirmSingle=function(e){t.deleteLink=a(e).attr("href"),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),a(document).trigger("open-modal-manual",NestedPages.selectors.linkDeleteConfirmationModal)},t.confirmMultiple=function(e){"trash"===a('select[name="np_bulk_action"]').val()&&""!==a(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),a(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),a(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),a(document).trigger("open-modal-manual",[NestedPages.selectors.linkDeleteConfirmationModal]))},t.deleteMultiple=function(){a(NestedPages.selectors.bulkActionsForm)[0].submit()},t.deleteSingle=function(){window.location.replace(t.deleteLink)},t.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var t=this,a=jQuery;return t.activeBtn="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.manualMenuSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncMenu()}),a(document).on("click",NestedPages.selectors.manualOrderSync,function(e){e.preventDefault(),t.activeBtn=a(this),t.syncOrder()})},t.syncMenu=function(){t.loading(!0),a.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.manualMenuSync,nonce:NestedPages.jsData.nonce,post_type:NestedPages.jsData.posttype,syncmenu:"sync"},success:function(e){"error"===e.status?(a(NestedPages.selectors.errorDiv).text(e.message).show(),a(NestedPages.selectors.loadingIndicator).hide()):t.loading(!1)}})},t.syncOrder=function(){t.loading(!0),(new NestedPages.Nesting).syncNesting(!0,t.loading(!1))},t.loading=function(e){if(e)return a(t.activeBtn).addClass("disabled"),void a(NestedPages.selectors.loadingIndicator).show();a(t.activeBtn).removeClass("disabled"),a(NestedPages.selectors.loadingIndicator).hide()},t.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var s=this,n=jQuery;return s.selectors={input:"data-nestedpages-post-search",form:"data-nestedpages-post-search-form",loadingIndicator:"data-nestedpages-loading",noResults:"data-nestedpages-no-results",results:"data-nestedpages-search-results"},s.changed=!1,s.activeInput="",s.results="",s.defaultResults="",s.postType="",s.activeForm="",s.bindEvents=function(){n("["+s.selectors.input+"]").on("input",function(){if(s.activeInput=n(this),s.setOptions(),s.changed||s.setDefaultResults(),""===n(this).val())return n(s.activeForm).find("["+s.selectors.noResults+"]").hide(),void s.showDefaultResults();s.query()})},s.setDefaultResults=function(){s.defaultResults=n(s.activeForm).find("["+s.selectors.results+"]").html(),s.changed=!0},s.showDefaultResults=function(){n(s.activeForm).find("["+s.selectors.results+"]").html(s.defaultResults)},s.setOptions=function(){s.postType=n(s.activeInput).attr(s.selectors.input),s.activeForm=n(s.activeInput).parents("["+s.selectors.form+"]")},s.performSearch=function(){if(s.defaultResults=n(s.activeForm).parent("li").siblings(s.selectors.defaultResults),2<n(s.activeForm).val().length)return n(s.defaultResults).hide(),s.toggleLoading(!0),void s.query();s.toggleLoading(!1),n(s.defaultResults).show()},s.query=function(){n(s.activeForm).find("["+s.selectors.results+"]").empty(),s.toggleLoading(!0),n.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:n(s.activeInput).val(),postType:s.postType},success:function(e){e.results?(s.results=e.results,s.loadResults(),s.toggleLoading(!1)):(s.toggleLoading(!1),n(s.activeForm).find("["+s.selectors.noResults+"]").show())}})},s.loadResults=function(){var a="<ul>";n.each(s.results,function(e,t){a+='<li><a href="#" data-assignment-page-id="'+t.ID+'" data-assignment-page-title="'+t.post_title+'">'+t.post_title+"</a></li>"}),a+="</ul>",n(s.activeForm).find("["+s.selectors.results+"]").html(a),s.toggleLoading(!1)},s.toggleLoading=function(e){var t=n(s.activeForm).find("["+s.selectors.loadingIndicator+"]"),a=n(s.activeForm).find("["+s.selectors.noResults+"]");n(a).hide(),e?n(t).show():n(t).hide()},s.bindEvents()},(NestedPages=NestedPages||{}).MovePost=function(){var a=this,s=jQuery;return a.formatter=new NestedPages.Formatter,a.nesting=new NestedPages.Nesting,a.activeRow,a.selectors={moveToTop:"data-push-to-top",moveToBottom:"data-push-to-bottom"},a.bindEvents=function(){s(document).ready(function(){a.disableTopOnFirst(),a.disableBottomOnLast()}),s(document).on("click","["+a.selectors.moveToTop+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToTop())}),s(document).on("click","["+a.selectors.moveToBottom+"]",function(e){e.preventDefault(),s(this).hasClass("disabled")||(a.activeRow=s(this).closest(NestedPages.selectors.rows),a.moveToBottom())})},a.moveToTop=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).find(NestedPages.selectors.rows).first();s(a.activeRow).insertBefore(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.moveToBottom=function(){var e=s(a.activeRow).parent(NestedPages.selectors.lists),t=s(e).children(NestedPages.selectors.rows).last();s(a.activeRow).insertAfter(t),a.formatter.setBorders(),s(document).click(),a.nesting.syncNesting(),a.disableTopOnFirst(),a.disableBottomOnLast()},a.disableTopOnFirst=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToTop+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).first();s(e).find("["+a.selectors.moveToTop+"]").addClass("disabled")})},a.disableBottomOnLast=function(){var e=s(NestedPages.selectors.lists);s.each(e,function(){s(this).find("["+a.selectors.moveToBottom+"]").removeClass("disabled");var e=s(this).find(NestedPages.selectors.rows).last();s(e).find("["+a.selectors.moveToBottom+"]").addClass("disabled")})},a.bindEvents()},(NestedPages=NestedPages||{}).TrashWithChildren=function(){var t=this,a=jQuery;return t.post_id="",t.bindEvents=function(){a(document).on("click",NestedPages.selectors.trashWithChildrenButton,function(e){e.preventDefault(),t.post_id=a(this).attr("data-post-id"),t.trash()})},t.trash=function(){a.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.trashWithChildren,nonce:NestedPages.jsData.nonce,post_id:t.post_id,screen:nestedpages.current_page},success:function(e){window.location.replace(e.redirect)},error:function(e){console.log(e)}})},t.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var a=this,o=jQuery;return a.button=null,a.postData=null,a.modal=null,a.parent_li=null,a.formatter=new NestedPages.Formatter,a.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},a.bindEvents=function(){nestedpages.wpml&&o(document).on("click","["+a.selectors.translationsBtn+"]",function(e){e.preventDefault(),a.createTranslationsModal(o(this))})},a.createTranslationsModal=function(e){if(a.parent_li=o(e).parents(".action-buttons").closest(NestedPages.selectors.row).parent("li"),a.button=o(a.parent_li).find(NestedPages.selectors.quickEditOpen),a.postData={id:o(a.button).attr("data-id"),title:o(a.button).attr("data-title"),slug:o(a.button).attr("data-slug")},a.modal=o("["+a.selectors.modal+"]").clone(),0<o(a.parent_li).children("ol").length){var t=o(a.parent_li).children("ol");o(a.modal).insertBefore(t)}else o(a.modal).appendTo(a.parent_li);o(a.modal).find("["+a.selectors.title+"]").text(a.postData.title),a.formatter.showQuickEdit(),o(a.modal).show(),a.getTranslationData()},a.getTranslationData=function(){o.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:a.postData.id,nonce:NestedPages.jsData.nonce},success:function(e){console.log(e),console.log(a.postData.id),"success"===e.status?a.populateModal(e.translations):(o(a.modal).find(NestedPages.selectors.quickEditErrorDiv).text(e.message).show(),a.toggleLoading(!1))}})},a.populateModal=function(s){var n="<tbody>";o.each(s,function(e,t){var a=s[e];n+="<tr>",n+='<td><img src="'+a.country_flag_url+'" alt="'+a.translated_name+'" /> '+a.translated_name+"</td>",n+="<td>",a.has_translation&&a.edit_link?n+='<a href="'+a.edit_link+'">'+a.translation.post_title+" ("+nestedpages.edit+")</a>":n+='<a href="'+a.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",n+="</td>",n+="</tr>"}),n+="</tbody>",o(a.modal).find("["+a.selectors.table+"]").html(n),a.toggleLoading(!1)},a.toggleLoading=function(e){e?o(a.modal).addClass("loading"):o(a.modal).removeClass("loading")},a.bindEvents()};
|
nestedpages.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Nested Pages
|
4 |
Plugin URI: http://nestedpages.com
|
5 |
Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
|
6 |
-
Version: 3.1.
|
7 |
Author: Kyle Phillips
|
8 |
Author URI: https://github.com/kylephillips
|
9 |
Text Domain: wp-nested-pages
|
3 |
Plugin Name: Nested Pages
|
4 |
Plugin URI: http://nestedpages.com
|
5 |
Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
|
6 |
+
Version: 3.1.12
|
7 |
Author: Kyle Phillips
|
8 |
Author URI: https://github.com/kylephillips
|
9 |
Text Domain: wp-nested-pages
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: kylephillips
|
|
3 |
Donate link: https://github.com/sponsors/kylephillips/
|
4 |
Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 3.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -105,6 +105,11 @@ No. The menu synchronization currently only works within the pages post type.
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
= 3.1.11 =
|
109 |
* Security Update.
|
110 |
|
3 |
Donate link: https://github.com/sponsors/kylephillips/
|
4 |
Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 5.5
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 3.1.11
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 3.1.12 =
|
109 |
+
* Includes security updates
|
110 |
+
* Fixes bug where posts not appearing when filtering by a non top-level hierarchical taxonomy. Allows order sorting while the list is filtered (not parent order)
|
111 |
+
* Adds ability to save and synchronize post type archive menu items when using menu sync
|
112 |
+
|
113 |
= 3.1.11 =
|
114 |
* Security Update.
|
115 |
|