Version Description
- WPML compatibility added (Limited support, see the "More Information" section for important notes on support).
- Important upgrade note: Custom links within the Nested Pages interface are disabled if WPML is installed and enabled. This is a potential breaking change, so please remove all custom links before updating. Links may be added back to menus by using the default WordPress Appearance > Menus editor.
- Sort/Order options on non-page post type listings may now be added/removed. All options are hidden by default. To enable these, visit Settings > Nested Pages > Post Types. Under the desired post type, options may be enabled under the "Sort Options" row.
- Bug fix where pages hidden from the Nested Pages view where displaying.
- "Sticky" checkbox added to quick edit form under non-hierarchical post types.
- Adds query optimizations to the listing view, reducing the overall number of queries made.
Download this release
Release Info
Developer | kylephillips |
Plugin | Nested Pages |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.1 to 2.0.1
- app/Activation/Activate.php +0 -2
- app/Activation/Dependencies.php +5 -5
- app/Activation/Updates/Updates.php +0 -3
- app/Bootstrap.php +0 -3
- app/Config/Settings.php +1 -4
- app/Config/SettingsRepository.php +2 -4
- app/Entities/AdminMenu/AdminMenu.php +1 -4
- app/Entities/AdminMenu/AdminSubmenu.php +1 -5
- app/Entities/AdminMenu/AdminSubmenuDefault.php +1 -4
- app/Entities/AdminMenu/AdminSubmenuExpander.php +1 -4
- app/Entities/AdminMenu/EnabledMenus.php +1 -4
- app/Entities/Confirmation/ConfirmationFactory.php +1 -4
- app/Entities/Confirmation/ConfirmationInterface.php +1 -4
- app/Entities/Confirmation/LinkDeletedConfirmation.php +1 -3
- app/Entities/Confirmation/TrashConfirmation.php +1 -4
- app/Entities/Confirmation/TrashRestoredConfirmation.php +0 -3
- app/Entities/DefaultList/DefaultListFactory.php +1 -5
- app/Entities/DefaultList/NestedViewLink.php +1 -4
- app/Entities/Listing/Listing.php +107 -153
- app/Entities/Listing/ListingActions.php +1 -4
- app/Entities/Listing/ListingQuery.php +177 -0
- app/Entities/Listing/ListingRepository.php +68 -2
- app/Entities/NavMenu/NavMenuActions.php +10 -5
- app/Entities/NavMenu/NavMenuFrontEnd.php +0 -1
- app/Entities/NavMenu/NavMenuRemoveItem.php +1 -4
- app/Entities/NavMenu/NavMenuRepository.php +1 -4
- app/Entities/NavMenu/NavMenuSync.php +8 -3
- app/Entities/NavMenu/NavMenuSyncListing.php +4 -5
- app/Entities/NavMenu/NavMenuSyncMenu.php +2 -5
- app/Entities/NavMenu/NavMenuTrashActions.php +1 -4
- app/Entities/PluginIntegration/AdvancedCustomFields.php +0 -2
- app/Entities/PluginIntegration/EditorialAccessManager.php +0 -4
- app/Entities/PluginIntegration/IntegrationFactory.php +2 -3
- app/Entities/PluginIntegration/WPML.php +345 -0
- app/Entities/PluginIntegration/YoastSeo.php +0 -3
- app/Entities/Post/PostCloner.php +0 -1
- app/Entities/Post/PostDataFactory.php +24 -3
- app/Entities/Post/PostFactory.php +0 -3
- app/Entities/Post/PostRepository.php +32 -12
- app/Entities/Post/PostTrashActions.php +0 -4
- app/Entities/Post/PostUpdateRepository.php +19 -4
- app/Entities/PostType/PostTypeRepository.php +32 -3
- app/Entities/PostType/RegisterPostTypes.php +8 -2
- app/Entities/User/UserRepository.php +27 -5
- app/Form/Events.php +2 -4
- app/Form/Listeners/BaseHandler.php +8 -3
- app/Form/Listeners/BulkActions.php +0 -2
- app/Form/Listeners/BulkEdit.php +0 -1
- app/Form/Listeners/CategoryFilter.php +0 -2
- app/Form/Listeners/ClonePost.php +0 -1
- app/Form/Listeners/EmptyTrash.php +0 -3
- app/Form/Listeners/GetTaxonomies.php +1 -3
- app/Form/Listeners/ListingSort.php +35 -10
- app/Form/Listeners/ManualMenuSync.php +0 -2
- app/Form/Listeners/MenuSearch.php +0 -2
- app/Form/Listeners/NestToggle.php +0 -3
- app/Form/Listeners/NewChild.php +0 -3
- app/Form/Listeners/NewMenuItem.php +1 -3
- app/Form/Listeners/PostSearch.php +0 -2
- app/Form/Listeners/QuickEdit.php +4 -4
- app/Form/Listeners/QuickEditLink.php +1 -4
- app/Form/Listeners/Search.php +0 -4
- app/Form/Listeners/Sort.php +3 -3
- app/Form/Listeners/SyncMenu.php +0 -3
- app/Form/Listeners/WpmlTranslations.php +89 -0
- app/Form/Validation/Validation.php +0 -3
- app/Helpers.php +0 -3
- app/NestedPages.php +1 -1
- app/Redirects.php +1 -5
- app/RedirectsFrontEnd.php +1 -1
- app/Views/forms/new-child.php +3 -2
- app/Views/forms/quickedit-link.php +1 -1
- app/Views/forms/quickedit-post.php +14 -3
- app/Views/listing.php +31 -11
- app/Views/partials/row-link.php +3 -3
- app/Views/partials/row.php +25 -15
- app/Views/partials/tool-list.php +46 -5
- app/Views/partials/wpml-translations.php +16 -0
- app/Views/settings/settings-posttypes.php +45 -6
- assets/css/nestedpages.css +1 -1
- assets/js/lib/nestedpages-factory.js +3 -1
- assets/js/lib/nestedpages.new-page.js +1 -0
- assets/js/lib/nestedpages.page-toggle.js +0 -1
- assets/js/lib/nestedpages.quickedit-post.js +19 -3
- assets/js/lib/nestedpages.settings.js +5 -5
- assets/js/lib/nestedpages.wpml.js +124 -0
- assets/js/nestedpages.js +3258 -0
- assets/js/nestedpages.min.js +1 -2
- assets/js/nestedpages.settings.min.js +1 -1
- composer.json +1 -2
- nestedpages.php +2 -2
- readme.txt +23 -2
- vendor/autoload.php +1 -1
- vendor/composer/ClassLoader.php +43 -8
- vendor/composer/autoload_real.php +4 -4
app/Activation/Activate.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Activation;
|
4 |
|
5 |
use NestedPages\Activation\Updates\Updates;
|
@@ -64,5 +63,4 @@ class Activate
|
|
64 |
update_option('nestedpages_menusync', 'nosync');
|
65 |
}
|
66 |
}
|
67 |
-
|
68 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Activation;
|
3 |
|
4 |
use NestedPages\Activation\Updates\Updates;
|
63 |
update_option('nestedpages_menusync', 'nosync');
|
64 |
}
|
65 |
}
|
|
|
66 |
}
|
app/Activation/Dependencies.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Activation;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -12,7 +11,6 @@ use NestedPages\Helpers;
|
|
12 |
*/
|
13 |
class Dependencies
|
14 |
{
|
15 |
-
|
16 |
/**
|
17 |
* Plugin Directory
|
18 |
*/
|
@@ -109,7 +107,7 @@ class Dependencies
|
|
109 |
if ( $np_env == 'dev' ){
|
110 |
wp_enqueue_script(
|
111 |
'nestedpages',
|
112 |
-
$this->plugin_dir . '/assets/js/
|
113 |
array('jquery'),
|
114 |
$this->plugin_version
|
115 |
);
|
@@ -151,7 +149,10 @@ class Dependencies
|
|
151 |
'manual_order_sync' => $this->settings->autoPageOrderDisabled(),
|
152 |
'currently_assigned_to' => __('Currently assigned to:', 'wp-nested-pages'),
|
153 |
'remove' => __('Remove', 'wp-nested-pages'),
|
154 |
-
'settings_page' => $settings_page
|
|
|
|
|
|
|
155 |
);
|
156 |
$syncmenu = ( get_option('nestedpages_menusync') == 'sync' ) ? true : false;
|
157 |
$localized_data['syncmenu'] = $syncmenu;
|
@@ -183,5 +184,4 @@ class Dependencies
|
|
183 |
);
|
184 |
endif;
|
185 |
}
|
186 |
-
|
187 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Activation;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
11 |
*/
|
12 |
class Dependencies
|
13 |
{
|
|
|
14 |
/**
|
15 |
* Plugin Directory
|
16 |
*/
|
107 |
if ( $np_env == 'dev' ){
|
108 |
wp_enqueue_script(
|
109 |
'nestedpages',
|
110 |
+
$this->plugin_dir . '/assets/js/nestedpages.js',
|
111 |
array('jquery'),
|
112 |
$this->plugin_version
|
113 |
);
|
149 |
'manual_order_sync' => $this->settings->autoPageOrderDisabled(),
|
150 |
'currently_assigned_to' => __('Currently assigned to:', 'wp-nested-pages'),
|
151 |
'remove' => __('Remove', 'wp-nested-pages'),
|
152 |
+
'settings_page' => $settings_page,
|
153 |
+
'wpml' => ( $this->integrations->plugins->wpml->installed ) ? true : false,
|
154 |
+
'add_translation' => __('Add Translation', 'wp-nested-pages'),
|
155 |
+
'edit' => __('Edit', 'wp-nested-pages')
|
156 |
);
|
157 |
$syncmenu = ( get_option('nestedpages_menusync') == 'sync' ) ? true : false;
|
158 |
$localized_data['syncmenu'] = $syncmenu;
|
184 |
);
|
185 |
endif;
|
186 |
}
|
|
|
187 |
}
|
app/Activation/Updates/Updates.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Activation\Updates;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
@@ -11,7 +10,6 @@ use NestedPages\Activation\Updates\CustomFieldsToHidden;
|
|
11 |
*/
|
12 |
class Updates
|
13 |
{
|
14 |
-
|
15 |
/**
|
16 |
* New Version
|
17 |
*/
|
@@ -142,5 +140,4 @@ class Updates
|
|
142 |
new CustomFieldsToHidden;
|
143 |
}
|
144 |
}
|
145 |
-
|
146 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Activation\Updates;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
10 |
*/
|
11 |
class Updates
|
12 |
{
|
|
|
13 |
/**
|
14 |
* New Version
|
15 |
*/
|
140 |
new CustomFieldsToHidden;
|
141 |
}
|
142 |
}
|
|
|
143 |
}
|
app/Bootstrap.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages;
|
|
7 |
*/
|
8 |
class Bootstrap
|
9 |
{
|
10 |
-
|
11 |
public function __construct()
|
12 |
{
|
13 |
$this->initializePlugin();
|
@@ -69,5 +67,4 @@ class Bootstrap
|
|
69 |
array_unshift($links, $settings_link);
|
70 |
return $links;
|
71 |
}
|
72 |
-
|
73 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class Bootstrap
|
8 |
{
|
|
|
9 |
public function __construct()
|
10 |
{
|
11 |
$this->initializePlugin();
|
67 |
array_unshift($links, $settings_link);
|
68 |
return $links;
|
69 |
}
|
|
|
70 |
}
|
app/Config/Settings.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Config;
|
4 |
|
5 |
use NestedPages\Helpers;
|
@@ -15,7 +14,6 @@ use NestedPages\Entities\Post\PostRepository;
|
|
15 |
*/
|
16 |
class Settings
|
17 |
{
|
18 |
-
|
19 |
/**
|
20 |
* Nested Pages Menu
|
21 |
* @var object
|
@@ -149,5 +147,4 @@ class Settings
|
|
149 |
$tab = ( isset($_GET['tab']) ) ? $_GET['tab'] : 'general';
|
150 |
include( Helpers::view('settings/settings') );
|
151 |
}
|
152 |
-
|
153 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Config;
|
3 |
|
4 |
use NestedPages\Helpers;
|
14 |
*/
|
15 |
class Settings
|
16 |
{
|
|
|
17 |
/**
|
18 |
* Nested Pages Menu
|
19 |
* @var object
|
147 |
$tab = ( isset($_GET['tab']) ) ? $_GET['tab'] : 'general';
|
148 |
include( Helpers::view('settings/settings') );
|
149 |
}
|
|
|
150 |
}
|
app/Config/SettingsRepository.php
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Config;
|
|
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
5 |
|
6 |
class SettingsRepository
|
7 |
{
|
8 |
-
|
9 |
/**
|
10 |
* Is the Datepicker UI option enabled
|
11 |
* @return boolean
|
@@ -139,5 +138,4 @@ class SettingsRepository
|
|
139 |
if ( isset( $sizes[ $size ] ) ) return $sizes[ $size ];
|
140 |
return false;
|
141 |
}
|
142 |
-
|
143 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Config;
|
3 |
+
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
5 |
|
6 |
class SettingsRepository
|
7 |
{
|
|
|
8 |
/**
|
9 |
* Is the Datepicker UI option enabled
|
10 |
* @return boolean
|
138 |
if ( isset( $sizes[ $size ] ) ) return $sizes[ $size ];
|
139 |
return false;
|
140 |
}
|
|
|
141 |
}
|
app/Entities/AdminMenu/AdminMenu.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\AdminMenu;
|
4 |
|
5 |
use NestedPages\Entities\AdminMenu\EnabledMenus;
|
@@ -11,7 +10,6 @@ use NestedPages\Entities\AdminMenu\AdminSubmenuExpander;
|
|
11 |
*/
|
12 |
class AdminMenu
|
13 |
{
|
14 |
-
|
15 |
public function __construct()
|
16 |
{
|
17 |
add_action( 'admin_menu', array($this, 'setMenus') );
|
@@ -33,5 +31,4 @@ class AdminMenu
|
|
33 |
{
|
34 |
new AdminSubmenuExpander;
|
35 |
}
|
36 |
-
|
37 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\AdminMenu;
|
3 |
|
4 |
use NestedPages\Entities\AdminMenu\EnabledMenus;
|
10 |
*/
|
11 |
class AdminMenu
|
12 |
{
|
|
|
13 |
public function __construct()
|
14 |
{
|
15 |
add_action( 'admin_menu', array($this, 'setMenus') );
|
31 |
{
|
32 |
new AdminSubmenuExpander;
|
33 |
}
|
|
|
34 |
}
|
app/Entities/AdminMenu/AdminSubmenu.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\AdminMenu;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -9,7 +8,6 @@ use NestedPages\Entities\PostType\PostTypeRepository;
|
|
9 |
*/
|
10 |
class AdminSubmenu
|
11 |
{
|
12 |
-
|
13 |
/**
|
14 |
* Post Type
|
15 |
* @var string
|
@@ -27,7 +25,6 @@ class AdminSubmenu
|
|
27 |
*/
|
28 |
private $slug;
|
29 |
|
30 |
-
|
31 |
public function __construct($post_type)
|
32 |
{
|
33 |
$this->post_type = $post_type;
|
@@ -86,5 +83,4 @@ class AdminSubmenu
|
|
86 |
{
|
87 |
$this->slug = $this->post_type_repo->getMenuSlug($this->post_type);
|
88 |
}
|
89 |
-
|
90 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\AdminMenu;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
8 |
*/
|
9 |
class AdminSubmenu
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Post Type
|
13 |
* @var string
|
25 |
*/
|
26 |
private $slug;
|
27 |
|
|
|
28 |
public function __construct($post_type)
|
29 |
{
|
30 |
$this->post_type = $post_type;
|
83 |
{
|
84 |
$this->slug = $this->post_type_repo->getMenuSlug($this->post_type);
|
85 |
}
|
|
|
86 |
}
|
app/Entities/AdminMenu/AdminSubmenuDefault.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\AdminMenu;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -10,7 +9,6 @@ use NestedPages\Entities\Listing\Listing;
|
|
10 |
*/
|
11 |
class AdminSubmenuDefault
|
12 |
{
|
13 |
-
|
14 |
/**
|
15 |
* Post Type
|
16 |
* @var object
|
@@ -70,5 +68,4 @@ class AdminSubmenuDefault
|
|
70 |
{
|
71 |
return $this->hook;
|
72 |
}
|
73 |
-
|
74 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\AdminMenu;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
9 |
*/
|
10 |
class AdminSubmenuDefault
|
11 |
{
|
|
|
12 |
/**
|
13 |
* Post Type
|
14 |
* @var object
|
68 |
{
|
69 |
return $this->hook;
|
70 |
}
|
|
|
71 |
}
|
app/Entities/AdminMenu/AdminSubmenuExpander.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\AdminMenu;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -9,7 +8,6 @@ use NestedPages\Entities\PostType\PostTypeRepository;
|
|
9 |
*/
|
10 |
class AdminSubmenuExpander
|
11 |
{
|
12 |
-
|
13 |
/**
|
14 |
* Current Page Object
|
15 |
*/
|
@@ -94,5 +92,4 @@ class AdminSubmenuExpander
|
|
94 |
echo '<script>jQuery(document).ready(function(){jQuery("#toplevel_page_nestedpages").removeClass("wp-not-current-submenu").addClass("wp-has-current-submenu").addClass("wp-menu-open");jQuery("#toplevel_page_nestedpages a:first").addClass("wp-has-current-submenu");});</script>';
|
95 |
}
|
96 |
}
|
97 |
-
|
98 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\AdminMenu;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
8 |
*/
|
9 |
class AdminSubmenuExpander
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Current Page Object
|
13 |
*/
|
92 |
echo '<script>jQuery(document).ready(function(){jQuery("#toplevel_page_nestedpages").removeClass("wp-not-current-submenu").addClass("wp-has-current-submenu").addClass("wp-menu-open");jQuery("#toplevel_page_nestedpages a:first").addClass("wp-has-current-submenu");});</script>';
|
93 |
}
|
94 |
}
|
|
|
95 |
}
|
app/Entities/AdminMenu/EnabledMenus.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\AdminMenu;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -13,7 +12,6 @@ use NestedPages\Entities\User\UserRepository;
|
|
13 |
*/
|
14 |
class EnabledMenus
|
15 |
{
|
16 |
-
|
17 |
/**
|
18 |
* Post Type
|
19 |
*/
|
@@ -143,5 +141,4 @@ class EnabledMenus
|
|
143 |
{
|
144 |
return $this->post_type_repo->getMenuSlug($this->post_type);
|
145 |
}
|
146 |
-
|
147 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\AdminMenu;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
12 |
*/
|
13 |
class EnabledMenus
|
14 |
{
|
|
|
15 |
/**
|
16 |
* Post Type
|
17 |
*/
|
141 |
{
|
142 |
return $this->post_type_repo->getMenuSlug($this->post_type);
|
143 |
}
|
|
|
144 |
}
|
app/Entities/Confirmation/ConfirmationFactory.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Confirmation;
|
4 |
|
5 |
/**
|
@@ -8,7 +7,6 @@ namespace NestedPages\Entities\Confirmation;
|
|
8 |
*/
|
9 |
class ConfirmationFactory
|
10 |
{
|
11 |
-
|
12 |
/**
|
13 |
* Message Output
|
14 |
* @var string
|
@@ -54,5 +52,4 @@ class ConfirmationFactory
|
|
54 |
{
|
55 |
return $this->message;
|
56 |
}
|
57 |
-
|
58 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\Confirmation;
|
3 |
|
4 |
/**
|
7 |
*/
|
8 |
class ConfirmationFactory
|
9 |
{
|
|
|
10 |
/**
|
11 |
* Message Output
|
12 |
* @var string
|
52 |
{
|
53 |
return $this->message;
|
54 |
}
|
|
|
55 |
}
|
app/Entities/Confirmation/ConfirmationInterface.php
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Confirmation;
|
4 |
|
5 |
interface ConfirmationInterface
|
6 |
{
|
7 |
-
|
8 |
/**
|
9 |
* Display the Confirmation Message
|
10 |
*/
|
11 |
public function setMessage();
|
12 |
-
|
13 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\Confirmation;
|
3 |
|
4 |
interface ConfirmationInterface
|
5 |
{
|
|
|
6 |
/**
|
7 |
* Display the Confirmation Message
|
8 |
*/
|
9 |
public function setMessage();
|
|
|
10 |
}
|
app/Entities/Confirmation/LinkDeletedConfirmation.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Confirmation;
|
4 |
|
5 |
/**
|
@@ -12,5 +11,4 @@ class LinkDeletedConfirmation implements ConfirmationInterface
|
|
12 |
$out = __('Link successfully deleted.', 'wp-nested-pages');
|
13 |
return $out;
|
14 |
}
|
15 |
-
|
16 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\Confirmation;
|
3 |
|
4 |
/**
|
11 |
$out = __('Link successfully deleted.', 'wp-nested-pages');
|
12 |
return $out;
|
13 |
}
|
|
|
14 |
}
|
app/Entities/Confirmation/TrashConfirmation.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Confirmation;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages\Entities\Confirmation;
|
|
7 |
*/
|
8 |
class TrashConfirmation implements ConfirmationInterface
|
9 |
{
|
10 |
-
|
11 |
public function setMessage()
|
12 |
{
|
13 |
$out = '';
|
@@ -38,5 +36,4 @@ class TrashConfirmation implements ConfirmationInterface
|
|
38 |
|
39 |
return $out;
|
40 |
}
|
41 |
-
|
42 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Confirmation;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class TrashConfirmation implements ConfirmationInterface
|
8 |
{
|
|
|
9 |
public function setMessage()
|
10 |
{
|
11 |
$out = '';
|
36 |
|
37 |
return $out;
|
38 |
}
|
39 |
+
}
|
|
app/Entities/Confirmation/TrashRestoredConfirmation.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Confirmation;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages\Entities\Confirmation;
|
|
7 |
*/
|
8 |
class TrashRestoredConfirmation implements ConfirmationInterface
|
9 |
{
|
10 |
-
|
11 |
public function setMessage()
|
12 |
{
|
13 |
$untrashed = sanitize_text_field($_GET['untrashed']);
|
@@ -15,5 +13,4 @@ class TrashRestoredConfirmation implements ConfirmationInterface
|
|
15 |
$out = $untrashed . ' ' . $label . ' ' . __('restored from trash.', 'wp-nested-pages');
|
16 |
return $out;
|
17 |
}
|
18 |
-
|
19 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Confirmation;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class TrashRestoredConfirmation implements ConfirmationInterface
|
8 |
{
|
|
|
9 |
public function setMessage()
|
10 |
{
|
11 |
$untrashed = sanitize_text_field($_GET['untrashed']);
|
13 |
$out = $untrashed . ' ' . $label . ' ' . __('restored from trash.', 'wp-nested-pages');
|
14 |
return $out;
|
15 |
}
|
|
|
16 |
}
|
app/Entities/DefaultList/DefaultListFactory.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\DefaultList;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -10,7 +9,6 @@ use NestedPages\Entities\DefaultList\NestedViewLink;
|
|
10 |
*/
|
11 |
class DefaultListFactory
|
12 |
{
|
13 |
-
|
14 |
/**
|
15 |
* Post Type Repository
|
16 |
*/
|
@@ -21,7 +19,6 @@ class DefaultListFactory
|
|
21 |
*/
|
22 |
private $post_type;
|
23 |
|
24 |
-
|
25 |
public function __construct()
|
26 |
{
|
27 |
$this->post_type_repo = new PostTypeRepository;
|
@@ -38,5 +35,4 @@ class DefaultListFactory
|
|
38 |
new NestedViewLink($type);
|
39 |
}
|
40 |
}
|
41 |
-
|
42 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\DefaultList;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
9 |
*/
|
10 |
class DefaultListFactory
|
11 |
{
|
|
|
12 |
/**
|
13 |
* Post Type Repository
|
14 |
*/
|
19 |
*/
|
20 |
private $post_type;
|
21 |
|
|
|
22 |
public function __construct()
|
23 |
{
|
24 |
$this->post_type_repo = new PostTypeRepository;
|
35 |
new NestedViewLink($type);
|
36 |
}
|
37 |
}
|
|
|
38 |
}
|
app/Entities/DefaultList/NestedViewLink.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\DefaultList;
|
4 |
|
5 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
@@ -9,7 +8,6 @@ use NestedPages\Entities\PostType\PostTypeRepository;
|
|
9 |
*/
|
10 |
class NestedViewLink
|
11 |
{
|
12 |
-
|
13 |
/**
|
14 |
* Post Type
|
15 |
*/
|
@@ -50,5 +48,4 @@ class NestedViewLink
|
|
50 |
}
|
51 |
return $views;
|
52 |
}
|
53 |
-
|
54 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\DefaultList;
|
3 |
|
4 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
8 |
*/
|
9 |
class NestedViewLink
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Post Type
|
13 |
*/
|
48 |
}
|
49 |
return $views;
|
50 |
}
|
|
|
51 |
}
|
app/Entities/Listing/Listing.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Listing;
|
4 |
|
5 |
use NestedPages\Helpers;
|
@@ -9,6 +8,7 @@ use NestedPages\Entities\Post\PostRepository;
|
|
9 |
use NestedPages\Entities\User\UserRepository;
|
10 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
11 |
use NestedPages\Entities\Listing\ListingRepository;
|
|
|
12 |
use NestedPages\Config\SettingsRepository;
|
13 |
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
14 |
|
@@ -17,13 +17,18 @@ use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
|
17 |
*/
|
18 |
class Listing
|
19 |
{
|
20 |
-
|
21 |
/**
|
22 |
* Post Type
|
23 |
* @var object WP Post Type Object
|
24 |
*/
|
25 |
private $post_type;
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* Hierarchical Taxonomies
|
29 |
* @var array
|
@@ -62,6 +67,11 @@ class Listing
|
|
62 |
*/
|
63 |
private $listing_repo;
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
/**
|
66 |
* Confirmation Factory
|
67 |
*/
|
@@ -72,12 +82,6 @@ class Listing
|
|
72 |
*/
|
73 |
private $user;
|
74 |
|
75 |
-
/**
|
76 |
-
* Sorting Options
|
77 |
-
* @var array
|
78 |
-
*/
|
79 |
-
private $sort_options;
|
80 |
-
|
81 |
/**
|
82 |
* Settings Repository
|
83 |
*/
|
@@ -105,23 +109,31 @@ class Listing
|
|
105 |
*/
|
106 |
private $disabled_standard_fields;
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* Enabled Custom Fields
|
110 |
*/
|
111 |
private $enabled_custom_fields;
|
112 |
|
113 |
-
|
114 |
public function __construct($post_type)
|
115 |
{
|
116 |
$this->setPostType($post_type);
|
|
|
117 |
$this->integrations = new IntegrationFactory;
|
118 |
$this->post_repo = new PostRepository;
|
119 |
$this->user = new UserRepository;
|
120 |
$this->confirmation = new ConfirmationFactory;
|
121 |
$this->post_type_repo = new PostTypeRepository;
|
122 |
$this->listing_repo = new ListingRepository;
|
|
|
123 |
$this->post_data_factory = new PostDataFactory;
|
124 |
$this->settings = new SettingsRepository;
|
|
|
125 |
$this->setPostTypeSettings();
|
126 |
$this->setStandardFields();
|
127 |
}
|
@@ -138,23 +150,6 @@ class Listing
|
|
138 |
return array(&$classinstance, "listPosts");
|
139 |
}
|
140 |
|
141 |
-
/**
|
142 |
-
* Set the Sort Options
|
143 |
-
*/
|
144 |
-
private function setSortOptions()
|
145 |
-
{
|
146 |
-
$this->sort_options = new \StdClass();
|
147 |
-
$this->sort_options->orderby = isset($_GET['orderby'])
|
148 |
-
? sanitize_text_field($_GET['orderby'])
|
149 |
-
: 'menu_order';
|
150 |
-
$this->sort_options->order = isset($_GET['order'])
|
151 |
-
? sanitize_text_field($_GET['order'])
|
152 |
-
: 'ASC';
|
153 |
-
$this->sort_options->author = isset($_GET['author'])
|
154 |
-
? sanitize_text_field($_GET['author'])
|
155 |
-
: null;
|
156 |
-
}
|
157 |
-
|
158 |
/**
|
159 |
* Get the Current Page URL
|
160 |
*/
|
@@ -173,6 +168,16 @@ class Listing
|
|
173 |
$this->post_type = get_post_type_object($post_type);
|
174 |
}
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
/**
|
177 |
* Set the Post Type Settings
|
178 |
* @since 1.6.9
|
@@ -211,7 +216,6 @@ class Listing
|
|
211 |
*/
|
212 |
public function listPosts()
|
213 |
{
|
214 |
-
$this->setSortOptions();
|
215 |
include( Helpers::view('listing') );
|
216 |
}
|
217 |
|
@@ -231,12 +235,12 @@ class Listing
|
|
231 |
*/
|
232 |
private function listOpening($pages, $count, $sortable = true)
|
233 |
{
|
234 |
-
if ( $this->isSearch() ) $sortable = false;
|
235 |
if ( $this->post_type_settings->disable_sorting ) $sortable = false;
|
236 |
|
237 |
// Get array of child pages
|
238 |
$children = array();
|
239 |
-
$all_children = $pages
|
240 |
foreach($all_children as $child){
|
241 |
array_push($children, $child->ID);
|
242 |
}
|
@@ -244,25 +248,22 @@ class Listing
|
|
244 |
$compared = array_intersect($this->listing_repo->visiblePages($this->post_type->name), $children);
|
245 |
|
246 |
$list_classes = 'sortable visible nplist';
|
247 |
-
if ( !$this->user->canSortPages() || !$sortable || $this->isSearch() ) $list_classes .= ' no-sort';
|
|
|
248 |
if ( $this->integrations->plugins->yoast->installed ) $list_classes .= ' has-yoast';
|
249 |
-
if ( $this->isSearch() ) $list_classes .= ' np-search-results';
|
250 |
|
251 |
// Primary List
|
252 |
-
if ( $count ==
|
253 |
include( Helpers::view('partials/list-header') ); // List Header
|
254 |
include( Helpers::view('partials/bulk-edit') ); // Bulk Edit
|
255 |
echo '<ol class="' . $list_classes . '" id="np-' . $this->post_type->name . '">';
|
256 |
return;
|
257 |
}
|
258 |
|
259 |
-
// Don't create new list for child elements of posts in trash
|
260 |
-
if ( get_post_status($pages->query['post_parent']) == 'trash' ) return;
|
261 |
-
|
262 |
echo '<ol class="nplist';
|
263 |
if ( count($compared) > 0 ) echo ' visible" style="display:block;';
|
264 |
-
echo '" id="np-' . $this->post_type->name . '">';
|
265 |
-
|
266 |
}
|
267 |
|
268 |
/**
|
@@ -271,159 +272,112 @@ class Listing
|
|
271 |
*/
|
272 |
private function setPost($post)
|
273 |
{
|
274 |
-
$this->post = $this->post_data_factory->build($post);
|
275 |
}
|
276 |
|
277 |
/**
|
278 |
-
* Get count of published posts
|
279 |
-
* @param object $
|
280 |
*/
|
281 |
-
private function
|
282 |
{
|
283 |
-
$publish_count =
|
284 |
-
|
285 |
-
|
286 |
-
if ( $p->post_status !== 'trash' ) $publish_count++;
|
287 |
}
|
288 |
return $publish_count;
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
-
*
|
293 |
-
*
|
294 |
*/
|
295 |
-
private function
|
296 |
{
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Is the list filtered?
|
302 |
-
*/
|
303 |
-
private function isFiltered()
|
304 |
-
{
|
305 |
-
return ( isset($_GET['category']) && $_GET['category'] !== "all" ) ? true : false;
|
306 |
}
|
307 |
|
308 |
/**
|
309 |
-
*
|
310 |
-
* Recursive Method, called in page.php view
|
311 |
*/
|
312 |
-
private function
|
313 |
{
|
314 |
-
$this->
|
315 |
-
|
316 |
-
if ( $this->
|
317 |
-
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
319 |
} else {
|
320 |
-
$
|
|
|
321 |
}
|
322 |
|
323 |
-
$
|
324 |
-
'post_type' => $post_type,
|
325 |
-
'posts_per_page' => -1,
|
326 |
-
'author' => $this->sort_options->author,
|
327 |
-
'orderby' => $this->sort_options->orderby,
|
328 |
-
'post_status' => array('publish', 'pending', 'draft', 'private', 'future', 'trash'),
|
329 |
-
'post_parent' => $parent_id,
|
330 |
-
'order' => $this->sort_options->order
|
331 |
-
);
|
332 |
-
|
333 |
-
if ( $this->isSearch() ) $query_args = $this->searchParams($query_args);
|
334 |
-
if ( $this->isFiltered() ) $query_args = $this->filterParams($query_args);
|
335 |
|
336 |
-
|
337 |
-
|
338 |
-
if ( $pages->have_posts() ) :
|
339 |
$count++;
|
340 |
-
$nest_count++;
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
while ( $pages->have_posts() ) : $pages->the_post();
|
347 |
|
348 |
-
|
349 |
-
$this->setPost($post);
|
350 |
|
351 |
-
|
352 |
|
353 |
-
|
|
|
354 |
|
355 |
-
|
356 |
-
|
357 |
|
358 |
-
|
359 |
-
|
|
|
|
|
|
|
|
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
|
368 |
-
|
369 |
-
echo ' ' . $this->post_repo->getTaxonomyCSS($this->post->id, $this->h_taxonomies);
|
370 |
-
echo ' ' . $this->post_repo->getTaxonomyCSS($this->post->id, $this->f_taxonomies, false);
|
371 |
-
|
372 |
-
echo '">';
|
373 |
-
|
374 |
-
$count++;
|
375 |
|
376 |
-
|
377 |
-
|
|
|
|
|
|
|
|
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
|
|
|
382 |
|
383 |
-
|
384 |
-
echo '</li>';
|
385 |
-
}
|
386 |
|
387 |
-
|
388 |
|
389 |
-
if ( $this->
|
390 |
-
echo '</ol>';
|
391 |
-
}
|
392 |
|
393 |
-
|
394 |
-
}
|
395 |
-
|
396 |
-
/**
|
397 |
-
* Search Posts
|
398 |
-
*/
|
399 |
-
private function searchParams($query_args)
|
400 |
-
{
|
401 |
-
$query_args['post_title_like'] = sanitize_text_field($_GET['search']);
|
402 |
-
unset($query_args['post_parent']);
|
403 |
-
return $query_args;
|
404 |
-
}
|
405 |
-
|
406 |
-
/**
|
407 |
-
* Filter Posts
|
408 |
-
*/
|
409 |
-
private function filterParams($query_args)
|
410 |
-
{
|
411 |
-
if ( !isset($_GET['category']) ) return $query_args;
|
412 |
-
$query_args['cat'] = sanitize_text_field($_GET['category']);
|
413 |
-
return $query_args;
|
414 |
-
}
|
415 |
|
416 |
-
|
417 |
-
* Parent Trash Status
|
418 |
-
* @param WP Query object
|
419 |
-
* @return boolean
|
420 |
-
*/
|
421 |
-
private function parentTrashed($pages)
|
422 |
-
{
|
423 |
-
if ( !isset($pages->query['post_parent']) || $pages->query['post_parent'] == 0 ) return false;
|
424 |
-
if ( get_post_status($pages->query['post_parent']) == 'trash' ) return true;
|
425 |
-
return false;
|
426 |
|
|
|
|
|
|
|
427 |
}
|
428 |
-
|
429 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Listing;
|
3 |
|
4 |
use NestedPages\Helpers;
|
8 |
use NestedPages\Entities\User\UserRepository;
|
9 |
use NestedPages\Entities\PostType\PostTypeRepository;
|
10 |
use NestedPages\Entities\Listing\ListingRepository;
|
11 |
+
use NestedPages\Entities\Listing\ListingQuery;
|
12 |
use NestedPages\Config\SettingsRepository;
|
13 |
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
14 |
|
17 |
*/
|
18 |
class Listing
|
19 |
{
|
|
|
20 |
/**
|
21 |
* Post Type
|
22 |
* @var object WP Post Type Object
|
23 |
*/
|
24 |
private $post_type;
|
25 |
|
26 |
+
/**
|
27 |
+
* Query Results
|
28 |
+
* @var array of post objects (WP Query)
|
29 |
+
*/
|
30 |
+
private $all_posts;
|
31 |
+
|
32 |
/**
|
33 |
* Hierarchical Taxonomies
|
34 |
* @var array
|
67 |
*/
|
68 |
private $listing_repo;
|
69 |
|
70 |
+
/**
|
71 |
+
* Listing Query
|
72 |
+
*/
|
73 |
+
private $listing_query;
|
74 |
+
|
75 |
/**
|
76 |
* Confirmation Factory
|
77 |
*/
|
82 |
*/
|
83 |
private $user;
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
/**
|
86 |
* Settings Repository
|
87 |
*/
|
109 |
*/
|
110 |
private $disabled_standard_fields;
|
111 |
|
112 |
+
/**
|
113 |
+
* Sticky Posts
|
114 |
+
* @var array
|
115 |
+
*/
|
116 |
+
private $sticky_posts;
|
117 |
+
|
118 |
/**
|
119 |
* Enabled Custom Fields
|
120 |
*/
|
121 |
private $enabled_custom_fields;
|
122 |
|
|
|
123 |
public function __construct($post_type)
|
124 |
{
|
125 |
$this->setPostType($post_type);
|
126 |
+
$this->setStickyPosts();
|
127 |
$this->integrations = new IntegrationFactory;
|
128 |
$this->post_repo = new PostRepository;
|
129 |
$this->user = new UserRepository;
|
130 |
$this->confirmation = new ConfirmationFactory;
|
131 |
$this->post_type_repo = new PostTypeRepository;
|
132 |
$this->listing_repo = new ListingRepository;
|
133 |
+
$this->listing_query = new ListingQuery;
|
134 |
$this->post_data_factory = new PostDataFactory;
|
135 |
$this->settings = new SettingsRepository;
|
136 |
+
$this->setTaxonomies();
|
137 |
$this->setPostTypeSettings();
|
138 |
$this->setStandardFields();
|
139 |
}
|
150 |
return array(&$classinstance, "listPosts");
|
151 |
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
/**
|
154 |
* Get the Current Page URL
|
155 |
*/
|
168 |
$this->post_type = get_post_type_object($post_type);
|
169 |
}
|
170 |
|
171 |
+
/**
|
172 |
+
* Set the Sticky Posts
|
173 |
+
* @since 2.0.1
|
174 |
+
*/
|
175 |
+
private function setStickyPosts()
|
176 |
+
{
|
177 |
+
$this->sticky_posts = get_option('sticky_posts');
|
178 |
+
if ( !$this->sticky_posts ) $this->sticky_posts = array();
|
179 |
+
}
|
180 |
+
|
181 |
/**
|
182 |
* Set the Post Type Settings
|
183 |
* @since 1.6.9
|
216 |
*/
|
217 |
public function listPosts()
|
218 |
{
|
|
|
219 |
include( Helpers::view('listing') );
|
220 |
}
|
221 |
|
235 |
*/
|
236 |
private function listOpening($pages, $count, $sortable = true)
|
237 |
{
|
238 |
+
if ( $this->listing_repo->isSearch() ) $sortable = false;
|
239 |
if ( $this->post_type_settings->disable_sorting ) $sortable = false;
|
240 |
|
241 |
// Get array of child pages
|
242 |
$children = array();
|
243 |
+
$all_children = $pages;
|
244 |
foreach($all_children as $child){
|
245 |
array_push($children, $child->ID);
|
246 |
}
|
248 |
$compared = array_intersect($this->listing_repo->visiblePages($this->post_type->name), $children);
|
249 |
|
250 |
$list_classes = 'sortable visible nplist';
|
251 |
+
if ( !$this->user->canSortPages() || !$sortable || $this->listing_repo->isSearch() ) $list_classes .= ' no-sort';
|
252 |
+
if ( $this->integrations->plugins->wpml->installed && $this->integrations->plugins->wpml->getCurrentLanguage() == 'all' ) $list_classes .= ' no-sort';
|
253 |
if ( $this->integrations->plugins->yoast->installed ) $list_classes .= ' has-yoast';
|
254 |
+
if ( $this->listing_repo->isSearch() ) $list_classes .= ' np-search-results';
|
255 |
|
256 |
// Primary List
|
257 |
+
if ( $count == 0 ) {
|
258 |
include( Helpers::view('partials/list-header') ); // List Header
|
259 |
include( Helpers::view('partials/bulk-edit') ); // Bulk Edit
|
260 |
echo '<ol class="' . $list_classes . '" id="np-' . $this->post_type->name . '">';
|
261 |
return;
|
262 |
}
|
263 |
|
|
|
|
|
|
|
264 |
echo '<ol class="nplist';
|
265 |
if ( count($compared) > 0 ) echo ' visible" style="display:block;';
|
266 |
+
echo '" id="np-' . $this->post_type->name . '">';
|
|
|
267 |
}
|
268 |
|
269 |
/**
|
272 |
*/
|
273 |
private function setPost($post)
|
274 |
{
|
275 |
+
$this->post = $this->post_data_factory->build($post, $this->h_taxonomies, $this->f_taxonomies);
|
276 |
}
|
277 |
|
278 |
/**
|
279 |
+
* Get count of published child posts
|
280 |
+
* @param object $post
|
281 |
*/
|
282 |
+
private function publishedChildrenCount($post)
|
283 |
{
|
284 |
+
$publish_count = 0;
|
285 |
+
foreach ( $this->all_posts as $p ){
|
286 |
+
if ( $p->post_parent == $post->id && $p->post_status !== 'trash' ) $publish_count++;
|
|
|
287 |
}
|
288 |
return $publish_count;
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
+
* Loop through all the pages and create the nested / sortable list
|
293 |
+
* Recursive Method, called in page.php view
|
294 |
*/
|
295 |
+
private function getPosts()
|
296 |
{
|
297 |
+
$this->all_posts = $this->listing_query->getPosts($this->post_type, $this->h_taxonomies, $this->f_taxonomies);
|
298 |
+
$this->listPostLevel();
|
299 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
}
|
301 |
|
302 |
/**
|
303 |
+
* List a single tree node of posts
|
|
|
304 |
*/
|
305 |
+
private function listPostLevel($parent = 0, $count = 0, $level = 1)
|
306 |
{
|
307 |
+
$wpml = $this->integrations->plugins->wpml->installed;
|
308 |
+
$wpml_current_language = null;
|
309 |
+
if ( $wpml ) $wpml_current_language = $this->integrations->plugins->wpml->getCurrentLanguage();
|
310 |
+
|
311 |
+
if ( !$this->listing_repo->isSearch() ){
|
312 |
+
$pages = get_page_children($parent, $this->all_posts);
|
313 |
+
if ( !$pages ) return;
|
314 |
+
$parent_status = get_post_status($parent);
|
315 |
+
$level++;
|
316 |
+
if ( $parent_status !== 'trash' ) $this->listOpening($pages, $count);
|
317 |
} else {
|
318 |
+
$pages = $this->all_posts;
|
319 |
+
echo '<ol class="sortable no-sort nplist visible">';
|
320 |
}
|
321 |
|
322 |
+
foreach($pages as $page) :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
|
324 |
+
if ( $page->post_parent !== $parent && !$this->listing_repo->isSearch() ) continue;
|
|
|
|
|
325 |
$count++;
|
|
|
326 |
|
327 |
+
global $post;
|
328 |
+
$post = $page;
|
329 |
+
$this->setPost($post);
|
|
|
|
|
330 |
|
331 |
+
if ( $this->post->status !== 'trash' ) :
|
|
|
332 |
|
333 |
+
echo '<li id="menuItem_' . esc_attr($this->post->id) . '" class="page-row';
|
334 |
|
335 |
+
// Post Type
|
336 |
+
echo ' post-type-' . esc_attr($this->post->post_type);
|
337 |
|
338 |
+
// Assigned to manage a post type?
|
339 |
+
if ( $this->listing_repo->isAssignedPostType($this->post->id, $this->assigned_pt_pages) ) echo ' is-page-assignment';
|
340 |
|
341 |
+
// Published?
|
342 |
+
if ( $this->post->status == 'publish' ) echo ' published';
|
343 |
+
if ( $this->post->status == 'draft' ) echo ' draft';
|
344 |
+
|
345 |
+
// Hidden in Nested Pages?
|
346 |
+
if ( $this->post->np_status == 'hide' ) echo ' np-hide';
|
347 |
|
348 |
+
// Taxonomies
|
349 |
+
echo ' ' . $this->post_repo->getTaxonomyCSS($this->post, $this->h_taxonomies, $this->f_taxonomies);
|
350 |
+
|
351 |
+
echo '">';
|
352 |
+
|
353 |
+
$count++;
|
354 |
|
355 |
+
$row_view = ( $this->post->type !== 'np-redirect' ) ? 'partials/row' : 'partials/row-link';
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
+
// CSS Classes for the <li> row element
|
358 |
+
$row_classes = '';
|
359 |
+
if ( !$this->post_type->hierarchical ) $row_classes .= ' non-hierarchical';
|
360 |
+
if ( !$this->user->canSortPages() ) $row_classes .= ' no-sort';
|
361 |
+
if ( $wpml_current_language == 'all' ) $row_classes .= ' no-sort';
|
362 |
+
if ( $this->listing_repo->isSearch() ) $row_classes .= ' search';
|
363 |
|
364 |
+
// Page Assignment for Post Type
|
365 |
+
$assigned_pt = ( $this->listing_repo->isAssignedPostType($this->post->id, $this->assigned_pt_pages) )
|
366 |
+
? $this->listing_repo->assignedPostType($this->post->id, $this->assigned_pt_pages)
|
367 |
+
: false;
|
368 |
|
369 |
+
include( Helpers::view($row_view) );
|
|
|
|
|
370 |
|
371 |
+
endif; // trash status
|
372 |
|
373 |
+
if ( !$this->listing_repo->isSearch() ) $this->listPostLevel($page->ID, $count, $level);
|
|
|
|
|
374 |
|
375 |
+
if ( $this->post->status !== 'trash' ) echo '</li>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
|
377 |
+
if ( $this->publishedChildrenCount($this->post) > 0 && !$this->listing_repo->isSearch() && $continue_nest ) echo '</ol>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
|
379 |
+
endforeach; // Loop
|
380 |
+
|
381 |
+
if ( $parent_status !== 'trash' ) echo '</ol><!-- list close -->';
|
382 |
}
|
|
|
383 |
}
|
app/Entities/Listing/ListingActions.php
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Listing;
|
4 |
|
5 |
class ListingActions
|
6 |
{
|
7 |
-
|
8 |
public function __construct()
|
9 |
{
|
10 |
add_filter( 'posts_where', array($this, 'titleSearch'), 10, 2 );
|
@@ -22,5 +20,4 @@ class ListingActions
|
|
22 |
}
|
23 |
return $where;
|
24 |
}
|
25 |
-
|
26 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\Listing;
|
3 |
|
4 |
class ListingActions
|
5 |
{
|
|
|
6 |
public function __construct()
|
7 |
{
|
8 |
add_filter( 'posts_where', array($this, 'titleSearch'), 10, 2 );
|
20 |
}
|
21 |
return $where;
|
22 |
}
|
|
|
23 |
}
|
app/Entities/Listing/ListingQuery.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace NestedPages\Entities\Listing;
|
3 |
+
|
4 |
+
use NestedPages\Entities\Listing\ListingRepository;
|
5 |
+
use NestedPages\Entities\PostType\PostTypeRepository;
|
6 |
+
use NestedPages\Config\SettingsRepository;
|
7 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Performs the query for the page listing and formats into a multidemensional array
|
11 |
+
*/
|
12 |
+
class ListingQuery
|
13 |
+
{
|
14 |
+
private $sort_options;
|
15 |
+
|
16 |
+
private $listing_repo;
|
17 |
+
|
18 |
+
private $post_type_repo;
|
19 |
+
|
20 |
+
private $settings;
|
21 |
+
|
22 |
+
private $integrations;
|
23 |
+
|
24 |
+
private $post_type;
|
25 |
+
|
26 |
+
private $h_taxonomies;
|
27 |
+
|
28 |
+
private $f_taxonomies;
|
29 |
+
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
$this->listing_repo = new ListingRepository;
|
33 |
+
$this->post_type_repo = new PostTypeRepository;
|
34 |
+
$this->settings = new SettingsRepository;
|
35 |
+
$this->integrations = new IntegrationFactory;
|
36 |
+
$this->setSortOptions();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Set the Sort Options
|
41 |
+
*/
|
42 |
+
private function setSortOptions()
|
43 |
+
{
|
44 |
+
$this->sort_options = new \StdClass();
|
45 |
+
$this->sort_options->orderby = isset($_GET['orderby'])
|
46 |
+
? sanitize_text_field($_GET['orderby'])
|
47 |
+
: 'menu_order';
|
48 |
+
$this->sort_options->order = isset($_GET['order'])
|
49 |
+
? sanitize_text_field($_GET['order'])
|
50 |
+
: 'ASC';
|
51 |
+
$this->sort_options->author = isset($_GET['author'])
|
52 |
+
? sanitize_text_field($_GET['author'])
|
53 |
+
: null;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get the Posts
|
58 |
+
*/
|
59 |
+
public function getPosts($post_type, $h_taxonomies = array(), $f_taxonomies = array())
|
60 |
+
{
|
61 |
+
$wpml = $this->integrations->plugins->wpml->installed;
|
62 |
+
$this->h_taxonomies = $h_taxonomies;
|
63 |
+
$this->f_taxonomies = $f_taxonomies;
|
64 |
+
$this->post_type = $post_type;
|
65 |
+
|
66 |
+
$this->setTaxonomyFilters();
|
67 |
+
|
68 |
+
if ( $this->post_type->name == 'page' ) {
|
69 |
+
$post_type = array('page');
|
70 |
+
if ( !$this->settings->menusDisabled() && !$wpml ) $post_type[] = 'np-redirect';
|
71 |
+
} else {
|
72 |
+
$post_type = array($post_type->name);
|
73 |
+
}
|
74 |
+
|
75 |
+
$query_args = array(
|
76 |
+
'post_type' => $post_type,
|
77 |
+
'posts_per_page' => -1,
|
78 |
+
'author' => $this->sort_options->author,
|
79 |
+
'orderby' => $this->sort_options->orderby,
|
80 |
+
'post_status' => array('publish', 'pending', 'draft', 'private', 'future', 'trash'),
|
81 |
+
'order' => $this->sort_options->order
|
82 |
+
);
|
83 |
+
|
84 |
+
if ( $this->listing_repo->isSearch() ) $query_args = $this->searchParams($query_args);
|
85 |
+
if ( $this->listing_repo->isFiltered() ) $query_args = $this->filterParams($query_args);
|
86 |
+
|
87 |
+
$query_args = apply_filters('nestedpages_page_listing', $query_args);
|
88 |
+
|
89 |
+
add_filter( 'posts_clauses', array($this, 'queryFilter') );
|
90 |
+
$all_posts = new \WP_Query($query_args);
|
91 |
+
remove_filter( 'posts_clauses', array($this, 'queryFilter') );
|
92 |
+
|
93 |
+
if ( $all_posts->have_posts() ) :
|
94 |
+
return $all_posts->posts;
|
95 |
+
endif; wp_reset_postdata();
|
96 |
+
return null;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Search Paramaters
|
101 |
+
*/
|
102 |
+
private function searchParams($query_args)
|
103 |
+
{
|
104 |
+
$query_args['post_title_like'] = sanitize_text_field($_GET['search']);
|
105 |
+
unset($query_args['post_parent']);
|
106 |
+
return $query_args;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Filter Posts
|
111 |
+
*/
|
112 |
+
private function filterParams($query_args)
|
113 |
+
{
|
114 |
+
if ( !isset($_GET['category']) ) return $query_args;
|
115 |
+
$query_args['cat'] = sanitize_text_field($_GET['category']);
|
116 |
+
return $query_args;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Add Taxonomy Filters to the sort options if applicable
|
121 |
+
*/
|
122 |
+
private function setTaxonomyFilters()
|
123 |
+
{
|
124 |
+
$taxonomies = array_merge($this->h_taxonomies, $this->f_taxonomies);
|
125 |
+
$tax_query = array();
|
126 |
+
foreach ( $taxonomies as $tax ) :
|
127 |
+
if ( $this->post_type_repo->sortOptionEnabled($this->post_type->name, $tax->name, true) && isset($_GET[$tax->name]) ) :
|
128 |
+
$tax_query[] = array(
|
129 |
+
'taxonomy' => $tax->name,
|
130 |
+
'fields' => 'term_id',
|
131 |
+
'terms' => sanitize_text_field($_GET[$tax->name])
|
132 |
+
);
|
133 |
+
endif;
|
134 |
+
endforeach;
|
135 |
+
if ( !empty($tax_query) ) $this->sort_options->tax_query = $tax_query;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Query filter to add taxonomies to return data
|
140 |
+
* Fixes N+1 problem with taxonomies, eliminating need to query on every post
|
141 |
+
*/
|
142 |
+
public function queryFilter($pieces)
|
143 |
+
{
|
144 |
+
global $wpdb;
|
145 |
+
|
146 |
+
// Add Hierarchical Categories
|
147 |
+
foreach($this->h_taxonomies as $tax){
|
148 |
+
$name = $tax->name;
|
149 |
+
$tr = 'tr_' . $tax->name;
|
150 |
+
$tt = 'tt_' . $tax->name;
|
151 |
+
$t = 't_' . $tax->name;
|
152 |
+
|
153 |
+
$pieces['join'] .= "
|
154 |
+
LEFT JOIN $wpdb->term_relationships AS $tr ON $tr.object_id = $wpdb->posts.ID
|
155 |
+
LEFT JOIN $wpdb->term_taxonomy $tt ON $tt.term_taxonomy_id = $tr.term_taxonomy_id AND $tt.taxonomy = '$name'
|
156 |
+
LEFT JOIN $wpdb->terms AS $t ON $t.term_id = $tt.term_id";
|
157 |
+
$pieces['fields'] .= ",GROUP_CONCAT(DISTINCT $t.term_id SEPARATOR ',') AS $name";
|
158 |
+
}
|
159 |
+
|
160 |
+
// Add Flat Categories
|
161 |
+
foreach($this->f_taxonomies as $tax){
|
162 |
+
$name = $tax->name;
|
163 |
+
$tr = 'tr_' . $tax->name;
|
164 |
+
$tt = 'tt_' . $tax->name;
|
165 |
+
$t = 't_' . $tax->name;
|
166 |
+
|
167 |
+
$pieces['join'] .= "
|
168 |
+
LEFT JOIN $wpdb->term_relationships AS $tr ON $tr.object_id = $wpdb->posts.ID
|
169 |
+
LEFT JOIN $wpdb->term_taxonomy $tt ON $tt.term_taxonomy_id = $tr.term_taxonomy_id AND $tt.taxonomy = '$name'
|
170 |
+
LEFT JOIN $wpdb->terms AS $t ON $t.term_id = $tt.term_id";
|
171 |
+
$pieces['fields'] .= ",GROUP_CONCAT(DISTINCT $t.term_id SEPARATOR ',') AS $name";
|
172 |
+
}
|
173 |
+
|
174 |
+
$pieces['groupby'] = "$wpdb->posts.ID";
|
175 |
+
return $pieces;
|
176 |
+
}
|
177 |
+
}
|
app/Entities/Listing/ListingRepository.php
CHANGED
@@ -1,9 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Listing;
|
4 |
|
|
|
|
|
5 |
class ListingRepository
|
6 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
/**
|
9 |
* User's Toggled Pages
|
@@ -61,4 +71,60 @@ class ListingRepository
|
|
61 |
endif; wp_reset_postdata();
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\Listing;
|
3 |
|
4 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
5 |
+
|
6 |
class ListingRepository
|
7 |
{
|
8 |
+
/**
|
9 |
+
* Plugin Integrations
|
10 |
+
*/
|
11 |
+
private $integrations;
|
12 |
+
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
$this->integrations = new IntegrationFactory;
|
16 |
+
}
|
17 |
|
18 |
/**
|
19 |
* User's Toggled Pages
|
71 |
endif; wp_reset_postdata();
|
72 |
}
|
73 |
|
74 |
+
/**
|
75 |
+
* Is the page, or it's parent translation, assigned a post type?
|
76 |
+
* @param $page - int - post id
|
77 |
+
* @param $assigned_pages - array
|
78 |
+
* @return bool
|
79 |
+
*/
|
80 |
+
public function isAssignedPostType($page_id, $assigned_pages)
|
81 |
+
{
|
82 |
+
if ( $this->integrations->plugins->wpml->installed && !$this->integrations->plugins->wpml->isDefaultLanguage() ){
|
83 |
+
$page_id = $this->integrations->plugins->wpml->getPrimaryLanguagePost($page_id);
|
84 |
+
}
|
85 |
+
if ( array_key_exists($page_id, $assigned_pages) ) return true;
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get the assigned post type for a page
|
91 |
+
* @param $page - int - post id
|
92 |
+
* @param $assigned_pages - array
|
93 |
+
* @return post type object
|
94 |
+
*/
|
95 |
+
public function assignedPostType($page_id, $assigned_pages)
|
96 |
+
{
|
97 |
+
if ( $this->integrations->plugins->wpml->installed && !$this->integrations->plugins->wpml->isDefaultLanguage() ){
|
98 |
+
$page_id = $this->integrations->plugins->wpml->getPrimaryLanguagePost($page_id);
|
99 |
+
}
|
100 |
+
return get_post_type_object($assigned_pages[$page_id]);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Get the number of published posts for a given post type
|
105 |
+
*/
|
106 |
+
public function postCount($post_type)
|
107 |
+
{
|
108 |
+
if ( $this->integrations->plugins->wpml->installed ){
|
109 |
+
return $this->integrations->plugins->wpml->getPostTypeCountByLanguage($post_type);
|
110 |
+
}
|
111 |
+
return wp_count_posts($post_type)->publish;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Is this a search
|
116 |
+
* @return boolean
|
117 |
+
*/
|
118 |
+
public function isSearch()
|
119 |
+
{
|
120 |
+
return ( isset($_GET['search']) && $_GET['search'] !== "" ) ? true : false;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Is the list filtered?
|
125 |
+
*/
|
126 |
+
public function isFiltered()
|
127 |
+
{
|
128 |
+
return ( isset($_GET['category']) && $_GET['category'] !== "all" ) ? true : false;
|
129 |
+
}
|
130 |
}
|
app/Entities/NavMenu/NavMenuActions.php
CHANGED
@@ -1,30 +1,35 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuSyncMenu;
|
|
|
|
|
6 |
/**
|
7 |
* Hook into WP actions for necessary tasks related to nav menus
|
8 |
*/
|
9 |
class NavMenuActions
|
10 |
{
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
public function __construct()
|
14 |
{
|
15 |
if ( get_option('nestedpages_menusync') !== 'sync' ) return;
|
16 |
if ( get_option('nestedpages_disable_menu') == 'true' ) return;
|
|
|
17 |
$this->addUpdateHook();
|
18 |
}
|
19 |
|
20 |
private function addUpdateHook()
|
21 |
{
|
22 |
-
add_action( 'wp_update_nav_menu', array($this, 'syncMenu'),
|
23 |
}
|
24 |
|
25 |
private function removeUpdateHook()
|
26 |
{
|
27 |
-
remove_action( 'wp_update_nav_menu', array($this, 'syncMenu'),
|
28 |
}
|
29 |
|
30 |
/**
|
@@ -32,9 +37,9 @@ class NavMenuActions
|
|
32 |
*/
|
33 |
public function syncMenu($menu_id, $menu_data = null)
|
34 |
{
|
|
|
35 |
$this->removeUpdateHook();
|
36 |
if ( $menu_data == null ) $sync = new NavMenuSyncMenu($menu_id);
|
37 |
$this->addUpdateHook();
|
38 |
}
|
39 |
-
|
40 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuSyncMenu;
|
5 |
+
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
6 |
+
|
7 |
/**
|
8 |
* Hook into WP actions for necessary tasks related to nav menus
|
9 |
*/
|
10 |
class NavMenuActions
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Nav Menu Repository
|
14 |
+
*/
|
15 |
+
private $nav_menu_repo;
|
16 |
|
17 |
public function __construct()
|
18 |
{
|
19 |
if ( get_option('nestedpages_menusync') !== 'sync' ) return;
|
20 |
if ( get_option('nestedpages_disable_menu') == 'true' ) return;
|
21 |
+
$this->nav_menu_repo = new NavMenuRepository;
|
22 |
$this->addUpdateHook();
|
23 |
}
|
24 |
|
25 |
private function addUpdateHook()
|
26 |
{
|
27 |
+
add_action( 'wp_update_nav_menu', array($this, 'syncMenu'), 10, 2 );
|
28 |
}
|
29 |
|
30 |
private function removeUpdateHook()
|
31 |
{
|
32 |
+
remove_action( 'wp_update_nav_menu', array($this, 'syncMenu'), 10);
|
33 |
}
|
34 |
|
35 |
/**
|
37 |
*/
|
38 |
public function syncMenu($menu_id, $menu_data = null)
|
39 |
{
|
40 |
+
if ( $menu_id !== $this->nav_menu_repo->getMenuID() ) return; // Don't try to sync menus not managed by NP
|
41 |
$this->removeUpdateHook();
|
42 |
if ( $menu_data == null ) $sync = new NavMenuSyncMenu($menu_id);
|
43 |
$this->addUpdateHook();
|
44 |
}
|
|
|
45 |
}
|
app/Entities/NavMenu/NavMenuFrontEnd.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
app/Entities/NavMenu/NavMenuRemoveItem.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages\Entities\NavMenu;
|
|
7 |
*/
|
8 |
class NavMenuRemoveItem
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
* Item ID to Remove
|
13 |
* @var int - ID of nav menu item
|
@@ -27,5 +25,4 @@ class NavMenuRemoveItem
|
|
27 |
{
|
28 |
wp_delete_post($this->item_id, true);
|
29 |
}
|
30 |
-
|
31 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class NavMenuRemoveItem
|
8 |
{
|
|
|
9 |
/**
|
10 |
* Item ID to Remove
|
11 |
* @var int - ID of nav menu item
|
25 |
{
|
26 |
wp_delete_post($this->item_id, true);
|
27 |
}
|
|
|
28 |
}
|
app/Entities/NavMenu/NavMenuRepository.php
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
class NavMenuRepository
|
6 |
{
|
7 |
-
|
8 |
/**
|
9 |
* Get the Menu ID
|
10 |
* @since 1.3.4
|
@@ -165,5 +163,4 @@ class NavMenuRepository
|
|
165 |
}
|
166 |
return $visible;
|
167 |
}
|
168 |
-
|
169 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
class NavMenuRepository
|
5 |
{
|
|
|
6 |
/**
|
7 |
* Get the Menu ID
|
8 |
* @since 1.3.4
|
163 |
}
|
164 |
return $visible;
|
165 |
}
|
|
|
166 |
}
|
app/Entities/NavMenu/NavMenuSync.php
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
|
|
6 |
|
7 |
/**
|
8 |
* Base Nav Menu Sync class
|
9 |
*/
|
10 |
abstract class NavMenuSync
|
11 |
{
|
12 |
-
|
13 |
/**
|
14 |
* Nav Menu Repository
|
15 |
* @var object NavMenuRepository
|
@@ -22,9 +21,16 @@ abstract class NavMenuSync
|
|
22 |
*/
|
23 |
protected $id;
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
public function __construct()
|
26 |
{
|
27 |
$this->nav_menu_repo = new NavMenuRepository;
|
|
|
28 |
$this->setMenuID();
|
29 |
}
|
30 |
|
@@ -45,5 +51,4 @@ abstract class NavMenuSync
|
|
45 |
{
|
46 |
wp_delete_post($id, true);
|
47 |
}
|
48 |
-
|
49 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
5 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
6 |
|
7 |
/**
|
8 |
* Base Nav Menu Sync class
|
9 |
*/
|
10 |
abstract class NavMenuSync
|
11 |
{
|
|
|
12 |
/**
|
13 |
* Nav Menu Repository
|
14 |
* @var object NavMenuRepository
|
21 |
*/
|
22 |
protected $id;
|
23 |
|
24 |
+
/**
|
25 |
+
* Plugin Integrations
|
26 |
+
* @var object
|
27 |
+
*/
|
28 |
+
protected $integrations;
|
29 |
+
|
30 |
public function __construct()
|
31 |
{
|
32 |
$this->nav_menu_repo = new NavMenuRepository;
|
33 |
+
$this->integrations = new IntegrationFactory;
|
34 |
$this->setMenuID();
|
35 |
}
|
36 |
|
51 |
{
|
52 |
wp_delete_post($id, true);
|
53 |
}
|
|
|
54 |
}
|
app/Entities/NavMenu/NavMenuSyncListing.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuSync;
|
@@ -11,7 +10,6 @@ use NestedPages\Entities\Post\PostDataFactory;
|
|
11 |
*/
|
12 |
class NavMenuSyncListing extends NavMenuSync
|
13 |
{
|
14 |
-
|
15 |
/**
|
16 |
* Individual Post
|
17 |
* @var array
|
@@ -40,10 +38,12 @@ class NavMenuSyncListing extends NavMenuSync
|
|
40 |
*/
|
41 |
public function sync($parent = 0, $menu_parent = 0, $nest_level = 0)
|
42 |
{
|
|
|
|
|
43 |
try {
|
44 |
$this->count = $this->count + 1;
|
45 |
$args = array(
|
46 |
-
'post_type' =>
|
47 |
'posts_per_page' => -1,
|
48 |
'post_status' => 'publish',
|
49 |
'orderby' => 'menu_order',
|
@@ -118,5 +118,4 @@ class NavMenuSyncListing extends NavMenuSync
|
|
118 |
$menu = wp_update_nav_menu_item($this->id, $menu_item_id, $args);
|
119 |
return $menu;
|
120 |
}
|
121 |
-
|
122 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuSync;
|
10 |
*/
|
11 |
class NavMenuSyncListing extends NavMenuSync
|
12 |
{
|
|
|
13 |
/**
|
14 |
* Individual Post
|
15 |
* @var array
|
38 |
*/
|
39 |
public function sync($parent = 0, $menu_parent = 0, $nest_level = 0)
|
40 |
{
|
41 |
+
$post_types = array('page');
|
42 |
+
if ( !$this->integrations->plugins->wpml->installed ) $post_types[] = 'np-redirect';
|
43 |
try {
|
44 |
$this->count = $this->count + 1;
|
45 |
$args = array(
|
46 |
+
'post_type' => $post_types,
|
47 |
'posts_per_page' => -1,
|
48 |
'post_status' => 'publish',
|
49 |
'orderby' => 'menu_order',
|
118 |
$menu = wp_update_nav_menu_item($this->id, $menu_item_id, $args);
|
119 |
return $menu;
|
120 |
}
|
|
|
121 |
}
|
app/Entities/NavMenu/NavMenuSyncMenu.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuSync;
|
@@ -13,7 +12,6 @@ use NestedPages\Entities\NavMenu\NavMenuRepository;
|
|
13 |
*/
|
14 |
class NavMenuSyncMenu extends NavMenuSync
|
15 |
{
|
16 |
-
|
17 |
/**
|
18 |
* Menu Items
|
19 |
* @var array of objects
|
@@ -38,7 +36,6 @@ class NavMenuSyncMenu extends NavMenuSync
|
|
38 |
*/
|
39 |
private $post_repo;
|
40 |
|
41 |
-
|
42 |
public function __construct()
|
43 |
{
|
44 |
parent::__construct();
|
@@ -124,6 +121,7 @@ class NavMenuSyncMenu extends NavMenuSync
|
|
124 |
*/
|
125 |
private function syncNewLink($item, $parent_id)
|
126 |
{
|
|
|
127 |
$post_data = array(
|
128 |
'menuTitle' => $item->title,
|
129 |
'np_link_title' => $item->title,
|
@@ -160,5 +158,4 @@ class NavMenuSyncMenu extends NavMenuSync
|
|
160 |
}
|
161 |
}
|
162 |
}
|
163 |
-
|
164 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuSync;
|
12 |
*/
|
13 |
class NavMenuSyncMenu extends NavMenuSync
|
14 |
{
|
|
|
15 |
/**
|
16 |
* Menu Items
|
17 |
* @var array of objects
|
36 |
*/
|
37 |
private $post_repo;
|
38 |
|
|
|
39 |
public function __construct()
|
40 |
{
|
41 |
parent::__construct();
|
121 |
*/
|
122 |
private function syncNewLink($item, $parent_id)
|
123 |
{
|
124 |
+
if ( $this->integrations->plugins->wpml->installed ) return;
|
125 |
$post_data = array(
|
126 |
'menuTitle' => $item->title,
|
127 |
'np_link_title' => $item->title,
|
158 |
}
|
159 |
}
|
160 |
}
|
|
|
161 |
}
|
app/Entities/NavMenu/NavMenuTrashActions.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\NavMenu;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
@@ -9,7 +8,6 @@ use NestedPages\Entities\NavMenu\NavMenuRepository;
|
|
9 |
*/
|
10 |
class NavMenuTrashActions
|
11 |
{
|
12 |
-
|
13 |
/**
|
14 |
* Nav Menu Repository
|
15 |
*/
|
@@ -42,5 +40,4 @@ class NavMenuTrashActions
|
|
42 |
|
43 |
}
|
44 |
}
|
45 |
-
|
46 |
}
|
1 |
+
<?php
|
|
|
2 |
namespace NestedPages\Entities\NavMenu;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuRepository;
|
8 |
*/
|
9 |
class NavMenuTrashActions
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Nav Menu Repository
|
13 |
*/
|
40 |
|
41 |
}
|
42 |
}
|
|
|
43 |
}
|
app/Entities/PluginIntegration/AdvancedCustomFields.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\PluginIntegration;
|
4 |
|
5 |
/**
|
@@ -68,5 +67,4 @@ class AdvancedCustomFields
|
|
68 |
}
|
69 |
return $all_fields;
|
70 |
}
|
71 |
-
|
72 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\PluginIntegration;
|
3 |
|
4 |
/**
|
67 |
}
|
68 |
return $all_fields;
|
69 |
}
|
|
|
70 |
}
|
app/Entities/PluginIntegration/EditorialAccessManager.php
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\PluginIntegration;
|
4 |
|
5 |
/**
|
6 |
* Editorial Access Manager Integration
|
7 |
* @link https://wordpress.org/plugins/editorial-access-manager/
|
8 |
*/
|
9 |
-
|
10 |
class EditorialAccessManager
|
11 |
{
|
12 |
/**
|
@@ -20,7 +18,6 @@ class EditorialAccessManager
|
|
20 |
*/
|
21 |
private $user;
|
22 |
|
23 |
-
|
24 |
public function __construct()
|
25 |
{
|
26 |
add_action( 'init', array( $this, 'init' ) );
|
@@ -70,5 +67,4 @@ class EditorialAccessManager
|
|
70 |
if ( in_array('administrator', $this->user->roles) ) return true;
|
71 |
return false;
|
72 |
}
|
73 |
-
|
74 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\PluginIntegration;
|
3 |
|
4 |
/**
|
5 |
* Editorial Access Manager Integration
|
6 |
* @link https://wordpress.org/plugins/editorial-access-manager/
|
7 |
*/
|
|
|
8 |
class EditorialAccessManager
|
9 |
{
|
10 |
/**
|
18 |
*/
|
19 |
private $user;
|
20 |
|
|
|
21 |
public function __construct()
|
22 |
{
|
23 |
add_action( 'init', array( $this, 'init' ) );
|
67 |
if ( in_array('administrator', $this->user->roles) ) return true;
|
68 |
return false;
|
69 |
}
|
|
|
70 |
}
|
app/Entities/PluginIntegration/IntegrationFactory.php
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\PluginIntegration;
|
4 |
|
5 |
use NestedPages\Entities\PluginIntegration\EditorialAccessManager;
|
6 |
use NestedPages\Entities\PluginIntegration\AdvancedCustomFields;
|
7 |
use NestedPages\Entities\PluginIntegration\YoastSeo;
|
|
|
8 |
|
9 |
class IntegrationFactory
|
10 |
{
|
11 |
-
|
12 |
/**
|
13 |
* Integration Classes
|
14 |
*/
|
@@ -26,6 +25,6 @@ class IntegrationFactory
|
|
26 |
$this->plugins->editorial_access_manager = new EditorialAccessManager;
|
27 |
$this->plugins->acf = new AdvancedCustomFields;
|
28 |
$this->plugins->yoast = new YoastSeo;
|
|
|
29 |
}
|
30 |
-
|
31 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\PluginIntegration;
|
3 |
|
4 |
use NestedPages\Entities\PluginIntegration\EditorialAccessManager;
|
5 |
use NestedPages\Entities\PluginIntegration\AdvancedCustomFields;
|
6 |
use NestedPages\Entities\PluginIntegration\YoastSeo;
|
7 |
+
use NestedPages\Entities\PluginIntegration\WPML;
|
8 |
|
9 |
class IntegrationFactory
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Integration Classes
|
13 |
*/
|
25 |
$this->plugins->editorial_access_manager = new EditorialAccessManager;
|
26 |
$this->plugins->acf = new AdvancedCustomFields;
|
27 |
$this->plugins->yoast = new YoastSeo;
|
28 |
+
$this->plugins->wpml = new WPML;
|
29 |
}
|
|
|
30 |
}
|
app/Entities/PluginIntegration/WPML.php
ADDED
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace NestedPages\Entities\PluginIntegration;
|
3 |
+
|
4 |
+
use NestedPages\Entities\Post\PostRepository;
|
5 |
+
|
6 |
+
/**
|
7 |
+
* WPML Integration
|
8 |
+
* @link https://wpml.org/
|
9 |
+
*/
|
10 |
+
class WPML
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Installed
|
14 |
+
* @var boolean
|
15 |
+
*/
|
16 |
+
public $installed = false;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Global Sitepress object
|
20 |
+
*/
|
21 |
+
private $sitepress;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* WPML Settings
|
25 |
+
*/
|
26 |
+
private $settings;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Post Repository
|
30 |
+
*/
|
31 |
+
private $post_repo;
|
32 |
+
|
33 |
+
public function __construct()
|
34 |
+
{
|
35 |
+
if ( defined('ICL_SITEPRESS_VERSION') ){
|
36 |
+
$this->installed = true;
|
37 |
+
global $sitepress;
|
38 |
+
$this->sitepress = $sitepress;
|
39 |
+
$this->settings = get_option('icl_sitepress_settings');
|
40 |
+
$this->post_repo = new PostRepository;
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the current language
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getCurrentLanguage($return_type = 'code')
|
50 |
+
{
|
51 |
+
if ( $return_type == 'code' ) return ICL_LANGUAGE_CODE;
|
52 |
+
if ( $return_type == 'name' ) return ICL_LANGUAGE_NAME;
|
53 |
+
if ( $return_type == 'name_en' ) return ICL_LANGUAGE_NAME_EN;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get all available languages
|
58 |
+
* @return array
|
59 |
+
*/
|
60 |
+
public function getLanguages()
|
61 |
+
{
|
62 |
+
return icl_get_languages();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get the default language
|
67 |
+
* @return array
|
68 |
+
*/
|
69 |
+
public function getDefaultLanguage()
|
70 |
+
{
|
71 |
+
return $this->sitepress->get_default_language();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get a single language
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
public function getSingleLanguage($language = 'en')
|
79 |
+
{
|
80 |
+
$languages = $this->getLanguages();
|
81 |
+
return ( array_key_exists($language, $languages) ) ? $languages[$language] : array();
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Is the default language currently being shown
|
86 |
+
* @return boolean
|
87 |
+
*/
|
88 |
+
public function isDefaultLanguage()
|
89 |
+
{
|
90 |
+
return ( $this->getCurrentLanguage() == $this->getDefaultLanguage() ) ? true : false;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Get all translations for a post
|
95 |
+
* @return array or int
|
96 |
+
*/
|
97 |
+
public function getAllTranslations($post_id, $return = 'array')
|
98 |
+
{
|
99 |
+
if ( !$post_id && $return == 'array' ) return array();
|
100 |
+
if ( !$post_id && $return == 'count' ) return 0;
|
101 |
+
$true_id = $this->sitepress->get_element_trid($post_id);
|
102 |
+
if ( $return == 'array' ) return $this->sitepress->get_element_translations($true_id);
|
103 |
+
if ( $return == 'count' ) return count($this->sitepress->get_element_translations($true_id));
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Get the primary language post ID for a provided child id
|
108 |
+
* @param int
|
109 |
+
* @return int - post id
|
110 |
+
*/
|
111 |
+
public function getPrimaryLanguagePost($post_id)
|
112 |
+
{
|
113 |
+
$all_translations = $this->getAllTranslations($post_id);
|
114 |
+
foreach ( $all_translations as $translation ){
|
115 |
+
if ( $translation->language_code == $this->getDefaultLanguage() ) return $translation->element_id;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Sync Post Order among translations
|
121 |
+
* @param array of posts with children
|
122 |
+
*/
|
123 |
+
public function syncPostOrder($posts)
|
124 |
+
{
|
125 |
+
if ( $this->settings['sync_page_ordering'] !== 1 ) return;
|
126 |
+
global $wpdb;
|
127 |
+
if ( !is_array($posts) ) return;
|
128 |
+
foreach ( $posts as $order => $post ) :
|
129 |
+
$translations = $this->getAllTranslations($post['id']);
|
130 |
+
foreach ( $translations as $lang_code => $post_info ) :
|
131 |
+
$post_id = $post_info->element_id;
|
132 |
+
$query = "UPDATE $wpdb->posts SET menu_order = '$order' WHERE ID = '$post_id'";
|
133 |
+
$wpdb->query( $query );
|
134 |
+
endforeach;
|
135 |
+
if ( isset($post['children']) ) $this->syncPostOrder($post['children']);
|
136 |
+
endforeach;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Output the sync menus button
|
141 |
+
* @return html
|
142 |
+
*/
|
143 |
+
public function syncMenusButton()
|
144 |
+
{
|
145 |
+
$url = esc_url(admin_url('admin.php?page=sitepress-multilingual-cms/menu/menu-sync/menus-sync.php'));
|
146 |
+
return '<a href="' . $url . '" class="np-btn">' . __('Sync WPML Menus', 'wp-nested-pages') . '</a>';
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get the Translated IDs of an array of post IDs
|
151 |
+
* @param array $post_ids
|
152 |
+
* @return array of post ids
|
153 |
+
*/
|
154 |
+
public function getAllTranslatedIds($post_ids)
|
155 |
+
{
|
156 |
+
if ( !is_array($post_ids) ) return array();
|
157 |
+
foreach ( $post_ids as $id ){
|
158 |
+
$translations = $this->getAllTranslations($id);
|
159 |
+
if ( empty($translations) ) continue;
|
160 |
+
foreach ( $translations as $lang => $post ){
|
161 |
+
if ( $post->element_id == $id ) continue;
|
162 |
+
array_push($post_ids, $post->element_id);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
return $post_ids;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Get the number of translated posts for a post type
|
170 |
+
*/
|
171 |
+
public function translatedPostCount($language_code = '', $post_type = '')
|
172 |
+
{
|
173 |
+
global $wpdb;
|
174 |
+
|
175 |
+
$default_language_code = $this->getDefaultLanguage();
|
176 |
+
$post_type = 'post_' . $post_type;
|
177 |
+
|
178 |
+
$query = $wpdb->prepare("SELECT COUNT( {$wpdb->prefix}posts.ID ) FROM {$wpdb->prefix}posts LEFT JOIN {$wpdb->prefix}icl_translations ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}icl_translations.element_id WHERE {$wpdb->prefix}icl_translations.language_code = '%s' AND {$wpdb->prefix}icl_translations.source_language_code = '%s' AND {$wpdb->prefix}icl_translations.element_type = '%s'", $language_code, $default_language_code, $post_type);
|
179 |
+
|
180 |
+
return $wpdb->get_var( $query );
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Get the number of default language posts for a post type
|
185 |
+
*/
|
186 |
+
public function defaultPostCount($post_type = '')
|
187 |
+
{
|
188 |
+
global $wpdb;
|
189 |
+
$default_language_code = $this->getDefaultLanguage();
|
190 |
+
$query = $wpdb->prepare("SELECT COUNT(p.ID) FROM {$wpdb->prefix}posts AS p LEFT JOIN {$wpdb->prefix}icl_translations AS t ON t.element_id = p.ID WHERE p.post_type = '%s' AND p.post_status = 'publish' AND t.language_code = '%s'", $post_type, $default_language_code);
|
191 |
+
return $wpdb->get_var( $query );
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Output a list of language links in the tools section of the listing head
|
196 |
+
* @param string $post_type
|
197 |
+
* @return string html
|
198 |
+
* @example English (2) | German (1) | Spanish (0)
|
199 |
+
*/
|
200 |
+
public function languageToolLinks($post_type)
|
201 |
+
{
|
202 |
+
$html = '<ul class="subsubsub" style="clear:both;">';
|
203 |
+
$c = 1;
|
204 |
+
$languages = $this->getLanguages();
|
205 |
+
foreach ( $languages as $lang_code => $lang ){
|
206 |
+
$translated_language = $this->getTranslatedLanguageName($this->getDefaultLanguage(), $lang_code);
|
207 |
+
if ( !$translated_language ) continue;
|
208 |
+
$post_count = ( $lang_code == $this->getDefaultLanguage() )
|
209 |
+
? $this->defaultPostCount($post_type)
|
210 |
+
: $this->translatedPostCount($lang_code, $post_type);
|
211 |
+
$html .= '<li>';
|
212 |
+
if ( $c > 1 ) $html .= '| ';
|
213 |
+
if ( $lang['active'] ) $html .= '<strong>';
|
214 |
+
if ( $post_count > 0 ) $html .= '<a href="' . $this->getLanguageFilteredLink($lang_code, $post_type) . '">';
|
215 |
+
$html .= $translated_language . ' ';
|
216 |
+
if ( $lang_code !== $this->getDefaultLanguage() ) $html .= '(' . $post_count . ')';
|
217 |
+
if ( $lang_code == $this->getDefaultLanguage() ) $html .= '(' . $post_count . ')';
|
218 |
+
if ( $lang['active'] ) $html .= '</strong>';
|
219 |
+
if ( $post_count > 0 ) $html .= '</a>';
|
220 |
+
$html .= ' </li>';
|
221 |
+
$c++;
|
222 |
+
}
|
223 |
+
$html .= '<li>| <a href="' . $this->getLanguageFilteredLink('all', $post_type) . '">' . __('All Languages', 'wp-nested-pages') . '</a></li>';
|
224 |
+
$html .= '</ul>';
|
225 |
+
return $html;
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Get the Links to a filtered language
|
230 |
+
*/
|
231 |
+
public function getLanguageFilteredLink($language, $post_type)
|
232 |
+
{
|
233 |
+
$url = 'admin.php?page=nestedpages';
|
234 |
+
if ( $post_type !== 'page' ) $url .= '-' . $post_type;
|
235 |
+
$url .= '&lang=' . $language;
|
236 |
+
return esc_url(admin_url($url));
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Get a translated language name for a given language
|
241 |
+
* @param string $translated_language - the language to return as
|
242 |
+
* @param string $target_language - the language to translate
|
243 |
+
* @return string - translated name of language (ex: if default is english, and target is spanish, will return "Spanish" rather than "Espanol")
|
244 |
+
*/
|
245 |
+
public function getTranslatedLanguageName($translated_language, $target_language)
|
246 |
+
{
|
247 |
+
global $wpdb;
|
248 |
+
$query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}icl_languages_translations WHERE language_code = '%s' AND display_language_code = '%s'", $target_language, $translated_language);
|
249 |
+
$results = $wpdb->get_results( $query );
|
250 |
+
return ( $results[0]->name ) ? $results[0]->name : null;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Sync fields across all langauges
|
255 |
+
*/
|
256 |
+
public function syncPosts($post_id)
|
257 |
+
{
|
258 |
+
$all_translations = $this->getAllTranslations($post_id);
|
259 |
+
$source_template = get_post_meta($post_id, '_wp_page_template', true);
|
260 |
+
$source_post = get_post($post_id);
|
261 |
+
$sticky_flag = ( $this->settings['sync_sticky_flag'] ) ? get_option('sticky_posts') : array();
|
262 |
+
foreach ( $all_translations as $translation ) :
|
263 |
+
if ( $translation->element_id == $post_id ) continue;
|
264 |
+
if ( $this->settings['sync_page_template'] && $source_template ){
|
265 |
+
update_post_meta(
|
266 |
+
$translation->element_id,
|
267 |
+
'_wp_page_template',
|
268 |
+
$source_template
|
269 |
+
);
|
270 |
+
}
|
271 |
+
$update_args = array();
|
272 |
+
if ( $this->settings['sync_comment_status'] ) $update_args['comment_status'] = $source_post->comment_status;
|
273 |
+
if ( $this->settings['sync_post_date'] ) $update_args['post_date'] = $source_post->post_date;
|
274 |
+
if ( $this->settings['sync_post_date'] ) $update_args['post_date_gmt'] = $source_post->post_date_gmt;
|
275 |
+
if ( $this->settings['sync_ping_status'] ) $update_args['post_status'] = $source_post->post_status;
|
276 |
+
if ( $this->settings['sync_password'] ) $update_args['post_password'] = $source_post->post_password;
|
277 |
+
if ( $this->settings['sync_private_flag'] ) $update_args['post_status'] = $source_post->post_status;
|
278 |
+
if ( $this->settings['sync_post_taxonomies'] ) $this->syncTaxonomies($post_id);
|
279 |
+
endforeach;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Sync Taxonomies across all languages
|
284 |
+
*/
|
285 |
+
public function syncTaxonomies($source_post_id)
|
286 |
+
{
|
287 |
+
global $wpdb;
|
288 |
+
$all_translations = $this->getAllTranslations($source_post_id);
|
289 |
+
$terms = $this->post_repo->getAllTerms($source_post_id);
|
290 |
+
$translated_terms = array();
|
291 |
+
|
292 |
+
// Get all translations for the terms
|
293 |
+
foreach ( $terms as $term ){
|
294 |
+
if ( $term->tax_name == 'language' ) continue;
|
295 |
+
$query = "SELECT trid FROM {$wpdb->prefix}icl_translations WHERE element_id = $term->term_id AND element_type LIKE 'tax_%'";
|
296 |
+
$trid = $wpdb->get_var($query);
|
297 |
+
if ( !$trid ) continue;
|
298 |
+
$translated_terms[] = $this->getTermTranslations($trid);
|
299 |
+
if ( !$translated_terms ) continue;
|
300 |
+
}
|
301 |
+
|
302 |
+
foreach ( $all_translations as $translation ) :
|
303 |
+
if ( $translation->element_id == $source_post_id ) continue;
|
304 |
+
if ( !$terms ) continue;
|
305 |
+
|
306 |
+
// Build the array of terms to sync
|
307 |
+
foreach ( $translated_terms as $term_translations ) :
|
308 |
+
foreach ( $term_translations as $trans ) :
|
309 |
+
$taxonomy = get_taxonomy($trans->taxonomy);
|
310 |
+
$tax_hierarchical = $taxonomy->hierarchical;
|
311 |
+
if ( $trans->language_code == $translation->language_code ) {
|
312 |
+
$translation->terms[$trans->taxonomy][] = ($tax_hierarchical) ? $trans->term_id : $trans->name;
|
313 |
+
}
|
314 |
+
endforeach;
|
315 |
+
endforeach;
|
316 |
+
|
317 |
+
if ( !is_array($translation->terms) ) continue;
|
318 |
+
foreach ( $translation->terms as $taxonomy => $terms ) :
|
319 |
+
wp_set_post_terms($translation->element_id, $terms, $taxonomy, false);
|
320 |
+
endforeach;
|
321 |
+
endforeach;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Get all the translations for a term
|
326 |
+
*/
|
327 |
+
public function getTermTranslations($trid)
|
328 |
+
{
|
329 |
+
global $wpdb;
|
330 |
+
return $wpdb->get_results($wpdb->prepare("SELECT iclt.language_code, t.term_id, t.name, t.slug, tt.taxonomy FROM {$wpdb->prefix}icl_translations AS iclt LEFT JOIN {$wpdb->prefix}terms AS t ON t.term_id = iclt.element_id LEFT JOIN {$wpdb->prefix}term_taxonomy AS tt ON tt.term_id = t.term_id WHERE trid = %s", $trid));
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Get the count of published posts for a post type in a specific language
|
335 |
+
* @param $post_type string – post type name
|
336 |
+
* @param $language string - language code
|
337 |
+
*/
|
338 |
+
public function getPostTypeCountByLanguage($post_type, $language = null)
|
339 |
+
{
|
340 |
+
if ( !$language ) $language = $this->getCurrentLanguage();
|
341 |
+
global $wpdb;
|
342 |
+
$query = $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}posts AS p LEFT JOIN {$wpdb->prefix}icl_translations AS trans ON p.ID = trans.element_id WHERE post_type = %s AND p.post_status = 'publish' AND trans.language_code = %s", $post_type, $language);
|
343 |
+
return $wpdb->get_var($query);
|
344 |
+
}
|
345 |
+
}
|
app/Entities/PluginIntegration/YoastSeo.php
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\PluginIntegration;
|
4 |
|
5 |
/**
|
6 |
* Yoast SEO Integration
|
7 |
* @link https://wordpress.org/plugins/wordpress-seo/
|
8 |
*/
|
9 |
-
|
10 |
class YoastSeo
|
11 |
{
|
12 |
/**
|
@@ -33,5 +31,4 @@ class YoastSeo
|
|
33 |
return 'noindex';
|
34 |
}
|
35 |
}
|
36 |
-
|
37 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\PluginIntegration;
|
3 |
|
4 |
/**
|
5 |
* Yoast SEO Integration
|
6 |
* @link https://wordpress.org/plugins/wordpress-seo/
|
7 |
*/
|
|
|
8 |
class YoastSeo
|
9 |
{
|
10 |
/**
|
31 |
return 'noindex';
|
32 |
}
|
33 |
}
|
|
|
34 |
}
|
app/Entities/Post/PostCloner.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Post;
|
4 |
|
5 |
class PostCloner
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Post;
|
3 |
|
4 |
class PostCloner
|
app/Entities/Post/PostDataFactory.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Post;
|
|
|
4 |
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
5 |
|
6 |
/**
|
@@ -8,7 +8,6 @@ use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
|
8 |
*/
|
9 |
class PostDataFactory
|
10 |
{
|
11 |
-
|
12 |
/**
|
13 |
* Post Data
|
14 |
* @var object
|
@@ -24,7 +23,7 @@ class PostDataFactory
|
|
24 |
/**
|
25 |
* Build the Object
|
26 |
*/
|
27 |
-
public function build($post)
|
28 |
{
|
29 |
$this->integrations = new IntegrationFactory;
|
30 |
$this->post_data = new \stdClass();
|
@@ -33,6 +32,7 @@ class PostDataFactory
|
|
33 |
$this->addOriginalLink($post);
|
34 |
$this->addDate($post);
|
35 |
$this->author($post);
|
|
|
36 |
return $this->post_data;
|
37 |
}
|
38 |
|
@@ -124,4 +124,25 @@ class PostDataFactory
|
|
124 |
$this->post_data->author_link = admin_url('edit.php?post_type=' . $post->post_type . '&author=' . $post->post_author);
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Post;
|
3 |
+
|
4 |
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
5 |
|
6 |
/**
|
8 |
*/
|
9 |
class PostDataFactory
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Post Data
|
13 |
* @var object
|
23 |
/**
|
24 |
* Build the Object
|
25 |
*/
|
26 |
+
public function build($post, $h_taxonomies = null, $f_taxonomies = null)
|
27 |
{
|
28 |
$this->integrations = new IntegrationFactory;
|
29 |
$this->post_data = new \stdClass();
|
32 |
$this->addOriginalLink($post);
|
33 |
$this->addDate($post);
|
34 |
$this->author($post);
|
35 |
+
if ( $h_taxonomies || $f_taxonomies ) $this->addTaxonomies($post, $h_taxonomies, $f_taxonomies);
|
36 |
return $this->post_data;
|
37 |
}
|
38 |
|
124 |
$this->post_data->author_link = admin_url('edit.php?post_type=' . $post->post_type . '&author=' . $post->post_author);
|
125 |
}
|
126 |
|
127 |
+
/**
|
128 |
+
* Add taxonomies
|
129 |
+
*/
|
130 |
+
public function addTaxonomies($post, $h_taxonomies, $f_taxonomies)
|
131 |
+
{
|
132 |
+
// Add taxonomies
|
133 |
+
if ( count($h_taxonomies) > 0 ) {
|
134 |
+
foreach($h_taxonomies as $tax){
|
135 |
+
$taxname = $tax->name;
|
136 |
+
if ( !isset($post->$taxname) ) continue;
|
137 |
+
$this->post_data->$taxname = explode(',', $post->$taxname);
|
138 |
+
}
|
139 |
+
}
|
140 |
+
if ( count($f_taxonomies) > 0 ) {
|
141 |
+
foreach($f_taxonomies as $tax){
|
142 |
+
$taxname = $tax->name;
|
143 |
+
if ( !isset($post->$taxname) ) continue;
|
144 |
+
$this->post_data->$taxname = explode(',', $post->$taxname);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
}
|
app/Entities/Post/PostFactory.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Post;
|
4 |
|
5 |
use NestedPages\Entities\Post\PostRepository;
|
@@ -10,7 +9,6 @@ use NestedPages\Entities\Post\PostUpdateRepository;
|
|
10 |
*/
|
11 |
class PostFactory
|
12 |
{
|
13 |
-
|
14 |
/**
|
15 |
* Post Repository
|
16 |
* @var object
|
@@ -67,5 +65,4 @@ class PostFactory
|
|
67 |
$new_posts = $this->post_repo->postArray($this->new_ids, $post_type);
|
68 |
return $new_posts;
|
69 |
}
|
70 |
-
|
71 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Post;
|
3 |
|
4 |
use NestedPages\Entities\Post\PostRepository;
|
9 |
*/
|
10 |
class PostFactory
|
11 |
{
|
|
|
12 |
/**
|
13 |
* Post Repository
|
14 |
* @var object
|
65 |
$new_posts = $this->post_repo->postArray($this->new_ids, $post_type);
|
66 |
return $new_posts;
|
67 |
}
|
|
|
68 |
}
|
app/Entities/Post/PostRepository.php
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Post;
|
4 |
|
5 |
class PostRepository
|
6 |
{
|
7 |
-
|
8 |
/**
|
9 |
* Get count of hidden posts
|
10 |
* @since 1.1.4
|
@@ -45,20 +43,33 @@ class PostRepository
|
|
45 |
|
46 |
/**
|
47 |
* Return css class string of taxonomies
|
48 |
-
* @param
|
49 |
* @return string
|
50 |
*/
|
51 |
-
public function getTaxonomyCSS($
|
52 |
{
|
53 |
-
$out = '';
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
foreach ( $terms as $term ){
|
58 |
-
$out .=
|
59 |
-
$out .= $taxonomy->name;
|
60 |
-
$out .= ( $hierarchical ) ? '-' : '-nps-';
|
61 |
-
$out .= $term->term_id . ' ';
|
62 |
}
|
63 |
}
|
64 |
}
|
@@ -148,4 +159,13 @@ class PostRepository
|
|
148 |
return false;
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Post;
|
3 |
|
4 |
class PostRepository
|
5 |
{
|
|
|
6 |
/**
|
7 |
* Get count of hidden posts
|
8 |
* @since 1.1.4
|
43 |
|
44 |
/**
|
45 |
* Return css class string of taxonomies
|
46 |
+
* @param object post object with taxonomies added
|
47 |
* @return string
|
48 |
*/
|
49 |
+
public function getTaxonomyCSS($post, $h_taxonomies = array(), $f_taxonomies = array())
|
50 |
{
|
51 |
+
$out = ' ';
|
52 |
+
|
53 |
+
// Build Hierarchical string
|
54 |
+
if ( count($h_taxonomies) > 0 ) {
|
55 |
+
foreach ( $h_taxonomies as $taxonomy ){
|
56 |
+
$taxname = $taxonomy->name;
|
57 |
+
if ( !isset($post->$taxname) ) continue;
|
58 |
+
$terms = $post->$taxname;
|
59 |
+
foreach ( $terms as $term ){
|
60 |
+
$out .= 'in-' . $taxonomy->name . '-' . $term . ' ';
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
// Build Non-Hierarchical string
|
66 |
+
if ( count($f_taxonomies) > 0 ) {
|
67 |
+
foreach ( $f_taxonomies as $taxonomy ){
|
68 |
+
$taxname = $taxonomy->name;
|
69 |
+
if ( !isset($post->$taxname) ) continue;
|
70 |
+
$terms = $post->$taxname;
|
71 |
foreach ( $terms as $term ){
|
72 |
+
$out .= 'inf-' . $taxonomy->name . '-nps-' . $term . ' ';
|
|
|
|
|
|
|
73 |
}
|
74 |
}
|
75 |
}
|
159 |
return false;
|
160 |
}
|
161 |
|
162 |
+
/**
|
163 |
+
* Get all terms for a post
|
164 |
+
*/
|
165 |
+
public function getAllTerms($post_id)
|
166 |
+
{
|
167 |
+
global $wpdb;
|
168 |
+
$query = $wpdb->prepare("SELECT p.post_title, tr.term_taxonomy_id AS tax_id, t.slug AS term_name, tt.taxonomy AS tax_name, tt.term_id AS term_id FROM {$wpdb->prefix}posts AS p LEFT JOIN {$wpdb->prefix}term_relationships AS tr ON tr.object_id = p.ID LEFT JOIN {$wpdb->prefix}terms AS t ON t.term_id = tr.term_taxonomy_id LEFT JOIN {$wpdb->prefix}term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id WHERE p.ID = %s", $post_id);
|
169 |
+
return $wpdb->get_results($query);
|
170 |
+
}
|
171 |
}
|
app/Entities/Post/PostTrashActions.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Post;
|
4 |
|
5 |
use NestedPages\Entities\User\UserRepository;
|
@@ -12,7 +11,6 @@ use NestedPages\Entities\NavMenu\NavMenuRepository;
|
|
12 |
*/
|
13 |
class PostTrashActions
|
14 |
{
|
15 |
-
|
16 |
/**
|
17 |
* User Repository
|
18 |
* @var object
|
@@ -24,7 +22,6 @@ class PostTrashActions
|
|
24 |
*/
|
25 |
private $nav_menu_repo;
|
26 |
|
27 |
-
|
28 |
public function __construct()
|
29 |
{
|
30 |
$this->user_repo = new UserRepository;
|
@@ -94,5 +91,4 @@ class PostTrashActions
|
|
94 |
|
95 |
$this->user_repo->updateVisiblePages($post_type, $visible_pages);
|
96 |
}
|
97 |
-
|
98 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Post;
|
3 |
|
4 |
use NestedPages\Entities\User\UserRepository;
|
11 |
*/
|
12 |
class PostTrashActions
|
13 |
{
|
|
|
14 |
/**
|
15 |
* User Repository
|
16 |
* @var object
|
22 |
*/
|
23 |
private $nav_menu_repo;
|
24 |
|
|
|
25 |
public function __construct()
|
26 |
{
|
27 |
$this->user_repo = new UserRepository;
|
91 |
|
92 |
$this->user_repo->updateVisiblePages($post_type, $visible_pages);
|
93 |
}
|
|
|
94 |
}
|
app/Entities/Post/PostUpdateRepository.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\Post;
|
4 |
|
5 |
use NestedPages\Form\Validation\Validation;
|
@@ -11,7 +10,6 @@ use NestedPages\Entities\PostType\PostTypeRepository;
|
|
11 |
*/
|
12 |
class PostUpdateRepository
|
13 |
{
|
14 |
-
|
15 |
/**
|
16 |
* Validation Class
|
17 |
* @var object NP_Validation
|
@@ -34,7 +32,6 @@ class PostUpdateRepository
|
|
34 |
*/
|
35 |
protected $new_id;
|
36 |
|
37 |
-
|
38 |
public function __construct()
|
39 |
{
|
40 |
$this->validation = new Validation;
|
@@ -125,6 +122,7 @@ class PostUpdateRepository
|
|
125 |
|
126 |
wp_update_post($updated_post);
|
127 |
|
|
|
128 |
$this->updateTemplate($data);
|
129 |
$this->updateNestedPagesStatus($data);
|
130 |
|
@@ -328,6 +326,24 @@ class PostUpdateRepository
|
|
328 |
);
|
329 |
}
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
/**
|
332 |
* Update Menu Related Meta
|
333 |
* @since 1.4.1
|
@@ -429,5 +445,4 @@ class PostUpdateRepository
|
|
429 |
$this->updateNavCSS($data);
|
430 |
}
|
431 |
}
|
432 |
-
|
433 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\Post;
|
3 |
|
4 |
use NestedPages\Form\Validation\Validation;
|
10 |
*/
|
11 |
class PostUpdateRepository
|
12 |
{
|
|
|
13 |
/**
|
14 |
* Validation Class
|
15 |
* @var object NP_Validation
|
32 |
*/
|
33 |
protected $new_id;
|
34 |
|
|
|
35 |
public function __construct()
|
36 |
{
|
37 |
$this->validation = new Validation;
|
122 |
|
123 |
wp_update_post($updated_post);
|
124 |
|
125 |
+
$this->updateSticky($data);
|
126 |
$this->updateTemplate($data);
|
127 |
$this->updateNestedPagesStatus($data);
|
128 |
|
326 |
);
|
327 |
}
|
328 |
|
329 |
+
/*
|
330 |
+
* Update Sticky Posts
|
331 |
+
* @since 2.0.1
|
332 |
+
* @param array data
|
333 |
+
*/
|
334 |
+
private function updateSticky($data)
|
335 |
+
{
|
336 |
+
if ( $this->post_type_repo->standardFieldDisabled('sticky', sanitize_text_field($data['post_type'])) ) return;
|
337 |
+
$sticky_posts = get_option('sticky_posts');
|
338 |
+
if ( isset($data['sticky']) ){
|
339 |
+
$sticky_posts[] = $data['post_id'];
|
340 |
+
update_option('sticky_posts', $sticky_posts);
|
341 |
+
return;
|
342 |
+
}
|
343 |
+
if ( ($key = array_search(intval($data['sticky']), $sticky_posts) ) !== false) unset($sticky_posts[$key]);
|
344 |
+
update_option('sticky_posts', $sticky_posts);
|
345 |
+
}
|
346 |
+
|
347 |
/**
|
348 |
* Update Menu Related Meta
|
349 |
* @since 1.4.1
|
445 |
$this->updateNavCSS($data);
|
446 |
}
|
447 |
}
|
|
|
448 |
}
|
app/Entities/PostType/PostTypeRepository.php
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\PostType;
|
4 |
|
5 |
class PostTypeRepository
|
6 |
{
|
7 |
-
|
8 |
/**
|
9 |
* Enabled Post Types
|
10 |
* @var array – the posttype setting
|
@@ -80,6 +78,7 @@ class PostTypeRepository
|
|
80 |
$post_types[$type->name]->page_assignment = $this->configuredFields($type->name, 'post_type_page_assignment');
|
81 |
$post_types[$type->name]->page_assignment_id = $this->configuredFields($type->name, 'post_type_page_assignment_page_id');
|
82 |
$post_types[$type->name]->page_assignment_title = $this->configuredFields($type->name, 'post_type_page_assignment_page_title');
|
|
|
83 |
}
|
84 |
return $post_types;
|
85 |
}
|
@@ -155,6 +154,37 @@ class PostTypeRepository
|
|
155 |
return $enabled;
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
/**
|
159 |
* Are Thumbnails enabled for this post type? If not, return false, if so, return the thumbnail size
|
160 |
* @param $post_type - post type name
|
@@ -383,5 +413,4 @@ class PostTypeRepository
|
|
383 |
}
|
384 |
return $array;
|
385 |
}
|
386 |
-
|
387 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\PostType;
|
3 |
|
4 |
class PostTypeRepository
|
5 |
{
|
|
|
6 |
/**
|
7 |
* Enabled Post Types
|
8 |
* @var array – the posttype setting
|
78 |
$post_types[$type->name]->page_assignment = $this->configuredFields($type->name, 'post_type_page_assignment');
|
79 |
$post_types[$type->name]->page_assignment_id = $this->configuredFields($type->name, 'post_type_page_assignment_page_id');
|
80 |
$post_types[$type->name]->page_assignment_title = $this->configuredFields($type->name, 'post_type_page_assignment_page_title');
|
81 |
+
$post_types[$type->name]->sort_options = $this->configuredFields($type->name, 'sort_options');
|
82 |
}
|
83 |
return $post_types;
|
84 |
}
|
154 |
return $enabled;
|
155 |
}
|
156 |
|
157 |
+
/**
|
158 |
+
* Is a sort option enabled?
|
159 |
+
* @param $post_type - post type name
|
160 |
+
* @param $sort_option - option to search for
|
161 |
+
* @param $taxonomy - boolean, is the sort option a taxonomy name
|
162 |
+
* @return boolean
|
163 |
+
*/
|
164 |
+
public function sortOptionEnabled($post_type, $sort_option, $taxonomy = false)
|
165 |
+
{
|
166 |
+
$enabled = false;
|
167 |
+
$options = $this->configuredFields($post_type, 'sort_options');
|
168 |
+
if ( !is_array($options) ) return $enabled;
|
169 |
+
if ( empty($options) ) return $enabled;
|
170 |
+
foreach ( $options as $option => $value ){
|
171 |
+
if ( $option == $sort_option && $value == 'true' ) $enabled = true;
|
172 |
+
}
|
173 |
+
if ( $taxonomy && !isset($options['taxonomies']) ) $enabled = false;
|
174 |
+
if ( $taxonomy && isset($options['taxonomies'][$sort_option]) && $options['taxonomies'][$sort_option] == 'true' ) $enabled = true;
|
175 |
+
return $enabled;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Does the post type have any sort options
|
180 |
+
* @return boolean
|
181 |
+
*/
|
182 |
+
public function hasSortOptions($post_type)
|
183 |
+
{
|
184 |
+
$options = $this->configuredFields($post_type, 'sort_options');
|
185 |
+
return ( empty($options) ) ? false : true;
|
186 |
+
}
|
187 |
+
|
188 |
/**
|
189 |
* Are Thumbnails enabled for this post type? If not, return false, if so, return the thumbnail size
|
190 |
* @param $post_type - post type name
|
413 |
}
|
414 |
return $array;
|
415 |
}
|
|
|
416 |
}
|
app/Entities/PostType/RegisterPostTypes.php
CHANGED
@@ -1,15 +1,22 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\PostType;
|
4 |
|
|
|
|
|
5 |
/**
|
6 |
* Post Types required by Nested Pages
|
7 |
*/
|
8 |
class RegisterPostTypes
|
9 |
{
|
|
|
|
|
|
|
|
|
10 |
|
11 |
public function __construct()
|
12 |
{
|
|
|
|
|
13 |
add_action( 'init', array( $this, 'registerRedirects') );
|
14 |
}
|
15 |
|
@@ -39,5 +46,4 @@ class RegisterPostTypes
|
|
39 |
);
|
40 |
register_post_type( 'np-redirect' , $args );
|
41 |
}
|
42 |
-
|
43 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\PostType;
|
3 |
|
4 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
5 |
+
|
6 |
/**
|
7 |
* Post Types required by Nested Pages
|
8 |
*/
|
9 |
class RegisterPostTypes
|
10 |
{
|
11 |
+
/**
|
12 |
+
* Plugin Integrations
|
13 |
+
*/
|
14 |
+
private $integrations;
|
15 |
|
16 |
public function __construct()
|
17 |
{
|
18 |
+
$this->integrations = new IntegrationFactory;
|
19 |
+
if ( $this->integrations->plugins->wpml->installed ) return;
|
20 |
add_action( 'init', array( $this, 'registerRedirects') );
|
21 |
}
|
22 |
|
46 |
);
|
47 |
register_post_type( 'np-redirect' , $args );
|
48 |
}
|
|
|
49 |
}
|
app/Entities/User/UserRepository.php
CHANGED
@@ -1,13 +1,24 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Entities\User;
|
4 |
|
|
|
|
|
5 |
/**
|
6 |
* User Repository
|
7 |
* @since 1.1.7
|
8 |
*/
|
9 |
class UserRepository
|
10 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
/**
|
13 |
* Return Current User's Roles
|
@@ -31,13 +42,13 @@ class UserRepository
|
|
31 |
* @return array
|
32 |
* @since 1.1.7
|
33 |
*/
|
34 |
-
public function allRoles()
|
35 |
{
|
36 |
global $wp_roles;
|
37 |
$all_roles = $wp_roles->roles;
|
38 |
$editable_roles = apply_filters('editable_roles', $all_roles);
|
39 |
$roles = array();
|
40 |
-
$exclude = array(
|
41 |
foreach($editable_roles as $key=>$editable_role){
|
42 |
if ( !in_array($editable_role['name'], $exclude) ){
|
43 |
$role = array(
|
@@ -50,6 +61,17 @@ class UserRepository
|
|
50 |
return $roles;
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* Can current user sort pages
|
55 |
* @return boolean
|
@@ -97,6 +119,7 @@ class UserRepository
|
|
97 |
public function updateVisiblePages($post_type, $ids)
|
98 |
{
|
99 |
$visible = $this->getVisiblePages();
|
|
|
100 |
$visible[$post_type] = $ids;
|
101 |
update_user_meta(
|
102 |
get_current_user_id(),
|
@@ -104,5 +127,4 @@ class UserRepository
|
|
104 |
serialize($visible)
|
105 |
);
|
106 |
}
|
107 |
-
|
108 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Entities\User;
|
3 |
|
4 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
5 |
+
|
6 |
/**
|
7 |
* User Repository
|
8 |
* @since 1.1.7
|
9 |
*/
|
10 |
class UserRepository
|
11 |
{
|
12 |
+
/**
|
13 |
+
* Plugin Integrations
|
14 |
+
* @var object
|
15 |
+
*/
|
16 |
+
private $integrations;
|
17 |
+
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
$this->integrations = new IntegrationFactory;
|
21 |
+
}
|
22 |
|
23 |
/**
|
24 |
* Return Current User's Roles
|
42 |
* @return array
|
43 |
* @since 1.1.7
|
44 |
*/
|
45 |
+
public function allRoles($exclude = array('Administrator', 'Contributor', 'Subscriber', 'Author') )
|
46 |
{
|
47 |
global $wp_roles;
|
48 |
$all_roles = $wp_roles->roles;
|
49 |
$editable_roles = apply_filters('editable_roles', $all_roles);
|
50 |
$roles = array();
|
51 |
+
if ( !is_array($exclude) ) $exclude = array();
|
52 |
foreach($editable_roles as $key=>$editable_role){
|
53 |
if ( !in_array($editable_role['name'], $exclude) ){
|
54 |
$role = array(
|
61 |
return $roles;
|
62 |
}
|
63 |
|
64 |
+
/**
|
65 |
+
* Get a single role
|
66 |
+
* @since 3.0
|
67 |
+
*/
|
68 |
+
public function getSingleRole($role = 'administrator')
|
69 |
+
{
|
70 |
+
global $wp_roles;
|
71 |
+
if ( isset($wp_roles->roles[$role]) ) return $wp_roles->roles[$role];
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
|
75 |
/**
|
76 |
* Can current user sort pages
|
77 |
* @return boolean
|
119 |
public function updateVisiblePages($post_type, $ids)
|
120 |
{
|
121 |
$visible = $this->getVisiblePages();
|
122 |
+
if ( $this->integrations->plugins->wpml->installed ) $ids = $this->integrations->plugins->wpml->getAllTranslatedIds($ids);
|
123 |
$visible[$post_type] = $ids;
|
124 |
update_user_meta(
|
125 |
get_current_user_id(),
|
127 |
serialize($visible)
|
128 |
);
|
129 |
}
|
130 |
+
}
|
|
app/Form/Events.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages\Form;
|
|
7 |
*/
|
8 |
class Events
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
* Actions
|
13 |
* @var array
|
@@ -48,7 +46,8 @@ class Events
|
|
48 |
'admin_post_npBulkActions',
|
49 |
'wp_ajax_npmanualMenuSync',
|
50 |
'admin_post_npBulkEdit',
|
51 |
-
'wp_ajax_nppostSearch'
|
|
|
52 |
);
|
53 |
$this->setHandlers();
|
54 |
}
|
@@ -79,5 +78,4 @@ class Events
|
|
79 |
});
|
80 |
}
|
81 |
}
|
82 |
-
|
83 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class Events
|
8 |
{
|
|
|
9 |
/**
|
10 |
* Actions
|
11 |
* @var array
|
46 |
'admin_post_npBulkActions',
|
47 |
'wp_ajax_npmanualMenuSync',
|
48 |
'admin_post_npBulkEdit',
|
49 |
+
'wp_ajax_nppostSearch',
|
50 |
+
'wp_ajax_npWpmlTranslations'
|
51 |
);
|
52 |
$this->setHandlers();
|
53 |
}
|
78 |
});
|
79 |
}
|
80 |
}
|
|
|
81 |
}
|
app/Form/Listeners/BaseHandler.php
CHANGED
@@ -1,18 +1,17 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
use NestedPages\Entities\NavMenu\NavMenuSyncListing;
|
6 |
use NestedPages\Entities\Post\PostRepository;
|
7 |
use NestedPages\Entities\Post\PostUpdateRepository;
|
8 |
use NestedPages\Entities\User\UserRepository;
|
|
|
9 |
|
10 |
/**
|
11 |
* Base Form Handler Class
|
12 |
*/
|
13 |
abstract class BaseHandler
|
14 |
{
|
15 |
-
|
16 |
/**
|
17 |
* Nonce
|
18 |
* @var string
|
@@ -48,12 +47,19 @@ abstract class BaseHandler
|
|
48 |
*/
|
49 |
protected $response;
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
public function __construct()
|
53 |
{
|
54 |
$this->post_repo = new PostRepository;
|
55 |
$this->post_update_repo = new PostUpdateRepository;
|
56 |
$this->user = new UserRepository;
|
|
|
57 |
$this->setData();
|
58 |
$this->validateNonce();
|
59 |
}
|
@@ -136,5 +142,4 @@ abstract class BaseHandler
|
|
136 |
{
|
137 |
return wp_send_json($this->response);
|
138 |
}
|
139 |
-
|
140 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
use NestedPages\Entities\NavMenu\NavMenuSyncListing;
|
5 |
use NestedPages\Entities\Post\PostRepository;
|
6 |
use NestedPages\Entities\Post\PostUpdateRepository;
|
7 |
use NestedPages\Entities\User\UserRepository;
|
8 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
9 |
|
10 |
/**
|
11 |
* Base Form Handler Class
|
12 |
*/
|
13 |
abstract class BaseHandler
|
14 |
{
|
|
|
15 |
/**
|
16 |
* Nonce
|
17 |
* @var string
|
47 |
*/
|
48 |
protected $response;
|
49 |
|
50 |
+
/**
|
51 |
+
* Plugin Integrations
|
52 |
+
* @var object;
|
53 |
+
*/
|
54 |
+
protected $integrations;
|
55 |
+
|
56 |
|
57 |
public function __construct()
|
58 |
{
|
59 |
$this->post_repo = new PostRepository;
|
60 |
$this->post_update_repo = new PostUpdateRepository;
|
61 |
$this->user = new UserRepository;
|
62 |
+
$this->integrations = new IntegrationFactory;
|
63 |
$this->setData();
|
64 |
$this->validateNonce();
|
65 |
}
|
142 |
{
|
143 |
return wp_send_json($this->response);
|
144 |
}
|
|
|
145 |
}
|
app/Form/Listeners/BulkActions.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages\Form\Listeners;
|
|
7 |
*/
|
8 |
class BulkActions
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
* URL to redirect to
|
13 |
* @var string
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class BulkActions
|
8 |
{
|
|
|
9 |
/**
|
10 |
* URL to redirect to
|
11 |
* @var string
|
app/Form/Listeners/BulkEdit.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
use NestedPages\Entities\Post\PostUpdateRepository;
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
use NestedPages\Entities\Post\PostUpdateRepository;
|
app/Form/Listeners/CategoryFilter.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages\Form\Listeners;
|
|
7 |
*/
|
8 |
class CategoryFilter
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
* URL to redirect to
|
13 |
* @var string
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class CategoryFilter
|
8 |
{
|
|
|
9 |
/**
|
10 |
* URL to redirect to
|
11 |
* @var string
|
app/Form/Listeners/ClonePost.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
use NestedPages\Entities\Post\PostCloner;
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
use NestedPages\Entities\Post\PostCloner;
|
app/Form/Listeners/EmptyTrash.php
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
class EmptyTrash extends BaseHandler
|
6 |
{
|
7 |
-
|
8 |
public function __construct()
|
9 |
{
|
10 |
parent::__construct();
|
@@ -21,5 +19,4 @@ class EmptyTrash extends BaseHandler
|
|
21 |
}
|
22 |
$this->sendErrorResponse();
|
23 |
}
|
24 |
-
|
25 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
class EmptyTrash extends BaseHandler
|
5 |
{
|
|
|
6 |
public function __construct()
|
7 |
{
|
8 |
parent::__construct();
|
19 |
}
|
20 |
$this->sendErrorResponse();
|
21 |
}
|
|
|
22 |
}
|
app/Form/Listeners/GetTaxonomies.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -8,7 +7,6 @@ namespace NestedPages\Form\Listeners;
|
|
8 |
*/
|
9 |
class GetTaxonomies extends BaseHandler
|
10 |
{
|
11 |
-
|
12 |
/**
|
13 |
* Terms to return
|
14 |
* @var object
|
@@ -55,4 +53,4 @@ class GetTaxonomies extends BaseHandler
|
|
55 |
{
|
56 |
$this->response = array('status'=>'success', 'terms'=>$this->terms);
|
57 |
}
|
58 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
7 |
*/
|
8 |
class GetTaxonomies extends BaseHandler
|
9 |
{
|
|
|
10 |
/**
|
11 |
* Terms to return
|
12 |
* @var object
|
53 |
{
|
54 |
$this->response = array('status'=>'success', 'terms'=>$this->terms);
|
55 |
}
|
56 |
+
}
|
app/Form/Listeners/ListingSort.php
CHANGED
@@ -1,21 +1,34 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
|
|
|
|
5 |
/**
|
6 |
* Redirect to Listing with Specified Sorting Options Applied
|
7 |
*/
|
8 |
class ListingSort
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
* URL to redirect to
|
13 |
* @var string
|
14 |
*/
|
15 |
private $url;
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public function __construct()
|
18 |
{
|
|
|
19 |
$this->setURL();
|
20 |
$this->redirect();
|
21 |
}
|
@@ -26,9 +39,11 @@ class ListingSort
|
|
26 |
private function setURL()
|
27 |
{
|
28 |
$this->url = sanitize_text_field($_POST['page']);
|
|
|
29 |
$this->setOrderBy();
|
30 |
$this->setOrder();
|
31 |
$this->setAuthor();
|
|
|
32 |
}
|
33 |
|
34 |
/**
|
@@ -37,8 +52,7 @@ class ListingSort
|
|
37 |
private function setOrderBy()
|
38 |
{
|
39 |
$allowed = array('menu_order', 'date', 'title'); // prevent tomfoolery
|
40 |
-
if ( ($_POST['np_orderby'] !== ""
|
41 |
-
$this->url .= '&orderby=' . sanitize_text_field($_POST['np_orderby']);
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -47,8 +61,7 @@ class ListingSort
|
|
47 |
private function setOrder()
|
48 |
{
|
49 |
$allowed = array('ASC', 'DESC'); // prevent tomfoolery
|
50 |
-
if (
|
51 |
-
$this->url .= '&order=' . sanitize_text_field($_POST['np_order']);
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -56,9 +69,22 @@ class ListingSort
|
|
56 |
*/
|
57 |
private function setAuthor()
|
58 |
{
|
59 |
-
if ( (isset($_POST['np_author'])) && ($_POST['np_author'] !== "") )
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -68,5 +94,4 @@ class ListingSort
|
|
68 |
{
|
69 |
header('Location:' . $this->url);
|
70 |
}
|
71 |
-
|
72 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
+
use NestedPages\Entities\PostType\PostTypeRepository;
|
5 |
+
|
6 |
/**
|
7 |
* Redirect to Listing with Specified Sorting Options Applied
|
8 |
*/
|
9 |
class ListingSort
|
10 |
{
|
|
|
11 |
/**
|
12 |
* URL to redirect to
|
13 |
* @var string
|
14 |
*/
|
15 |
private $url;
|
16 |
|
17 |
+
/**
|
18 |
+
* The Post Type
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
private $post_type;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Post Type Repository
|
25 |
+
* @var object
|
26 |
+
*/
|
27 |
+
private $post_type_repo;
|
28 |
+
|
29 |
public function __construct()
|
30 |
{
|
31 |
+
$this->post_type_repo = new PostTypeRepository;
|
32 |
$this->setURL();
|
33 |
$this->redirect();
|
34 |
}
|
39 |
private function setURL()
|
40 |
{
|
41 |
$this->url = sanitize_text_field($_POST['page']);
|
42 |
+
$this->post_type = sanitize_text_field($_POST['post_type']);
|
43 |
$this->setOrderBy();
|
44 |
$this->setOrder();
|
45 |
$this->setAuthor();
|
46 |
+
$this->setTaxonomies();
|
47 |
}
|
48 |
|
49 |
/**
|
52 |
private function setOrderBy()
|
53 |
{
|
54 |
$allowed = array('menu_order', 'date', 'title'); // prevent tomfoolery
|
55 |
+
if ( isset($_POST['np_orderby']) && $_POST['np_orderby'] !== "" && in_array($_POST['np_orderby'], $allowed) ) $this->url .= '&orderby=' . sanitize_text_field($_POST['np_orderby']);
|
|
|
56 |
}
|
57 |
|
58 |
/**
|
61 |
private function setOrder()
|
62 |
{
|
63 |
$allowed = array('ASC', 'DESC'); // prevent tomfoolery
|
64 |
+
if ( isset($_POST['np_order']) && in_array($_POST['np_order'], $allowed) ) $this->url .= '&order=' . sanitize_text_field($_POST['np_order']);
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
69 |
*/
|
70 |
private function setAuthor()
|
71 |
{
|
72 |
+
if ( (isset($_POST['np_author'])) && ($_POST['np_author'] !== "") ) $this->url .= '&author=' . sanitize_text_field($_POST['np_author']);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Set Taxonomy Parameters
|
77 |
+
*/
|
78 |
+
private function setTaxonomies()
|
79 |
+
{
|
80 |
+
$h_taxonomies = $this->post_type_repo->getTaxonomies($this->post_type, true);
|
81 |
+
$f_taxonomies = $this->post_type_repo->getTaxonomies($this->post_type, false);
|
82 |
+
$taxonomies = array_merge($h_taxonomies, $f_taxonomies);
|
83 |
+
foreach ( $taxonomies as $tax ) :
|
84 |
+
if ( $this->post_type_repo->sortOptionEnabled($this->post_type, $tax->name, true) ) :
|
85 |
+
if ( isset($_POST[$tax->name]) && $_POST[$tax->name] !== 'all' ) $this->url .= '&' . $tax->name . '=' . sanitize_text_field($_POST[$tax->name]);
|
86 |
+
endif;
|
87 |
+
endforeach;
|
88 |
}
|
89 |
|
90 |
/**
|
94 |
{
|
95 |
header('Location:' . $this->url);
|
96 |
}
|
|
|
97 |
}
|
app/Form/Listeners/ManualMenuSync.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -15,5 +14,4 @@ class ManualMenuSync extends BaseHandler
|
|
15 |
$this->response = array('status' => 'success');
|
16 |
$this->sendResponse();
|
17 |
}
|
18 |
-
|
19 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
14 |
$this->response = array('status' => 'success');
|
15 |
$this->sendResponse();
|
16 |
}
|
|
|
17 |
}
|
app/Form/Listeners/MenuSearch.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
class MenuSearch extends BaseHandler
|
@@ -80,5 +79,4 @@ class MenuSearch extends BaseHandler
|
|
80 |
}
|
81 |
$this->results = null;
|
82 |
}
|
83 |
-
|
84 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
class MenuSearch extends BaseHandler
|
79 |
}
|
80 |
$this->results = null;
|
81 |
}
|
|
|
82 |
}
|
app/Form/Listeners/NestToggle.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
use NestedPages\Entities\User\UserRepository;
|
@@ -9,7 +8,6 @@ use NestedPages\Entities\User\UserRepository;
|
|
9 |
*/
|
10 |
class NestToggle extends BaseHandler
|
11 |
{
|
12 |
-
|
13 |
public function __construct()
|
14 |
{
|
15 |
parent::__construct();
|
@@ -36,5 +34,4 @@ class NestToggle extends BaseHandler
|
|
36 |
$this->response = array('status'=>'success', 'data'=>$this->data);
|
37 |
$this->sendResponse();
|
38 |
}
|
39 |
-
|
40 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
use NestedPages\Entities\User\UserRepository;
|
8 |
*/
|
9 |
class NestToggle extends BaseHandler
|
10 |
{
|
|
|
11 |
public function __construct()
|
12 |
{
|
13 |
parent::__construct();
|
34 |
$this->response = array('status'=>'success', 'data'=>$this->data);
|
35 |
$this->sendResponse();
|
36 |
}
|
|
|
37 |
}
|
app/Form/Listeners/NewChild.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
use NestedPages\Form\Validation\Validation;
|
@@ -11,7 +10,6 @@ use NestedPages\Entities\Post\PostFactory;
|
|
11 |
*/
|
12 |
class NewChild extends BaseHandler
|
13 |
{
|
14 |
-
|
15 |
/**
|
16 |
* Post Factory
|
17 |
*/
|
@@ -63,5 +61,4 @@ class NewChild extends BaseHandler
|
|
63 |
'new_pages' => $this->data['new_pages']
|
64 |
);
|
65 |
}
|
66 |
-
|
67 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
use NestedPages\Form\Validation\Validation;
|
10 |
*/
|
11 |
class NewChild extends BaseHandler
|
12 |
{
|
|
|
13 |
/**
|
14 |
* Post Factory
|
15 |
*/
|
61 |
'new_pages' => $this->data['new_pages']
|
62 |
);
|
63 |
}
|
|
|
64 |
}
|
app/Form/Listeners/NewMenuItem.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
use NestedPages\Helpers;
|
@@ -73,5 +72,4 @@ class NewMenuItem extends BaseHandler
|
|
73 |
$this->data['post']['original_link'] = get_the_permalink($id);
|
74 |
$this->data['post']['original_title'] = get_the_title($id);
|
75 |
}
|
76 |
-
|
77 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
use NestedPages\Helpers;
|
72 |
$this->data['post']['original_link'] = get_the_permalink($id);
|
73 |
$this->data['post']['original_title'] = get_the_title($id);
|
74 |
}
|
75 |
+
}
|
|
app/Form/Listeners/PostSearch.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
class PostSearch extends BaseHandler
|
@@ -47,5 +46,4 @@ class PostSearch extends BaseHandler
|
|
47 |
$this->results = null;
|
48 |
endif; wp_reset_postdata();
|
49 |
}
|
50 |
-
|
51 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
class PostSearch extends BaseHandler
|
46 |
$this->results = null;
|
47 |
endif; wp_reset_postdata();
|
48 |
}
|
|
|
49 |
}
|
app/Form/Listeners/QuickEdit.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -8,7 +7,6 @@ namespace NestedPages\Form\Listeners;
|
|
8 |
*/
|
9 |
class QuickEdit extends BaseHandler
|
10 |
{
|
11 |
-
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
@@ -26,6 +24,7 @@ class QuickEdit extends BaseHandler
|
|
26 |
$updated = $this->post_update_repo->updatePost($this->data);
|
27 |
if ( !$updated ) $this->sendErrorResponse();
|
28 |
if ( isset($this->data['tax_input']) ) $this->addFlatTaxonomies();
|
|
|
29 |
$this->addData();
|
30 |
$this->response = array(
|
31 |
'status' => 'success',
|
@@ -61,13 +60,14 @@ class QuickEdit extends BaseHandler
|
|
61 |
private function addData()
|
62 |
{
|
63 |
if ( isset($this->data['post_author']) ) $this->data['author_name'] = get_the_author_meta('display_name', $this->data['post_author']);
|
|
|
64 |
$this->data['nav_status'] = ( isset($this->data['nav_status']) ) ? 'hide' : 'show';
|
65 |
$this->data['np_status'] = ( isset($this->data['nested_pages_status']) ) ? 'hide' : 'show';
|
66 |
$this->data['link_target'] = ( isset($this->data['link_target']) ) ? '_blank' : 'none';
|
67 |
$this->data['keep_private'] = ( isset($this->data['keep_private']) ) ? 'private' : 'public';
|
68 |
$this->data['_status'] = ( isset($this->data['_status']) ) ? $this->data['_status'] : 'publish';
|
69 |
$this->data['permalink'] = get_the_permalink($this->data['post_id']);
|
|
|
70 |
if ( !isset($_POST['comment_status']) ) $this->data['comment_status'] = 'closed';
|
71 |
}
|
72 |
-
|
73 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
7 |
*/
|
8 |
class QuickEdit extends BaseHandler
|
9 |
{
|
|
|
10 |
public function __construct()
|
11 |
{
|
12 |
parent::__construct();
|
24 |
$updated = $this->post_update_repo->updatePost($this->data);
|
25 |
if ( !$updated ) $this->sendErrorResponse();
|
26 |
if ( isset($this->data['tax_input']) ) $this->addFlatTaxonomies();
|
27 |
+
if ( $this->integrations->plugins->wpml->installed ) $this->integrations->plugins->wpml->syncPosts($this->data['post_id']);
|
28 |
$this->addData();
|
29 |
$this->response = array(
|
30 |
'status' => 'success',
|
60 |
private function addData()
|
61 |
{
|
62 |
if ( isset($this->data['post_author']) ) $this->data['author_name'] = get_the_author_meta('display_name', $this->data['post_author']);
|
63 |
+
if ( !isset($this->data['sticky']) ) $this->data['sticky'] = false;
|
64 |
$this->data['nav_status'] = ( isset($this->data['nav_status']) ) ? 'hide' : 'show';
|
65 |
$this->data['np_status'] = ( isset($this->data['nested_pages_status']) ) ? 'hide' : 'show';
|
66 |
$this->data['link_target'] = ( isset($this->data['link_target']) ) ? '_blank' : 'none';
|
67 |
$this->data['keep_private'] = ( isset($this->data['keep_private']) ) ? 'private' : 'public';
|
68 |
$this->data['_status'] = ( isset($this->data['_status']) ) ? $this->data['_status'] : 'publish';
|
69 |
$this->data['permalink'] = get_the_permalink($this->data['post_id']);
|
70 |
+
if ( isset($this->data['post_title']) ) $this->data['post_title'] = stripslashes($this->data['post_title']);
|
71 |
if ( !isset($_POST['comment_status']) ) $this->data['comment_status'] = 'closed';
|
72 |
}
|
73 |
+
}
|
|
app/Form/Listeners/QuickEditLink.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -8,7 +7,6 @@ namespace NestedPages\Form\Listeners;
|
|
8 |
*/
|
9 |
class QuickEditLink extends BaseHandler
|
10 |
{
|
11 |
-
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
@@ -41,5 +39,4 @@ class QuickEditLink extends BaseHandler
|
|
41 |
$this->data['np_status'] = ( isset($this->data['nested_pages_status']) ) ? 'hide' : 'show';
|
42 |
$this->data['linkTarget'] = ( isset($this->data['linkTarget']) ) ? '_blank' : 'none';
|
43 |
}
|
44 |
-
|
45 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
7 |
*/
|
8 |
class QuickEditLink extends BaseHandler
|
9 |
{
|
|
|
10 |
public function __construct()
|
11 |
{
|
12 |
parent::__construct();
|
39 |
$this->data['np_status'] = ( isset($this->data['nested_pages_status']) ) ? 'hide' : 'show';
|
40 |
$this->data['linkTarget'] = ( isset($this->data['linkTarget']) ) ? '_blank' : 'none';
|
41 |
}
|
42 |
+
}
|
|
app/Form/Listeners/Search.php
CHANGED
@@ -1,17 +1,14 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
class Search extends BaseHandler
|
6 |
{
|
7 |
-
|
8 |
/**
|
9 |
* URL to redirect to
|
10 |
* @var string
|
11 |
*/
|
12 |
private $url;
|
13 |
|
14 |
-
|
15 |
public function __construct()
|
16 |
{
|
17 |
parent::__construct();
|
@@ -34,5 +31,4 @@ class Search extends BaseHandler
|
|
34 |
{
|
35 |
header('Location:' . $this->url);
|
36 |
}
|
37 |
-
|
38 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
class Search extends BaseHandler
|
5 |
{
|
|
|
6 |
/**
|
7 |
* URL to redirect to
|
8 |
* @var string
|
9 |
*/
|
10 |
private $url;
|
11 |
|
|
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
31 |
{
|
32 |
header('Location:' . $this->url);
|
33 |
}
|
|
|
34 |
}
|
app/Form/Listeners/Sort.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
|
|
|
|
5 |
/**
|
6 |
* Handles processing sortable pages
|
7 |
* updates menu order & page parents
|
@@ -9,7 +10,6 @@ namespace NestedPages\Form\Listeners;
|
|
9 |
*/
|
10 |
class Sort extends BaseHandler
|
11 |
{
|
12 |
-
|
13 |
public function __construct()
|
14 |
{
|
15 |
parent::__construct();
|
@@ -26,10 +26,10 @@ class Sort extends BaseHandler
|
|
26 |
$posts = $this->data['list'];
|
27 |
$order = $this->post_update_repo->updateOrder($posts);
|
28 |
if ( $order ){
|
|
|
29 |
$this->response = array('status' => 'success', 'message' => __('Page order successfully updated.','wp-nested-pages') );
|
30 |
} else {
|
31 |
$this->response = array('status'=>'error', 'message'=> __('There was an error updating the page order.','wp-nested-pages') );
|
32 |
}
|
33 |
}
|
34 |
-
|
35 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
+
use NestedPages\Entities\PluginIntegration\IntegrationFactory;
|
5 |
+
|
6 |
/**
|
7 |
* Handles processing sortable pages
|
8 |
* updates menu order & page parents
|
10 |
*/
|
11 |
class Sort extends BaseHandler
|
12 |
{
|
|
|
13 |
public function __construct()
|
14 |
{
|
15 |
parent::__construct();
|
26 |
$posts = $this->data['list'];
|
27 |
$order = $this->post_update_repo->updateOrder($posts);
|
28 |
if ( $order ){
|
29 |
+
if ( $this->integrations->plugins->wpml->installed ) $this->integrations->plugins->wpml->syncPostOrder($posts);
|
30 |
$this->response = array('status' => 'success', 'message' => __('Page order successfully updated.','wp-nested-pages') );
|
31 |
} else {
|
32 |
$this->response = array('status'=>'error', 'message'=> __('There was an error updating the page order.','wp-nested-pages') );
|
33 |
}
|
34 |
}
|
|
|
35 |
}
|
app/Form/Listeners/SyncMenu.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Listeners;
|
4 |
|
5 |
/**
|
@@ -8,7 +7,6 @@ namespace NestedPages\Form\Listeners;
|
|
8 |
*/
|
9 |
class SyncMenu extends BaseHandler
|
10 |
{
|
11 |
-
|
12 |
public function __construct()
|
13 |
{
|
14 |
parent::__construct();
|
@@ -35,5 +33,4 @@ class SyncMenu extends BaseHandler
|
|
35 |
$this->syncMenu();
|
36 |
$this->response = array('status'=>'success', 'message'=> __('Menu sync enabled.', 'wp-nested-pages'));
|
37 |
}
|
38 |
-
|
39 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Listeners;
|
3 |
|
4 |
/**
|
7 |
*/
|
8 |
class SyncMenu extends BaseHandler
|
9 |
{
|
|
|
10 |
public function __construct()
|
11 |
{
|
12 |
parent::__construct();
|
33 |
$this->syncMenu();
|
34 |
$this->response = array('status'=>'success', 'message'=> __('Menu sync enabled.', 'wp-nested-pages'));
|
35 |
}
|
|
|
36 |
}
|
app/Form/Listeners/WpmlTranslations.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace NestedPages\Form\Listeners;
|
3 |
+
|
4 |
+
use NestedPages\Entities\PluginIntegration\WPML;
|
5 |
+
|
6 |
+
class WpmlTranslations extends BaseHandler
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Form Data
|
10 |
+
*/
|
11 |
+
protected $data;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Post Translations
|
15 |
+
*/
|
16 |
+
private $translations;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* WPML Integration
|
20 |
+
*/
|
21 |
+
private $wpml;
|
22 |
+
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->wpml = new WPML;
|
27 |
+
if ( !$this->wpml->installed ){
|
28 |
+
$this->exception(__('WPML is not currently installed.', 'wp-nested-pages'));
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
$this->setPostId();
|
32 |
+
$this->getTranslations();
|
33 |
+
$this->organizeLanguages();
|
34 |
+
if ( !is_array($this->translations) || sizeof($this->translations) == 0 ){
|
35 |
+
$this->exception(__('There are currently no translations for the selected post.', 'wp-nested-pages'));
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
return wp_send_json(array('status' => 'success', 'translations' => $this->translations));
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Set the Post Id
|
43 |
+
*/
|
44 |
+
private function setPostId()
|
45 |
+
{
|
46 |
+
if ( !isset($_POST['post_id']) ){
|
47 |
+
return $this->sendResponse(array('status' => 'error', 'message' => __('Post Not Found', 'nestedapges')));
|
48 |
+
}
|
49 |
+
$this->data['post_id'] = intval(sanitize_text_field($_POST['post_id']));
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Get all the translated versions of this post
|
54 |
+
*/
|
55 |
+
private function getTranslations()
|
56 |
+
{
|
57 |
+
$this->translations = $this->wpml->getAllTranslations($this->data['post_id']);
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Add Translation links
|
62 |
+
*/
|
63 |
+
private function organizeLanguages()
|
64 |
+
{
|
65 |
+
global $sitepress;
|
66 |
+
$all_languages = $this->wpml->getLanguages();
|
67 |
+
$current_language = $this->wpml->getCurrentLanguage();
|
68 |
+
foreach ( $all_languages as $lang_code => $lang )
|
69 |
+
{
|
70 |
+
$add_link = 'post-new.php?' . http_build_query (
|
71 |
+
array(
|
72 |
+
'lang' => $lang_code,
|
73 |
+
'post_type' => get_post_type ( $this->data['post_id'] ),
|
74 |
+
'trid' => $sitepress->get_element_trid($this->data['post_id']),
|
75 |
+
'source_lang' => $current_language
|
76 |
+
)
|
77 |
+
);
|
78 |
+
$all_languages[$lang_code]['add_link'] = $add_link;
|
79 |
+
if ( array_key_exists($lang_code, $this->translations) ){
|
80 |
+
$all_languages[$lang_code]['has_translation'] = true;
|
81 |
+
$all_languages[$lang_code]['translation'] = $this->translations[$lang_code];
|
82 |
+
$all_languages[$lang_code]['edit_link'] = get_edit_post_link($this->translations[$lang_code]->element_id);
|
83 |
+
} else {
|
84 |
+
$all_languages[$lang_code]['has_translation'] = false;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
$this->translations = $all_languages;
|
88 |
+
}
|
89 |
+
}
|
app/Form/Validation/Validation.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages\Form\Validation;
|
4 |
|
5 |
use NestedPages\Config\SettingsRepository;
|
@@ -9,7 +8,6 @@ use NestedPages\Config\SettingsRepository;
|
|
9 |
*/
|
10 |
class Validation
|
11 |
{
|
12 |
-
|
13 |
/**
|
14 |
* Settings Repository
|
15 |
*/
|
@@ -195,5 +193,4 @@ class Validation
|
|
195 |
|
196 |
return true;
|
197 |
}
|
198 |
-
|
199 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages\Form\Validation;
|
3 |
|
4 |
use NestedPages\Config\SettingsRepository;
|
8 |
*/
|
9 |
class Validation
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Settings Repository
|
13 |
*/
|
193 |
|
194 |
return true;
|
195 |
}
|
|
|
196 |
}
|
app/Helpers.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages;
|
|
7 |
*/
|
8 |
class Helpers
|
9 |
{
|
10 |
-
|
11 |
/**
|
12 |
* Verify URL Format
|
13 |
* @param string - URL to check
|
@@ -44,5 +42,4 @@ class Helpers
|
|
44 |
$link = esc_url( admin_url('edit.php?post_type=' . $type ) );
|
45 |
return $link;
|
46 |
}
|
47 |
-
|
48 |
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class Helpers
|
8 |
{
|
|
|
9 |
/**
|
10 |
* Verify URL Format
|
11 |
* @param string - URL to check
|
42 |
$link = esc_url( admin_url('edit.php?post_type=' . $type ) );
|
43 |
return $link;
|
44 |
}
|
|
|
45 |
}
|
app/NestedPages.php
CHANGED
@@ -12,7 +12,7 @@ class NestedPages
|
|
12 |
$np_env = 'live';
|
13 |
|
14 |
global $np_version;
|
15 |
-
$np_version = '
|
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 = '2.0.1';
|
16 |
|
17 |
if ( is_admin() ) $app = new NestedPages\Bootstrap;
|
18 |
if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
|
app/Redirects.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
namespace NestedPages;
|
4 |
|
5 |
/**
|
@@ -7,7 +6,6 @@ namespace NestedPages;
|
|
7 |
*/
|
8 |
class Redirects
|
9 |
{
|
10 |
-
|
11 |
public function __construct()
|
12 |
{
|
13 |
add_action('load-edit.php', array($this, 'pageTrashed'));
|
@@ -84,6 +82,4 @@ class Redirects
|
|
84 |
$enabledPostTypes = $postTypeRepository->enabledPostTypes();
|
85 |
return array_key_exists( 'page', $enabledPostTypes );
|
86 |
}
|
87 |
-
|
88 |
-
|
89 |
-
}
|
1 |
<?php
|
|
|
2 |
namespace NestedPages;
|
3 |
|
4 |
/**
|
6 |
*/
|
7 |
class Redirects
|
8 |
{
|
|
|
9 |
public function __construct()
|
10 |
{
|
11 |
add_action('load-edit.php', array($this, 'pageTrashed'));
|
82 |
$enabledPostTypes = $postTypeRepository->enabledPostTypes();
|
83 |
return array_key_exists( 'page', $enabledPostTypes );
|
84 |
}
|
85 |
+
}
|
|
|
|
app/RedirectsFrontEnd.php
CHANGED
@@ -87,4 +87,4 @@ class RedirectsFrontEnd
|
|
87 |
}
|
88 |
return $slug;
|
89 |
}
|
90 |
-
}
|
87 |
}
|
88 |
return $slug;
|
89 |
}
|
90 |
+
}
|
app/Views/forms/new-child.php
CHANGED
@@ -54,7 +54,8 @@
|
|
54 |
'id' => 'post_author',
|
55 |
'class'=> 'authors',
|
56 |
'multi' => 1,
|
57 |
-
'echo' => 0
|
|
|
58 |
);
|
59 |
|
60 |
if ( $authors = wp_dropdown_users( $users_opt ) ) :
|
@@ -76,7 +77,7 @@
|
|
76 |
</div>
|
77 |
<?php endif; ?>
|
78 |
|
79 |
-
<?php if ( $this->post_type->name == 'page' && $this->user->canSortPages() && !$this->isSearch() ) : ?>
|
80 |
<div class="form-control full checkbox">
|
81 |
<label>
|
82 |
<input type="checkbox" name="nav_status" class="np_nav_status" value="hide" />
|
54 |
'id' => 'post_author',
|
55 |
'class'=> 'authors',
|
56 |
'multi' => 1,
|
57 |
+
'echo' => 0,
|
58 |
+
'selected' => get_current_user_id()
|
59 |
);
|
60 |
|
61 |
if ( $authors = wp_dropdown_users( $users_opt ) ) :
|
77 |
</div>
|
78 |
<?php endif; ?>
|
79 |
|
80 |
+
<?php if ( $this->post_type->name == 'page' && $this->user->canSortPages() && !$this->listing_repo->isSearch() ) : ?>
|
81 |
<div class="form-control full checkbox">
|
82 |
<label>
|
83 |
<input type="checkbox" name="nav_status" class="np_nav_status" value="hide" />
|
app/Views/forms/quickedit-link.php
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
|
40 |
<div class="right">
|
41 |
|
42 |
-
<?php if ( $this->user->canSortPages() && !$this->isSearch() ) : // Menu Options Button ?>
|
43 |
<div class="form-control">
|
44 |
<label><?php _e( 'Title Attribute' ); ?></label>
|
45 |
<input type="text" name="titleAttribute" class="np_title_attribute" value="" />
|
39 |
|
40 |
<div class="right">
|
41 |
|
42 |
+
<?php if ( $this->user->canSortPages() && !$this->listing_repo->isSearch() ) : // Menu Options Button ?>
|
43 |
<div class="form-control">
|
44 |
<label><?php _e( 'Title Attribute' ); ?></label>
|
45 |
<input type="text" name="titleAttribute" class="np_title_attribute" value="" />
|
app/Views/forms/quickedit-post.php
CHANGED
@@ -4,6 +4,8 @@
|
|
4 |
*/
|
5 |
$post_type_object = get_post_type_object( 'page' );
|
6 |
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
|
|
|
|
7 |
?>
|
8 |
|
9 |
<form method="get" action="">
|
@@ -136,14 +138,23 @@
|
|
136 |
<?php if ( current_user_can('edit_theme_options') && !array_key_exists('hide_in_np', $this->disabled_standard_fields) ) : ?>
|
137 |
<div class="comments">
|
138 |
<label>
|
139 |
-
<input type="checkbox" name="nested_pages_status" class="
|
140 |
<span class="checkbox-title"><?php _e( 'Hide in Nested Pages', 'wp-nested-pages' ); ?></span>
|
141 |
</label>
|
142 |
</div>
|
143 |
<?php endif; // Edit theme options ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
<div class="form-control np-toggle-options">
|
146 |
-
<?php if ( $this->user->canSortPages() && $this->post_type->name == 'page' && !$this->isSearch() && !array_key_exists('menu_options', $this->disabled_standard_fields) ) : ?>
|
147 |
<a href="#" class="np-btn np-btn-half np-toggle-menuoptions"><?php _e('Menu Options', 'wp-nested-pages'); ?></a>
|
148 |
<?php endif; ?>
|
149 |
|
@@ -190,7 +201,7 @@
|
|
190 |
<?php endif; // if taxonomies ?>
|
191 |
|
192 |
|
193 |
-
<?php if ( $this->user->canSortPages() && !$this->isSearch() ) : ?>
|
194 |
<div class="np-menuoptions">
|
195 |
<div class="menuoptions-left">
|
196 |
<div class="form-control">
|
4 |
*/
|
5 |
$post_type_object = get_post_type_object( 'page' );
|
6 |
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
7 |
+
$wpml_pages = ( $this->integrations->plugins->wpml->installed && $this->integrations->plugins->wpml->isDefaultLanguage()) ? true : false;
|
8 |
+
if ( !$this->integrations->plugins->wpml->installed ) $wpml_pages = true;
|
9 |
?>
|
10 |
|
11 |
<form method="get" action="">
|
138 |
<?php if ( current_user_can('edit_theme_options') && !array_key_exists('hide_in_np', $this->disabled_standard_fields) ) : ?>
|
139 |
<div class="comments">
|
140 |
<label>
|
141 |
+
<input type="checkbox" name="nested_pages_status" class="nested_pages_status" value="hide" />
|
142 |
<span class="checkbox-title"><?php _e( 'Hide in Nested Pages', 'wp-nested-pages' ); ?></span>
|
143 |
</label>
|
144 |
</div>
|
145 |
<?php endif; // Edit theme options ?>
|
146 |
+
|
147 |
+
<?php if ( !$this->post_type->hierarchical ) : ?>
|
148 |
+
<div class="comments">
|
149 |
+
<label>
|
150 |
+
<input type="checkbox" name="sticky" class="np-sticky" value="sticky" />
|
151 |
+
<span class="checkbox-title"><?php _e( 'Make Sticky', 'wp-nested-pages' ); ?></span>
|
152 |
+
</label>
|
153 |
+
</div>
|
154 |
+
<?php endif; ?>
|
155 |
|
156 |
<div class="form-control np-toggle-options">
|
157 |
+
<?php if ( $this->user->canSortPages() && $this->post_type->name == 'page' && !$this->listing_repo->isSearch() && !array_key_exists('menu_options', $this->disabled_standard_fields) && $wpml_pages ) : ?>
|
158 |
<a href="#" class="np-btn np-btn-half np-toggle-menuoptions"><?php _e('Menu Options', 'wp-nested-pages'); ?></a>
|
159 |
<?php endif; ?>
|
160 |
|
201 |
<?php endif; // if taxonomies ?>
|
202 |
|
203 |
|
204 |
+
<?php if ( $this->user->canSortPages() && !$this->listing_repo->isSearch() ) : ?>
|
205 |
<div class="np-menuoptions">
|
206 |
<div class="menuoptions-left">
|
207 |
<div class="form-control">
|
app/Views/listing.php
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
<div class="wrap nestedpages">
|
2 |
<h2 class="nestedpages-listing-title">
|
3 |
<?php esc_html_e($this->post_type->labels->name); ?>
|
@@ -6,18 +10,17 @@
|
|
6 |
<?php esc_html_e($this->post_type->labels->add_new); ?>
|
7 |
</a>
|
8 |
|
9 |
-
<?php if ( current_user_can('publish_pages') && !$this->isSearch() ) : ?>
|
10 |
<a href="#" class="add-new-h2 open-bulk-modal" title="<?php _e('Add Multiple', 'wp-nested-pages'); ?>" data-parentid="0">
|
11 |
<?php esc_html_e('Add Multiple', 'wp-nested-pages'); ?>
|
12 |
</a>
|
13 |
<?php endif; ?>
|
14 |
|
15 |
-
<?php if ( current_user_can('publish_pages') && $this->post_type->name == 'page' && !$this->isSearch() && !$this->settings->menusDisabled() ) : ?>
|
16 |
<a href="#" class="add-new-h2 open-redirect-modal" title="<?php _e('Add Link', 'wp-nested-pages'); ?>" data-parentid="0">
|
17 |
<?php esc_html_e('Add Link', 'wp-nested-pages'); ?>
|
18 |
</a>
|
19 |
<?php endif; ?>
|
20 |
-
|
21 |
</h2>
|
22 |
|
23 |
<?php if ( $this->confirmation->getMessage() ) : ?>
|
@@ -27,29 +30,45 @@
|
|
27 |
<div data-nestedpages-error class="updated error notice is-dismissible" style="display:none;"><p></p><button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e('Dismiss this notice.', 'wp-nested-pages'); ?></span></button></div>
|
28 |
|
29 |
<div class="nestedpages-top-toggles">
|
30 |
-
<?php if ( $this->post_type->hierarchical && !$this->isSearch() ) : ?>
|
31 |
<a href="#" class="np-btn nestedpages-toggleall" data-toggle="closed"><?php esc_html_e('Expand All', 'wp-nested-pages'); ?></a>
|
32 |
<?php endif; ?>
|
33 |
|
34 |
-
<?php if ( $this->user->canSortPages() && !$this->isSearch() && !$this->isFiltered() ) : ?>
|
35 |
<div class="np-sync-menu-cont" <?php if ( $this->confirmation->getMessage() ) echo 'style="margin-top:2px;"';?>>
|
36 |
|
37 |
<?php if ( $this->settings->autoPageOrderDisabled() ) : ?>
|
38 |
<a href="#" class="np-btn" data-np-manual-order-sync><?php echo __('Sync', 'wp-nested-pages') . ' ' . esc_html($this->post_type->labels->singular_name) . ' ' . __('Order', 'wp-nested-pages'); ?></a>
|
39 |
<?php endif; ?>
|
40 |
|
41 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
<?php if ( !$this->settings->autoMenuDisabled() ) : ?>
|
44 |
<label>
|
45 |
-
<input type="checkbox" name="np_sync_menu" class="np-sync-menu" value="sync" <?php if ( get_option('nestedpages_menusync') == 'sync' ) echo 'checked'; ?>/>
|
|
|
|
|
|
|
|
|
46 |
</label>
|
47 |
<?php else : ?>
|
48 |
<a href="#" class="np-btn" data-np-manual-menu-sync><?php esc_html_e('Sync Menu', 'wp-nested-pages'); ?></a>
|
49 |
<?php endif; ?>
|
50 |
|
|
|
51 |
<?php endif; ?>
|
52 |
|
|
|
|
|
53 |
</div>
|
54 |
<?php endif; ?>
|
55 |
|
@@ -62,13 +81,13 @@
|
|
62 |
|
63 |
|
64 |
<div class="nestedpages">
|
65 |
-
<?php $this->
|
66 |
|
67 |
<div class="quick-edit quick-edit-form np-inline-modal" style="display:none;">
|
68 |
<?php include( NestedPages\Helpers::view('forms/quickedit-post') ); ?>
|
69 |
</div>
|
70 |
|
71 |
-
<?php if ( current_user_can('publish_pages') ) : ?>
|
72 |
<div class="quick-edit quick-edit-form-redirect np-inline-modal" style="display:none;">
|
73 |
<?php include( NestedPages\Helpers::view('forms/quickedit-link') ); ?>
|
74 |
</div>
|
@@ -85,6 +104,7 @@
|
|
85 |
include( NestedPages\Helpers::view('forms/more-options-modal') );
|
86 |
include( NestedPages\Helpers::view('forms/empty-trash-modal') );
|
87 |
include( NestedPages\Helpers::view('forms/clone-form') );
|
88 |
-
include( NestedPages\Helpers::view('forms/link-form') );
|
89 |
include( NestedPages\Helpers::view('forms/bulk-add') );
|
90 |
-
include( NestedPages\Helpers::view('forms/delete-confirmation-modal') );
|
|
1 |
+
<?php
|
2 |
+
$wpml_pages = ( $this->integrations->plugins->wpml->installed && $this->integrations->plugins->wpml->isDefaultLanguage()) ? true : false;
|
3 |
+
if ( !$this->integrations->plugins->wpml->installed ) $wpml_pages = true;
|
4 |
+
?>
|
5 |
<div class="wrap nestedpages">
|
6 |
<h2 class="nestedpages-listing-title">
|
7 |
<?php esc_html_e($this->post_type->labels->name); ?>
|
10 |
<?php esc_html_e($this->post_type->labels->add_new); ?>
|
11 |
</a>
|
12 |
|
13 |
+
<?php if ( current_user_can('publish_pages') && !$this->listing_repo->isSearch() && $wpml_pages ) : ?>
|
14 |
<a href="#" class="add-new-h2 open-bulk-modal" title="<?php _e('Add Multiple', 'wp-nested-pages'); ?>" data-parentid="0">
|
15 |
<?php esc_html_e('Add Multiple', 'wp-nested-pages'); ?>
|
16 |
</a>
|
17 |
<?php endif; ?>
|
18 |
|
19 |
+
<?php if ( current_user_can('publish_pages') && $this->post_type->name == 'page' && !$this->listing_repo->isSearch() && !$this->settings->menusDisabled() && !$this->integrations->plugins->wpml->installed ) : ?>
|
20 |
<a href="#" class="add-new-h2 open-redirect-modal" title="<?php _e('Add Link', 'wp-nested-pages'); ?>" data-parentid="0">
|
21 |
<?php esc_html_e('Add Link', 'wp-nested-pages'); ?>
|
22 |
</a>
|
23 |
<?php endif; ?>
|
|
|
24 |
</h2>
|
25 |
|
26 |
<?php if ( $this->confirmation->getMessage() ) : ?>
|
30 |
<div data-nestedpages-error class="updated error notice is-dismissible" style="display:none;"><p></p><button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e('Dismiss this notice.', 'wp-nested-pages'); ?></span></button></div>
|
31 |
|
32 |
<div class="nestedpages-top-toggles">
|
33 |
+
<?php if ( $this->post_type->hierarchical && !$this->listing_repo->isSearch() ) : ?>
|
34 |
<a href="#" class="np-btn nestedpages-toggleall" data-toggle="closed"><?php esc_html_e('Expand All', 'wp-nested-pages'); ?></a>
|
35 |
<?php endif; ?>
|
36 |
|
37 |
+
<?php if ( $this->user->canSortPages() && !$this->listing_repo->isSearch() && !$this->listing_repo->isFiltered() ) : ?>
|
38 |
<div class="np-sync-menu-cont" <?php if ( $this->confirmation->getMessage() ) echo 'style="margin-top:2px;"';?>>
|
39 |
|
40 |
<?php if ( $this->settings->autoPageOrderDisabled() ) : ?>
|
41 |
<a href="#" class="np-btn" data-np-manual-order-sync><?php echo __('Sync', 'wp-nested-pages') . ' ' . esc_html($this->post_type->labels->singular_name) . ' ' . __('Order', 'wp-nested-pages'); ?></a>
|
42 |
<?php endif; ?>
|
43 |
|
44 |
+
<?php
|
45 |
+
$wpml = $this->integrations->plugins->wpml->installed;
|
46 |
+
$primary_language = ( $wpml && $this->integrations->plugins->wpml->isDefaultLanguage() ) ? true : false;
|
47 |
+
if ( !$wpml ) $primary_language = true;
|
48 |
+
|
49 |
+
if ( $this->post_type->name == 'page' &&
|
50 |
+
!$this->settings->hideMenuSync() &&
|
51 |
+
!$this->settings->menusDisabled() &&
|
52 |
+
$primary_language ) :
|
53 |
+
?>
|
54 |
|
55 |
<?php if ( !$this->settings->autoMenuDisabled() ) : ?>
|
56 |
<label>
|
57 |
+
<input type="checkbox" name="np_sync_menu" class="np-sync-menu" value="sync" <?php if ( get_option('nestedpages_menusync') == 'sync' ) echo 'checked'; ?>/>
|
58 |
+
<?php
|
59 |
+
esc_html_e('Sync Menu', 'wp-nested-pages');
|
60 |
+
if ( $wpml ) echo ' (' . esc_html($this->integrations->plugins->wpml->getCurrentLanguage('name')) . ')';
|
61 |
+
?>
|
62 |
</label>
|
63 |
<?php else : ?>
|
64 |
<a href="#" class="np-btn" data-np-manual-menu-sync><?php esc_html_e('Sync Menu', 'wp-nested-pages'); ?></a>
|
65 |
<?php endif; ?>
|
66 |
|
67 |
+
|
68 |
<?php endif; ?>
|
69 |
|
70 |
+
<?php if ( $wpml && !$primary_language ) echo $this->integrations->plugins->wpml->syncMenusButton(); ?>
|
71 |
+
|
72 |
</div>
|
73 |
<?php endif; ?>
|
74 |
|
81 |
|
82 |
|
83 |
<div class="nestedpages">
|
84 |
+
<?php $this->getPosts(); ?>
|
85 |
|
86 |
<div class="quick-edit quick-edit-form np-inline-modal" style="display:none;">
|
87 |
<?php include( NestedPages\Helpers::view('forms/quickedit-post') ); ?>
|
88 |
</div>
|
89 |
|
90 |
+
<?php if ( current_user_can('publish_pages') && !$this->integrations->plugins->wpml->installed ) : ?>
|
91 |
<div class="quick-edit quick-edit-form-redirect np-inline-modal" style="display:none;">
|
92 |
<?php include( NestedPages\Helpers::view('forms/quickedit-link') ); ?>
|
93 |
</div>
|
104 |
include( NestedPages\Helpers::view('forms/more-options-modal') );
|
105 |
include( NestedPages\Helpers::view('forms/empty-trash-modal') );
|
106 |
include( NestedPages\Helpers::view('forms/clone-form') );
|
107 |
+
if ( !$this->integrations->plugins->wpml->installed) include( NestedPages\Helpers::view('forms/link-form') );
|
108 |
include( NestedPages\Helpers::view('forms/bulk-add') );
|
109 |
+
include( NestedPages\Helpers::view('forms/delete-confirmation-modal') );
|
110 |
+
if ( $this->integrations->plugins->wpml->installed ) include( NestedPages\Helpers::view('partials/wpml-translations') );
|
app/Views/partials/row-link.php
CHANGED
@@ -6,9 +6,9 @@ $link = ( $this->post->nav_type && $this->post->nav_type !== 'custom' )
|
|
6 |
? $this->post->nav_original_link
|
7 |
: esc_url($this->post->content);
|
8 |
?>
|
9 |
-
<div class="row" <?php if ( $this->isSearch() ) echo 'style="padding-left:10px;"';?>>
|
10 |
|
11 |
-
<?php if ( $this->post_type->hierarchical && !$this->isSearch() ) : ?>
|
12 |
<div class="child-toggle"></div>
|
13 |
<?php endif; ?>
|
14 |
|
@@ -16,7 +16,7 @@ $link = ( $this->post->nav_type && $this->post->nav_type !== 'custom' )
|
|
16 |
|
17 |
<i class="np-icon-sub-menu"></i>
|
18 |
|
19 |
-
<?php if ( $this->user->canSortPages() && !$this->isSearch() ) : ?>
|
20 |
<i class="handle np-icon-menu"></i>
|
21 |
<?php endif; ?>
|
22 |
|
6 |
? $this->post->nav_original_link
|
7 |
: esc_url($this->post->content);
|
8 |
?>
|
9 |
+
<div class="row" <?php if ( $this->listing_repo->isSearch() ) echo 'style="padding-left:10px;"';?>>
|
10 |
|
11 |
+
<?php if ( $this->post_type->hierarchical && !$this->listing_repo->isSearch() ) : ?>
|
12 |
<div class="child-toggle"></div>
|
13 |
<?php endif; ?>
|
14 |
|
16 |
|
17 |
<i class="np-icon-sub-menu"></i>
|
18 |
|
19 |
+
<?php if ( $this->user->canSortPages() && !$this->listing_repo->isSearch() ) : ?>
|
20 |
<i class="handle np-icon-menu"></i>
|
21 |
<?php endif; ?>
|
22 |
|
app/Views/partials/row.php
CHANGED
@@ -2,11 +2,9 @@
|
|
2 |
/**
|
3 |
* Row represents a single page
|
4 |
*/
|
5 |
-
$
|
6 |
-
|
7 |
-
if ( !$
|
8 |
-
if ( $this->isSearch() ) $row_classes .= ' search';
|
9 |
-
$assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->post->id, $this->assigned_pt_pages) ) ? get_post_type_object($this->assigned_pt_pages[$this->post->id]) : false;
|
10 |
?>
|
11 |
<div class="row<?php echo $row_classes; ?>">
|
12 |
|
@@ -21,7 +19,7 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
21 |
<div class="row-inner">
|
22 |
<i class="np-icon-sub-menu"></i>
|
23 |
|
24 |
-
<?php if ( $this->user->canSortPages() && !$this->isSearch() && !$this->post_type_settings->disable_sorting ) : ?>
|
25 |
<i class="handle np-icon-menu"></i>
|
26 |
<?php endif; ?>
|
27 |
|
@@ -43,11 +41,11 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
43 |
echo '</span>';
|
44 |
|
45 |
// Nested Pages Status
|
46 |
-
if ( $this->post->np_status == 'hide' )
|
47 |
echo '<i class="np-icon-eye-blocked"></i>';
|
48 |
|
49 |
// Nav Status
|
50 |
-
if ( $this->post->nav_status == 'hide' ){
|
51 |
echo '<span class="nav-status">' . __('Hidden', 'wp-nested-pages') . '</span>';
|
52 |
} else {
|
53 |
echo '<span class="nav-status"></span>';
|
@@ -62,6 +60,16 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
62 |
} else {
|
63 |
echo '<span class="edit-indicator"><i class="np-icon-pencil"></i>' . apply_filters('nestedpages_edit_link_text', __('Edit'), $this->post) . '</span>';
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
?>
|
67 |
</a>
|
@@ -71,7 +79,7 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
71 |
<?php if ( current_user_can('publish_posts') ) : ?>
|
72 |
<li><a href="<?php echo $this->post_type_repo->addNewPostLink($assigned_pt->name); ?>" class=""><?php echo $assigned_pt->labels->add_new; ?></a></li>
|
73 |
<?php endif; ?>
|
74 |
-
<li><a href="<?php echo $this->post_type_repo->allPostsLink($assigned_pt->name); ?>" class=""><?php echo $assigned_pt->labels->all_items . ' (' .
|
75 |
</ul>
|
76 |
<?php endif; ?>
|
77 |
|
@@ -94,10 +102,11 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
94 |
?>
|
95 |
|
96 |
<div class="action-buttons">
|
|
|
|
|
|
|
97 |
|
98 |
<?php if ( $this->post->comment_status == 'open' ) : $comments = wp_count_comments($this->post->id); $cs = 'open' ?>
|
99 |
-
|
100 |
-
|
101 |
|
102 |
<a href="<?php echo admin_url( 'edit-comments.php?p=' . get_the_id() ); ?>" class="np-btn">
|
103 |
<i class="np-icon-bubble"></i> <?php echo $comments->total_comments; ?>
|
@@ -105,9 +114,9 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
105 |
|
106 |
<?php else : $cs = 'closed'; endif; ?>
|
107 |
|
108 |
-
<?php if ( current_user_can('publish_pages') && $this->post_type->hierarchical && !$this->isSearch() ) : ?>
|
109 |
|
110 |
-
<?php if (!$this->settings->menusDisabled()) : ?>
|
111 |
<a href="#" class="np-btn open-redirect-modal" data-parentid="<?php echo esc_attr($this->post->id); ?>"><i class="np-icon-link"></i></a>
|
112 |
<?php endif; ?>
|
113 |
|
@@ -115,7 +124,7 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
115 |
|
116 |
<?php endif; ?>
|
117 |
|
118 |
-
<?php if ( current_user_can('edit_pages') && current_user_can('edit_posts') ) : ?>
|
119 |
<a href="#" class="np-btn clone-post" data-id="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php echo esc_html($this->post->title); ?>"><?php _e('Clone', 'wp-nested-pages'); ?></a>
|
120 |
<?php endif; ?>
|
121 |
|
@@ -147,7 +156,8 @@ $assigned_pt = ( $this->post_type->name == 'page' && array_key_exists($this->pos
|
|
147 |
data-time="<?php echo date_i18n('H:i', $this->post->date->datepicker); ?>"
|
148 |
data-formattedtime="<?php echo date_i18n('g:i', $this->post->date->datepicker); ?>"
|
149 |
data-timeformat="<?php echo get_option('time_format'); ?>"
|
150 |
-
data-ampm="<?php echo date('a', $this->post->date->datepicker); ?>"
|
|
|
151 |
<?php _e('Quick Edit'); ?>
|
152 |
</a>
|
153 |
<?php endif; ?>
|
2 |
/**
|
3 |
* Row represents a single page
|
4 |
*/
|
5 |
+
$wpml = $this->integrations->plugins->wpml->installed;
|
6 |
+
$wpml_pages = ( $wpml && $this->integrations->plugins->wpml->isDefaultLanguage()) ? true : false;
|
7 |
+
if ( !$wpml ) $wpml_pages = true;
|
|
|
|
|
8 |
?>
|
9 |
<div class="row<?php echo $row_classes; ?>">
|
10 |
|
19 |
<div class="row-inner">
|
20 |
<i class="np-icon-sub-menu"></i>
|
21 |
|
22 |
+
<?php if ( $this->user->canSortPages() && !$this->listing_repo->isSearch() && !$this->post_type_settings->disable_sorting && $wpml_current_language !== 'all' ) : ?>
|
23 |
<i class="handle np-icon-menu"></i>
|
24 |
<?php endif; ?>
|
25 |
|
41 |
echo '</span>';
|
42 |
|
43 |
// Nested Pages Status
|
44 |
+
if ( $this->post->np_status == 'hide' && !$wpml )
|
45 |
echo '<i class="np-icon-eye-blocked"></i>';
|
46 |
|
47 |
// Nav Status
|
48 |
+
if ( $this->post->nav_status == 'hide' && !$wpml ){
|
49 |
echo '<span class="nav-status">' . __('Hidden', 'wp-nested-pages') . '</span>';
|
50 |
} else {
|
51 |
echo '<span class="nav-status"></span>';
|
60 |
} else {
|
61 |
echo '<span class="edit-indicator"><i class="np-icon-pencil"></i>' . apply_filters('nestedpages_edit_link_text', __('Edit'), $this->post) . '</span>';
|
62 |
}
|
63 |
+
|
64 |
+
// Sticky
|
65 |
+
echo '<span class="sticky"';
|
66 |
+
if ( !in_array($this->post->id, $this->sticky_posts) ) echo ' style="display:none;"';
|
67 |
+
echo '>(' . __('Sticky', 'wp-nested-pages') . ')<span>';
|
68 |
+
|
69 |
+
if ( $this->post->status !== 'publish' ) echo '(' . __(ucfirst($this->post->status)) . ')';
|
70 |
+
if ( post_password_required($this->post->id) ) echo ' <i class="np-icon-lock"></i>';
|
71 |
+
|
72 |
+
|
73 |
|
74 |
?>
|
75 |
</a>
|
79 |
<?php if ( current_user_can('publish_posts') ) : ?>
|
80 |
<li><a href="<?php echo $this->post_type_repo->addNewPostLink($assigned_pt->name); ?>" class=""><?php echo $assigned_pt->labels->add_new; ?></a></li>
|
81 |
<?php endif; ?>
|
82 |
+
<li><a href="<?php echo $this->post_type_repo->allPostsLink($assigned_pt->name); ?>" class=""><?php echo $assigned_pt->labels->all_items . ' (' . $this->listing_repo->postCount($assigned_pt->name) . ')'; ?></a></li>
|
83 |
</ul>
|
84 |
<?php endif; ?>
|
85 |
|
102 |
?>
|
103 |
|
104 |
<div class="action-buttons">
|
105 |
+
<?php if ( $wpml ) : ?>
|
106 |
+
<a href="#" class="np-btn" data-nestedpages-translations><?php _e('Translations', 'wp-nested-pages'); ?> (<?php echo $this->integrations->plugins->wpml->getAllTranslations($this->post->id, 'count'); ?>)</a>
|
107 |
+
<?php endif; ?>
|
108 |
|
109 |
<?php if ( $this->post->comment_status == 'open' ) : $comments = wp_count_comments($this->post->id); $cs = 'open' ?>
|
|
|
|
|
110 |
|
111 |
<a href="<?php echo admin_url( 'edit-comments.php?p=' . get_the_id() ); ?>" class="np-btn">
|
112 |
<i class="np-icon-bubble"></i> <?php echo $comments->total_comments; ?>
|
114 |
|
115 |
<?php else : $cs = 'closed'; endif; ?>
|
116 |
|
117 |
+
<?php if ( current_user_can('publish_pages') && $this->post_type->hierarchical && !$this->listing_repo->isSearch() && $wpml_pages ) : ?>
|
118 |
|
119 |
+
<?php if (!$this->settings->menusDisabled() && !$this->integrations->plugins->wpml->installed) : ?>
|
120 |
<a href="#" class="np-btn open-redirect-modal" data-parentid="<?php echo esc_attr($this->post->id); ?>"><i class="np-icon-link"></i></a>
|
121 |
<?php endif; ?>
|
122 |
|
124 |
|
125 |
<?php endif; ?>
|
126 |
|
127 |
+
<?php if ( current_user_can('edit_pages') && current_user_can('edit_posts') && $wpml_pages ) : ?>
|
128 |
<a href="#" class="np-btn clone-post" data-id="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php echo esc_html($this->post->title); ?>"><?php _e('Clone', 'wp-nested-pages'); ?></a>
|
129 |
<?php endif; ?>
|
130 |
|
156 |
data-time="<?php echo date_i18n('H:i', $this->post->date->datepicker); ?>"
|
157 |
data-formattedtime="<?php echo date_i18n('g:i', $this->post->date->datepicker); ?>"
|
158 |
data-timeformat="<?php echo get_option('time_format'); ?>"
|
159 |
+
data-ampm="<?php echo date('a', $this->post->date->datepicker); ?>"
|
160 |
+
data-sticky="<?php if ( in_array($this->post->id, $this->sticky_posts) ) echo 'sticky'; ?>">
|
161 |
<?php _e('Quick Edit'); ?>
|
162 |
</a>
|
163 |
<?php endif; ?>
|
app/Views/partials/tool-list.php
CHANGED
@@ -1,4 +1,12 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<div class="nestedpages-tools">
|
3 |
|
4 |
<ul class="subsubsub">
|
@@ -15,7 +23,7 @@
|
|
15 |
</li>
|
16 |
|
17 |
<li> |
|
18 |
-
<?php if ( !$this->isSearch() ) : ?>
|
19 |
<a href="#hide" class="np-toggle-hidden"><?php _e('Show Hidden', 'wp-nested-pages'); ?> </a>
|
20 |
<?php else : ?>
|
21 |
<a href="#show" class="np-toggle-hidden"><?php _e('Hide Hidden', 'wp-nested-pages'); ?> </a>
|
@@ -41,11 +49,19 @@
|
|
41 |
<?php endif; ?>
|
42 |
</ul>
|
43 |
|
44 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<div class="np-tools-primary">
|
46 |
<form action="<?php echo admin_url('admin-post.php'); ?>" method="post" class="np-tools-sort">
|
47 |
<input type="hidden" name="action" value="npListingSort">
|
48 |
<input type="hidden" name="page" value="<?php echo $this->pageURL(); ?>">
|
|
|
|
|
49 |
<div class="select first">
|
50 |
<select id="np_sortauthor" name="np_author" class="nestedpages-sort">
|
51 |
<?php
|
@@ -60,6 +76,8 @@
|
|
60 |
?>
|
61 |
</select>
|
62 |
</div>
|
|
|
|
|
63 |
<div class="select">
|
64 |
<select id="np_orderby" name="np_orderby" class="nestedpages-sort">
|
65 |
<?php
|
@@ -78,6 +96,8 @@
|
|
78 |
?>
|
79 |
</select>
|
80 |
</div>
|
|
|
|
|
81 |
<div class="select">
|
82 |
<select id="np_order" name="np_order" class="nestedpages-sort">
|
83 |
<?php
|
@@ -95,6 +115,27 @@
|
|
95 |
?>
|
96 |
</select>
|
97 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
<div class="select">
|
99 |
<input type="submit" id="nestedpages-sort" class="button" value="Apply">
|
100 |
</div>
|
@@ -136,8 +177,8 @@
|
|
136 |
<input type="hidden" name="posttype" value="<?php echo esc_attr($this->post_type->name); ?>">
|
137 |
<input type="hidden" name="page" value="<?php echo esc_url($this->pageURL()); ?>">
|
138 |
<?php wp_nonce_field('nestedpages-nonce', 'nonce'); ?>
|
139 |
-
<input type="search" name="search_term" id="nestedpages-search" placeholder="<?php echo esc_attr($this->post_type->labels->search_items); ?>" <?php if ( $this->isSearch() ) echo ' value="' .
|
140 |
-
<input type="submit" name="" class="button" value="<?php echo
|
141 |
</form>
|
142 |
</div><!-- .np-tools-search -->
|
143 |
|
1 |
+
<?php
|
2 |
+
$trashedCount = $this->post_repo->trashedCount($this->post_type->name);
|
3 |
+
$searchLabel = esc_attr($this->post_type->labels->search_items);
|
4 |
+
|
5 |
+
// WPML
|
6 |
+
$wpml = $this->integrations->plugins->wpml->installed;
|
7 |
+
if ( $wpml ) $current_lang = $this->integrations->plugins->wpml->getCurrentLanguage('name');
|
8 |
+
if ( $wpml && $current_lang ) $searchLabel .= ' (' . $this->integrations->plugins->wpml->getCurrentLanguage('name') . ')';
|
9 |
+
?>
|
10 |
<div class="nestedpages-tools">
|
11 |
|
12 |
<ul class="subsubsub">
|
23 |
</li>
|
24 |
|
25 |
<li> |
|
26 |
+
<?php if ( !$this->listing_repo->isSearch() ) : ?>
|
27 |
<a href="#hide" class="np-toggle-hidden"><?php _e('Show Hidden', 'wp-nested-pages'); ?> </a>
|
28 |
<?php else : ?>
|
29 |
<a href="#show" class="np-toggle-hidden"><?php _e('Hide Hidden', 'wp-nested-pages'); ?> </a>
|
49 |
<?php endif; ?>
|
50 |
</ul>
|
51 |
|
52 |
+
<?php
|
53 |
+
if ( $this->integrations->plugins->wpml->installed )
|
54 |
+
if ( $this->post_type->name !== 'post' ) echo $this->integrations->plugins->wpml->languageToolLinks(esc_attr($this->post_type->name));
|
55 |
+
?>
|
56 |
+
|
57 |
+
<?php
|
58 |
+
if ( $this->post_type->name !== 'page' && $this->post_type_repo->hasSortOptions($this->post_type->name) ) : ?>
|
59 |
<div class="np-tools-primary">
|
60 |
<form action="<?php echo admin_url('admin-post.php'); ?>" method="post" class="np-tools-sort">
|
61 |
<input type="hidden" name="action" value="npListingSort">
|
62 |
<input type="hidden" name="page" value="<?php echo $this->pageURL(); ?>">
|
63 |
+
<input type="hidden" name="post_type" value="<?php echo esc_attr($this->post_type->name); ?>">
|
64 |
+
<?php if ( $this->post_type_repo->sortOptionEnabled($this->post_type->name, 'author') ) : ?>
|
65 |
<div class="select first">
|
66 |
<select id="np_sortauthor" name="np_author" class="nestedpages-sort">
|
67 |
<?php
|
76 |
?>
|
77 |
</select>
|
78 |
</div>
|
79 |
+
<?php endif; ?>
|
80 |
+
<?php if ( $this->post_type_repo->sortOptionEnabled($this->post_type->name, 'orderby') ) : ?>
|
81 |
<div class="select">
|
82 |
<select id="np_orderby" name="np_orderby" class="nestedpages-sort">
|
83 |
<?php
|
96 |
?>
|
97 |
</select>
|
98 |
</div>
|
99 |
+
<?php endif; ?>
|
100 |
+
<?php if ( $this->post_type_repo->sortOptionEnabled($this->post_type->name, 'order') ) : ?>
|
101 |
<div class="select">
|
102 |
<select id="np_order" name="np_order" class="nestedpages-sort">
|
103 |
<?php
|
115 |
?>
|
116 |
</select>
|
117 |
</div>
|
118 |
+
<?php endif; ?>
|
119 |
+
<?php
|
120 |
+
// Taxonomies
|
121 |
+
$taxonomies = array_merge($this->h_taxonomies, $this->f_taxonomies);
|
122 |
+
foreach ( $taxonomies as $tax ) :
|
123 |
+
if ( $this->post_type_repo->sortOptionEnabled($this->post_type->name, $tax->name, true) ) :
|
124 |
+
$terms = get_terms($tax->name);
|
125 |
+
$out = '<div class="select">';
|
126 |
+
$out .= '<select id="np_taxonomy_' . $tax->name . '" name="' . $tax->name . '" class="nestedpages-sort">';
|
127 |
+
$out .= '<option value="all">' . $tax->labels->all_items . '</option>';
|
128 |
+
foreach ( $terms as $term ) :
|
129 |
+
$out .= '<option value="' . $term->term_id . '"';
|
130 |
+
if ( isset($_GET[$tax->name]) && $_GET[$tax->name] == $term->term_id ) $out .= ' selected';
|
131 |
+
$out .= '>' . $term->name . '</option>';
|
132 |
+
endforeach;
|
133 |
+
$out .= '</select>';
|
134 |
+
$out .= '</div>';
|
135 |
+
echo $out;
|
136 |
+
endif;
|
137 |
+
endforeach;
|
138 |
+
?>
|
139 |
<div class="select">
|
140 |
<input type="submit" id="nestedpages-sort" class="button" value="Apply">
|
141 |
</div>
|
177 |
<input type="hidden" name="posttype" value="<?php echo esc_attr($this->post_type->name); ?>">
|
178 |
<input type="hidden" name="page" value="<?php echo esc_url($this->pageURL()); ?>">
|
179 |
<?php wp_nonce_field('nestedpages-nonce', 'nonce'); ?>
|
180 |
+
<input type="search" name="search_term" id="nestedpages-search" placeholder="<?php echo esc_attr($this->post_type->labels->search_items); ?>" <?php if ( $this->listing_repo->isSearch() ) echo ' value="' . esc_attr(sanitize_text_field($_GET['search'])) . '"'; ?>>
|
181 |
+
<input type="submit" name="" class="button" value="<?php echo $searchLabel;?>">
|
182 |
</form>
|
183 |
</div><!-- .np-tools-search -->
|
184 |
|
app/Views/partials/wpml-translations.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $all_languages = $this->integrations->plugins->wpml->getLanguages(); ?>
|
2 |
+
<div class="quick-edit np-wpml-translations-modal np-inline-modal loading" data-np-wpml-translations-modal style="display:none;">
|
3 |
+
<div class="form-interior">
|
4 |
+
<h3><?php _e('Translations for ', 'wp-nested-pages'); ?><strong data-wmpl-translation-title></strong></h3>
|
5 |
+
<div class="loading-indicator">
|
6 |
+
<img src="<?php echo NestedPages\Helpers::plugin_url(); ?>/assets/images/spinner-2x.gif" alt="<?php _e('Loading', 'wp-nested-pages'); ?>" />
|
7 |
+
</div>
|
8 |
+
<div class="np-quickedit-error" style="clear:both;display:none;"></div>
|
9 |
+
<table class="np-translations-table" data-np-wpml-translations-modal-table></table>
|
10 |
+
</div><!-- .form-interior -->
|
11 |
+
<div class="buttons">
|
12 |
+
<a accesskey="c" href="#inline-edit" class="button-secondary alignleft np-cancel-quickedit">
|
13 |
+
<?php _e( 'Close' ); ?>
|
14 |
+
</a>
|
15 |
+
</div>
|
16 |
+
</div><!-- .np-wpml-translations-modal -->
|
app/Views/settings/settings-posttypes.php
CHANGED
@@ -4,14 +4,14 @@ $thumbnail_sizes = get_intermediate_image_sizes();
|
|
4 |
settings_fields( 'nestedpages-posttypes' );
|
5 |
?>
|
6 |
|
7 |
-
<h3><?php _e('Enable
|
8 |
|
9 |
-
<div class="nestedpages-settings-
|
10 |
<?php foreach ($types as $type) : ?>
|
11 |
-
<div class="
|
12 |
<div class="head">
|
13 |
<div class="checkbox">
|
14 |
-
<input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>]" value="<?php echo esc_attr($type->name); ?>" <?php if ( $type->np_enabled ) echo 'checked'; ?> data-nestedpages-
|
15 |
</div>
|
16 |
<label for="post-type-<?php echo $type->name; ?>">
|
17 |
<?php
|
@@ -22,7 +22,7 @@ settings_fields( 'nestedpages-posttypes' );
|
|
22 |
<a href="#" class="button" data-toggle-nestedpages-pt-settings><?php _e('Settings', 'wp-nested-pages'); ?></a>
|
23 |
</div><!-- .head -->
|
24 |
<div class="body">
|
25 |
-
<ul class="
|
26 |
<li>
|
27 |
<div class="row">
|
28 |
<div class="description">
|
@@ -235,7 +235,46 @@ settings_fields( 'nestedpages-posttypes' );
|
|
235 |
</div><!-- .field -->
|
236 |
</div><!-- .row -->
|
237 |
</li>
|
238 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
</ul>
|
240 |
</div><!-- .body -->
|
241 |
</div><!-- .post-type -->
|
4 |
settings_fields( 'nestedpages-posttypes' );
|
5 |
?>
|
6 |
|
7 |
+
<h3><?php _e('Enable Post Types:', 'wp-nested-pages'); ?></h3>
|
8 |
|
9 |
+
<div class="nestedpages-settings-table">
|
10 |
<?php foreach ($types as $type) : ?>
|
11 |
+
<div class="row-container">
|
12 |
<div class="head">
|
13 |
<div class="checkbox">
|
14 |
+
<input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>]" value="<?php echo esc_attr($type->name); ?>" <?php if ( $type->np_enabled ) echo 'checked'; ?> data-nestedpages-settings-row-checkbox id="post-type-<?php echo esc_attr($type->name); ?>" />
|
15 |
</div>
|
16 |
<label for="post-type-<?php echo $type->name; ?>">
|
17 |
<?php
|
22 |
<a href="#" class="button" data-toggle-nestedpages-pt-settings><?php _e('Settings', 'wp-nested-pages'); ?></a>
|
23 |
</div><!-- .head -->
|
24 |
<div class="body">
|
25 |
+
<ul class="settings-details">
|
26 |
<li>
|
27 |
<div class="row">
|
28 |
<div class="description">
|
235 |
</div><!-- .field -->
|
236 |
</div><!-- .row -->
|
237 |
</li>
|
238 |
+
<?php endif; ?>
|
239 |
+
<?php
|
240 |
+
if ( $type->name !== 'page' ) :
|
241 |
+
$h_taxonomies = $this->post_type_repo->getTaxonomies($type->name, true);
|
242 |
+
$f_taxonomies = $this->post_type_repo->getTaxonomies($type->name, false);
|
243 |
+
$taxonomies = array_merge($h_taxonomies, $f_taxonomies);
|
244 |
+
?>
|
245 |
+
<li>
|
246 |
+
<div class="row">
|
247 |
+
<div class="description">
|
248 |
+
<p><strong><?php _e('Sort Options', 'wp-nested-pages'); ?></strong><br />
|
249 |
+
<?php _e('Add and remove sort options.', 'wp-nested-pages'); ?></p>
|
250 |
+
</div>
|
251 |
+
<div class="field">
|
252 |
+
<div class="nestedpages-sort-options-selection">
|
253 |
+
<label>
|
254 |
+
<input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][sort_options][author]" value="true" <?php if ( $this->post_type_repo->sortOptionEnabled($type->name, 'author') ) echo 'checked'; ?> />
|
255 |
+
<?php _e('Author') ?>
|
256 |
+
</label>
|
257 |
+
<label>
|
258 |
+
<input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][sort_options][orderby]" value="true" <?php if ( $this->post_type_repo->sortOptionEnabled($type->name, 'orderby') ) echo 'checked'; ?> />
|
259 |
+
<?php _e('Order By') ?>
|
260 |
+
</label>
|
261 |
+
<label>
|
262 |
+
<input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][sort_options][order]" value="true" <?php if ( $this->post_type_repo->sortOptionEnabled($type->name, 'order') ) echo 'checked'; ?> />
|
263 |
+
<?php _e('Order') ?>
|
264 |
+
</label>
|
265 |
+
|
266 |
+
<?php if ( !empty($taxonomies) ) : foreach ( $taxonomies as $tax ) : ?>
|
267 |
+
<label>
|
268 |
+
<input type="checkbox" name="nestedpages_posttypes[<?php echo esc_attr($type->name); ?>][sort_options][taxonomies][<?php echo $tax->name; ?>]" value="true" <?php if ( $this->post_type_repo->sortOptionEnabled($type->name, $tax->name, true) ) echo 'checked'; ?> />
|
269 |
+
<?php echo $tax->label; ?>
|
270 |
+
</label>
|
271 |
+
<?php endforeach; endif; ?>
|
272 |
+
|
273 |
+
<!-- .nestedpages-sort-options-selection -->
|
274 |
+
</div><!-- .field -->
|
275 |
+
</div><!-- .row -->
|
276 |
+
</li>
|
277 |
+
<?php endif; ?>
|
278 |
</ul>
|
279 |
</div><!-- .body -->
|
280 |
</div><!-- .post-type -->
|
assets/css/nestedpages.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@font-face{font-family:'nestedpages';src:url("fonts/nestedpages.eot")}@font-face{font-family:'nestedpages';src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMghi/6sAAAC8AAAAYGNtYXCa4JfrAAABHAAAAIxnYXNwAAAAEAAAAagAAAAIZ2x5ZthTIwkAAAGwAAAIVGhlYWQJZzAVAAAKBAAAADZoaGVhA+IB+QAACjwAAAAkaG10eCsABZEAAApgAAAAYGxvY2EUUBJOAAAKwAAAADJtYXhwACAAUwAACvQAAAAgbmFtZdvrS2kAAAsUAAABtnBvc3QAAwAAAAAMzAAAACAAAwH0AZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAQHg/+AAIAHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAcAAAABgAEAADAAgAAQAg4lTlTuXU5gfmDeYS6JfpAf/9//8AAAAAACDiVOVO5dTmAOYK5hHol+kA//3//wAB/+MdsBq3GjIaBxoFGgIXfhcWAAMAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAIAQAAVAboBjwAJAA4AAAEHJzc2Mh8BFhQFNxcHIwG6J1AnBhIGMgb+gOxQ7FABPydQJwYGMgYS4OxQ7AAAAAACACsAAAHVAaoACwAlAAATMjY1NCYjIgYVFBYFHgEVFAYPAQ4BIyImLwEuAT0BNDY7ATIWF3UNExIODRMSAWIGBgYGlgYPCQkPBsAGBhkRlgkPBgFAEw0OEhIODRNiBg8JCQ8GlgYGBgbABg8JlhIYBgYAAAMA1QAqASsBgAALABcAIwAAJTIWFRQGIyImNTQ2NzIWFRQGIyImNTQ2NyImNTQ2MzIWFRQGAQARGhoRERoaEREaGhERGhoRERoaEREaGoAZEhEaGhESGYAZEhEaGhESGSoaERIZGRIRGgAAAAEAMwBGAc0BegAJAAA3MzUXBzUhNTMVZueAgP7mM8ZNZmdN57QAAAABAG0ATQGTAXQACwAAJQcnByc3JzcXNxcHAY44WF00XVg4WF00XYE0XVg4WF01XVc4WAAAAQCaAHwBkwFTAAYAAAEXByMnNxcBcCOKIk0iPAFTGL9nIDAAAwBNAGABswFgAAMABwALAAABNSEVBTUhFQU1IRUBs/6aAWb+mgFm/poBLTMzZzQ0ZjMzAAEAswB6AYABEwADAAABByczAYBnZs0BE5mZAAABAM0AegFmAUYAAwAAExcHNc2ZmQFGZ2XMAAAAAwAgACAB4AGAAAMABwALAAATIRUhFSEVIRUhFSEgAcD+QAHA/kABwP5AAYBgIGAgYAAAAAEAAP/gAgABwAAeAAABMh4CFRQOAiMiJicOAQc1PgE1NCY1LgE1ND4CAQA1XUYoKEZdNQoUCilfMBomASwzKEZdAcAhOEwrK0w4IQECKhgBDgwsGgQHAx1UMStMOCEAAAcAQP/gAcAB4AAJAA4AHwAvADMANwA7AAABISIGHQEhNTQmJxcjNzM3IyIGDwEGFjsBMjYvAS4BIxchIgYXEx4BOwEyNjcTNiYDIyczFyM1MxcjNTMBkP7gFBwBgBxoB4YHeASAChABCgEMCqAKDAEKARAKWP7QDREBGgEVDfANFQEaARHlMBBAYEBAUDBAAaAcFBAQFBwgMjIgDgpDCg0NCkMKDqATDf7gDRMTDQEgDRP+4ODg4ODgAAAAAwAAAEACAAGAABMAOABEAAABIg4CBx4DMzI+AjcuAxceARcOAQcOASMiJicuASc+ATc+ATcOARUUFjMyNjU0JiceARcHFAYjIiY1NDYzMhYBACpNQjUSEjVCTSoqTUI1EhI1Qk1UFyYODiYXHEAiIkAcFyYODiYXAQMCBARLNTVLBAQCAwF+HBQUHBwUFBwBgBcqOyQkOyoXFyo7JCQ7KhdVDiYXFyYOEhMTEg4mFxcmDgECAQoWDDVLSzUMFgoBAgEYFBwcFBQcHAAABQAAAAACAAHgABkAIwA1AD8AUAAAAR4BFw4DIyImJzceATMyNjc+ATcuASc3ByImJzceARUUBhMjBy4BIyIOAgceARcHFTMBBTIWFwcuATU0Ngc+ATc+ATcOARUUFhcHLgEnAaQdLxASNUJNKhctFicNGQ0iQBwXJg4OJBYjpAkQCJ0CAkurG24ULBcqTUI1EhAuHVsbAcX+8BIbAjYSFxyFDiYXAQMCBAQODB0VIw4BTBU3ICQ7KhcHCCcDAxMSDiYXFiUOI8kCAp0IEAk1SwFdbgcHFyo7JCA2FVobAcWCFxI2AhsSFBxjFyYOAQIBChYMFigQHQ4kFgAABgAA/+ACAAHgAAMABwALABcAIwAvAAATIRUhFSEVIRUhFSEDNDYzMhYVFAYjIiYVNDYzMhYVFAYjIiYVNDYzMhYVFAYjIibAAUD+wAFA/sABQP7AwCUbGyUlGxslJRsbJSUbGyUlGxslJRsbJQHAQIBAgEABoBslJRsbJSWlGyUlGxslJaUbJSUbGyUlAAAAAQAA/+ACAAHgACMAAAEjNTQmKwEiBh0BIyIGHQEUFjsBFRQWOwEyNj0BMzI2PQE0JgHwsAkHYAcJsAcJCQewCQdgBwmwBwkJASCwBwkJB7AJB2AHCbAHCQkHsAkHYAcJAAAAAAIAIwADAd0BvQAjAEgAAAEnJiIPAQYUHwEeARc3LgEvASY0PwE2Mh8BFhQPAR4BBzc2NAcuAScHHgEfARYUDwEGIi8BJjQ/AS4BNwcGFB8BFjI/ATY0LwEB3QIkZCNuIyMCAwcDKAQGAwITE20TNhMCFBQxBwYBTSPEAwcDKAQGAwITE20TNhMCFBQxBwYBTSMjAiRkI24jIwIBuwIjI20kZCQCAgYCKAIFAwITNhNtFBQCEzYTMg8iEU0jZHkCBgIoAgUDAhM2E20UFAITNhMyDyIRTSNkJAIjI20kZCQCAAAAAAMAVQAAAasBwAAIABQALQAAATU0JiMiBh0BFzI2NTQmIyIGFRQWNzIWHQEUBiMhIiY9ATQ2OwE1NDYzMhYdAQFCJxsbJ0IRGhoRERoakREaGhH/ABEaGhEVPywsPwEqKxsnJxsrwBoREhkZEhEawBgS1hEZGRHWEhgrLT4+LSsAAQAlAAkB3QHBAB0AAAE3FwcmBg8BDgEXBycHDgEnJjY/ASc3FjY/AT4BJwELL6MvFDIRFBEFDS4+SAhRCAg6CEg+LxQxEhMSBQ4Bky6iLw0EEhMSMRUuPkgIOwgJUQhHPi8NBBITEjEVAAAAAgBNABMBmgGtAAQACgAANxEhESEHMxUhETOaAQD/ABrN/wAzYAFN/rMaMwFNAAAAAQAAAAEAAPW5O21fDzz1AAsCAAAAAADUI/esAAAAANQj96wAAP/gAgAB4AAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAACAAABAAAAAAAAAAAAAAAAAAAAGAIAAAAAAAAAAAAAAAEAAAACAABAAgAAKwIAANUCAAAzAgAAbQIAAJoCAABNAgAAswIAAM0CAAAgAgAAAAIAAEACAAAAAgAAAAIAAAACAAAAAgAAIwIAAFUCAAAlAgAATQAAAAAACgAUAB4APgB4AK4AwgDcAO4BCAEWASQBPgFuAcwCMgKwAvgDKgOcA9wEEgQqAAAAAQAAABgAUQAHAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAsAAAABAAAAAAACAAcAhAABAAAAAAADAAsAQgABAAAAAAAEAAsAmQABAAAAAAAFAAsAIQABAAAAAAAGAAsAYwABAAAAAAAKABoAugADAAEECQABABYACwADAAEECQACAA4AiwADAAEECQADABYATQADAAEECQAEABYApAADAAEECQAFABYALAADAAEECQAGABYAbgADAAEECQAKADQA1G5lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMG5lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc25lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc1JlZ3VsYXIAUgBlAGcAdQBsAGEAcm5lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype");font-weight:normal;font-style:normal}[class^="np-icon-"],[class*=" np-icon-"]{font-family:'nestedpages' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.np-icon-pencil:before{content:"\e254"}.np-icon-lock:before{content:"\e897"}.np-icon-tag:before{content:"\e54e"}.np-icon-more_vert:before{content:"\e5d4"}.np-icon-page:before{content:"\e901"}.np-icon-post:before{content:"\e900"}.np-icon-no:before{content:"\e601"}.np-icon-yes:before{content:"\e602"}.np-icon-menu:before{content:"\e603"}.np-icon-arrow-down:before{content:"\e604"}.np-icon-arrow-right:before{content:"\e605"}.np-icon-sub-menu:before{content:"\e600"}.np-icon-bubble:before{content:"\e607"}.np-icon-remove:before{content:"\e60a"}.np-icon-list:before{content:"\e60d"}.np-icon-menu2:before{content:"\e606"}.np-icon-link:before{content:"\e612"}.np-icon-eye:before{content:"\e60b"}.np-icon-eye-blocked:before{content:"\e60c"}.np-icon-plus:before{content:"\e611"}.np-btn,.np-toggle-edit{text-decoration:none;color:#555;display:inline-block;background-color:#f7f7f7;border:1px solid #e1e1e1;padding:5px 8px;-webkit-transition:all 200ms ease;transition:all 200ms ease}.np-btn:hover,.np-toggle-edit:hover{background-color:#0074a2;color:#fff;-webkit-transition:all 200ms ease;transition:all 200ms ease;border-color:#0074a2}.np-btn:disabled,.np-toggle-edit:disabled,.np-btn.disabled,.disabled.np-toggle-edit{opacity:.6;cursor:not-allowed}.np-btn-half{float:left;width:47%;padding:3px 0px;text-align:center}.np-btn-half.btn-right{float:right}.np-btn-trash{background-color:#e14d43;border-color:#e14d43;color:#fff}.np-btn-trash:hover{background-color:#ba281e;border-color:#ba281e}.np-toggle-edit{display:none;float:right;margin-right:10px;position:relative;top:9px}.np-toggle-edit.active{background-color:#0074a2;color:#fff;-webkit-box-shadow:none;box-shadow:none;border-color:#0074a2}@media (max-width: 767px){.np-toggle-edit{display:inline-block}}.np-quickedit-error{border-left:4px solid #dd3d36;padding:4px 0 4px 8px;margin-bottom:10px;background-color:#f9f9f9}.np-quickedit-info{border-left:4px solid #0074a2;padding:4px 0 4px 8px;margin-bottom:10px;background-color:#f9f9f9}.modal-open{overflow:hidden}.np-modal{display:none;overflow:hidden;position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999;-webkit-overflow-scrolling:touch;outline:0}.np-modal .modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.85;z-index:9999}.np-modal.fade .modal-dialog{-webkit-transform:translate(0, -25%);-ms-transform:translate(0, -25%);transform:translate(0, -25%);-webkit-transition:-webkit-transform 0.3s ease-out;transition:-webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out;transition:transform 0.3s ease-out, -webkit-transform 0.3s ease-out}.np-modal.in .modal-dialog{-webkit-transform:translate(0, 0);-ms-transform:translate(0, 0);transform:translate(0, 0)}.np-modal .modal-open .modal{overflow-x:hidden;overflow-y:auto}.np-modal .modal-dialog{position:relative;width:90%;height:80%;margin:10px auto 0px auto;max-width:800px;z-index:9999}.np-modal .modal-content{position:relative;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);background-clip:padding-box;outline:0}.np-modal .modal-header{padding:8px;background-color:#ebebeb}.np-modal .modal-header .sr-only{display:none}.np-modal .modal-header .close{margin-top:-2px}.np-modal .modal-title{margin:0}.np-modal .modal-body{position:relative;padding:10px}.np-modal .modal-body.new-child{padding:0}.np-modal .modal-footer{padding:10px;text-align:right;background-color:#404040;zoom:1}.np-modal .modal-footer:before,.np-modal .modal-footer:after{content:" ";display:table}.np-modal .modal-footer:after{clear:both}.np-modal .modal-footer .modal-close{float:left}.np-modal .modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.clone-modal h3{margin:0;padding:8px;background-color:#e5e5e5}.clone-modal .form-control{margin:0 !important;padding:5px 10px}.np-trash-modal{text-align:center}.np-trash-modal .modal-body{padding-bottom:30px}.np-trash-modal .button-primary{margin-left:10px}.np-inline-overlay{position:fixed;width:100%;height:100%;background-color:rgba(0,0,0,0.4);z-index:998;top:0;right:0;bottom:0;left:0;opacity:0;-webkit-transition:opacity 200ms ease;transition:opacity 200ms ease}.np-inline-overlay.active{opacity:1;-webkit-transition:opacity 200ms ease;transition:opacity 200ms ease}.np-inline-modal{position:relative;z-index:999;background-color:#fff;-webkit-border-radius:0;border-radius:0;-webkit-box-shadow:0px 0px 4px 0px rgba(0,0,0,0.5);box-shadow:0px 0px 4px 0px rgba(0,0,0,0.5)}.nestedpages-listing-title{float:left}.nestedpages .updated{clear:both}.nestedpages-toggleall.np-btn,.nestedpages-toggleall.np-toggle-edit{float:right}.np-toggle-publish{color:#999}.np-toggle-publish.active{color:#333;font-weight:bold}.np-sync-menu-cont{float:right;margin:0px 15px 0px 0px}.np-sync-menu-cont button{position:relative;top:-5px;padding:5px 8px}.np-sync-menu-cont label{position:relative;top:4px}#nested-loading{display:none;float:right;width:30px;margin:0px 20px 0 0}.nestedpages-top-toggles{zoom:1;padding-top:10px}.nestedpages-top-toggles:before,.nestedpages-top-toggles:after{content:" ";display:table}.nestedpages-top-toggles:after{clear:both}.np-tabs{background-color:#ebebeb;padding:0px}.np-tabs ul{text-align:left;list-style-type:none;margin:0;padding:0}.np-tabs ul li{display:inline-block;margin:0}.np-tabs ul li a{display:block;text-decoration:none;padding:5px 10px}.np-tabs ul li a.active{position:relative;color:#333;background-color:#fff}.np-tabs ul li a:focus,.np-tabs ul li a:active{outline:none;-webkit-box-shadow:none;box-shadow:none}.nestedpages-datepicker.ui-datepicker{background-color:#fff;font-size:90%;-webkit-box-shadow:0px 0px 3px 0px rgba(0,0,0,0.4);box-shadow:0px 0px 3px 0px rgba(0,0,0,0.4);-webkit-border-radius:3px;border-radius:3px;padding:0;width:auto}.nestedpages-datepicker.ui-datepicker .ui-datepicker-next,.nestedpages-datepicker.ui-datepicker .ui-datepicker-prev{position:absolute;color:#fff;top:0px;right:0px;cursor:pointer;display:block;width:35px;height:35px;font-size:0;background:url("../images/datepicker-arrow-next.png");background-position:center;opacity:1;-webkit-transition:opacity 200ms ease;transition:opacity 200ms ease}.nestedpages-datepicker.ui-datepicker .ui-datepicker-next:hover,.nestedpages-datepicker.ui-datepicker .ui-datepicker-prev:hover{opacity:.5;-webkit-transition:opacity 200ms ease;transition:opacity 200ms ease}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar{margin:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-prev{right:auto;left:0px;background:url("../images/datepicker-arrow-prev.png")}.nestedpages-datepicker.ui-datepicker .ui-datepicker-header{padding:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-title{background-color:#1a1a1a;text-align:center;color:#fff;height:35px;line-height:35px;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;margin:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar{border-collapse:collapse}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar table{width:auto}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar th,.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar td{text-align:center;width:30px;height:30px}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar th{background-color:#e6e6e6;text-transform:uppercase;font-size:11px;letter-spacing:1px;padding:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar td{border-top:1px solid #ebebeb;border-left:1px solid #ebebeb;padding:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar td:first-child{border-left:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar a{text-align:center;padding:0;text-decoration:none;color:#333;display:block;background-color:#fff;-webkit-transition:all 200ms ease;transition:all 200ms ease;width:30px;height:30px;line-height:30px}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar a.ui-state-active{background-color:#1a1a1a;color:#fff}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar a:hover{background-color:#333;color:#fff;-webkit-transition:all 200ms ease;transition:all 200ms ease}.nestedpages-tools{zoom:1;clear:both;clear:both;margin:20px 0px 5px 0px}.nestedpages-tools:before,.nestedpages-tools:after{content:" ";display:table}.nestedpages-tools:after{clear:both}.nestedpages-tools .subsubsub{margin:0}.nestedpages-tools .np-tools-primary{clear:left;padding-top:8px}.nestedpages-tools .select{float:left;margin-left:5px}.nestedpages-tools .select.first{margin-left:0}.nestedpages-tools .np-tools-sort{float:left}.nestedpages-tools .np-tools-search{float:right}.wppages-handle-expand{float:left;background-color:#f2f2f2;font-size:18px;width:46px;height:46px;margin-right:5px;text-align:center;border-right:1px solid #e1e1e1}.wppages-handle-expand div{background-color:#fff;border:1px solid #e1e1e1;width:24px;height:24px;line-height:24px;-webkit-border-radius:15px;border-radius:15px;margin-top:9px;cursor:pointer;-webkit-transition:all 200ms ease;transition:all 200ms ease}.wppages-handle-expand div:hover{background-color:#0074a2;border-color:#0074a2;color:#fff;-webkit-transition:all 200ms ease;transition:all 200ms ease}.nestedpages{clear:both;-webkit-border-radius:4px;border-radius:4px}.nestedpages .ui-sortable-placeholder{display:block !important;position:relative;min-height:46px;border:0;border:1px dashed #0074a2 !important;background-color:#effaff;margin:0}.nestedpages .ui-sortable-helper{opacity:0.8;-webkit-box-shadow:2px 2px 3px 0px rgba(0,0,0,0.5);box-shadow:2px 2px 3px 0px rgba(0,0,0,0.5)}.nestedpages ol{list-style-type:none;clear:both;margin:0;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.06);box-shadow:0 1px 1px rgba(0,0,0,0.06);border:1px solid #e5e5e5;-webkit-border-radius:3px;border-radius:3px}.nestedpages ol a{text-decoration:none}.nestedpages ol .page-link .edit-indicator{margin-left:10px;display:none}.nestedpages ol .page-link .edit-indicator i{font-size:12px;margin-right:3px}.nestedpages ol .page-link:hover .edit-indicator{display:inline}.nestedpages ol .np-page-type{color:#333}.nestedpages ol .locked{color:#333;margin-left:20px}.nestedpages ol .locked em{font-style:normal}.nestedpages ol .status{color:#999}.nestedpages ol .np-icon-eye-blocked{color:#999}.nestedpages ol .nav-status{color:#b3b3b3}.nestedpages ol .np-hide{display:none}.nestedpages ol .np-assigned-pt-actions{list-style-type:none;margin:0;padding:0;display:inline-block;margin-left:10px}.nestedpages ol .np-assigned-pt-actions li{display:inline-block;background:transparent;border:0}.nestedpages ol .np-assigned-pt-actions li a{color:#333;display:block;border-left:1px solid #e1e1e1;padding:0 5px}.nestedpages ol .np-assigned-pt-actions li:first-child a{border:0;padding-left:0}.nestedpages ol .np-seo-indicator{display:block;position:absolute;right:10px;top:50%;margin-top:-6px;width:12px;height:12px;-webkit-border-radius:50%;border-radius:50%;background-color:#999}.nestedpages ol .np-seo-indicator.good{background-color:#7ad03a}.nestedpages ol .np-seo-indicator.ok{background-color:#ffba00}.nestedpages ol .np-seo-indicator.poor{background-color:#ee7c1b}.nestedpages ol .np-seo-indicator.bad{background-color:#dd3d36}.nestedpages ol .np-seo-indicator.warn{background-color:maroon}.nestedpages ol .np-seo-indicator.wrong{background-color:red}.nestedpages ol .np-seo-indicator.noindex{background-color:#1e8cbe}.nestedpages ol li{margin:0;border-top:1px solid #e1e1e1;background-color:#0074a2}.nestedpages ol li.first{border:0}.nestedpages ol li:first-child{border:0}.nestedpages ol li.no-border{border:0}.nestedpages ol ol{display:none;-webkit-border-radius:0;border-radius:0;list-style-type:none;border:0;-webkit-box-shadow:none;box-shadow:none;border-top:1px solid #e1e1e1}.nestedpages .np-search-results .np-hide{display:block}.nestedpages .child-toggle{display:table-cell;width:46px;background-color:#f0f0f0;text-align:center;position:relative}.nestedpages .child-toggle .child-toggle-spacer{height:46px;width:100%}.nestedpages .child-toggle a{position:absolute;top:50%;left:8px;margin-top:-16px;width:28px;height:28px;background-color:#fff;border:1px solid #e1e1e1;-webkit-border-radius:20px;border-radius:20px;font-size:20px;line-height:30px;color:#333;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:all 200ms ease;transition:all 200ms ease}.nestedpages .child-toggle a i{line-height:26px}.nestedpages .child-toggle a:hover{background-color:#0074a2;color:#fff;border-color:#0074a2}.nestedpages .handle{display:inline-block;cursor:move;font-size:20px;margin-top:-8px;position:relative;top:2px;color:#b3b3b3;-webkit-transition:all 200ms ease;transition:all 200ms ease}.nestedpages .handle:hover{-webkit-transition:all 200ms ease;transition:all 200ms ease;color:#0074a2}.nestedpages .np-icon-sub-menu{display:none;color:#999}.nestedpages .row.no-sort .page-title{padding-left:10px}.nestedpages .np-thumbnail{display:table-cell;width:80px;vertical-align:middle;zoom:1}.nestedpages .np-thumbnail:before,.nestedpages .np-thumbnail:after{content:" ";display:table}.nestedpages .np-thumbnail:after{clear:both}.nestedpages .np-thumbnail img{float:right;width:100%;height:auto}.nestedpages .np-thumbnail.large{width:150px}.nestedpages .np-thumbnail.small{width:50px}.nestedpages .np-thumbnail.link{background-color:#ebebeb;text-align:center}.nestedpages .np-thumbnail.link i{font-size:1.8em;opacity:.5}.nestedpages .np-bulk-checkbox{display:table-cell;width:33px;vertical-align:middle;text-align:center;background-color:#f0f0f0}.nestedpages .np-bulk-checkbox input[type="checkbox"]{margin-right:0}.nestedpages .handle,.nestedpages .np-icon-sub-menu{width:30px;text-align:center;vertical-align:middle}.nestedpages li ol .row .np-icon-sub-menu{display:inline-block}.nestedpages li ol .row .handle{display:none}.nestedpages li ol .row:hover .np-icon-sub-menu{display:none}.nestedpages li ol .row:hover .handle{display:inline-block}.nestedpages li ol .row.no-sort .np-icon-sub-menu{display:inline-block}.nestedpages .row{background-color:#fff;display:table;width:100%}.nestedpages .row:hover{background-color:#f0f0f0}.nestedpages .row:hover .cell.custom-column{visibility:hidden}.nestedpages .row.np-updated{background-color:#e9f7df;-webkit-transition:background-color 400ms ease;transition:background-color 400ms ease}.nestedpages .row.np-updated-show{background-color:#fff;-webkit-transition:background-color 400ms ease;transition:background-color 400ms ease}.nestedpages .row.search .page-title{padding-left:10px}.nestedpages .non-hierarchical-spacer{height:47px}.nestedpages .row-inner{display:table-cell;vertical-align:middle;position:relative}.nestedpages ol li ol .row-inner{padding-left:0px}.nestedpages ol li ol li ol .row-inner{padding-left:20px}.nestedpages ol li ol li ol li ol .row-inner{padding-left:40px}.nestedpages ol li ol li ol li ol li ol .row-inner{padding-left:60px}.nestedpages ol li ol li ol li ol li ol li ol .row-inner{padding-left:80px}.nestedpages .np-post-columns{float:right;margin:3px 20px 0px 0px;zoom:1}.nestedpages .np-post-columns:before,.nestedpages .np-post-columns:after{content:" ";display:table}.nestedpages .np-post-columns:after{clear:both}.nestedpages .np-post-columns ul li{background:transparent;color:gray;border:0;float:left;margin-left:8px;padding-left:8px;border-left:1px solid #ccc}.nestedpages .np-post-columns ul li:first-child{margin-left:0;padding-left:0;border:0}.nestedpages .has-yoast .np-post-columns{margin-right:30px}.nestedpages .has-custom-columns .np-post-columns{display:none}.nestedpages .action-buttons{display:none;position:absolute;right:10px;top:50%;margin-top:-15px}.nestedpages .action-buttons a{margin:0 0 0 -5px}.nestedpages .action-buttons a.np-btn-trash{margin-left:4px}.np-search{float:right}.nestedpages-list-header{background-color:#fff;border:1px solid #e1e1e1;border-bottom:0;height:46px;zoom:1}.nestedpages-list-header:before,.nestedpages-list-header:after{content:" ";display:table}.nestedpages-list-header:after{clear:both}.nestedpages-list-header .np-check-all{float:right;width:33px;text-align:center;line-height:46px;background-color:#f0f0f0}.nestedpages-list-header .np-check-all input[type="checkbox"]{margin:0}.nestedpages-list-header .np-check-all input[type="checkbox"].check-all-partial:checked:before{content:"-";margin:0;margin-top:-9px}.nestedpages-list-header .np-hidden-select-count{display:none;float:right;margin:0 1em 0 0;line-height:46px;font-style:oblique}.nestedpages-list-header .np-bulk-form{padding-right:3px;float:right;margin-right:5px;position:relative;top:9px}.nestedpages-list-header .np-bulk-form select,.nestedpages-list-header .np-bulk-form input[type="submit"]{display:inline-block}@media (min-width: 768px){.nestedpages .row:hover .action-buttons{display:block}.nestedpages .row:hover .np-post-columns{display:none}}@media (max-width: 767px){.nestedpages ol .page-link{line-height:24px}.nestedpages ol .page-link:hover span{display:none}.nestedpages ol .locked em{display:none}.nestedpages .child-toggle{background:transparent}.nestedpages .row{height:auto}.nestedpages .action-buttons{display:none;background-color:#0074a2;float:none;margin:0;padding:8px}.nestedpages .action-buttons a{margin-left:5px}}.nestedpages .quick-edit .form-interior,.nestedpages .new-child .form-interior{padding:10px}.nestedpages .quick-edit h3,.nestedpages .new-child h3{margin:0 0 8px 0;font-size:14px}.nestedpages .quick-edit h3 span,.nestedpages .new-child h3 span{float:right;font-size:12px}.nestedpages .quick-edit h3 span em,.nestedpages .new-child h3 span em{font-weight:normal;font-style:normal;color:gray}.nestedpages .quick-edit .fields,.nestedpages .new-child .fields{margin-bottom:10px;background:url("../images/border.png") repeat-y;background-position:center;zoom:1}.nestedpages .quick-edit .fields:before,.nestedpages .quick-edit .fields:after,.nestedpages .new-child .fields:before,.nestedpages .new-child .fields:after{content:" ";display:table}.nestedpages .quick-edit .fields:after,.nestedpages .new-child .fields:after{clear:both}.nestedpages .quick-edit .left,.nestedpages .new-child .left{float:left;width:48%}.nestedpages .quick-edit .right,.nestedpages .new-child .right{float:right;width:48%}.nestedpages .quick-edit label,.nestedpages .new-child label{font-style:oblique}.nestedpages .quick-edit .buttons,.nestedpages .new-child .buttons{clear:both;zoom:1;background-color:#404040;padding:8px}.nestedpages .quick-edit .buttons:before,.nestedpages .quick-edit .buttons:after,.nestedpages .new-child .buttons:before,.nestedpages .new-child .buttons:after{content:" ";display:table}.nestedpages .quick-edit .buttons:after,.nestedpages .new-child .buttons:after{clear:both}.nestedpages .quick-edit .form-control,.nestedpages .new-child .form-control{clear:both;zoom:1;margin-bottom:5px}.nestedpages .quick-edit .form-control:before,.nestedpages .quick-edit .form-control:after,.nestedpages .new-child .form-control:before,.nestedpages .new-child .form-control:after{content:" ";display:table}.nestedpages .quick-edit .form-control:after,.nestedpages .new-child .form-control:after{clear:both}.nestedpages .quick-edit .form-control input[type='text'],.nestedpages .quick-edit .form-control input[type='password'],.nestedpages .quick-edit .form-control select,.nestedpages .new-child .form-control input[type='text'],.nestedpages .new-child .form-control input[type='password'],.nestedpages .new-child .form-control select{float:right;width:75%}.nestedpages .quick-edit .form-control label,.nestedpages .new-child .form-control label{float:left;width:20%}.nestedpages .quick-edit .form-control.original-link,.nestedpages .new-child .form-control.original-link{background-color:#f9f9f9;border:1px solid #e1e1e1;padding:5px;font-style:oblique;margin-bottom:8px}.nestedpages .quick-edit .form-control.password label,.nestedpages .new-child .form-control.password label{width:25%}.nestedpages .quick-edit .form-control.password input[type="text"],.nestedpages .new-child .form-control.password input[type="text"]{float:left;width:35%}.nestedpages .quick-edit .form-control.password .private,.nestedpages .new-child .form-control.password .private{float:right;width:35%;margin-top:4px}.nestedpages .quick-edit .form-control.password .private label,.nestedpages .new-child .form-control.password .private label{width:auto;float:none}.nestedpages .quick-edit .form-control.np-datepicker-container .datetime,.nestedpages .new-child .form-control.np-datepicker-container .datetime{float:right;width:75%}.nestedpages .quick-edit .form-control.np-datepicker-container .np-time-container,.nestedpages .new-child .form-control.np-datepicker-container .np-time-container{float:left;width:45%;margin:0;position:relative}.nestedpages .quick-edit .form-control.np-datepicker-container .np-time-container input[type="text"],.nestedpages .new-child .form-control.np-datepicker-container .np-time-container input[type="text"]{float:left;width:55%}.nestedpages .quick-edit .form-control.np-datepicker-container .np-time-container select,.nestedpages .new-child .form-control.np-datepicker-container .np-time-container select{float:right;width:35%}.nestedpages .quick-edit .form-control.np-datepicker-container .np_datepicker,.nestedpages .new-child .form-control.np-datepicker-container .np_datepicker{float:left;width:45%;margin:0}.nestedpages .quick-edit .form-control.np-datepicker-container span,.nestedpages .new-child .form-control.np-datepicker-container span{float:left;width:10%;display:block;text-align:center;padding-top:3px}.nestedpages .quick-edit .form-control.full label,.nestedpages .new-child .form-control.full label{width:100%}.nestedpages .quick-edit .form-control.full.checkbox label,.nestedpages .new-child .form-control.full.checkbox label{padding:5px 0 5px 25%}.nestedpages .quick-edit .comments,.nestedpages .new-child .comments{float:right;width:75%;margin-bottom:10px;zoom:1}.nestedpages .quick-edit .comments:before,.nestedpages .quick-edit .comments:after,.nestedpages .new-child .comments:before,.nestedpages .new-child .comments:after{content:" ";display:table}.nestedpages .quick-edit .comments:after,.nestedpages .new-child .comments:after{clear:both}.nestedpages .quick-edit .dates,.nestedpages .new-child .dates{float:right;width:75%;margin-bottom:6px}.nestedpages .quick-edit .dates select,.nestedpages .new-child .dates select{width:25%}.nestedpages .quick-edit .dates input,.nestedpages .new-child .dates input{width:12%}.nestedpages .quick-edit .np-toggle-options,.nestedpages .new-child .np-toggle-options{background-color:#f2f2f2;padding:5px}.nestedpages .quick-edit .np-taxonomies,.nestedpages .quick-edit .np-menuoptions,.nestedpages .new-child .np-taxonomies,.nestedpages .new-child .np-menuoptions{display:none;clear:both;background-color:#f9f9f9;padding:8px;zoom:1;margin-top:5px}.nestedpages .quick-edit .np-taxonomies:before,.nestedpages .quick-edit .np-taxonomies:after,.nestedpages .quick-edit .np-menuoptions:before,.nestedpages .quick-edit .np-menuoptions:after,.nestedpages .new-child .np-taxonomies:before,.nestedpages .new-child .np-taxonomies:after,.nestedpages .new-child .np-menuoptions:before,.nestedpages .new-child .np-menuoptions:after{content:" ";display:table}.nestedpages .quick-edit .np-taxonomies:after,.nestedpages .quick-edit .np-menuoptions:after,.nestedpages .new-child .np-taxonomies:after,.nestedpages .new-child .np-menuoptions:after{clear:both}.nestedpages .quick-edit .np-taxonomy,.nestedpages .new-child .np-taxonomy{float:left;width:30%;margin-right:3.33%}.nestedpages .quick-edit .np-taxonomy .title,.nestedpages .new-child .np-taxonomy .title{font-weight:bold;margin-bottom:4px;display:block}.nestedpages .quick-edit .np-taxonomy li,.nestedpages .new-child .np-taxonomy li{background-color:#fff;border:0}.nestedpages .quick-edit .np-taxonomy textarea,.nestedpages .new-child .np-taxonomy textarea{width:100%;height:6.5em}.nestedpages .quick-edit .np-menuoptions,.nestedpages .new-child .np-menuoptions{padding:15px}.nestedpages .quick-edit .np-menuoptions label,.nestedpages .quick-edit .np-menuoptions input[type="text"],.nestedpages .new-child .np-menuoptions label,.nestedpages .new-child .np-menuoptions input[type="text"]{display:block;float:none;width:100%}.nestedpages .quick-edit .np-menuoptions .menuoptions-left,.nestedpages .new-child .np-menuoptions .menuoptions-left{float:left;width:47%}.nestedpages .quick-edit .np-menuoptions .menuoptions-right,.nestedpages .new-child .np-menuoptions .menuoptions-right{float:right;width:47%;padding-top:18px}.nestedpages .quick-edit .np-menuoptions .menuoptions-right label,.nestedpages .new-child .np-menuoptions .menuoptions-right label{margin-bottom:10px}.nestedpages .quick-edit .np-hide-options,.nestedpages .new-child .np-hide-options{display:none;background-color:#f0f0f0;-webkit-border-radius:3px;border-radius:3px;clear:both;padding:6px;-webkit-box-sizing:border-box;box-sizing:border-box}.nestedpages .quick-edit .np-hide-options p,.nestedpages .new-child .np-hide-options p{margin:0}.nestedpages .quick-edit .np-hide-options label,.nestedpages .new-child .np-hide-options label{display:block;margin-top:4px;font-style:normal}.nestedpages .quick-edit .new-page-titles,.nestedpages .new-child .new-page-titles{display:block;border:0}.nestedpages .quick-edit .new-page-titles li,.nestedpages .new-child .new-page-titles li{background:transparent;border:0;padding:4px;zoom:1}.nestedpages .quick-edit .new-page-titles li:before,.nestedpages .quick-edit .new-page-titles li:after,.nestedpages .new-child .new-page-titles li:before,.nestedpages .new-child .new-page-titles li:after{content:" ";display:table}.nestedpages .quick-edit .new-page-titles li:after,.nestedpages .new-child .new-page-titles li:after{clear:both}.nestedpages .quick-edit .new-page-titles li:nth-child(even),.nestedpages .new-child .new-page-titles li:nth-child(even){background-color:#f0f0f0}.nestedpages .quick-edit .new-page-titles li label,.nestedpages .new-child .new-page-titles li label{margin-top:7px}.nestedpages .quick-edit .new-page-titles .form-control,.nestedpages .new-child .new-page-titles .form-control{float:right;width:90%;clear:none}.nestedpages .quick-edit .new-page-titles .np-icon-menu,.nestedpages .new-child .new-page-titles .np-icon-menu{float:left;margin-top:0px;height:auto;line-height:26px}.nestedpages .quick-edit .new-page-titles .new-child-row div,.nestedpages .new-child .new-page-titles .new-child-row div{float:right;width:75%;margin:2px;zoom:1}.nestedpages .quick-edit .new-page-titles .new-child-row div:before,.nestedpages .quick-edit .new-page-titles .new-child-row div:after,.nestedpages .new-child .new-page-titles .new-child-row div:before,.nestedpages .new-child .new-page-titles .new-child-row div:after{content:" ";display:table}.nestedpages .quick-edit .new-page-titles .new-child-row div:after,.nestedpages .new-child .new-page-titles .new-child-row div:after{clear:both}.nestedpages .quick-edit .new-page-titles .new-child-row div input[type='text'],.nestedpages .new-child .new-page-titles .new-child-row div input[type='text']{float:left;width:80%}.nestedpages .quick-edit .new-page-titles .new-child-row div a,.nestedpages .new-child .new-page-titles .new-child-row div a{float:right}.np-modal.nestedpages .new-child .right .form-control input[type='text'],.np-modal.nestedpages .new-child .right .form-control input[type='password'],.np-modal.nestedpages .new-child .right .form-control select{float:none;width:100%}.np-modal.nestedpages .new-child .right .form-control label{float:none;width:100%}.np-modal.nestedpages .new-child .right .form-control.full label{padding-left:0}.np-modal.nestedpages .new-child .new-page-titles .form-control{width:85%}.np-modal.nestedpages .new-child .new-page-titles .form-control div{width:100%}.np-modal.nestedpages .new-child .left label{display:none}.np-qe-loading{display:none;float:right;width:25px;height:25px;margin:2px 10px 0 0;background:url("../images/loading-white.gif") no-repeat}@media (max-width: 767px){.nestedpages .quick-edit .fields{background:transparent}.nestedpages .quick-edit .left,.nestedpages .quick-edit .right{float:none;width:100%}.nestedpages .quick-edit .form-control{margin-bottom:10px}.nestedpages .quick-edit .form-control input[type='text'],.nestedpages .quick-edit .form-control input[type='password'],.nestedpages .quick-edit .form-control select{float:none;width:100%}.nestedpages .quick-edit .form-control label{display:block;float:none;width:100%;margin-bottom:4px}.nestedpages .quick-edit .form-control.np-datepicker-container .datetime{float:none;width:100%}.nestedpages .quick-edit .comments{float:none;width:100%}.nestedpages .quick-edit .dates{float:none;width:100%;margin-bottom:6px}}.np-modal-form .form-interior{zoom:1;background:url("../images/border.png") repeat-y;background-position:center;padding:5px 0}.np-modal-form .form-interior:before,.np-modal-form .form-interior:after{content:" ";display:table}.np-modal-form .form-interior:after{clear:both}.np-modal-form .form-control{zoom:1;margin-bottom:10px}.np-modal-form .form-control:before,.np-modal-form .form-control:after{content:" ";display:table}.np-modal-form .form-control:after{clear:both}.np-modal-form .checkbox{margin-bottom:10px}.np-modal-form .left{float:left;width:45%}.np-modal-form .right{float:right;width:45%;padding-top:18px}.np-modal-form label{display:block}.np-modal-form input[type="text"],.np-modal-form select{width:100%}.np-modal-form .buttons{clear:both}.modal-body.np-menu-item-form{height:400px;padding:0;border-top:1px solid #e1e1e1}.np-menu-type-selection{float:left;height:100%;overflow:auto;width:35%;padding:15px;background-color:#f9f9f9;border-right:1px solid #e1e1e1;-webkit-box-sizing:border-box;box-sizing:border-box}.np-menu-type-selection ul{list-style-type:none;margin:0;padding:0;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.06);box-shadow:0 1px 1px rgba(0,0,0,0.06);border:1px solid #e5e5e5;-webkit-border-radius:3px;border-radius:3px;border:0}.np-menu-type-selection ul li{margin:0;border:1px solid #e5e5e5;border-top:0}.np-menu-type-selection ul li a{background-color:#fff;display:block;text-decoration:none;padding:15px 10px;position:relative;color:#333;font-weight:bold;-webkit-transition:all 200ms ease;transition:all 200ms ease}.np-menu-type-selection ul li a:hover{background-color:#ebebeb;-webkit-transition:all 200ms ease;transition:all 200ms ease}.np-menu-type-selection ul li a:after{position:absolute;font-family:"dashicons";content:"\f140";font-size:18px;right:10px;top:15px;color:gray}.np-menu-type-selection ul li a.active:after{content:"\f142"}.np-menu-type-selection ul li a.np-custom-link:after{content:"\f139"}.np-menu-type-selection ul li a.np-custom-link.active{background-color:#0074a2;color:#fff}.np-menu-type-selection ul li a.np-custom-link.active:after{content:"\f335";color:#fff}.np-menu-type-selection ul li a:active,.np-menu-type-selection ul li a:focus{-webkit-box-shadow:none;box-shadow:none}.np-menu-type-selection ul li a.no-terms{color:#b3b3b3}.np-menu-type-selection ul li a.no-terms span{float:right;font-weight:normal;font-style:oblique}.np-menu-type-selection ul li a.no-terms:after{content:''}.np-menu-type-selection ul li a.no-terms:hover{background-color:#fff;cursor:default}.np-menu-type-selection ul li a.no-terms.section{padding:8px 10px;background-color:#333;color:#fff}.np-menu-type-selection ul li:first-child{border-top:1px solid #e5e5e5}.np-menu-type-selection ul li ul{display:none;-webkit-box-shadow:none;box-shadow:none;padding:10px;background-color:#fff}.np-menu-type-selection ul li ul li{border-color:#e0e0e0}.np-menu-type-selection ul li ul li a{padding:8px;background-color:#f9f9f9;font-weight:normal}.np-menu-type-selection ul li ul li a:after{content:"\f139";top:8px;right:5px}.np-menu-type-selection ul li ul li a.active{background-color:#0074a2;color:#fff}.np-menu-type-selection ul li ul li a.active:after{content:"\f335";color:#fff}.np-menu-link-object{width:65%;float:right;height:100%;overflow:auto}.np-menu-link-object-placeholder{text-align:center;position:relative;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);color:#b3b3b3}.np-menu-search{padding:10px;background-color:#f9f9f9}.np-menu-search input[type="text"]{width:100%;height:35px}.np-menu-search .np-menu-search-loading{display:none;height:30px;background:url("../images/spinner.gif") no-repeat;background-position:center}.np-menu-search .np-menu-search-noresults{display:none;text-align:center;padding-top:8px;font-style:oblique}.np-menu-link-details{padding:20px}.np-menu-link-details h3{margin-top:0}.np-menu-link-details h3 em{float:right;font-size:13px;font-weight:normal;font-style:normal;color:gray}.np-menu-link-details .original-link{border:1px solid #e5e5e5;font-size:12px;margin-bottom:15px;padding:5px;font-style:oblique}.np-menu-link-details .fields{background-color:#f9f9f9;padding:15px}.np-menu-link-details p{margin-top:0}.np-menu-link-details .checkbox{margin-bottom:10px}.np-menu-link-details label{display:block}.np-menu-link-details input[type="text"]{width:100%}.nestedpages .nestedpages-bulk-edit{display:none;background-color:#fff;margin:0;border:1px solid #e1e1e1;border-bottom:0}.nestedpages .nestedpages-bulk-edit h3{padding:1em;margin:0}.nestedpages .nestedpages-bulk-edit .np-bulk-edit-link-info{padding:0 1em}.nestedpages .nestedpages-bulk-edit .fields{padding:1em;margin:0}.nestedpages .nestedpages-bulk-edit .np-taxonomies{margin:0}.nestedpages .nestedpages-bulk-edit .np-bulk-titles{list-style-type:none;margin:0;padding:0;background-color:#f9f9f9;border:1px solid #e5e5e5;border-left:0;border-right:0;padding:.5em}.nestedpages .nestedpages-bulk-edit .np-bulk-titles li{padding:0;margin:.5em 0 0 0}.nestedpages .nestedpages-bulk-edit .np-bulk-titles li:first-child{margin:0}.nestedpages .nestedpages-bulk-edit .np-bulk-titles .np-remove{display:inline-block;background-color:#333;width:22px;height:22px;-webkit-border-radius:50%;border-radius:50%;text-align:center;text-decoration:none;color:#fff;line-height:18px;font-size:1.5em;margin-right:.3em}.nestedpages .nestedpages-bulk-edit .np-bulk-titles .np-remove:hover{background-color:gray}.nestedpages .nestedpages-bulk-edit .np-taxonomies{display:block;padding:1em}.nestedpages .nestedpages-bulk-edit .np-bulk-footer{padding:10px;text-align:right;background-color:#404040;zoom:1}.nestedpages .nestedpages-bulk-edit .np-bulk-footer:before,.nestedpages .nestedpages-bulk-edit .np-bulk-footer:after{content:" ";display:table}.nestedpages .nestedpages-bulk-edit .np-bulk-footer:after{clear:both}.nestedpages .nestedpages-bulk-edit .np-bulk-footer .pull-left{float:left}.nestedpages-columns-header{display:table;border-collapse:collapse;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f0f0f0;border:1px solid #e1e1e1;border-bottom:0}.nestedpages-columns-header .cell{font-weight:bold;text-align:left;display:table-cell;padding:1em .5em 1em 0;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.nestedpages-columns-header .toggle-spacer span{display:block;width:50px}.nestedpages-columns-header .bulk-spacer span{display:block;width:33px}.nestedpages-columns-header .thumbnail-spacer span{display:block;width:100%}.nestedpages-columns-header .title{width:30%;padding:0 5px}.nestedpages-row-columns{display:table;width:100%;border-collapse:collapse;-webkit-box-sizing:border-box;box-sizing:border-box}.nestedpages-row-columns .cell{text-align:left;display:table-cell;padding:1em .5em 1em 0;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.nestedpages-row-columns .title-cell{width:30%;position:relative}.nestedpages-row-columns .title-cell-spacer{position:absolute;display:block;width:100%}@media (max-width: 767px){.nestedpages-row-columns .custom-column,.nestedpages-columns-header{display:none}.nestedpages-row-columns .title-cell.cell{width:100%}}.nestedpages-settings-table{border:1px solid #d9d9d9;border-collapse:collapse}.nestedpages-settings-table thead th{background-color:#d9d9d9;padding:5px}.nestedpages-settings-table tbody tr td{padding:5px;border-left:1px solid #e0e0e0}.nestedpages-settings-table tbody tr td:first-child{border:0}.nestedpages-settings-table tbody tr:nth-child(odd) td{background-color:#fff}.nestedpages-settings-table i{font-size:20px}.nestedpages-settings-posttypes{-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.06);box-shadow:0 1px 1px rgba(0,0,0,0.06);border:1px solid #e5e5e5;-webkit-border-radius:3px;border-radius:3px}.nestedpages-settings-posttypes .post-type{background-color:#fff;border-bottom:1px solid #e1e1e1}.nestedpages-settings-posttypes .post-type:last-child{border:0}.nestedpages-settings-posttypes .post-type .head{zoom:1;line-height:46px;background-color:#fff;padding-right:10px}.nestedpages-settings-posttypes .post-type .head:before,.nestedpages-settings-posttypes .post-type .head:after{content:" ";display:table}.nestedpages-settings-posttypes .post-type .head:after{clear:both}.nestedpages-settings-posttypes .post-type .head .checkbox{float:left;width:46px;height:46px;background-color:rgba(51,51,51,0.06);text-align:center;line-height:46px;margin-right:10px}.nestedpages-settings-posttypes .post-type .head label{float:left;line-height:46px;margin:0}.nestedpages-settings-posttypes .post-type .head label em{color:#999}.nestedpages-settings-posttypes .post-type .head .button{float:right;margin-top:10px}.nestedpages-settings-posttypes .post-type.active .head{background-color:#0074a2;color:#fff}.nestedpages-settings-posttypes .post-type .row{display:table;width:100%}.nestedpages-settings-posttypes .post-type .row .description{display:table-cell;width:25%;border-bottom:1px solid #e1e1e1;background-color:#f9f9f9;padding:10px}.nestedpages-settings-posttypes .post-type .row .description p{color:gray;font-size:.9em}.nestedpages-settings-posttypes .post-type .row .description strong{color:#333;font-size:1.2em}.nestedpages-settings-posttypes .post-type .row .field{display:table-cell;width:75%;background-color:#fff;border-bottom:1px solid #e1e1e1;border-left:1px solid #e1e1e1;padding:10px}.nestedpages-settings-posttypes .post-type .body{display:none}.nestedpages-settings-posttypes .post-type .body h4{margin:0;padding:10px 0 0 10px}.nestedpages-settings-posttypes .post-type .body .post-type-settings{margin:0}.nestedpages-settings-posttypes .post-type .body li{margin:0}.nestedpages-settings-posttypes .post-type .post-type-settings li:last-child .field,.nestedpages-settings-posttypes .post-type .post-type-settings li:last-child .description{border-bottom:0}.nestedpages-settings-posttypes .post-type .custom-fields,.nestedpages-settings-posttypes .post-type .standard-fields,.nestedpages-settings-posttypes .post-type .columns{display:none;padding-top:20px}.nestedpages-settings-posttypes .post-type .custom-fields .custom-field-group,.nestedpages-settings-posttypes .post-type .standard-fields .custom-field-group,.nestedpages-settings-posttypes .post-type .columns .custom-field-group{height:150px;overflow:auto;background-color:#f9f9f9;padding:10px;border:1px solid #e1e1e1}.nestedpages-settings-posttypes .post-type .custom-fields h5,.nestedpages-settings-posttypes .post-type .standard-fields h5,.nestedpages-settings-posttypes .post-type .columns h5{padding:0;font-weight:normal;font-style:oblique;margin:0;color:#999;margin-bottom:6px}.nestedpages-settings-posttypes .post-type .custom-fields p,.nestedpages-settings-posttypes .post-type .standard-fields p,.nestedpages-settings-posttypes .post-type .columns p{margin:0 0 6px 0;font-weight:bold}.nestedpages-settings-posttypes .post-type .custom-fields ul,.nestedpages-settings-posttypes .post-type .standard-fields ul,.nestedpages-settings-posttypes .post-type .columns ul{margin:0}.nestedpages-settings-posttypes .post-type .custom-fields ul.indented,.nestedpages-settings-posttypes .post-type .standard-fields ul.indented,.nestedpages-settings-posttypes .post-type .columns ul.indented{padding-left:15px}.nestedpages-settings-posttypes .post-type .custom-fields ul li,.nestedpages-settings-posttypes .post-type .standard-fields ul li,.nestedpages-settings-posttypes .post-type .columns ul li{margin:3px 0 0 0}.nestedpages-settings-posttypes .post-type .thumbnail-options{background-color:#f9f9f9;padding:10px;border:1px solid #e1e1e1;margin-top:1em}.nestedpages-settings-posttypes .post-type .thumbnail-options label{display:block}.nestedpages-settings-posttypes .post-type .thumbnail-options select{margin-bottom:1em}.nestedpages-page-pt-assignment{background-color:#f9f9f9;padding:10px;border:1px solid #e1e1e1;margin-top:1em}.nestedpages-page-pt-assignment input[type="search"]{width:100%;margin-bottom:1em}.nestedpages-page-pt-assignment .np-quickedit-info{background-color:#fff;border-right:1px solid #e5e5e5;border-top:1px solid #e5e5e5;border-bottom:1px solid #e5e5e5}.nestedpages-page-pt-assignment .nestedpages-page-search-results{height:100px;overflow:auto}.nestedpages-page-pt-assignment .nestedpages-page-search-results ul{list-style-type:none;margin:0;padding:0}.nestedpages-page-pt-assignment .nestedpages-page-search-results a{display:block;text-decoration:none;border-top:1px solid #dcdcdc;padding:3px 0;color:#333;background-color:#f9f9f9}.nestedpages-page-pt-assignment .nestedpages-page-search-results a:hover{background-color:#0074a2;color:#fff;padding-left:5px}.nestedpages-page-pt-assignment .nestedpages-page-search-results li:first-child a{border:0;padding-top:0}.nestedpages-page-pt-assignment-selection{background-color:#f9f9f9;border:1px solid #e1e1e1;margin-top:1em;padding:.5em}
|
1 |
+
@font-face{font-family:'nestedpages';src:url("fonts/nestedpages.eot")}@font-face{font-family:'nestedpages';src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMghi/6sAAAC8AAAAYGNtYXCa4JfrAAABHAAAAIxnYXNwAAAAEAAAAagAAAAIZ2x5ZthTIwkAAAGwAAAIVGhlYWQJZzAVAAAKBAAAADZoaGVhA+IB+QAACjwAAAAkaG10eCsABZEAAApgAAAAYGxvY2EUUBJOAAAKwAAAADJtYXhwACAAUwAACvQAAAAgbmFtZdvrS2kAAAsUAAABtnBvc3QAAwAAAAAMzAAAACAAAwH0AZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpAQHg/+AAIAHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAcAAAABgAEAADAAgAAQAg4lTlTuXU5gfmDeYS6JfpAf/9//8AAAAAACDiVOVO5dTmAOYK5hHol+kA//3//wAB/+MdsBq3GjIaBxoFGgIXfhcWAAMAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAIAQAAVAboBjwAJAA4AAAEHJzc2Mh8BFhQFNxcHIwG6J1AnBhIGMgb+gOxQ7FABPydQJwYGMgYS4OxQ7AAAAAACACsAAAHVAaoACwAlAAATMjY1NCYjIgYVFBYFHgEVFAYPAQ4BIyImLwEuAT0BNDY7ATIWF3UNExIODRMSAWIGBgYGlgYPCQkPBsAGBhkRlgkPBgFAEw0OEhIODRNiBg8JCQ8GlgYGBgbABg8JlhIYBgYAAAMA1QAqASsBgAALABcAIwAAJTIWFRQGIyImNTQ2NzIWFRQGIyImNTQ2NyImNTQ2MzIWFRQGAQARGhoRERoaEREaGhERGhoRERoaEREaGoAZEhEaGhESGYAZEhEaGhESGSoaERIZGRIRGgAAAAEAMwBGAc0BegAJAAA3MzUXBzUhNTMVZueAgP7mM8ZNZmdN57QAAAABAG0ATQGTAXQACwAAJQcnByc3JzcXNxcHAY44WF00XVg4WF00XYE0XVg4WF01XVc4WAAAAQCaAHwBkwFTAAYAAAEXByMnNxcBcCOKIk0iPAFTGL9nIDAAAwBNAGABswFgAAMABwALAAABNSEVBTUhFQU1IRUBs/6aAWb+mgFm/poBLTMzZzQ0ZjMzAAEAswB6AYABEwADAAABByczAYBnZs0BE5mZAAABAM0AegFmAUYAAwAAExcHNc2ZmQFGZ2XMAAAAAwAgACAB4AGAAAMABwALAAATIRUhFSEVIRUhFSEgAcD+QAHA/kABwP5AAYBgIGAgYAAAAAEAAP/gAgABwAAeAAABMh4CFRQOAiMiJicOAQc1PgE1NCY1LgE1ND4CAQA1XUYoKEZdNQoUCilfMBomASwzKEZdAcAhOEwrK0w4IQECKhgBDgwsGgQHAx1UMStMOCEAAAcAQP/gAcAB4AAJAA4AHwAvADMANwA7AAABISIGHQEhNTQmJxcjNzM3IyIGDwEGFjsBMjYvAS4BIxchIgYXEx4BOwEyNjcTNiYDIyczFyM1MxcjNTMBkP7gFBwBgBxoB4YHeASAChABCgEMCqAKDAEKARAKWP7QDREBGgEVDfANFQEaARHlMBBAYEBAUDBAAaAcFBAQFBwgMjIgDgpDCg0NCkMKDqATDf7gDRMTDQEgDRP+4ODg4ODgAAAAAwAAAEACAAGAABMAOABEAAABIg4CBx4DMzI+AjcuAxceARcOAQcOASMiJicuASc+ATc+ATcOARUUFjMyNjU0JiceARcHFAYjIiY1NDYzMhYBACpNQjUSEjVCTSoqTUI1EhI1Qk1UFyYODiYXHEAiIkAcFyYODiYXAQMCBARLNTVLBAQCAwF+HBQUHBwUFBwBgBcqOyQkOyoXFyo7JCQ7KhdVDiYXFyYOEhMTEg4mFxcmDgECAQoWDDVLSzUMFgoBAgEYFBwcFBQcHAAABQAAAAACAAHgABkAIwA1AD8AUAAAAR4BFw4DIyImJzceATMyNjc+ATcuASc3ByImJzceARUUBhMjBy4BIyIOAgceARcHFTMBBTIWFwcuATU0Ngc+ATc+ATcOARUUFhcHLgEnAaQdLxASNUJNKhctFicNGQ0iQBwXJg4OJBYjpAkQCJ0CAkurG24ULBcqTUI1EhAuHVsbAcX+8BIbAjYSFxyFDiYXAQMCBAQODB0VIw4BTBU3ICQ7KhcHCCcDAxMSDiYXFiUOI8kCAp0IEAk1SwFdbgcHFyo7JCA2FVobAcWCFxI2AhsSFBxjFyYOAQIBChYMFigQHQ4kFgAABgAA/+ACAAHgAAMABwALABcAIwAvAAATIRUhFSEVIRUhFSEDNDYzMhYVFAYjIiYVNDYzMhYVFAYjIiYVNDYzMhYVFAYjIibAAUD+wAFA/sABQP7AwCUbGyUlGxslJRsbJSUbGyUlGxslJRsbJQHAQIBAgEABoBslJRsbJSWlGyUlGxslJaUbJSUbGyUlAAAAAQAA/+ACAAHgACMAAAEjNTQmKwEiBh0BIyIGHQEUFjsBFRQWOwEyNj0BMzI2PQE0JgHwsAkHYAcJsAcJCQewCQdgBwmwBwkJASCwBwkJB7AJB2AHCbAHCQkHsAkHYAcJAAAAAAIAIwADAd0BvQAjAEgAAAEnJiIPAQYUHwEeARc3LgEvASY0PwE2Mh8BFhQPAR4BBzc2NAcuAScHHgEfARYUDwEGIi8BJjQ/AS4BNwcGFB8BFjI/ATY0LwEB3QIkZCNuIyMCAwcDKAQGAwITE20TNhMCFBQxBwYBTSPEAwcDKAQGAwITE20TNhMCFBQxBwYBTSMjAiRkI24jIwIBuwIjI20kZCQCAgYCKAIFAwITNhNtFBQCEzYTMg8iEU0jZHkCBgIoAgUDAhM2E20UFAITNhMyDyIRTSNkJAIjI20kZCQCAAAAAAMAVQAAAasBwAAIABQALQAAATU0JiMiBh0BFzI2NTQmIyIGFRQWNzIWHQEUBiMhIiY9ATQ2OwE1NDYzMhYdAQFCJxsbJ0IRGhoRERoakREaGhH/ABEaGhEVPywsPwEqKxsnJxsrwBoREhkZEhEawBgS1hEZGRHWEhgrLT4+LSsAAQAlAAkB3QHBAB0AAAE3FwcmBg8BDgEXBycHDgEnJjY/ASc3FjY/AT4BJwELL6MvFDIRFBEFDS4+SAhRCAg6CEg+LxQxEhMSBQ4Bky6iLw0EEhMSMRUuPkgIOwgJUQhHPi8NBBITEjEVAAAAAgBNABMBmgGtAAQACgAANxEhESEHMxUhETOaAQD/ABrN/wAzYAFN/rMaMwFNAAAAAQAAAAEAAPW5O21fDzz1AAsCAAAAAADUI/esAAAAANQj96wAAP/gAgAB4AAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAACAAABAAAAAAAAAAAAAAAAAAAAGAIAAAAAAAAAAAAAAAEAAAACAABAAgAAKwIAANUCAAAzAgAAbQIAAJoCAABNAgAAswIAAM0CAAAgAgAAAAIAAEACAAAAAgAAAAIAAAACAAAAAgAAIwIAAFUCAAAlAgAATQAAAAAACgAUAB4APgB4AK4AwgDcAO4BCAEWASQBPgFuAcwCMgKwAvgDKgOcA9wEEgQqAAAAAQAAABgAUQAHAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAsAAAABAAAAAAACAAcAhAABAAAAAAADAAsAQgABAAAAAAAEAAsAmQABAAAAAAAFAAsAIQABAAAAAAAGAAsAYwABAAAAAAAKABoAugADAAEECQABABYACwADAAEECQACAA4AiwADAAEECQADABYATQADAAEECQAEABYApAADAAEECQAFABYALAADAAEECQAGABYAbgADAAEECQAKADQA1G5lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMG5lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc25lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc1JlZ3VsYXIAUgBlAGcAdQBsAGEAcm5lc3RlZHBhZ2VzAG4AZQBzAHQAZQBkAHAAYQBnAGUAc0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype");font-weight:normal;font-style:normal}[class^="np-icon-"],[class*=" np-icon-"]{font-family:'nestedpages' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.np-icon-pencil:before{content:"\e254"}.np-icon-lock:before{content:"\e897"}.np-icon-tag:before{content:"\e54e"}.np-icon-more_vert:before{content:"\e5d4"}.np-icon-page:before{content:"\e901"}.np-icon-post:before{content:"\e900"}.np-icon-no:before{content:"\e601"}.np-icon-yes:before{content:"\e602"}.np-icon-menu:before{content:"\e603"}.np-icon-arrow-down:before{content:"\e604"}.np-icon-arrow-right:before{content:"\e605"}.np-icon-sub-menu:before{content:"\e600"}.np-icon-bubble:before{content:"\e607"}.np-icon-remove:before{content:"\e60a"}.np-icon-list:before{content:"\e60d"}.np-icon-menu2:before{content:"\e606"}.np-icon-link:before{content:"\e612"}.np-icon-eye:before{content:"\e60b"}.np-icon-eye-blocked:before{content:"\e60c"}.np-icon-plus:before{content:"\e611"}.np-btn,.np-toggle-edit{text-decoration:none;color:#555;display:inline-block;background-color:#f7f7f7;border:1px solid #e1e1e1;padding:5px 8px;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.np-btn:hover,.np-toggle-edit:hover{background-color:#0074a2;color:#fff;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease;border-color:#0074a2}.np-btn:disabled,.np-toggle-edit:disabled,.np-btn.disabled,.disabled.np-toggle-edit{opacity:.6;cursor:not-allowed}.np-btn-half{float:left;width:47%;padding:3px 0px;text-align:center}.np-btn-half.btn-right{float:right}.np-btn-trash{background-color:#e14d43;border-color:#e14d43;color:#fff}.np-btn-trash:hover{background-color:#ba281e;border-color:#ba281e}.np-toggle-edit{display:none;float:right;margin-right:10px;position:relative;top:9px}.np-toggle-edit.active{background-color:#0074a2;color:#fff;-webkit-box-shadow:none;box-shadow:none;border-color:#0074a2}@media (max-width: 767px){.np-toggle-edit{display:inline-block}}.np-quickedit-error{border-left:4px solid #dd3d36;padding:4px 0 4px 8px;margin-bottom:10px;background-color:#f9f9f9}.np-quickedit-info{border-left:4px solid #0074a2;padding:4px 0 4px 8px;margin-bottom:10px;background-color:#f9f9f9}.modal-open{overflow:hidden}.np-modal{display:none;overflow:hidden;position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999;-webkit-overflow-scrolling:touch;outline:0}.np-modal .modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.85;z-index:9999}.np-modal.fade .modal-dialog{-webkit-transform:translate(0, -25%);-ms-transform:translate(0, -25%);transform:translate(0, -25%);-webkit-transition:-webkit-transform 0.3s ease-out;-o-transition:-o-transform 0.3s ease-out;transition:-webkit-transform 0.3s ease-out;-o-transition:transform 0.3s ease-out;transition:transform 0.3s ease-out;transition:transform 0.3s ease-out, -webkit-transform 0.3s ease-out}.np-modal.in .modal-dialog{-webkit-transform:translate(0, 0);-ms-transform:translate(0, 0);transform:translate(0, 0)}.np-modal .modal-open .modal{overflow-x:hidden;overflow-y:auto}.np-modal .modal-dialog{position:relative;width:90%;height:80%;margin:10px auto 0px auto;max-width:800px;z-index:9999}.np-modal .modal-content{position:relative;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);-webkit-background-clip:padding-box;background-clip:padding-box;outline:0}.np-modal .modal-header{padding:8px;background-color:#ebebeb}.np-modal .modal-header .sr-only{display:none}.np-modal .modal-header .close{margin-top:-2px}.np-modal .modal-title{margin:0}.np-modal .modal-body{position:relative;padding:10px}.np-modal .modal-body.new-child{padding:0}.np-modal .modal-footer{padding:10px;text-align:right;background-color:#404040;zoom:1}.np-modal .modal-footer:before,.np-modal .modal-footer:after{content:" ";display:table}.np-modal .modal-footer:after{clear:both}.np-modal .modal-footer .modal-close{float:left}.np-modal .modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.clone-modal h3{margin:0;padding:8px;background-color:#e5e5e5}.clone-modal .form-control{margin:0 !important;padding:5px 10px}.np-trash-modal{text-align:center}.np-trash-modal .modal-body{padding-bottom:30px}.np-trash-modal .button-primary{margin-left:10px}.np-inline-overlay{position:fixed;width:100%;height:100%;background-color:rgba(0,0,0,0.4);z-index:998;top:0;right:0;bottom:0;left:0;opacity:0;-webkit-transition:opacity 200ms ease;-o-transition:opacity 200ms ease;transition:opacity 200ms ease}.np-inline-overlay.active{opacity:1;-webkit-transition:opacity 200ms ease;-o-transition:opacity 200ms ease;transition:opacity 200ms ease}.np-inline-modal{position:relative;z-index:999;background-color:#fff;-webkit-border-radius:0;border-radius:0;-webkit-box-shadow:0px 0px 4px 0px rgba(0,0,0,0.5);box-shadow:0px 0px 4px 0px rgba(0,0,0,0.5)}.nestedpages-listing-title{float:left}.nestedpages .updated{clear:both}.nestedpages-toggleall.np-btn,.nestedpages-toggleall.np-toggle-edit{float:right}.np-toggle-publish{color:#999}.np-toggle-publish.active{color:#333;font-weight:bold}.np-sync-menu-cont{float:right;margin:0px 15px 0px 0px}.np-sync-menu-cont button{position:relative;top:-5px;padding:5px 8px}.np-sync-menu-cont label{position:relative;top:4px}#nested-loading{display:none;float:right;width:30px;margin:0px 20px 0 0}.nestedpages-top-toggles{zoom:1;padding-top:10px}.nestedpages-top-toggles:before,.nestedpages-top-toggles:after{content:" ";display:table}.nestedpages-top-toggles:after{clear:both}.np-tabs{background-color:#ebebeb;padding:0px}.np-tabs ul{text-align:left;list-style-type:none;margin:0;padding:0}.np-tabs ul li{display:inline-block;margin:0}.np-tabs ul li a{display:block;text-decoration:none;padding:5px 10px}.np-tabs ul li a.active{position:relative;color:#333;background-color:#fff}.np-tabs ul li a:focus,.np-tabs ul li a:active{outline:none;-webkit-box-shadow:none;box-shadow:none}.nestedpages-datepicker.ui-datepicker{background-color:#fff;font-size:90%;-webkit-box-shadow:0px 0px 3px 0px rgba(0,0,0,0.4);box-shadow:0px 0px 3px 0px rgba(0,0,0,0.4);-webkit-border-radius:3px;border-radius:3px;padding:0;width:auto}.nestedpages-datepicker.ui-datepicker .ui-datepicker-next,.nestedpages-datepicker.ui-datepicker .ui-datepicker-prev{position:absolute;color:#fff;top:0px;right:0px;cursor:pointer;display:block;width:35px;height:35px;font-size:0;background:url("../images/datepicker-arrow-next.png");background-position:center;opacity:1;-webkit-transition:opacity 200ms ease;-o-transition:opacity 200ms ease;transition:opacity 200ms ease}.nestedpages-datepicker.ui-datepicker .ui-datepicker-next:hover,.nestedpages-datepicker.ui-datepicker .ui-datepicker-prev:hover{opacity:.5;-webkit-transition:opacity 200ms ease;-o-transition:opacity 200ms ease;transition:opacity 200ms ease}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar{margin:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-prev{right:auto;left:0px;background:url("../images/datepicker-arrow-prev.png")}.nestedpages-datepicker.ui-datepicker .ui-datepicker-header{padding:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-title{background-color:#1a1a1a;text-align:center;color:#fff;height:35px;line-height:35px;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;margin:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar{border-collapse:collapse}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar table{width:auto}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar th,.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar td{text-align:center;width:30px;height:30px}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar th{background-color:#e6e6e6;text-transform:uppercase;font-size:11px;letter-spacing:1px;padding:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar td{border-top:1px solid #ebebeb;border-left:1px solid #ebebeb;padding:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar td:first-child{border-left:0}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar a{text-align:center;padding:0;text-decoration:none;color:#333;display:block;background-color:#fff;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease;width:30px;height:30px;line-height:30px}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar a.ui-state-active{background-color:#1a1a1a;color:#fff}.nestedpages-datepicker.ui-datepicker .ui-datepicker-calendar a:hover{background-color:#333;color:#fff;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.nestedpages-tools{zoom:1;clear:both;clear:both;margin:20px 0px 5px 0px}.nestedpages-tools:before,.nestedpages-tools:after{content:" ";display:table}.nestedpages-tools:after{clear:both}.nestedpages-tools .subsubsub{margin:0}.nestedpages-tools .np-tools-primary{clear:left;padding-top:8px}.nestedpages-tools .select{float:left;margin-left:5px}.nestedpages-tools .select.first{margin-left:0}.nestedpages-tools .np-tools-sort{float:left}.nestedpages-tools .np-tools-search{float:right}.wppages-handle-expand{float:left;background-color:#f2f2f2;font-size:18px;width:46px;height:46px;margin-right:5px;text-align:center;border-right:1px solid #e1e1e1}.wppages-handle-expand div{background-color:#fff;border:1px solid #e1e1e1;width:24px;height:24px;line-height:24px;-webkit-border-radius:15px;border-radius:15px;margin-top:9px;cursor:pointer;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.wppages-handle-expand div:hover{background-color:#0074a2;border-color:#0074a2;color:#fff;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.nestedpages{clear:both;-webkit-border-radius:4px;border-radius:4px}.nestedpages .ui-sortable-placeholder{display:block !important;position:relative;min-height:46px;border:0;border:1px dashed #0074a2 !important;background-color:#effaff;margin:0}.nestedpages .ui-sortable-helper{opacity:0.8;-webkit-box-shadow:2px 2px 3px 0px rgba(0,0,0,0.5);box-shadow:2px 2px 3px 0px rgba(0,0,0,0.5)}.nestedpages ol{list-style-type:none;clear:both;margin:0;border:1px solid #e5e5e5;-webkit-border-radius:3px;border-radius:3px}.nestedpages ol a{text-decoration:none}.nestedpages ol .page-link .edit-indicator{margin-left:10px;display:none}.nestedpages ol .page-link .edit-indicator i{font-size:12px;margin-right:3px}.nestedpages ol .page-link:hover .edit-indicator{display:inline}.nestedpages ol .np-page-type{color:#333}.nestedpages ol .locked{color:#333;margin-left:20px}.nestedpages ol .locked em{font-style:normal}.nestedpages ol .status{color:#999}.nestedpages ol .sticky{color:#999}.nestedpages ol .np-icon-eye-blocked{color:#999}.nestedpages ol .nav-status{color:#b3b3b3}.nestedpages ol .np-hide{display:none}.nestedpages ol .np-assigned-pt-actions{list-style-type:none;margin:0;padding:0;display:inline-block;margin-left:10px}.nestedpages ol .np-assigned-pt-actions li{display:inline-block;background:transparent;border:0}.nestedpages ol .np-assigned-pt-actions li a{color:#333;display:block;border-left:1px solid #e1e1e1;padding:0 5px}.nestedpages ol .np-assigned-pt-actions li:first-child a{border:0;padding-left:0}.nestedpages ol .np-seo-indicator{display:block;position:absolute;right:10px;top:50%;margin-top:-6px;width:12px;height:12px;-webkit-border-radius:50%;border-radius:50%;background-color:#999}.nestedpages ol .np-seo-indicator.good{background-color:#7ad03a}.nestedpages ol .np-seo-indicator.ok{background-color:#ffba00}.nestedpages ol .np-seo-indicator.poor{background-color:#ee7c1b}.nestedpages ol .np-seo-indicator.bad{background-color:#dd3d36}.nestedpages ol .np-seo-indicator.warn{background-color:maroon}.nestedpages ol .np-seo-indicator.wrong{background-color:red}.nestedpages ol .np-seo-indicator.noindex{background-color:#1e8cbe}.nestedpages ol li{margin:0;border-top:1px solid #e1e1e1;background-color:#0074a2}.nestedpages ol li.first{border:0}.nestedpages ol li:first-child{border:0}.nestedpages ol li.no-border{border:0}.nestedpages ol ol{display:none;-webkit-border-radius:0;border-radius:0;list-style-type:none;border:0;-webkit-box-shadow:none;box-shadow:none;border-top:1px solid #e1e1e1}.nestedpages .np-search-results .np-hide{display:block}.nestedpages .child-toggle{display:table-cell;width:46px;background-color:#f0f0f0;text-align:center;position:relative}.nestedpages .child-toggle .child-toggle-spacer{height:46px;width:100%}.nestedpages .child-toggle a{position:absolute;top:50%;left:8px;margin-top:-16px;width:28px;height:28px;background-color:#fff;border:1px solid #e1e1e1;-webkit-border-radius:20px;border-radius:20px;font-size:20px;line-height:30px;color:#333;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.nestedpages .child-toggle a i{line-height:26px}.nestedpages .child-toggle a:hover{background-color:#0074a2;color:#fff;border-color:#0074a2}.nestedpages .handle{display:inline-block;cursor:move;font-size:20px;margin-top:-8px;position:relative;top:2px;color:#b3b3b3;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.nestedpages .handle:hover{-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease;color:#0074a2}.nestedpages .np-icon-sub-menu{display:none;color:#999}.nestedpages .row.no-sort .page-title{padding-left:10px}.nestedpages .np-thumbnail{display:table-cell;width:80px;vertical-align:middle;zoom:1}.nestedpages .np-thumbnail:before,.nestedpages .np-thumbnail:after{content:" ";display:table}.nestedpages .np-thumbnail:after{clear:both}.nestedpages .np-thumbnail img{float:right;width:100%;height:auto}.nestedpages .np-thumbnail.large{width:150px}.nestedpages .np-thumbnail.small{width:50px}.nestedpages .np-thumbnail.link{background-color:#ebebeb;text-align:center}.nestedpages .np-thumbnail.link i{font-size:1.8em;opacity:.5}.nestedpages .np-bulk-checkbox{display:table-cell;width:33px;vertical-align:middle;text-align:center;background-color:#f0f0f0}.nestedpages .np-bulk-checkbox input[type="checkbox"]{margin-right:0}.nestedpages .handle,.nestedpages .np-icon-sub-menu{width:30px;text-align:center;vertical-align:middle}.nestedpages li ol .row .np-icon-sub-menu{display:inline-block}.nestedpages li ol .row .handle{display:none}.nestedpages li ol .row:hover .np-icon-sub-menu{display:none}.nestedpages li ol .row:hover .handle{display:inline-block}.nestedpages li ol .row.no-sort .np-icon-sub-menu{display:inline-block}.nestedpages .row{background-color:#fff;display:table;width:100%}.nestedpages .row:hover{background-color:#f0f0f0}.nestedpages .row:hover .cell.custom-column{visibility:hidden}.nestedpages .row.np-updated{background-color:#e9f7df;-webkit-transition:background-color 400ms ease;-o-transition:background-color 400ms ease;transition:background-color 400ms ease}.nestedpages .row.np-updated-show{background-color:#fff;-webkit-transition:background-color 400ms ease;-o-transition:background-color 400ms ease;transition:background-color 400ms ease}.nestedpages .row.search .page-title{padding-left:10px}.nestedpages .non-hierarchical-spacer{height:47px}.nestedpages .row-inner{display:table-cell;vertical-align:middle;position:relative}.nestedpages ol li ol .row-inner{padding-left:0px}.nestedpages ol li ol li ol .row-inner{padding-left:20px}.nestedpages ol li ol li ol li ol .row-inner{padding-left:40px}.nestedpages ol li ol li ol li ol li ol .row-inner{padding-left:60px}.nestedpages ol li ol li ol li ol li ol li ol .row-inner{padding-left:80px}.nestedpages .np-post-columns{float:right;margin:3px 20px 0px 0px;zoom:1}.nestedpages .np-post-columns:before,.nestedpages .np-post-columns:after{content:" ";display:table}.nestedpages .np-post-columns:after{clear:both}.nestedpages .np-post-columns ul li{background:transparent;color:gray;border:0;float:left;margin-left:8px;padding-left:8px;border-left:1px solid #ccc}.nestedpages .np-post-columns ul li:first-child{margin-left:0;padding-left:0;border:0}.nestedpages .has-yoast .np-post-columns{margin-right:30px}.nestedpages .has-custom-columns .np-post-columns{display:none}.nestedpages .action-buttons{display:none;position:absolute;right:10px;top:50%;margin-top:-15px}.nestedpages .action-buttons a{margin:0 0 0 -5px}.nestedpages .action-buttons a.np-btn-trash{margin-left:4px}.np-search{float:right}.nestedpages-list-header{background-color:#fff;border:1px solid #e1e1e1;border-bottom:0;height:46px;zoom:1}.nestedpages-list-header:before,.nestedpages-list-header:after{content:" ";display:table}.nestedpages-list-header:after{clear:both}.nestedpages-list-header .np-check-all{float:right;width:33px;text-align:center;line-height:46px;background-color:#f0f0f0}.nestedpages-list-header .np-check-all input[type="checkbox"]{margin:0}.nestedpages-list-header .np-check-all input[type="checkbox"].check-all-partial:checked:before{content:"-";margin:0;margin-top:-9px}.nestedpages-list-header .np-hidden-select-count{display:none;float:right;margin:0 1em 0 0;line-height:46px;font-style:oblique}.nestedpages-list-header .np-bulk-form{padding-right:3px;float:right;margin-right:5px;position:relative;top:9px}.nestedpages-list-header .np-bulk-form select,.nestedpages-list-header .np-bulk-form input[type="submit"]{display:inline-block}@media (min-width: 768px){.nestedpages .row:hover .action-buttons{display:block}.nestedpages .row:hover .np-post-columns{display:none}}@media (max-width: 767px){.nestedpages ol .page-link{line-height:24px}.nestedpages ol .page-link:hover span{display:none}.nestedpages ol .locked em{display:none}.nestedpages .child-toggle{background:transparent}.nestedpages .row{height:auto}.nestedpages .action-buttons{display:none;background-color:#0074a2;float:none;margin:0;padding:8px}.nestedpages .action-buttons a{margin-left:5px}}.nestedpages .quick-edit .form-interior,.nestedpages .new-child .form-interior{padding:10px}.nestedpages .quick-edit h3,.nestedpages .new-child h3{margin:0 0 8px 0;font-size:14px}.nestedpages .quick-edit h3 span,.nestedpages .new-child h3 span{float:right;font-size:12px}.nestedpages .quick-edit h3 span em,.nestedpages .new-child h3 span em{font-weight:normal;font-style:normal;color:gray}.nestedpages .quick-edit .fields,.nestedpages .new-child .fields{margin-bottom:10px;background:url("../images/border.png") repeat-y;background-position:center;zoom:1}.nestedpages .quick-edit .fields:before,.nestedpages .quick-edit .fields:after,.nestedpages .new-child .fields:before,.nestedpages .new-child .fields:after{content:" ";display:table}.nestedpages .quick-edit .fields:after,.nestedpages .new-child .fields:after{clear:both}.nestedpages .quick-edit .left,.nestedpages .new-child .left{float:left;width:48%}.nestedpages .quick-edit .right,.nestedpages .new-child .right{float:right;width:48%}.nestedpages .quick-edit label,.nestedpages .new-child label{font-style:oblique}.nestedpages .quick-edit .buttons,.nestedpages .new-child .buttons{clear:both;zoom:1;background-color:#404040;padding:8px}.nestedpages .quick-edit .buttons:before,.nestedpages .quick-edit .buttons:after,.nestedpages .new-child .buttons:before,.nestedpages .new-child .buttons:after{content:" ";display:table}.nestedpages .quick-edit .buttons:after,.nestedpages .new-child .buttons:after{clear:both}.nestedpages .quick-edit .form-control,.nestedpages .new-child .form-control{clear:both;zoom:1;margin-bottom:5px}.nestedpages .quick-edit .form-control:before,.nestedpages .quick-edit .form-control:after,.nestedpages .new-child .form-control:before,.nestedpages .new-child .form-control:after{content:" ";display:table}.nestedpages .quick-edit .form-control:after,.nestedpages .new-child .form-control:after{clear:both}.nestedpages .quick-edit .form-control input[type='text'],.nestedpages .quick-edit .form-control input[type='password'],.nestedpages .quick-edit .form-control select,.nestedpages .new-child .form-control input[type='text'],.nestedpages .new-child .form-control input[type='password'],.nestedpages .new-child .form-control select{float:right;width:75%}.nestedpages .quick-edit .form-control label,.nestedpages .new-child .form-control label{float:left;width:20%}.nestedpages .quick-edit .form-control.original-link,.nestedpages .new-child .form-control.original-link{background-color:#f9f9f9;border:1px solid #e1e1e1;padding:5px;font-style:oblique;margin-bottom:8px}.nestedpages .quick-edit .form-control.password label,.nestedpages .new-child .form-control.password label{width:25%}.nestedpages .quick-edit .form-control.password input[type="text"],.nestedpages .new-child .form-control.password input[type="text"]{float:left;width:35%}.nestedpages .quick-edit .form-control.password .private,.nestedpages .new-child .form-control.password .private{float:right;width:35%;margin-top:4px}.nestedpages .quick-edit .form-control.password .private label,.nestedpages .new-child .form-control.password .private label{width:auto;float:none}.nestedpages .quick-edit .form-control.np-datepicker-container .datetime,.nestedpages .new-child .form-control.np-datepicker-container .datetime{float:right;width:75%}.nestedpages .quick-edit .form-control.np-datepicker-container .np-time-container,.nestedpages .new-child .form-control.np-datepicker-container .np-time-container{float:left;width:45%;margin:0;position:relative}.nestedpages .quick-edit .form-control.np-datepicker-container .np-time-container input[type="text"],.nestedpages .new-child .form-control.np-datepicker-container .np-time-container input[type="text"]{float:left;width:55%}.nestedpages .quick-edit .form-control.np-datepicker-container .np-time-container select,.nestedpages .new-child .form-control.np-datepicker-container .np-time-container select{float:right;width:35%}.nestedpages .quick-edit .form-control.np-datepicker-container .np_datepicker,.nestedpages .new-child .form-control.np-datepicker-container .np_datepicker{float:left;width:45%;margin:0}.nestedpages .quick-edit .form-control.np-datepicker-container span,.nestedpages .new-child .form-control.np-datepicker-container span{float:left;width:10%;display:block;text-align:center;padding-top:3px}.nestedpages .quick-edit .form-control.full label,.nestedpages .new-child .form-control.full label{width:100%}.nestedpages .quick-edit .form-control.full.checkbox label,.nestedpages .new-child .form-control.full.checkbox label{padding:5px 0 5px 25%}.nestedpages .quick-edit .comments,.nestedpages .new-child .comments{float:right;width:75%;margin-bottom:10px;zoom:1}.nestedpages .quick-edit .comments:before,.nestedpages .quick-edit .comments:after,.nestedpages .new-child .comments:before,.nestedpages .new-child .comments:after{content:" ";display:table}.nestedpages .quick-edit .comments:after,.nestedpages .new-child .comments:after{clear:both}.nestedpages .quick-edit .dates,.nestedpages .new-child .dates{float:right;width:75%;margin-bottom:6px}.nestedpages .quick-edit .dates select,.nestedpages .new-child .dates select{width:25%}.nestedpages .quick-edit .dates input,.nestedpages .new-child .dates input{width:12%}.nestedpages .quick-edit .np-toggle-options,.nestedpages .new-child .np-toggle-options{background-color:#f2f2f2;padding:5px}.nestedpages .quick-edit .np-taxonomies,.nestedpages .quick-edit .np-menuoptions,.nestedpages .new-child .np-taxonomies,.nestedpages .new-child .np-menuoptions{display:none;clear:both;background-color:#f9f9f9;padding:8px;zoom:1;margin-top:5px}.nestedpages .quick-edit .np-taxonomies:before,.nestedpages .quick-edit .np-taxonomies:after,.nestedpages .quick-edit .np-menuoptions:before,.nestedpages .quick-edit .np-menuoptions:after,.nestedpages .new-child .np-taxonomies:before,.nestedpages .new-child .np-taxonomies:after,.nestedpages .new-child .np-menuoptions:before,.nestedpages .new-child .np-menuoptions:after{content:" ";display:table}.nestedpages .quick-edit .np-taxonomies:after,.nestedpages .quick-edit .np-menuoptions:after,.nestedpages .new-child .np-taxonomies:after,.nestedpages .new-child .np-menuoptions:after{clear:both}.nestedpages .quick-edit .np-taxonomy,.nestedpages .new-child .np-taxonomy{float:left;width:30%;margin-right:3.33%}.nestedpages .quick-edit .np-taxonomy .title,.nestedpages .new-child .np-taxonomy .title{font-weight:bold;margin-bottom:4px;display:block}.nestedpages .quick-edit .np-taxonomy li,.nestedpages .new-child .np-taxonomy li{background-color:#fff;border:0}.nestedpages .quick-edit .np-taxonomy textarea,.nestedpages .new-child .np-taxonomy textarea{width:100%;height:6.5em}.nestedpages .quick-edit .np-menuoptions,.nestedpages .new-child .np-menuoptions{padding:15px}.nestedpages .quick-edit .np-menuoptions label,.nestedpages .quick-edit .np-menuoptions input[type="text"],.nestedpages .new-child .np-menuoptions label,.nestedpages .new-child .np-menuoptions input[type="text"]{display:block;float:none;width:100%}.nestedpages .quick-edit .np-menuoptions .menuoptions-left,.nestedpages .new-child .np-menuoptions .menuoptions-left{float:left;width:47%}.nestedpages .quick-edit .np-menuoptions .menuoptions-right,.nestedpages .new-child .np-menuoptions .menuoptions-right{float:right;width:47%;padding-top:18px}.nestedpages .quick-edit .np-menuoptions .menuoptions-right label,.nestedpages .new-child .np-menuoptions .menuoptions-right label{margin-bottom:10px}.nestedpages .quick-edit .np-hide-options,.nestedpages .new-child .np-hide-options{display:none;background-color:#f0f0f0;-webkit-border-radius:3px;border-radius:3px;clear:both;padding:6px;-webkit-box-sizing:border-box;box-sizing:border-box}.nestedpages .quick-edit .np-hide-options p,.nestedpages .new-child .np-hide-options p{margin:0}.nestedpages .quick-edit .np-hide-options label,.nestedpages .new-child .np-hide-options label{display:block;margin-top:4px;font-style:normal}.nestedpages .quick-edit .new-page-titles,.nestedpages .new-child .new-page-titles{display:block;border:0}.nestedpages .quick-edit .new-page-titles li,.nestedpages .new-child .new-page-titles li{background:transparent;border:0;padding:4px;zoom:1}.nestedpages .quick-edit .new-page-titles li:before,.nestedpages .quick-edit .new-page-titles li:after,.nestedpages .new-child .new-page-titles li:before,.nestedpages .new-child .new-page-titles li:after{content:" ";display:table}.nestedpages .quick-edit .new-page-titles li:after,.nestedpages .new-child .new-page-titles li:after{clear:both}.nestedpages .quick-edit .new-page-titles li:nth-child(even),.nestedpages .new-child .new-page-titles li:nth-child(even){background-color:#f0f0f0}.nestedpages .quick-edit .new-page-titles li label,.nestedpages .new-child .new-page-titles li label{margin-top:7px}.nestedpages .quick-edit .new-page-titles .form-control,.nestedpages .new-child .new-page-titles .form-control{float:right;width:90%;clear:none}.nestedpages .quick-edit .new-page-titles .np-icon-menu,.nestedpages .new-child .new-page-titles .np-icon-menu{float:left;margin-top:0px;height:auto;line-height:26px}.nestedpages .quick-edit .new-page-titles .new-child-row div,.nestedpages .new-child .new-page-titles .new-child-row div{float:right;width:75%;margin:2px;zoom:1}.nestedpages .quick-edit .new-page-titles .new-child-row div:before,.nestedpages .quick-edit .new-page-titles .new-child-row div:after,.nestedpages .new-child .new-page-titles .new-child-row div:before,.nestedpages .new-child .new-page-titles .new-child-row div:after{content:" ";display:table}.nestedpages .quick-edit .new-page-titles .new-child-row div:after,.nestedpages .new-child .new-page-titles .new-child-row div:after{clear:both}.nestedpages .quick-edit .new-page-titles .new-child-row div input[type='text'],.nestedpages .new-child .new-page-titles .new-child-row div input[type='text']{float:left;width:80%}.nestedpages .quick-edit .new-page-titles .new-child-row div a,.nestedpages .new-child .new-page-titles .new-child-row div a{float:right}.np-modal.nestedpages .new-child .right .form-control input[type='text'],.np-modal.nestedpages .new-child .right .form-control input[type='password'],.np-modal.nestedpages .new-child .right .form-control select{float:none;width:100%}.np-modal.nestedpages .new-child .right .form-control label{float:none;width:100%}.np-modal.nestedpages .new-child .right .form-control.full label{padding-left:0}.np-modal.nestedpages .new-child .new-page-titles .form-control{width:85%}.np-modal.nestedpages .new-child .new-page-titles .form-control div{width:100%}.np-modal.nestedpages .new-child .left label{display:none}.np-qe-loading{display:none;float:right;width:25px;height:25px;margin:2px 10px 0 0;background:url("../images/loading-white.gif") no-repeat}@media (max-width: 767px){.nestedpages .quick-edit .fields{background:transparent}.nestedpages .quick-edit .left,.nestedpages .quick-edit .right{float:none;width:100%}.nestedpages .quick-edit .form-control{margin-bottom:10px}.nestedpages .quick-edit .form-control input[type='text'],.nestedpages .quick-edit .form-control input[type='password'],.nestedpages .quick-edit .form-control select{float:none;width:100%}.nestedpages .quick-edit .form-control label{display:block;float:none;width:100%;margin-bottom:4px}.nestedpages .quick-edit .form-control.np-datepicker-container .datetime{float:none;width:100%}.nestedpages .quick-edit .comments{float:none;width:100%}.nestedpages .quick-edit .dates{float:none;width:100%;margin-bottom:6px}}.np-modal-form .form-interior{zoom:1;background:url("../images/border.png") repeat-y;background-position:center;padding:5px 0}.np-modal-form .form-interior:before,.np-modal-form .form-interior:after{content:" ";display:table}.np-modal-form .form-interior:after{clear:both}.np-modal-form .form-control{zoom:1;margin-bottom:10px}.np-modal-form .form-control:before,.np-modal-form .form-control:after{content:" ";display:table}.np-modal-form .form-control:after{clear:both}.np-modal-form .checkbox{margin-bottom:10px}.np-modal-form .left{float:left;width:45%}.np-modal-form .right{float:right;width:45%;padding-top:18px}.np-modal-form label{display:block}.np-modal-form input[type="text"],.np-modal-form select{width:100%}.np-modal-form .buttons{clear:both}.modal-body.np-menu-item-form{height:400px;padding:0;border-top:1px solid #e1e1e1}.np-menu-type-selection{float:left;height:100%;overflow:auto;width:35%;padding:15px;background-color:#f9f9f9;border-right:1px solid #e1e1e1;-webkit-box-sizing:border-box;box-sizing:border-box}.np-menu-type-selection ul{list-style-type:none;margin:0;padding:0;border:1px solid #e5e5e5;-webkit-border-radius:3px;border-radius:3px;border:0}.np-menu-type-selection ul li{margin:0;border:1px solid #e5e5e5;border-top:0}.np-menu-type-selection ul li a{background-color:#fff;display:block;text-decoration:none;padding:15px 10px;position:relative;color:#333;font-weight:bold;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.np-menu-type-selection ul li a:hover{background-color:#ebebeb;-webkit-transition:all 200ms ease;-o-transition:all 200ms ease;transition:all 200ms ease}.np-menu-type-selection ul li a:after{position:absolute;font-family:"dashicons";content:"\f140";font-size:18px;right:10px;top:15px;color:gray}.np-menu-type-selection ul li a.active:after{content:"\f142"}.np-menu-type-selection ul li a.np-custom-link:after{content:"\f139"}.np-menu-type-selection ul li a.np-custom-link.active{background-color:#0074a2;color:#fff}.np-menu-type-selection ul li a.np-custom-link.active:after{content:"\f335";color:#fff}.np-menu-type-selection ul li a:active,.np-menu-type-selection ul li a:focus{-webkit-box-shadow:none;box-shadow:none}.np-menu-type-selection ul li a.no-terms{color:#b3b3b3}.np-menu-type-selection ul li a.no-terms span{float:right;font-weight:normal;font-style:oblique}.np-menu-type-selection ul li a.no-terms:after{content:''}.np-menu-type-selection ul li a.no-terms:hover{background-color:#fff;cursor:default}.np-menu-type-selection ul li a.no-terms.section{padding:8px 10px;background-color:#333;color:#fff}.np-menu-type-selection ul li:first-child{border-top:1px solid #e5e5e5}.np-menu-type-selection ul li ul{display:none;-webkit-box-shadow:none;box-shadow:none;padding:10px;background-color:#fff}.np-menu-type-selection ul li ul li{border-color:#e0e0e0}.np-menu-type-selection ul li ul li a{padding:8px;background-color:#f9f9f9;font-weight:normal}.np-menu-type-selection ul li ul li a:after{content:"\f139";top:8px;right:5px}.np-menu-type-selection ul li ul li a.active{background-color:#0074a2;color:#fff}.np-menu-type-selection ul li ul li a.active:after{content:"\f335";color:#fff}.np-menu-link-object{width:65%;float:right;height:100%;overflow:auto}.np-menu-link-object-placeholder{text-align:center;position:relative;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);color:#b3b3b3}.np-menu-search{padding:10px;background-color:#f9f9f9}.np-menu-search input[type="text"]{width:100%;height:35px}.np-menu-search .np-menu-search-loading{display:none;height:30px;background:url("../images/spinner.gif") no-repeat;background-position:center}.np-menu-search .np-menu-search-noresults{display:none;text-align:center;padding-top:8px;font-style:oblique}.np-menu-link-details{padding:20px}.np-menu-link-details h3{margin-top:0}.np-menu-link-details h3 em{float:right;font-size:13px;font-weight:normal;font-style:normal;color:gray}.np-menu-link-details .original-link{border:1px solid #e5e5e5;font-size:12px;margin-bottom:15px;padding:5px;font-style:oblique}.np-menu-link-details .fields{background-color:#f9f9f9;padding:15px}.np-menu-link-details p{margin-top:0}.np-menu-link-details .checkbox{margin-bottom:10px}.np-menu-link-details label{display:block}.np-menu-link-details input[type="text"]{width:100%}.nestedpages .nestedpages-bulk-edit{display:none;background-color:#fff;margin:0;border:1px solid #e1e1e1;border-bottom:0}.nestedpages .nestedpages-bulk-edit h3{padding:1em;margin:0}.nestedpages .nestedpages-bulk-edit .np-bulk-edit-link-info{padding:0 1em}.nestedpages .nestedpages-bulk-edit .fields{padding:1em;margin:0}.nestedpages .nestedpages-bulk-edit .np-taxonomies{margin:0}.nestedpages .nestedpages-bulk-edit .np-bulk-titles{list-style-type:none;margin:0;padding:0;background-color:#f9f9f9;border:1px solid #e5e5e5;border-left:0;border-right:0;padding:.5em}.nestedpages .nestedpages-bulk-edit .np-bulk-titles li{padding:0;margin:.5em 0 0 0}.nestedpages .nestedpages-bulk-edit .np-bulk-titles li:first-child{margin:0}.nestedpages .nestedpages-bulk-edit .np-bulk-titles .np-remove{display:inline-block;background-color:#333;width:22px;height:22px;-webkit-border-radius:50%;border-radius:50%;text-align:center;text-decoration:none;color:#fff;line-height:18px;font-size:1.5em;margin-right:.3em}.nestedpages .nestedpages-bulk-edit .np-bulk-titles .np-remove:hover{background-color:gray}.nestedpages .nestedpages-bulk-edit .np-taxonomies{display:block;padding:1em}.nestedpages .nestedpages-bulk-edit .np-bulk-footer{padding:10px;text-align:right;background-color:#404040;zoom:1}.nestedpages .nestedpages-bulk-edit .np-bulk-footer:before,.nestedpages .nestedpages-bulk-edit .np-bulk-footer:after{content:" ";display:table}.nestedpages .nestedpages-bulk-edit .np-bulk-footer:after{clear:both}.nestedpages .nestedpages-bulk-edit .np-bulk-footer .pull-left{float:left}.nestedpages-columns-header{display:table;border-collapse:collapse;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f0f0f0;border:1px solid #e1e1e1;border-bottom:0}.nestedpages-columns-header .cell{font-weight:bold;text-align:left;display:table-cell;padding:1em .5em 1em 0;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.nestedpages-columns-header .toggle-spacer span{display:block;width:50px}.nestedpages-columns-header .bulk-spacer span{display:block;width:33px}.nestedpages-columns-header .thumbnail-spacer span{display:block;width:100%}.nestedpages-columns-header .title{width:30%;padding:0 5px}.nestedpages-row-columns{display:table;width:100%;border-collapse:collapse;-webkit-box-sizing:border-box;box-sizing:border-box}.nestedpages-row-columns .cell{text-align:left;display:table-cell;padding:1em .5em 1em 0;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.nestedpages-row-columns .title-cell{width:30%;position:relative}.nestedpages-row-columns .title-cell-spacer{position:absolute;display:block;width:100%}@media (max-width: 767px){.nestedpages-row-columns .custom-column,.nestedpages-columns-header{display:none}.nestedpages-row-columns .title-cell.cell{width:100%}}.np-wpml-translations-modal .loading-indicator{display:none;text-align:center;padding:30px 0}.np-wpml-translations-modal.loading .np-translations-table{display:none}.np-wpml-translations-modal.loading .loading-indicator{display:block}.np-wpml-translations-modal .np-translations-table{display:table;border-collapse:collapse;width:100%}.np-wpml-translations-modal .np-translations-table tr td{padding:10px;border:1px solid #e1e1e1}.np-wpml-translations-modal .np-translations-table tr td:first-child{border-left:0;padding-left:0}.np-wpml-translations-modal .np-translations-table tr td:last-child{border-right:0}.np-wpml-translations-modal .np-translations-table tr:last-child td{border-bottom:0}.nestedpages-settings-table{border:1px solid #d9d9d9;border-collapse:collapse}.nestedpages-settings-table thead th{background-color:#d9d9d9;padding:5px}.nestedpages-settings-table tbody tr td{padding:5px;border-left:1px solid #e0e0e0}.nestedpages-settings-table tbody tr td:first-child{border:0}.nestedpages-settings-table tbody tr:nth-child(odd) td{background-color:#fff}.nestedpages-settings-table i{font-size:20px}.nestedpages-settings-table{border:1px solid #e5e5e5;-webkit-border-radius:3px;border-radius:3px}.nestedpages-settings-table .row-container{background-color:#fff;border-bottom:1px solid #e1e1e1}.nestedpages-settings-table .row-container:last-child{border:0}.nestedpages-settings-table .row-container .head{zoom:1;line-height:46px;background-color:#fff;padding-right:10px}.nestedpages-settings-table .row-container .head:before,.nestedpages-settings-table .row-container .head:after{content:" ";display:table}.nestedpages-settings-table .row-container .head:after{clear:both}.nestedpages-settings-table .row-container .head .checkbox{float:left;width:46px;height:46px;background-color:rgba(51,51,51,0.06);text-align:center;line-height:46px;margin-right:10px}.nestedpages-settings-table .row-container .head label{float:left;line-height:46px;margin:0}.nestedpages-settings-table .row-container .head label em{color:#999}.nestedpages-settings-table .row-container .head .button{float:right;margin-top:10px}.nestedpages-settings-table .row-container.active .head{background-color:#0074a2;color:#fff}.nestedpages-settings-table .row-container .row{display:table;width:100%}.nestedpages-settings-table .row-container .row .description{display:table-cell;vertical-align:top;width:25%;border-bottom:1px solid #e1e1e1;background-color:#f9f9f9;padding:1em}.nestedpages-settings-table .row-container .row .description p{color:gray;font-size:.9em}.nestedpages-settings-table .row-container .row .description strong{color:#333;font-size:1.2em}.nestedpages-settings-table .row-container .row .field{display:table-cell;vertical-align:top;width:75%;background-color:#fff;border-bottom:1px solid #e1e1e1;border-left:1px solid #e1e1e1;padding:1em}.nestedpages-settings-table .row-container .row .field.padded-sides{padding:1em 2em}.nestedpages-settings-table .row-container .row .field.extra-padding{padding:2em}.nestedpages-settings-table .row-container .row .field label.block{display:block}.nestedpages-settings-table .row-container .row .field input[type="text"],.nestedpages-settings-table .row-container .row .field input[type="tel"],.nestedpages-settings-table .row-container .row .field select{width:100%}.nestedpages-settings-table .row-container .body{display:none}.nestedpages-settings-table .row-container .body h4{margin:0;padding:10px 0 0 10px}.nestedpages-settings-table .row-container .body .settings-details{margin:0}.nestedpages-settings-table .row-container .body li{margin:0}.nestedpages-settings-table .row-container .settings-details li:last-child .field,.nestedpages-settings-table .row-container .settings-details li:last-child .description{border-bottom:0}.nestedpages-settings-table .row-container .custom-fields,.nestedpages-settings-table .row-container .standard-fields,.nestedpages-settings-table .row-container .columns{display:none;padding-top:20px}.nestedpages-settings-table .row-container .custom-fields .custom-field-group,.nestedpages-settings-table .row-container .standard-fields .custom-field-group,.nestedpages-settings-table .row-container .columns .custom-field-group{height:150px;overflow:auto;background-color:#f9f9f9;padding:10px;border:1px solid #e1e1e1}.nestedpages-settings-table .row-container .custom-fields h5,.nestedpages-settings-table .row-container .standard-fields h5,.nestedpages-settings-table .row-container .columns h5{padding:0;font-weight:normal;font-style:oblique;margin:0;color:#999;margin-bottom:6px}.nestedpages-settings-table .row-container .custom-fields p,.nestedpages-settings-table .row-container .standard-fields p,.nestedpages-settings-table .row-container .columns p{margin:0 0 6px 0;font-weight:bold}.nestedpages-settings-table .row-container .custom-fields ul,.nestedpages-settings-table .row-container .standard-fields ul,.nestedpages-settings-table .row-container .columns ul{margin:0}.nestedpages-settings-table .row-container .custom-fields ul.indented,.nestedpages-settings-table .row-container .standard-fields ul.indented,.nestedpages-settings-table .row-container .columns ul.indented{padding-left:15px}.nestedpages-settings-table .row-container .custom-fields ul li,.nestedpages-settings-table .row-container .standard-fields ul li,.nestedpages-settings-table .row-container .columns ul li{margin:3px 0 0 0}.nestedpages-settings-table .row-container .thumbnail-options{background-color:#f9f9f9;padding:10px;border:1px solid #e1e1e1;margin-top:1em}.nestedpages-settings-table .row-container .thumbnail-options label{display:block}.nestedpages-settings-table .row-container .thumbnail-options select{margin-bottom:1em}.nestedpages-page-pt-assignment{background-color:#f9f9f9;padding:10px;border:1px solid #e1e1e1;margin-top:1em}.nestedpages-page-pt-assignment input[type="search"]{width:100%;margin-bottom:1em}.nestedpages-page-pt-assignment .np-quickedit-info{background-color:#fff;border-right:1px solid #e5e5e5;border-top:1px solid #e5e5e5;border-bottom:1px solid #e5e5e5}.nestedpages-page-pt-assignment .nestedpages-page-search-results{height:100px;overflow:auto}.nestedpages-page-pt-assignment .nestedpages-page-search-results ul{list-style-type:none;margin:0;padding:0}.nestedpages-page-pt-assignment .nestedpages-page-search-results a{display:block;text-decoration:none;border-top:1px solid #dcdcdc;padding:3px 0;color:#333;background-color:#f9f9f9}.nestedpages-page-pt-assignment .nestedpages-page-search-results a:hover{background-color:#0074a2;color:#fff;padding-left:5px}.nestedpages-page-pt-assignment .nestedpages-page-search-results li:first-child a{border:0;padding-top:0}.nestedpages-page-pt-assignment-selection{background-color:#f9f9f9;border:1px solid #e1e1e1;margin-top:1em;padding:.5em}.nestedpages-sort-options-selection,.nestedpages-checklist-field{background-color:#f9f9f9;border:1px solid #e1e1e1;margin-top:1em;padding:.5em}.nestedpages-sort-options-selection label,.nestedpages-checklist-field label{display:block;margin-top:3px}.nestedpages-sort-options-selection label:first-child,.nestedpages-checklist-field label:first-child{margin:0}
|
assets/js/lib/nestedpages-factory.js
CHANGED
@@ -158,7 +158,8 @@ NestedPages.formActions = {
|
|
158 |
search : 'npmenuSearch',
|
159 |
newMenuItem : 'npnewMenuItem',
|
160 |
manualMenuSync : 'npmanualMenuSync',
|
161 |
-
postSearch: 'nppostSearch'
|
|
|
162 |
}
|
163 |
|
164 |
|
@@ -188,6 +189,7 @@ NestedPages.Factory = function()
|
|
188 |
plugin.confirmDelete = new NestedPages.ConfirmDelete;
|
189 |
plugin.manualSync = new NestedPages.ManualSync;
|
190 |
plugin.postSearch = new NestedPages.PostSearch;
|
|
|
191 |
|
192 |
plugin.init = function()
|
193 |
{
|
158 |
search : 'npmenuSearch',
|
159 |
newMenuItem : 'npnewMenuItem',
|
160 |
manualMenuSync : 'npmanualMenuSync',
|
161 |
+
postSearch: 'nppostSearch',
|
162 |
+
wpmlTranslations : 'npWpmlTranslations'
|
163 |
}
|
164 |
|
165 |
|
189 |
plugin.confirmDelete = new NestedPages.ConfirmDelete;
|
190 |
plugin.manualSync = new NestedPages.ManualSync;
|
191 |
plugin.postSearch = new NestedPages.PostSearch;
|
192 |
+
plugin.wpml = new NestedPages.Wpml;
|
193 |
|
194 |
plugin.init = function()
|
195 |
{
|
assets/js/lib/nestedpages.new-page.js
CHANGED
@@ -201,6 +201,7 @@ NestedPages.NewPage = function()
|
|
201 |
// Show the child page list and reset submenu toggles
|
202 |
$(appendto).show();
|
203 |
plugin.formatter.updateSubMenuToggle();
|
|
|
204 |
plugin.cancelNewPage();
|
205 |
$(NestedPages.selectors.newPageModal).modal('hide');
|
206 |
}
|
201 |
// Show the child page list and reset submenu toggles
|
202 |
$(appendto).show();
|
203 |
plugin.formatter.updateSubMenuToggle();
|
204 |
+
plugin.formatter.setNestedMargins();
|
205 |
plugin.cancelNewPage();
|
206 |
$(NestedPages.selectors.newPageModal).modal('hide');
|
207 |
}
|
assets/js/lib/nestedpages.page-toggle.js
CHANGED
@@ -38,7 +38,6 @@ NestedPages.PageToggle = function()
|
|
38 |
{
|
39 |
var button = $(plugin.activeButton);
|
40 |
var action = $(button).attr('href');
|
41 |
-
console.log(action);
|
42 |
|
43 |
if ( action == '#show' ){
|
44 |
$(button).attr('href', '#hide').text(NestedPages.jsData.showHiddenText);
|
38 |
{
|
39 |
var button = $(plugin.activeButton);
|
40 |
var action = $(button).attr('href');
|
|
|
41 |
|
42 |
if ( action == '#show' ){
|
43 |
$(button).attr('href', '#hide').text(NestedPages.jsData.showHiddenText);
|
assets/js/lib/nestedpages.quickedit-post.js
CHANGED
@@ -102,7 +102,8 @@ NestedPages.QuickEditPost = function()
|
|
102 |
time: $(plugin.button).attr('data-formattedtime'),
|
103 |
timeTwentyFour : $(plugin.button).attr('data-time'),
|
104 |
ampm: $(plugin.button).attr('data-ampm'),
|
105 |
-
timeFormat: $(plugin.button).attr('data-timeformat')
|
|
|
106 |
};
|
107 |
|
108 |
// Add Array of Taxonomies to the data object using classes applied to the list element
|
@@ -165,9 +166,9 @@ NestedPages.QuickEditPost = function()
|
|
165 |
}
|
166 |
|
167 |
if ( plugin.initialData.npstatus === 'hide' ){
|
168 |
-
$(plugin.form).find('.
|
169 |
} else {
|
170 |
-
$(plugin.form).find('.
|
171 |
}
|
172 |
|
173 |
if ( plugin.initialData.navstatus === 'hide' ) {
|
@@ -185,6 +186,12 @@ NestedPages.QuickEditPost = function()
|
|
185 |
if ( plugin.initialData.status === "private" ) {
|
186 |
$(plugin.form).find('.np_status').val('publish');
|
187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
// Date Fields
|
190 |
if ( plugin.initialData.timeFormat === 'H:i' ){
|
@@ -373,6 +380,14 @@ NestedPages.QuickEditPost = function()
|
|
373 |
$(plugin.row).find('.np-icon-eye-blocked').remove();
|
374 |
}
|
375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
// Author for Non-Hierarchical Types
|
377 |
if ( !NestedPages.jsData.hierarchical ){
|
378 |
$(plugin.row).find('.np-author-display').text(plugin.newData.author_name);
|
@@ -386,6 +401,7 @@ NestedPages.QuickEditPost = function()
|
|
386 |
$(button).attr('data-slug', plugin.newData.post_name);
|
387 |
$(button).attr('data-commentstatus', plugin.newData.comment_status);
|
388 |
$(button).attr('data-status', plugin.newData._status);
|
|
|
389 |
|
390 |
// Private Status
|
391 |
if ( plugin.newData.keep_private === 'private' ) {
|
102 |
time: $(plugin.button).attr('data-formattedtime'),
|
103 |
timeTwentyFour : $(plugin.button).attr('data-time'),
|
104 |
ampm: $(plugin.button).attr('data-ampm'),
|
105 |
+
timeFormat: $(plugin.button).attr('data-timeformat'),
|
106 |
+
sticky: $(plugin.button).attr('data-sticky')
|
107 |
};
|
108 |
|
109 |
// Add Array of Taxonomies to the data object using classes applied to the list element
|
166 |
}
|
167 |
|
168 |
if ( plugin.initialData.npstatus === 'hide' ){
|
169 |
+
$(plugin.form).find('.nested_pages_status').attr('checked', 'checked');
|
170 |
} else {
|
171 |
+
$(plugin.form).find('.nested_pages_status').removeAttr('checked');
|
172 |
}
|
173 |
|
174 |
if ( plugin.initialData.navstatus === 'hide' ) {
|
186 |
if ( plugin.initialData.status === "private" ) {
|
187 |
$(plugin.form).find('.np_status').val('publish');
|
188 |
}
|
189 |
+
|
190 |
+
if ( plugin.initialData.sticky === 'sticky' ){
|
191 |
+
$(plugin.form).find('.np-sticky').attr('checked', 'checked');
|
192 |
+
} else {
|
193 |
+
$(plugin.form).find('.np-sticky').removeAttr('checked');
|
194 |
+
}
|
195 |
|
196 |
// Date Fields
|
197 |
if ( plugin.initialData.timeFormat === 'H:i' ){
|
380 |
$(plugin.row).find('.np-icon-eye-blocked').remove();
|
381 |
}
|
382 |
|
383 |
+
// Sticky
|
384 |
+
var sticky = $(plugin.row).find('.sticky');
|
385 |
+
if ( (plugin.newData.sticky == 'sticky') ){
|
386 |
+
$(sticky).show();
|
387 |
+
} else {
|
388 |
+
$(sticky).hide();
|
389 |
+
}
|
390 |
+
|
391 |
// Author for Non-Hierarchical Types
|
392 |
if ( !NestedPages.jsData.hierarchical ){
|
393 |
$(plugin.row).find('.np-author-display').text(plugin.newData.author_name);
|
401 |
$(button).attr('data-slug', plugin.newData.post_name);
|
402 |
$(button).attr('data-commentstatus', plugin.newData.comment_status);
|
403 |
$(button).attr('data-status', plugin.newData._status);
|
404 |
+
$(button).attr('data-sticky', plugin.newData.sticky);
|
405 |
|
406 |
// Private Status
|
407 |
if ( plugin.newData.keep_private === 'private' ) {
|
assets/js/lib/nestedpages.settings.js
CHANGED
@@ -12,7 +12,7 @@ NestedPages.Settings = function()
|
|
12 |
|
13 |
plugin.selectors = {
|
14 |
postTypeToggle : '[data-toggle-nestedpages-pt-settings]', // Toggle Button for Post Type Settings
|
15 |
-
postTypeCheckbox : '[data-nestedpages-
|
16 |
customFieldsCheckbox : '[data-toggle-nestedpages-cf-settings]', // Checkbox for toggling custom fields settings
|
17 |
standardFieldsCheckbox : '[data-toggle-nestedpages-sf-settings]', // Checkbox for toggling standard field settings
|
18 |
taxonomiesFieldCheckbox : '[data-hide-taxonomies]', // Checkbox for disabling taxonomies from quick edit
|
@@ -42,7 +42,7 @@ NestedPages.Settings = function()
|
|
42 |
});
|
43 |
$(document).on('click', plugin.selectors.postTypeToggle, function(e){
|
44 |
e.preventDefault();
|
45 |
-
plugin.
|
46 |
});
|
47 |
$(document).on('change', plugin.selectors.postTypeCheckbox, function(){
|
48 |
plugin.toggleSettingsButton($(this));
|
@@ -81,10 +81,10 @@ NestedPages.Settings = function()
|
|
81 |
/**
|
82 |
* Toggle Individual Post Type Settings
|
83 |
*/
|
84 |
-
plugin.
|
85 |
{
|
86 |
$(button).parent('.head').siblings('.body').toggle();
|
87 |
-
$(button).parents('.
|
88 |
}
|
89 |
|
90 |
/**
|
@@ -100,7 +100,7 @@ NestedPages.Settings = function()
|
|
100 |
}
|
101 |
$(button).hide();
|
102 |
$(button).parents('.head').siblings('.body').hide();
|
103 |
-
$(button).parents('.
|
104 |
$(button).parents('.head').siblings('.body').find('input[type="checkbox"]').attr('checked', false);
|
105 |
$(button).parents('.head').siblings('.body').find('input[type="hidden"]').attr('disabled', true);
|
106 |
$(button).parents('.head').siblings('.body').find('select').val(false);
|
12 |
|
13 |
plugin.selectors = {
|
14 |
postTypeToggle : '[data-toggle-nestedpages-pt-settings]', // Toggle Button for Post Type Settings
|
15 |
+
postTypeCheckbox : '[data-nestedpages-settings-row-checkbox]', // Checkbox for enabling post type
|
16 |
customFieldsCheckbox : '[data-toggle-nestedpages-cf-settings]', // Checkbox for toggling custom fields settings
|
17 |
standardFieldsCheckbox : '[data-toggle-nestedpages-sf-settings]', // Checkbox for toggling standard field settings
|
18 |
taxonomiesFieldCheckbox : '[data-hide-taxonomies]', // Checkbox for disabling taxonomies from quick edit
|
42 |
});
|
43 |
$(document).on('click', plugin.selectors.postTypeToggle, function(e){
|
44 |
e.preventDefault();
|
45 |
+
plugin.toggleRow($(this));
|
46 |
});
|
47 |
$(document).on('change', plugin.selectors.postTypeCheckbox, function(){
|
48 |
plugin.toggleSettingsButton($(this));
|
81 |
/**
|
82 |
* Toggle Individual Post Type Settings
|
83 |
*/
|
84 |
+
plugin.toggleRow = function(button)
|
85 |
{
|
86 |
$(button).parent('.head').siblings('.body').toggle();
|
87 |
+
$(button).parents('.row-container').toggleClass('active');
|
88 |
}
|
89 |
|
90 |
/**
|
100 |
}
|
101 |
$(button).hide();
|
102 |
$(button).parents('.head').siblings('.body').hide();
|
103 |
+
$(button).parents('.row-container').removeClass('active');
|
104 |
$(button).parents('.head').siblings('.body').find('input[type="checkbox"]').attr('checked', false);
|
105 |
$(button).parents('.head').siblings('.body').find('input[type="hidden"]').attr('disabled', true);
|
106 |
$(button).parents('.head').siblings('.body').find('select').val(false);
|
assets/js/lib/nestedpages.wpml.js
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var NestedPages = NestedPages || {};
|
2 |
+
|
3 |
+
/**
|
4 |
+
* WPML functionality
|
5 |
+
* @package Nested Pages
|
6 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
7 |
+
*/
|
8 |
+
NestedPages.Wpml = function()
|
9 |
+
{
|
10 |
+
var plugin = this;
|
11 |
+
var $ = jQuery;
|
12 |
+
|
13 |
+
plugin.button = null; // The quick edit button with all the data-attributes for the post
|
14 |
+
plugin.postData = null; // Object containing post data
|
15 |
+
plugin.modal = null; // The modal element
|
16 |
+
plugin.parent_li = null; // The post's nested pages list element
|
17 |
+
plugin.formatter = new NestedPages.Formatter;
|
18 |
+
|
19 |
+
plugin.selectors = {
|
20 |
+
translationsBtn : 'data-nestedpages-translations',
|
21 |
+
modal : 'data-np-wpml-translations-modal',
|
22 |
+
title : 'data-wmpl-translation-title',
|
23 |
+
table : 'data-np-wpml-translations-modal-table'
|
24 |
+
}
|
25 |
+
|
26 |
+
plugin.bindEvents = function()
|
27 |
+
{
|
28 |
+
if ( !nestedpages.wpml ) return;
|
29 |
+
$(document).on('click', '[' + plugin.selectors.translationsBtn + ']', function(e){
|
30 |
+
e.preventDefault();
|
31 |
+
plugin.createTranslationsModal($(this));
|
32 |
+
});
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Create the translations modal
|
37 |
+
*/
|
38 |
+
plugin.createTranslationsModal = function(button)
|
39 |
+
{
|
40 |
+
plugin.parent_li = $(button).closest(NestedPages.selectors.row).parent('li');
|
41 |
+
plugin.button = $(button).siblings(NestedPages.selectors.quickEditOpen);
|
42 |
+
plugin.postData = {
|
43 |
+
id : $(plugin.button).attr('data-id'),
|
44 |
+
title : $(plugin.button).attr('data-title'),
|
45 |
+
slug : $(plugin.button).attr('data-slug')
|
46 |
+
}
|
47 |
+
plugin.modal = $('[' + plugin.selectors.modal + ']').clone();
|
48 |
+
|
49 |
+
if ( $(plugin.parent_li).children('ol').length > 0 ){
|
50 |
+
var child_ol = $(plugin.parent_li).children('ol');
|
51 |
+
$(plugin.modal).insertBefore(child_ol);
|
52 |
+
} else {
|
53 |
+
$(plugin.modal).appendTo(plugin.parent_li);
|
54 |
+
}
|
55 |
+
$(plugin.modal).find('[' + plugin.selectors.title + ']').text(plugin.postData.title);
|
56 |
+
plugin.formatter.showQuickEdit();
|
57 |
+
$(plugin.modal).show();
|
58 |
+
plugin.getTranslationData();
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Get the Translation Data for the Post
|
63 |
+
*/
|
64 |
+
plugin.getTranslationData = function()
|
65 |
+
{
|
66 |
+
$.ajax({
|
67 |
+
url: NestedPages.jsData.ajaxurl,
|
68 |
+
type: 'post',
|
69 |
+
datatype: 'json',
|
70 |
+
data : {
|
71 |
+
action : NestedPages.formActions.wpmlTranslations,
|
72 |
+
post_id : plugin.postData.id,
|
73 |
+
nonce : NestedPages.jsData.nonce
|
74 |
+
},
|
75 |
+
success: function(data){
|
76 |
+
if ( data.status === 'success' ){
|
77 |
+
plugin.populateModal(data.translations);
|
78 |
+
} else {
|
79 |
+
$(plugin.modal).find(NestedPages.selectors.quickEditErrorDiv).text(data.message).show();
|
80 |
+
plugin.toggleLoading(false);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
});
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Open the Modal
|
88 |
+
*/
|
89 |
+
plugin.populateModal = function(translations)
|
90 |
+
{
|
91 |
+
var html = '<tbody>';
|
92 |
+
$.each(translations, function(i, v){
|
93 |
+
var translation = translations[i];
|
94 |
+
html += '<tr>';
|
95 |
+
html += '<td><img src="' + translation.country_flag_url + '" alt="' + translation.translated_name + '" /> ' + translation.translated_name + '</td>';
|
96 |
+
html += '<td>';
|
97 |
+
if ( translation.has_translation && translation.edit_link ){
|
98 |
+
html += '<a href="' + translation.edit_link + '">' + translation.translation.post_title + ' (' + nestedpages.edit + ')</a>';
|
99 |
+
} else {
|
100 |
+
html += '<a href="' + translation.add_link + '" class="np-btn">+ ' + nestedpages.add_translation + '</a>';
|
101 |
+
}
|
102 |
+
html += '</td>';
|
103 |
+
html += '</tr>';
|
104 |
+
});
|
105 |
+
html += '</tbody>';
|
106 |
+
$(plugin.modal).find('[' + plugin.selectors.table + ']').html(html);
|
107 |
+
plugin.toggleLoading(false);
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Toggle the Loading State
|
112 |
+
*/
|
113 |
+
plugin.toggleLoading = function(loading)
|
114 |
+
{
|
115 |
+
if ( loading ){
|
116 |
+
$(plugin.modal).addClass('loading');
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
$(plugin.modal).removeClass('loading');
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
return plugin.bindEvents();
|
124 |
+
}
|
assets/js/nestedpages.js
ADDED
@@ -0,0 +1,3258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var NestedPages = NestedPages || {};
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Responsive functionality for nested view
|
5 |
+
* @package Nested Pages
|
6 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
7 |
+
*/
|
8 |
+
NestedPages.Responsive = function()
|
9 |
+
{
|
10 |
+
var plugin = this;
|
11 |
+
var $ = jQuery;
|
12 |
+
|
13 |
+
plugin.init = function()
|
14 |
+
{
|
15 |
+
plugin.bindEvents();
|
16 |
+
}
|
17 |
+
|
18 |
+
plugin.bindEvents = function()
|
19 |
+
{
|
20 |
+
$(document).on('click', NestedPages.selectors.toggleEditButtons, function(e){
|
21 |
+
e.preventDefault();
|
22 |
+
plugin.toggleEdit($(this));
|
23 |
+
});
|
24 |
+
// Remove the block display when sizing up
|
25 |
+
$(window).resize(function() {
|
26 |
+
plugin.timer(function(){
|
27 |
+
$('.action-buttons').removeAttr('style');
|
28 |
+
$('.np-toggle-edit').removeClass('active');
|
29 |
+
}, 500);
|
30 |
+
});
|
31 |
+
}
|
32 |
+
|
33 |
+
// Toggle the responsive edit buttons
|
34 |
+
plugin.toggleEdit = function(button)
|
35 |
+
{
|
36 |
+
var buttons = $(button).siblings('.action-buttons');
|
37 |
+
if ( $(buttons).is(':visible') ){
|
38 |
+
$(button).removeClass('active');
|
39 |
+
$(buttons).hide();
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
$(button).addClass('active');
|
43 |
+
$(buttons).show();
|
44 |
+
}
|
45 |
+
|
46 |
+
plugin.timer = (function(){
|
47 |
+
var timer = 0;
|
48 |
+
return function(callback, ms){
|
49 |
+
clearTimeout (timer);
|
50 |
+
timer = setTimeout(callback, ms);
|
51 |
+
};
|
52 |
+
})();
|
53 |
+
|
54 |
+
return plugin.init();
|
55 |
+
}
|
56 |
+
var NestedPages = NestedPages || {};
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Formatting updates
|
60 |
+
* @package Nested Pages
|
61 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
62 |
+
*/
|
63 |
+
NestedPages.Formatter = function()
|
64 |
+
{
|
65 |
+
|
66 |
+
var plugin = this;
|
67 |
+
var $ = jQuery;
|
68 |
+
|
69 |
+
|
70 |
+
// Update the Submenu Toggle Button State based on if the child menu is visible
|
71 |
+
plugin.updateSubMenuToggle = function()
|
72 |
+
{
|
73 |
+
var allButtons = $(NestedPages.selectors.childToggle);
|
74 |
+
for ( var i = 0; i < allButtons.length; i++ ){
|
75 |
+
var button = allButtons[i];
|
76 |
+
var row = $(button).parent('.row').parent('li');
|
77 |
+
if ( $(row).children('ol').length > 0 ){ // Row has a child menu
|
78 |
+
|
79 |
+
var icon = ( $(row).children('ol:visible').length > 0 )
|
80 |
+
? NestedPages.cssClasses.iconToggleDown
|
81 |
+
: NestedPages.cssClasses.iconToggleRight;
|
82 |
+
|
83 |
+
$(button).html('<div class="child-toggle-spacer"></div><a href="#"><i class="' + icon + '"></i></a>');
|
84 |
+
|
85 |
+
if ( ($(row).children('ol').children('.np-hide').length > 0) && ($(row).children('ol').children('.np-hide.shown').length === 0) ){
|
86 |
+
$(button).find('a').hide();
|
87 |
+
} else if ( ($(row).children('ol').children('.np-hide').length > 0) && ($(row).children('ol').children('.np-hide.shown').length > 0) ){
|
88 |
+
$(button).find('a').show();
|
89 |
+
}
|
90 |
+
|
91 |
+
continue;
|
92 |
+
}
|
93 |
+
$(button).empty().html('<div class="child-toggle-spacer"></div>'); // No Child Menu
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
// Fix :visible :first css limitation when toggling various options
|
99 |
+
plugin.setBorders = function()
|
100 |
+
{
|
101 |
+
$(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder);
|
102 |
+
$.each($(NestedPages.selectors.lists), function(){
|
103 |
+
$(this).find('.page-row:visible:first').addClass(NestedPages.cssClasses.noborder);
|
104 |
+
});
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
// Adjust nested margins based on how deep the list is nested
|
109 |
+
plugin.setNestedMargins = function()
|
110 |
+
{
|
111 |
+
$.each($(NestedPages.selectors.lists), function(i, v){
|
112 |
+
var parent_count = $(this).parents(NestedPages.selectors.lists).length;
|
113 |
+
var padding = 0;
|
114 |
+
if ( !NestedPages.jsData.sortable ) padding = 10;
|
115 |
+
if ( parent_count > 0 ){
|
116 |
+
var padding = ( parent_count * 20 ) + padding;
|
117 |
+
$(this).find('.row-inner').css('padding-left', padding + 'px');
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
if ( !NestedPages.jsData.sortable ){
|
121 |
+
$(this).find('.row-inner').css('padding-left', '10px');
|
122 |
+
return;
|
123 |
+
}
|
124 |
+
$(this).find('.row-inner').css('padding-left', '0px');
|
125 |
+
});
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
// Update the width of the placeholder ( width changes depending on level of nesting )
|
130 |
+
plugin.updatePlaceholderWidth = function(ui)
|
131 |
+
{
|
132 |
+
if ( NestedPages.jsData.nestable ){
|
133 |
+
var parentCount = $(ui.placeholder).parents('ol').length;
|
134 |
+
var listWidth = $(NestedPages.selectors.sortable).width();
|
135 |
+
var offset = ( parentCount * 40 ) - 40;
|
136 |
+
var newWidth = listWidth - offset;
|
137 |
+
$(ui.placeholder).width(newWidth).css('margin-left', offset + 'px');
|
138 |
+
}
|
139 |
+
plugin.updateListVisibility(ui);
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
// Update the list visibility on sort (prevent lists from collapsing when nesting)
|
144 |
+
plugin.updateListVisibility = function(ui)
|
145 |
+
{
|
146 |
+
var parentList = $(ui.placeholder).parent('ol');
|
147 |
+
if ( !$(parentList).is(':visible') ){
|
148 |
+
$(parentList).addClass('nplist');
|
149 |
+
$(parentList).show();
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
|
154 |
+
// Remove the Quick Edit Overlay
|
155 |
+
plugin.removeQuickEdit = function()
|
156 |
+
{
|
157 |
+
$(NestedPages.selectors.quickEditOverlay).removeClass('active').remove();
|
158 |
+
$('.sortable .quick-edit').remove();
|
159 |
+
$('.row').show();
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
// Show the Quick Edit Overlay
|
164 |
+
plugin.showQuickEdit = function()
|
165 |
+
{
|
166 |
+
$('body').append('<div class="np-inline-overlay"></div>');
|
167 |
+
setTimeout(function(){
|
168 |
+
$('.np-inline-overlay').addClass('active');
|
169 |
+
}, 50);
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
// Flash an updated row
|
174 |
+
plugin.flashRow = function(row)
|
175 |
+
{
|
176 |
+
$(row).addClass('np-updated');
|
177 |
+
plugin.setBorders();
|
178 |
+
setTimeout(function(){
|
179 |
+
$(row).addClass('np-updated-show');
|
180 |
+
}, 1500);
|
181 |
+
}
|
182 |
+
|
183 |
+
|
184 |
+
// Show an error message
|
185 |
+
plugin.showAjaxError = function(message)
|
186 |
+
{
|
187 |
+
$(NestedPages.selectors.ajaxError).find('p').text(message);
|
188 |
+
$(NestedPages.selectors.ajaxError).show();
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
// Hide the error message
|
193 |
+
plugin.hideAjaxError = function(message)
|
194 |
+
{
|
195 |
+
$(NestedPages.selectors.ajaxError).hide();
|
196 |
+
}
|
197 |
+
|
198 |
+
|
199 |
+
// Size the link thumbnails to the same as the page/post thumbnails
|
200 |
+
plugin.sizeLinkThumbnails = function()
|
201 |
+
{
|
202 |
+
var thumbnail = $(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find('img');
|
203 |
+
var width = $(thumbnail).width();
|
204 |
+
var height = $(thumbnail).height();
|
205 |
+
$.each($(NestedPages.selectors.thumbnailContainerLink), function(){
|
206 |
+
$(this).width(width);
|
207 |
+
$(this).height(height);
|
208 |
+
});
|
209 |
+
}
|
210 |
+
|
211 |
+
}
|
212 |
+
var NestedPages = NestedPages || {};
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Check All functionality for Nested Pages
|
216 |
+
* @package Nested Pages
|
217 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
218 |
+
*/
|
219 |
+
NestedPages.CheckAll = function()
|
220 |
+
{
|
221 |
+
var plugin = this;
|
222 |
+
var $ = jQuery;
|
223 |
+
|
224 |
+
plugin.activeCheckbox = "";
|
225 |
+
|
226 |
+
plugin.selectors = {
|
227 |
+
checkbox : '[data-np-check-all]',
|
228 |
+
}
|
229 |
+
|
230 |
+
plugin.bindEvents = function()
|
231 |
+
{
|
232 |
+
$(document).on('change', plugin.selectors.checkbox, function(){
|
233 |
+
plugin.activeCheckbox = $(this);
|
234 |
+
plugin.toggleCheckboxes();
|
235 |
+
});
|
236 |
+
$(document).on('change', 'input[type=checkbox]', function(){
|
237 |
+
plugin.checkAllStatus($(this));
|
238 |
+
});
|
239 |
+
}
|
240 |
+
|
241 |
+
plugin.init = function()
|
242 |
+
{
|
243 |
+
plugin.bindEvents();
|
244 |
+
}
|
245 |
+
|
246 |
+
plugin.toggleCheckboxes = function()
|
247 |
+
{
|
248 |
+
var checked = ( $(plugin.activeCheckbox).is(':checked') ) ? true : false;
|
249 |
+
var name = $(plugin.activeCheckbox).attr('data-np-check-all');
|
250 |
+
|
251 |
+
var checkboxes = $('*[name="' + name + '"]');
|
252 |
+
$.each(checkboxes, function(){
|
253 |
+
var row = $(this).parents(NestedPages.selectors.rows);
|
254 |
+
$(this).prop('checked', checked);
|
255 |
+
// Uncheck any hidden checkboxes
|
256 |
+
if ( $(row).hasClass('np-hide') && !$(row).is(':visible') ) {
|
257 |
+
$(row).find(NestedPages.selectors.bulkActionsCheckbox).prop('checked', false)
|
258 |
+
};
|
259 |
+
});
|
260 |
+
|
261 |
+
plugin.toggleCheckAll();
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Toggle the "Partial" class for the checkall checkbox
|
266 |
+
*/
|
267 |
+
plugin.toggleCheckAll = function()
|
268 |
+
{
|
269 |
+
var name = $(plugin.activeCheckbox).attr('data-np-check-all');
|
270 |
+
|
271 |
+
var checkboxes_total = $('*[name="' + name + '"]').length;
|
272 |
+
var hidden_checkboxes = $('.np-hide').find(NestedPages.selectors.bulkActionsCheckbox).length;
|
273 |
+
var hidden_checkboxes_visible = $('.np-hide:visible').find(NestedPages.selectors.bulkActionsCheckbox).length;
|
274 |
+
|
275 |
+
checkboxes_total = ( checkboxes_total - hidden_checkboxes ) + hidden_checkboxes_visible;
|
276 |
+
|
277 |
+
var checkboxes_checked = $('*[name="' + name + '"]:checked').length;
|
278 |
+
|
279 |
+
if ( checkboxes_total == checkboxes_checked ){
|
280 |
+
$(plugin.activeCheckbox).prop('checked', true);
|
281 |
+
$(plugin.activeCheckbox).removeClass('check-all-partial');
|
282 |
+
return;
|
283 |
+
}
|
284 |
+
if ( checkboxes_checked > 0 ){
|
285 |
+
$(plugin.activeCheckbox).addClass('check-all-partial');
|
286 |
+
return;
|
287 |
+
}
|
288 |
+
$(plugin.activeCheckbox).attr('checked', false);
|
289 |
+
$(plugin.activeCheckbox).removeClass('check-all-partial');
|
290 |
+
}
|
291 |
+
|
292 |
+
plugin.checkAllStatus = function(checkbox)
|
293 |
+
{
|
294 |
+
var name = $(checkbox).attr('name');
|
295 |
+
var toggleAllCheckbox = $('*[data-np-check-all="' + name + '"]');
|
296 |
+
if ( toggleAllCheckbox.length === 0 ) return;
|
297 |
+
plugin.activeCheckbox = $(toggleAllCheckbox)[0];
|
298 |
+
plugin.toggleCheckAll();
|
299 |
+
}
|
300 |
+
|
301 |
+
return plugin.init();
|
302 |
+
}
|
303 |
+
var NestedPages = NestedPages || {};
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Bulk Actions for Nested View
|
307 |
+
* @package Nested Pages
|
308 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
309 |
+
*/
|
310 |
+
NestedPages.BulkActions = function()
|
311 |
+
{
|
312 |
+
var plugin = this;
|
313 |
+
var $ = jQuery;
|
314 |
+
|
315 |
+
plugin.selectedNumber = 0;
|
316 |
+
plugin.selectedLinks = [];
|
317 |
+
plugin.selectedPosts = []; // array
|
318 |
+
|
319 |
+
plugin.init = function()
|
320 |
+
{
|
321 |
+
plugin.bindEvents();
|
322 |
+
}
|
323 |
+
|
324 |
+
plugin.bindEvents = function()
|
325 |
+
{
|
326 |
+
$(document).on('change', NestedPages.selectors.bulkActionsCheckbox, function(){
|
327 |
+
plugin.toggleBulkForm();
|
328 |
+
});
|
329 |
+
$(document).on('submit', NestedPages.selectors.bulkActionsForm, function(e){
|
330 |
+
if ( $('select[name=np_bulk_action]').val() === 'edit' ){
|
331 |
+
e.preventDefault();
|
332 |
+
plugin.toggleBulkEdit(true);
|
333 |
+
}
|
334 |
+
});
|
335 |
+
$(document).on('click', NestedPages.selectors.bulkEditRemoveItem, function(e){
|
336 |
+
e.preventDefault();
|
337 |
+
var id = $(this).siblings('input[type=hidden]').val();
|
338 |
+
plugin.uncheckBulkItem(id);
|
339 |
+
});
|
340 |
+
$(document).on('click', NestedPages.selectors.bulkEditCancel, function(e){
|
341 |
+
e.preventDefault();
|
342 |
+
plugin.uncheckAllBulkItems();
|
343 |
+
});
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Toggle the Bulk Actions Form & Populate the Hidden ID Fields for posts and redirects
|
348 |
+
*/
|
349 |
+
plugin.toggleBulkForm = function()
|
350 |
+
{
|
351 |
+
var checked = false;
|
352 |
+
var checked_ids = '';
|
353 |
+
var checked_redirect_ids = '';
|
354 |
+
plugin.selectedPosts = [];
|
355 |
+
plugin.selectedLinks = [];
|
356 |
+
$.each($(NestedPages.selectors.bulkActionsCheckbox), function(){
|
357 |
+
if ( $(this).is(':checked') ) {
|
358 |
+
var row = $(this).parents(NestedPages.selectors.rows);
|
359 |
+
checked = true;
|
360 |
+
if ( !$(this).parent('div').hasClass('np-check-all') && !$(row).hasClass('post-type-np-redirect') ) checked_ids += $(this).val() + ',';
|
361 |
+
if ( $(row).hasClass('post-type-np-redirect') ) {
|
362 |
+
checked_redirect_ids += $(this).val() + ',';
|
363 |
+
plugin.selectedLinks.push($(this).val());
|
364 |
+
}
|
365 |
+
if ( $(this).attr('data-np-post-type') !== 'np-redirect' && !$(this).parent('div').hasClass('np-check-all') ){
|
366 |
+
var post = [];
|
367 |
+
post['title'] = $(this).attr('data-np-bulk-checkbox');
|
368 |
+
post['id'] = $(this).val();
|
369 |
+
plugin.selectedPosts.push(post);
|
370 |
+
}
|
371 |
+
}
|
372 |
+
});
|
373 |
+
plugin.setBulkEditPosts();
|
374 |
+
plugin.toggleEditOption();
|
375 |
+
plugin.toggleLinkCountAlert();
|
376 |
+
if ( checked ){
|
377 |
+
$(NestedPages.selectors.bulkActionsForm).show();
|
378 |
+
$(NestedPages.selectors.bulkActionsIds).val(checked_ids);
|
379 |
+
$(NestedPages.selectors.bulkActionRedirectIds).val(checked_redirect_ids);
|
380 |
+
plugin.setSelectedNumber();
|
381 |
+
return;
|
382 |
+
}
|
383 |
+
$(NestedPages.selectors.bulkActionsIds).val('');
|
384 |
+
$(NestedPages.selectors.bulkActionsForm).hide();
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Set the Posts for Bulk Edit
|
389 |
+
*/
|
390 |
+
plugin.setBulkEditPosts = function()
|
391 |
+
{
|
392 |
+
var html = '';
|
393 |
+
for ( var i = 0; i < plugin.selectedPosts.length; i++ ){
|
394 |
+
html += '<li><a href="#" class="np-remove" data-np-remove-bulk-item>×</a>';
|
395 |
+
html += plugin.selectedPosts[i].title;
|
396 |
+
html += '<input type="hidden" name="post_ids[]" value="' + plugin.selectedPosts[i].id + '"></li>';
|
397 |
+
}
|
398 |
+
$(NestedPages.selectors.bulkEditTitles).html(html);
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Uncheck a bulk item
|
403 |
+
*/
|
404 |
+
plugin.uncheckBulkItem = function(id)
|
405 |
+
{
|
406 |
+
$.each($(NestedPages.selectors.bulkActionsCheckbox), function(){
|
407 |
+
if ( $(this).val() == id ) {
|
408 |
+
$(this).prop('checked', false).change();
|
409 |
+
}
|
410 |
+
});
|
411 |
+
// Hide the form if all posts are removed
|
412 |
+
if ( $(NestedPages.selectors.bulkEditRemoveItem).length === 0 ){
|
413 |
+
plugin.toggleBulkEdit(false);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Uncheck all bulk items
|
419 |
+
*/
|
420 |
+
plugin.uncheckAllBulkItems = function()
|
421 |
+
{
|
422 |
+
$.each($(NestedPages.selectors.bulkActionsCheckbox), function(){
|
423 |
+
$(this).prop('checked', false).change();
|
424 |
+
});
|
425 |
+
plugin.toggleBulkEdit(false);
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Set the number of total selected
|
430 |
+
*/
|
431 |
+
plugin.setSelectedNumber = function()
|
432 |
+
{
|
433 |
+
var checkedLength = $(NestedPages.selectors.bulkActionsCheckbox + ':checked').not('.np-check-all input').length;
|
434 |
+
var option = $(NestedPages.selectors.bulkActionsForm).find('select option').first();
|
435 |
+
$(option).text(nestedpages.bulk_actions + ' (' + checkedLength + ')');
|
436 |
+
}
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Toggle the edit option to disabled if no post checkboxes are checked
|
440 |
+
* Prevents opening the bulk edit form with only np-redirects checked
|
441 |
+
*/
|
442 |
+
plugin.toggleEditOption = function()
|
443 |
+
{
|
444 |
+
var checkedLength = $(NestedPages.selectors.bulkActionsCheckbox + ':checked').not('.np-check-all input').not('.np-redirect-bulk').length;
|
445 |
+
var option = $(NestedPages.selectors.bulkActionsForm).find('select option[value=edit]');
|
446 |
+
if ( checkedLength === 0 ){
|
447 |
+
$(option).prop('disabled', true);
|
448 |
+
$(NestedPages.selectors.bulkActionsForm).find('select option').first().prop('selected', true);
|
449 |
+
plugin.toggleBulkEdit(false);
|
450 |
+
return;
|
451 |
+
}
|
452 |
+
$(option).prop('disabled', false);
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Toggle the bulk edit form
|
457 |
+
*/
|
458 |
+
plugin.toggleBulkEdit = function(visible)
|
459 |
+
{
|
460 |
+
plugin.toggleLinkCountAlert();
|
461 |
+
if ( visible ){
|
462 |
+
$(NestedPages.selectors.bulkEditForm).show();
|
463 |
+
$(NestedPages.selectors.bulkActionsForm).hide();
|
464 |
+
plugin.setWPSuggest();
|
465 |
+
return;
|
466 |
+
}
|
467 |
+
$(NestedPages.selectors.bulkEditForm).hide();
|
468 |
+
$(NestedPages.selectors.bulkActionsForm).show();
|
469 |
+
$(NestedPages.selectors.bulkEditLinkCount).parent('div').hide();
|
470 |
+
$(NestedPages.selectors.bulkActionsForm).find('select option').first().text(nestedpages.bulk_actions);
|
471 |
+
plugin.resetBulkEditFields();
|
472 |
+
}
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Toggle the bulk edit link count alert
|
476 |
+
*/
|
477 |
+
plugin.toggleLinkCountAlert = function()
|
478 |
+
{
|
479 |
+
var selectedLinkCount = plugin.selectedLinks.length;
|
480 |
+
if ( selectedLinkCount === 0 ) {
|
481 |
+
$(NestedPages.selectors.bulkEditLinkCount).parent('div').hide();
|
482 |
+
return;
|
483 |
+
}
|
484 |
+
$(NestedPages.selectors.bulkEditLinkCount).parent('div').show();
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Initialize WP Auto Suggest on Flat Taxonomy fields
|
489 |
+
*/
|
490 |
+
plugin.setWPSuggest = function()
|
491 |
+
{
|
492 |
+
var tagfields = $(NestedPages.selectors.bulkEditForm).find('[data-autotag]');
|
493 |
+
$.each(tagfields, function(i, v){
|
494 |
+
var taxonomy = $(this).attr('data-taxonomy');
|
495 |
+
$(this).suggest(ajaxurl + '?action=ajax-tag-search&tax=' + taxonomy , {multiple:true, multipleSep: ","});
|
496 |
+
});
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Clear out the bulk edit fields
|
501 |
+
*/
|
502 |
+
plugin.resetBulkEditFields = function()
|
503 |
+
{
|
504 |
+
var selectFields = $(NestedPages.selectors.bulkEditForm).find('select');
|
505 |
+
$.each(selectFields, function(){
|
506 |
+
$(this).find('option').first().prop('selected', true);
|
507 |
+
});
|
508 |
+
var categoryChecklists = $(NestedPages.selectors.bulkEditForm).find('.cat-checklist');
|
509 |
+
$.each(categoryChecklists, function(){
|
510 |
+
$(this).find('input[type=checkbox]').prop('checked', false);
|
511 |
+
});
|
512 |
+
}
|
513 |
+
|
514 |
+
return plugin.init();
|
515 |
+
}
|
516 |
+
var NestedPages = NestedPages || {};
|
517 |
+
|
518 |
+
/**
|
519 |
+
* The Hidden Item Count for selected items in the Nested View
|
520 |
+
* @package Nested Pages
|
521 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
522 |
+
*/
|
523 |
+
NestedPages.HiddenItemCount = function()
|
524 |
+
{
|
525 |
+
var plugin = this;
|
526 |
+
var $ = jQuery;
|
527 |
+
|
528 |
+
plugin.init = function()
|
529 |
+
{
|
530 |
+
plugin.bindEvents();
|
531 |
+
}
|
532 |
+
|
533 |
+
plugin.bindEvents = function()
|
534 |
+
{
|
535 |
+
$(document).on('change', NestedPages.selectors.bulkActionsCheckbox, function(){
|
536 |
+
plugin.toggleHiddenCount();
|
537 |
+
});
|
538 |
+
$(document).on('click', NestedPages.selectors.toggleAll, function(){
|
539 |
+
plugin.toggleHiddenCount();
|
540 |
+
});
|
541 |
+
$(document).on('click', NestedPages.selectors.pageToggle, function(){
|
542 |
+
plugin.toggleHiddenCount();
|
543 |
+
});
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Toggle the Hidden Count
|
548 |
+
*/
|
549 |
+
plugin.toggleHiddenCount = function()
|
550 |
+
{
|
551 |
+
var hiddenCount = 0;
|
552 |
+
$.each($(NestedPages.selectors.bulkActionsCheckbox), function(){
|
553 |
+
if ( $(this).is(':checked') ) {
|
554 |
+
if ( $(this).parent('div').hasClass('np-check-all') ) return;
|
555 |
+
var row = $(this).closest('.page-row');
|
556 |
+
if ( !$(row).is(':visible') ) hiddenCount++;
|
557 |
+
}
|
558 |
+
});
|
559 |
+
if ( hiddenCount < 1 ){
|
560 |
+
$(NestedPages.selectors.hiddenItemCountParent).hide();
|
561 |
+
return;
|
562 |
+
}
|
563 |
+
$(NestedPages.selectors.hiddenItemCount).text(hiddenCount);
|
564 |
+
$(NestedPages.selectors.hiddenItemCountParent).show();
|
565 |
+
}
|
566 |
+
|
567 |
+
return plugin.init();
|
568 |
+
}
|
569 |
+
var NestedPages = NestedPages || {};
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Toggles Menu Elements
|
573 |
+
* @package Nested Pages
|
574 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
575 |
+
*/
|
576 |
+
NestedPages.MenuToggle = function()
|
577 |
+
{
|
578 |
+
var plugin = this;
|
579 |
+
var $ = jQuery;
|
580 |
+
|
581 |
+
plugin.formatter = new NestedPages.Formatter;
|
582 |
+
|
583 |
+
plugin.bindEvents = function()
|
584 |
+
{
|
585 |
+
$(document).on('click', NestedPages.selectors.childToggleLink, function(e){
|
586 |
+
e.preventDefault();
|
587 |
+
plugin.toggleSingleMenu($(this));
|
588 |
+
});
|
589 |
+
$(document).on('click', NestedPages.selectors.toggleAll, function(e){
|
590 |
+
e.preventDefault();
|
591 |
+
plugin.toggleAllMenus();
|
592 |
+
});
|
593 |
+
}
|
594 |
+
|
595 |
+
|
596 |
+
// Toggle individual submenus
|
597 |
+
plugin.toggleSingleMenu = function(button)
|
598 |
+
{
|
599 |
+
var submenu = $(button).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings('ol');
|
600 |
+
$(button).find('i')
|
601 |
+
.toggleClass(NestedPages.cssClasses.iconToggleDown)
|
602 |
+
.toggleClass(NestedPages.cssClasses.iconToggleRight);
|
603 |
+
$(submenu).toggle();
|
604 |
+
plugin.formatter.setBorders();
|
605 |
+
plugin.formatter.setNestedMargins();
|
606 |
+
plugin.syncUserToggles();
|
607 |
+
}
|
608 |
+
|
609 |
+
|
610 |
+
// Toggle All Submenus
|
611 |
+
plugin.toggleAllMenus = function()
|
612 |
+
{
|
613 |
+
var button = NestedPages.selectors.toggleAll;
|
614 |
+
if ( $(button).attr('data-toggle') === 'closed' ){
|
615 |
+
$(NestedPages.selectors.lists).show();
|
616 |
+
$(button).attr('data-toggle', 'opened').text(NestedPages.jsData.collapseText);
|
617 |
+
$(NestedPages.selectors.childToggle).find('i').removeClass(NestedPages.cssClasses.iconToggleRight).addClass(NestedPages.cssClasses.iconToggleDown);
|
618 |
+
// revert_quick_edit();
|
619 |
+
plugin.formatter.setBorders();
|
620 |
+
plugin.syncUserToggles();
|
621 |
+
return;
|
622 |
+
}
|
623 |
+
|
624 |
+
$(NestedPages.selectors.lists).not($(NestedPages.selectors.lists)[0]).hide();
|
625 |
+
$(button).attr('data-toggle', 'closed').text(NestedPages.jsData.expandText);
|
626 |
+
$(NestedPages.selectors.childToggle).find('i').removeClass(NestedPages.cssClasses.iconToggleDown).addClass(NestedPages.cssClasses.iconToggleRight);
|
627 |
+
// revert_quick_edit();
|
628 |
+
plugin.formatter.setBorders();
|
629 |
+
plugin.syncUserToggles();
|
630 |
+
}
|
631 |
+
|
632 |
+
|
633 |
+
// Get an array of visible rows
|
634 |
+
plugin.visibleRowIDs = function()
|
635 |
+
{
|
636 |
+
var visible_ids = [];
|
637 |
+
var visible = $(NestedPages.selectors.rows + ':visible');
|
638 |
+
$.each(visible, function(i, v){
|
639 |
+
var id = $(this).attr('id');
|
640 |
+
visible_ids.push(id.replace("menuItem_", ""));
|
641 |
+
});
|
642 |
+
return visible_ids;
|
643 |
+
}
|
644 |
+
|
645 |
+
|
646 |
+
// Save the user's toggled menus
|
647 |
+
plugin.syncUserToggles = function()
|
648 |
+
{
|
649 |
+
$.ajax({
|
650 |
+
url: NestedPages.jsData.ajaxurl,
|
651 |
+
type: 'post',
|
652 |
+
datatype: 'json',
|
653 |
+
data: {
|
654 |
+
action : NestedPages.formActions.syncToggles,
|
655 |
+
nonce : NestedPages.jsData.nonce,
|
656 |
+
ids : plugin.visibleRowIDs(),
|
657 |
+
posttype : NestedPages.jsData.posttype
|
658 |
+
},
|
659 |
+
success: function(data){
|
660 |
+
if ( data.status !== 'success' ){
|
661 |
+
console.log('There was an error saving toggled pages.');
|
662 |
+
}
|
663 |
+
}
|
664 |
+
});
|
665 |
+
}
|
666 |
+
|
667 |
+
|
668 |
+
return plugin.bindEvents();
|
669 |
+
}
|
670 |
+
var NestedPages = NestedPages || {};
|
671 |
+
|
672 |
+
/**
|
673 |
+
* Toggle Page Rows
|
674 |
+
* @package Nested Pages
|
675 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
676 |
+
*/
|
677 |
+
NestedPages.PageToggle = function()
|
678 |
+
{
|
679 |
+
var plugin = this;
|
680 |
+
var $ = jQuery;
|
681 |
+
|
682 |
+
plugin.activeButton = '';
|
683 |
+
|
684 |
+
plugin.formatter = new NestedPages.Formatter;
|
685 |
+
|
686 |
+
plugin.init = function()
|
687 |
+
{
|
688 |
+
plugin.bindEvents();
|
689 |
+
}
|
690 |
+
|
691 |
+
plugin.bindEvents = function()
|
692 |
+
{
|
693 |
+
$(document).on('click', NestedPages.selectors.toggleHidden, function(e){
|
694 |
+
e.preventDefault();
|
695 |
+
plugin.activeButton = $(this);
|
696 |
+
plugin.toggleHidden();
|
697 |
+
});
|
698 |
+
$(document).on('click', NestedPages.selectors.toggleStatus, function(e){
|
699 |
+
e.preventDefault();
|
700 |
+
plugin.toggleStatus($(this));
|
701 |
+
});
|
702 |
+
}
|
703 |
+
|
704 |
+
|
705 |
+
// Toggle Hidden Pages
|
706 |
+
plugin.toggleHidden = function()
|
707 |
+
{
|
708 |
+
var button = $(plugin.activeButton);
|
709 |
+
var action = $(button).attr('href');
|
710 |
+
|
711 |
+
if ( action == '#show' ){
|
712 |
+
$(button).attr('href', '#hide').text(NestedPages.jsData.showHiddenText);
|
713 |
+
$(NestedPages.selectors.hiddenRows).removeClass('shown').hide();
|
714 |
+
plugin.formatter.updateSubMenuToggle();
|
715 |
+
plugin.formatter.setBorders();
|
716 |
+
return;
|
717 |
+
}
|
718 |
+
|
719 |
+
if ( action == '#hide' ){
|
720 |
+
$(button).attr('href', '#show').text(NestedPages.jsData.hideHiddenText);
|
721 |
+
$(NestedPages.selectors.hiddenRows).addClass('shown').show();
|
722 |
+
plugin.formatter.updateSubMenuToggle();
|
723 |
+
plugin.formatter.setBorders();
|
724 |
+
}
|
725 |
+
}
|
726 |
+
|
727 |
+
|
728 |
+
// Toggle Pages based on status
|
729 |
+
plugin.toggleStatus = function(button)
|
730 |
+
{
|
731 |
+
var target = $(button).attr('href');
|
732 |
+
target = target.substring(1);
|
733 |
+
$(NestedPages.selectors.syncCheckbox).attr('disabled', false);
|
734 |
+
$(NestedPages.selectors.toggleStatus).removeClass('active');
|
735 |
+
$(button).addClass('active');
|
736 |
+
if ( target == 'draft' ){
|
737 |
+
$(NestedPages.selectors.syncCheckbox).attr('disabled', true);
|
738 |
+
$('.' + target).addClass('nested-visible');
|
739 |
+
}
|
740 |
+
if ( target == 'all' ){
|
741 |
+
$(NestedPages.selectors.rows).show();
|
742 |
+
return;
|
743 |
+
}
|
744 |
+
$(NestedPages.selectors.rows).hide();
|
745 |
+
$('.' + target).show();
|
746 |
+
return;
|
747 |
+
}
|
748 |
+
|
749 |
+
|
750 |
+
return plugin.init();
|
751 |
+
|
752 |
+
}
|
753 |
+
var NestedPages = NestedPages || {};
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Enables and Saves Nesting
|
757 |
+
* @package Nested Pages
|
758 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
759 |
+
*/
|
760 |
+
NestedPages.Nesting = function()
|
761 |
+
{
|
762 |
+
var plugin = this;
|
763 |
+
var $ = jQuery;
|
764 |
+
|
765 |
+
plugin.formatter = new NestedPages.Formatter;
|
766 |
+
|
767 |
+
|
768 |
+
// Make the Menu sortable
|
769 |
+
plugin.initializeSortable = function()
|
770 |
+
{
|
771 |
+
maxLevels = ( NestedPages.jsData.nestable ) ? 0 : 1;
|
772 |
+
$(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({
|
773 |
+
items : NestedPages.selectors.rows,
|
774 |
+
toleranceElement: '> .row',
|
775 |
+
handle: NestedPages.selectors.handle,
|
776 |
+
placeholder: "ui-sortable-placeholder",
|
777 |
+
maxLevels: maxLevels,
|
778 |
+
tabSize : 56,
|
779 |
+
start: function(e, ui){
|
780 |
+
ui.placeholder.height(ui.item.height());
|
781 |
+
},
|
782 |
+
sort: function(e, ui){
|
783 |
+
plugin.formatter.updatePlaceholderWidth(ui);
|
784 |
+
},
|
785 |
+
stop: function(e, ui){
|
786 |
+
setTimeout(
|
787 |
+
function(){
|
788 |
+
plugin.formatter.updateSubMenuToggle();
|
789 |
+
plugin.formatter.setBorders();
|
790 |
+
plugin.formatter.setNestedMargins();
|
791 |
+
}, 100
|
792 |
+
);
|
793 |
+
plugin.syncNesting();
|
794 |
+
},
|
795 |
+
});
|
796 |
+
}
|
797 |
+
|
798 |
+
|
799 |
+
// Disable Nesting
|
800 |
+
plugin.disableNesting = function()
|
801 |
+
{
|
802 |
+
$(NestedPages.selectors.sortable).sortable('destroy');
|
803 |
+
}
|
804 |
+
|
805 |
+
|
806 |
+
// Sync Nesting
|
807 |
+
plugin.syncNesting = function(manual, callback)
|
808 |
+
{
|
809 |
+
if ( nestedpages.manual_order_sync === '1' && !manual) return;
|
810 |
+
$(NestedPages.selectors.errorDiv).hide();
|
811 |
+
$(NestedPages.selectors.loadingIndicator).show();
|
812 |
+
|
813 |
+
list = $(NestedPages.selectors.sortable).nestedSortable('toHierarchy', {startDepthCount: 0});
|
814 |
+
plugin.disableNesting();
|
815 |
+
|
816 |
+
var syncmenu = NestedPages.jsData.syncmenu;
|
817 |
+
if ( nestedpages.manual_menu_sync === '1' ) syncmenu = 'nosync';
|
818 |
+
|
819 |
+
$.ajax({
|
820 |
+
url: ajaxurl,
|
821 |
+
type: 'post',
|
822 |
+
datatype: 'json',
|
823 |
+
data: {
|
824 |
+
action : NestedPages.formActions.syncNesting,
|
825 |
+
nonce : NestedPages.jsData.nonce,
|
826 |
+
list : list,
|
827 |
+
post_type : NestedPages.jsData.posttype,
|
828 |
+
syncmenu : syncmenu
|
829 |
+
},
|
830 |
+
success: function(data, callback){
|
831 |
+
plugin.initializeSortable();
|
832 |
+
if (data.status === 'error'){
|
833 |
+
$(NestedPages.selectors.errorDiv).text(data.message).show();
|
834 |
+
$(NestedPages.selectors.loadingIndicator).hide();
|
835 |
+
} else {
|
836 |
+
if ( callback && typeof callback === 'function') {
|
837 |
+
callback();
|
838 |
+
return;
|
839 |
+
}
|
840 |
+
$(NestedPages.selectors.loadingIndicator).hide();
|
841 |
+
}
|
842 |
+
}
|
843 |
+
});
|
844 |
+
}
|
845 |
+
|
846 |
+
}
|
847 |
+
var NestedPages = NestedPages || {};
|
848 |
+
|
849 |
+
/**
|
850 |
+
* Sync the "sync menu" setting
|
851 |
+
* @package Nested Pages
|
852 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
853 |
+
*/
|
854 |
+
NestedPages.SyncMenuSetting = function()
|
855 |
+
{
|
856 |
+
var plugin = this;
|
857 |
+
var $ = jQuery;
|
858 |
+
|
859 |
+
plugin.formatter = new NestedPages.Formatter;
|
860 |
+
|
861 |
+
plugin.init = function()
|
862 |
+
{
|
863 |
+
plugin.bindEvents();
|
864 |
+
}
|
865 |
+
|
866 |
+
plugin.bindEvents = function()
|
867 |
+
{
|
868 |
+
$(document).ready(function(){ // catches trash updates
|
869 |
+
if ( nestedpages.manual_menu_sync === '1' ) return;
|
870 |
+
if ( nestedpages.syncmenu === '1' ) plugin.syncSetting();
|
871 |
+
});
|
872 |
+
$(document).on('change', NestedPages.selectors.syncCheckbox, function(){
|
873 |
+
plugin.syncSetting();
|
874 |
+
});
|
875 |
+
}
|
876 |
+
|
877 |
+
// Sync the "Sync menu" preference / setting
|
878 |
+
plugin.syncSetting = function()
|
879 |
+
{
|
880 |
+
|
881 |
+
if ( NestedPages.jsData.posttype !== 'page' ) return;
|
882 |
+
if ($(NestedPages.selectors.syncCheckbox).length === 0) return;
|
883 |
+
|
884 |
+
NestedPages.jsData.syncmenu = ( $(NestedPages.selectors.syncCheckbox).is(':checked') ) ? 'sync' : 'nosync';
|
885 |
+
|
886 |
+
$.ajax({
|
887 |
+
url: NestedPages.jsData.ajaxurl,
|
888 |
+
type: 'post',
|
889 |
+
datatype: 'json',
|
890 |
+
data: {
|
891 |
+
action : NestedPages.formActions.syncMenu,
|
892 |
+
nonce : NestedPages.jsData.nonce,
|
893 |
+
post_type : NestedPages.jsData.posttype,
|
894 |
+
syncmenu : NestedPages.jsData.syncmenu
|
895 |
+
},
|
896 |
+
success: function(data){
|
897 |
+
if (data.status === 'error'){
|
898 |
+
plugin.formatter.showAjaxError(data.message);
|
899 |
+
}
|
900 |
+
},
|
901 |
+
});
|
902 |
+
}
|
903 |
+
|
904 |
+
return plugin.bindEvents();
|
905 |
+
}
|
906 |
+
var NestedPages = NestedPages || {};
|
907 |
+
|
908 |
+
/**
|
909 |
+
* Add new page(s) - Top level & child
|
910 |
+
* @package Nested Pages
|
911 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
912 |
+
*/
|
913 |
+
NestedPages.NewPage = function()
|
914 |
+
{
|
915 |
+
var plugin = this;
|
916 |
+
var $ = jQuery;
|
917 |
+
|
918 |
+
plugin.formatter = new NestedPages.Formatter;
|
919 |
+
plugin.parent_id = 0; // Parent ID for the post(s) to add
|
920 |
+
plugin.posts = ''; // The newly added posts
|
921 |
+
plugin.form = ''; // The active form
|
922 |
+
|
923 |
+
|
924 |
+
plugin.init = function()
|
925 |
+
{
|
926 |
+
plugin.bindEvents();
|
927 |
+
}
|
928 |
+
|
929 |
+
|
930 |
+
plugin.bindEvents = function()
|
931 |
+
{
|
932 |
+
$(document).on('click', NestedPages.selectors.openPageModal, function(e){
|
933 |
+
e.preventDefault();
|
934 |
+
plugin.openModal();
|
935 |
+
});
|
936 |
+
$(document).on('submit', NestedPages.selectors.newPageForm, function(e){
|
937 |
+
e.preventDefault();
|
938 |
+
});
|
939 |
+
$(document).on('click', NestedPages.selectors.newPageSubmitButton, function(e){
|
940 |
+
e.preventDefault();
|
941 |
+
plugin.submitForm($(this));
|
942 |
+
});
|
943 |
+
$(document).on('click', NestedPages.selectors.newPageTitle, function(e){
|
944 |
+
e.preventDefault();
|
945 |
+
plugin.addTitleField($(this));
|
946 |
+
});
|
947 |
+
$(document).on('click', NestedPages.selectors.newPageRemoveTitle, function(e){
|
948 |
+
e.preventDefault();
|
949 |
+
plugin.removeTitleField($(this));
|
950 |
+
});
|
951 |
+
$(document).on('click', NestedPages.selectors.addChildButton, function(e){
|
952 |
+
e.preventDefault();
|
953 |
+
plugin.openQuickEdit($(this));
|
954 |
+
});
|
955 |
+
$(NestedPages.selectors.newPageModal).on('hide.bs.modal', function(){
|
956 |
+
plugin.cancelNewPage();
|
957 |
+
});
|
958 |
+
$(NestedPages.selectors.newPageModal).on('shown.bs.modal', function(){
|
959 |
+
plugin.modalOpened($(this));
|
960 |
+
});
|
961 |
+
$(document).on('click', NestedPages.selectors.cancelNewChildButton, function(e){
|
962 |
+
e.preventDefault();
|
963 |
+
plugin.cancelNewPage();
|
964 |
+
$(NestedPages.selectors.newPageModal).modal('hide');
|
965 |
+
});
|
966 |
+
}
|
967 |
+
|
968 |
+
|
969 |
+
// Open the form modal
|
970 |
+
plugin.openModal = function()
|
971 |
+
{
|
972 |
+
var newform = $(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);
|
973 |
+
$(newform).addClass('in-modal');
|
974 |
+
$(NestedPages.selectors.newPageModal).find('.modal-body').html(newform);
|
975 |
+
$(NestedPages.selectors.newPageModal).find('h3').text(nestedpages.add_multiple);
|
976 |
+
$(NestedPages.selectors.newPageModal).find('.page_parent_id').val(plugin.parent_id);
|
977 |
+
$(NestedPages.selectors.newPageModal).modal('show');
|
978 |
+
}
|
979 |
+
|
980 |
+
// Modal has opened, set the attributes
|
981 |
+
plugin.modalOpened = function(modal)
|
982 |
+
{
|
983 |
+
$(modal).find('.np_title').focus();
|
984 |
+
$(modal).find(NestedPages.selectors.newPageTitle).prop('tabindex', '2');
|
985 |
+
}
|
986 |
+
|
987 |
+
|
988 |
+
// Open the new child quick edit
|
989 |
+
plugin.openQuickEdit = function(button)
|
990 |
+
{
|
991 |
+
var parent_li = $(button).closest(NestedPages.selectors.row).parent('li');
|
992 |
+
var newform = $(NestedPages.selectors.newPageFormContainer).clone();
|
993 |
+
|
994 |
+
// Append the form to the list item
|
995 |
+
if ( $(parent_li).children('ol').length > 0 ){
|
996 |
+
var child_ol = $(parent_li).children('ol');
|
997 |
+
$(newform).insertBefore(child_ol);
|
998 |
+
} else {
|
999 |
+
$(newform).appendTo(parent_li);
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
$(newform).siblings(NestedPages.selectors.row).hide();
|
1003 |
+
|
1004 |
+
plugin.formatter.showQuickEdit();
|
1005 |
+
|
1006 |
+
$(newform).find('.parent_name').html('<em>Parent:</em> ' + $(button).attr('data-parentname'));
|
1007 |
+
$(newform).find('.page_parent_id').val($(button).attr('data-id'));
|
1008 |
+
$(newform).show();
|
1009 |
+
$(newform).find('.np_title').focus();
|
1010 |
+
$(newform).find(NestedPages.selectors.newPageTitle).prop('tabindex', '2');
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
|
1014 |
+
// Close the form modal
|
1015 |
+
plugin.cancelNewPage = function()
|
1016 |
+
{
|
1017 |
+
plugin.formatter.removeQuickEdit();
|
1018 |
+
$(NestedPages.selectors.newChildError).hide();
|
1019 |
+
$(NestedPages.selectors.newPageModal).find('.modal-body').empty();
|
1020 |
+
$(NestedPages.selectors.sortable).find('.new-child').remove();
|
1021 |
+
$(NestedPages.selectors.row).show();
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
|
1025 |
+
// Add a page title field to the form
|
1026 |
+
plugin.addTitleField = function(button)
|
1027 |
+
{
|
1028 |
+
var form = $(button).parents('form');
|
1029 |
+
var fieldcount = $(button).siblings('.new-page-titles').children('li').length + 1;
|
1030 |
+
var html = '<li><i class="handle np-icon-menu"></i><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="' + fieldcount + '" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';
|
1031 |
+
var container = $(button).siblings('.new-page-titles').append(html);
|
1032 |
+
$(form).find('.np_title').last().focus();
|
1033 |
+
$(form).find(NestedPages.selectors.newPageTitle).prop('tabindex', fieldcount++);
|
1034 |
+
$('.new-page-titles').sortable({
|
1035 |
+
items : 'li',
|
1036 |
+
handle: '.handle',
|
1037 |
+
});
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
|
1041 |
+
// Remove a page title field
|
1042 |
+
plugin.removeTitleField = function(button)
|
1043 |
+
{
|
1044 |
+
$(button).parents('.new-child-row').parent('li').remove();
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
|
1048 |
+
// Submit the New Page Form
|
1049 |
+
plugin.submitForm = function(button)
|
1050 |
+
{
|
1051 |
+
plugin.toggleLoading(true);
|
1052 |
+
plugin.form = $(button).parents('form');
|
1053 |
+
|
1054 |
+
var addedit = ( $(button).hasClass('add-edit') ) ? true : false;
|
1055 |
+
|
1056 |
+
$.ajax({
|
1057 |
+
url: NestedPages.jsData.ajaxurl,
|
1058 |
+
type: 'post',
|
1059 |
+
datatype: 'json',
|
1060 |
+
data: $(plugin.form).serialize() + '&action=' + NestedPages.formActions.newPage + '&nonce=' + NestedPages.jsData.nonce + '&syncmenu=' + NestedPages.jsData.syncmenu + '&post_type=' + NestedPages.jsData.posttype,
|
1061 |
+
success: function(data){
|
1062 |
+
if (data.status === 'error'){
|
1063 |
+
plugin.toggleLoading(false);
|
1064 |
+
$(plugin.form).find(NestedPages.selectors.quickEditErrorDiv).text(data.message).show();
|
1065 |
+
return;
|
1066 |
+
}
|
1067 |
+
if ( addedit === true ){ // Redirect to Edit Screen
|
1068 |
+
var link = data.new_pages[0].edit_link;
|
1069 |
+
link = link.replace(/&/g, '&');
|
1070 |
+
window.location.replace(link);
|
1071 |
+
return;
|
1072 |
+
}
|
1073 |
+
plugin.toggleLoading(false);
|
1074 |
+
plugin.posts = data.new_pages;
|
1075 |
+
plugin.addPosts();
|
1076 |
+
},
|
1077 |
+
error: function(data){
|
1078 |
+
console.log(data);
|
1079 |
+
plugin.toggleLoading(false);
|
1080 |
+
$(plugin.form).find(NestedPages.selectors.quickEditErrorDiv).text('The form could not be saved at this time.').show();
|
1081 |
+
}
|
1082 |
+
});
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
|
1086 |
+
// Add the new posts
|
1087 |
+
plugin.addPosts = function()
|
1088 |
+
{
|
1089 |
+
var parent_li = $(plugin.form).parent('.new-child').parent('.page-row');
|
1090 |
+
|
1091 |
+
// If parent li doesn't have a child ol, add one
|
1092 |
+
if ( $(parent_li).children('ol').length === 0 ){
|
1093 |
+
$(parent_li).append('<ol class="nplist"></ol>');
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if ( $(plugin.form).hasClass('in-modal') ){
|
1097 |
+
var appendto = $('.nplist.sortable li.page-row:first');
|
1098 |
+
} else {
|
1099 |
+
var appendto = $(parent_li).children('ol');
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
for (i = 0; i < plugin.posts.length; i++){
|
1103 |
+
plugin.appendRows(appendto, plugin.posts[i]);
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
// Show the child page list and reset submenu toggles
|
1107 |
+
$(appendto).show();
|
1108 |
+
plugin.formatter.updateSubMenuToggle();
|
1109 |
+
plugin.formatter.setNestedMargins();
|
1110 |
+
plugin.cancelNewPage();
|
1111 |
+
$(NestedPages.selectors.newPageModal).modal('hide');
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
|
1115 |
+
// Append new post rows to the nested view
|
1116 |
+
plugin.appendRows = function(appendto, post)
|
1117 |
+
{
|
1118 |
+
var html = '<li id="menuItem_' + post.id + '" class="page-row';
|
1119 |
+
if ( post.status === 'publish' ) html += ' published';
|
1120 |
+
html += '">';
|
1121 |
+
|
1122 |
+
if ( NestedPages.jsData.hierarchical ){
|
1123 |
+
html += '<div class="row">';
|
1124 |
+
html += '<div class="child-toggle"></div>';
|
1125 |
+
} else {
|
1126 |
+
html += '<div class="row non-hierarchical">';
|
1127 |
+
html += '<div class="non-hierarchical-spacer"></div>';
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
html += '<div class="row-inner">';
|
1131 |
+
html += '<i class="np-icon-sub-menu"></i><i class="handle np-icon-menu"></i>';
|
1132 |
+
html += '<a href="' + post.edit_link + '" class="page-link page-title">';
|
1133 |
+
html += '<span class="title">' + post.title + '</span>';
|
1134 |
+
|
1135 |
+
// Status
|
1136 |
+
if ( post.status !== 'Publish' ){
|
1137 |
+
html += '<span class="status">(' + post.status + ')</span>';
|
1138 |
+
} else {
|
1139 |
+
html += '<span class="status"></span>';
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
// Nav Status
|
1143 |
+
html += '<span class="nav-status">';
|
1144 |
+
if ( post.np_nav_status === 'hide' ){
|
1145 |
+
html += ' ' + nestedpages.hidden;
|
1146 |
+
}
|
1147 |
+
html += '</span>';
|
1148 |
+
|
1149 |
+
html += '<span class="edit-indicator"><i class="np-icon-pencil"></i>Edit</span>';
|
1150 |
+
html += '</a>';
|
1151 |
+
|
1152 |
+
// Non-Hierarchical Data
|
1153 |
+
if ( !NestedPages.jsData.hierarchical ){
|
1154 |
+
html += '<div class="np-post-columns">';
|
1155 |
+
html += '<ul class="np-post-info">';
|
1156 |
+
html += '<li><span class="np-author-display">' + post.author_formatted + '</span></li>';
|
1157 |
+
html += '<li>' + post.date_formatted + '</li>';
|
1158 |
+
html += '</ul>';
|
1159 |
+
html += '</div>';
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
// Yoast
|
1163 |
+
if ( $('.nplist').first().hasClass('has-yoast') ) {
|
1164 |
+
html += '<span class="np-seo-indicator na"></span>';
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
// Action Buttons
|
1168 |
+
html += '<div class="action-buttons">';
|
1169 |
+
html += '<a href="#" class="np-btn open-redirect-modal" data-parentid="' + post.id + '"><i class="np-icon-link"></i></a>';
|
1170 |
+
html += '<a href="#" class="np-btn add-new-child" data-id="' + post.id + '" data-parentname="' + post.title + '">' + nestedpages.add_child_short + '</a>';
|
1171 |
+
|
1172 |
+
// Quick Edit (data attrs)
|
1173 |
+
html += '<a href="#" class="np-btn np-quick-edit" data-id="' + post.id + '" data-template="' + post.page_template + '" data-title="' + post.title + '" data-slug="' + post.slug + '" data-commentstatus="closed" data-status="' + post.status.toLowerCase() + '" data-np-status="show" data-navstatus="show" data-author="' + post.author + '" data-template="' + post.template + '" data-month="' + post.month + '" data-day="' + post.day + '" data-year="' + post.year + '" data-hour="' + post.hour + '" data-minute="' + post.minute + '" data-datepicker="' + post.datepicker + '" data-time="' + post.time + '" data-formattedtime="' + post.formattedtime + '" data-ampm="' + post.ampm + '">' + nestedpages.quick_edit + '</a>';
|
1174 |
+
|
1175 |
+
html += '<a href="' + post.view_link + '" class="np-btn" target="_blank">' + nestedpages.view + '</a>';
|
1176 |
+
html += '<a href="' + post.delete_link + '" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>';
|
1177 |
+
html += '</div><!-- .action-buttons -->';
|
1178 |
+
|
1179 |
+
html += '</div><!-- .row-inner --></div><!-- .row -->';
|
1180 |
+
html += '</li>';
|
1181 |
+
|
1182 |
+
$(appendto).append(html);
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
|
1186 |
+
|
1187 |
+
// Toggle the form loading state
|
1188 |
+
plugin.toggleLoading = function(loading)
|
1189 |
+
{
|
1190 |
+
if ( loading ){
|
1191 |
+
$(NestedPages.selectors.quickEditErrorDiv).hide();
|
1192 |
+
$(NestedPages.selectors.newPageSubmitButton).attr('disabled', 'disabled');
|
1193 |
+
$(NestedPages.selectors.quickEditLoadingIndicator).show();
|
1194 |
+
return;
|
1195 |
+
}
|
1196 |
+
$(NestedPages.selectors.newPageSubmitButton).attr('disabled', false);
|
1197 |
+
$(NestedPages.selectors.quickEditLoadingIndicator).hide();
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
|
1201 |
+
|
1202 |
+
return plugin.init();
|
1203 |
+
}
|
1204 |
+
var NestedPages = NestedPages || {};
|
1205 |
+
|
1206 |
+
/**
|
1207 |
+
* Quick Edit functionality for posts
|
1208 |
+
* @package Nested Pages
|
1209 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
1210 |
+
*/
|
1211 |
+
NestedPages.QuickEditPost = function()
|
1212 |
+
{
|
1213 |
+
var plugin = this;
|
1214 |
+
var $ = jQuery;
|
1215 |
+
|
1216 |
+
plugin.formatter = new NestedPages.Formatter;
|
1217 |
+
plugin.button = ''; // The quick edit button
|
1218 |
+
plugin.initialData = ''; // The unedited post data
|
1219 |
+
plugin.parent_li = ''; // The post's nested pages list element
|
1220 |
+
plugin.form = ''; // The newly created form
|
1221 |
+
plugin.flatTerms = ''; // Object containing flat taxonomy IDs
|
1222 |
+
plugin.termNames = ''; // Flat Taxonomy Term Names
|
1223 |
+
plugin.saveButton = ''; // Save button
|
1224 |
+
plugin.newData = ''; // New Data, after save
|
1225 |
+
plugin.row = ''; // The row being edited
|
1226 |
+
|
1227 |
+
|
1228 |
+
plugin.init = function()
|
1229 |
+
{
|
1230 |
+
plugin.bindEvents();
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
|
1234 |
+
plugin.bindEvents = function()
|
1235 |
+
{
|
1236 |
+
$(document).on('click', NestedPages.selectors.quickEditOpen, function(e){
|
1237 |
+
e.preventDefault();
|
1238 |
+
plugin.button = $(this);
|
1239 |
+
plugin.openForm();
|
1240 |
+
});
|
1241 |
+
$(document).on('click', NestedPages.selectors.quickEditCancel, function(e){
|
1242 |
+
e.preventDefault();
|
1243 |
+
plugin.formatter.removeQuickEdit();
|
1244 |
+
});
|
1245 |
+
$(document).on('click', NestedPages.selectors.quickEditToggleTaxonomies, function(e){
|
1246 |
+
e.preventDefault();
|
1247 |
+
$(this).parents('form').find('.np-taxonomies').toggle();
|
1248 |
+
});
|
1249 |
+
$(document).on('click', NestedPages.selectors.quickEditToggleMenuOptions, function(e){
|
1250 |
+
e.preventDefault();
|
1251 |
+
$(this).parents('form').find('.np-menuoptions').toggle();
|
1252 |
+
});
|
1253 |
+
$(document).on('change', '.keep_private', function(){
|
1254 |
+
if ( this.checked ){
|
1255 |
+
$('.post_password').val('').prop('readonly', true);
|
1256 |
+
} else {
|
1257 |
+
$('.post_password').prop('readonly', false);
|
1258 |
+
}
|
1259 |
+
});
|
1260 |
+
$(document).on('click', NestedPages.selectors.quickEditSaveButton, function(e){
|
1261 |
+
e.preventDefault();
|
1262 |
+
plugin.saveButton = $(this);
|
1263 |
+
plugin.save();
|
1264 |
+
});
|
1265 |
+
$(document).on('keydown', function(e){
|
1266 |
+
if ( e.keyCode === 27 ) plugin.formatter.removeQuickEdit();
|
1267 |
+
});
|
1268 |
+
}
|
1269 |
+
|
1270 |
+
|
1271 |
+
// Create and open the quick edit form
|
1272 |
+
plugin.openForm = function()
|
1273 |
+
{
|
1274 |
+
plugin.setInitialData();
|
1275 |
+
plugin.createForm();
|
1276 |
+
plugin.populateForm();
|
1277 |
+
plugin.populateFlatTaxonomies();
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
|
1281 |
+
// Set the unedited initial data
|
1282 |
+
plugin.setInitialData = function()
|
1283 |
+
{
|
1284 |
+
plugin.initialData = {
|
1285 |
+
id : $(plugin.button).attr('data-id'),
|
1286 |
+
title : $(plugin.button).attr('data-title'),
|
1287 |
+
slug : $(plugin.button).attr('data-slug'),
|
1288 |
+
author : $(plugin.button).attr('data-author'),
|
1289 |
+
cs : $(plugin.button).attr('data-commentstatus'),
|
1290 |
+
status : $(plugin.button).attr('data-status'),
|
1291 |
+
template : $(plugin.button).attr('data-template'),
|
1292 |
+
month : $(plugin.button).attr('data-month'),
|
1293 |
+
day : $(plugin.button).attr('data-day'),
|
1294 |
+
year : $(plugin.button).attr('data-year'),
|
1295 |
+
hour : $(plugin.button).attr('data-hour'),
|
1296 |
+
minute : $(plugin.button).attr('data-minute'),
|
1297 |
+
navstatus : $(plugin.button).attr('data-navstatus'),
|
1298 |
+
npstatus : $(plugin.button).attr('data-np-status'),
|
1299 |
+
navtitle : $(plugin.button).attr('data-navtitle'),
|
1300 |
+
navtitleattr : $(plugin.button).attr('data-navtitleattr'),
|
1301 |
+
navcss : $(plugin.button).attr('data-navcss'),
|
1302 |
+
linktarget : $(plugin.button).attr('data-linktarget'),
|
1303 |
+
password : $(plugin.button).attr('data-password'),
|
1304 |
+
datepicker : $(plugin.button).attr('data-datepicker'),
|
1305 |
+
time: $(plugin.button).attr('data-formattedtime'),
|
1306 |
+
timeTwentyFour : $(plugin.button).attr('data-time'),
|
1307 |
+
ampm: $(plugin.button).attr('data-ampm'),
|
1308 |
+
timeFormat: $(plugin.button).attr('data-timeformat'),
|
1309 |
+
sticky: $(plugin.button).attr('data-sticky')
|
1310 |
+
};
|
1311 |
+
|
1312 |
+
// Add Array of Taxonomies to the data object using classes applied to the list element
|
1313 |
+
plugin.initialData.h_taxonomies = [];
|
1314 |
+
plugin.initialData.f_taxonomies = [];
|
1315 |
+
|
1316 |
+
plugin.parent_li = $(plugin.button).closest(NestedPages.selectors.row).parent('li');
|
1317 |
+
var classes = $(plugin.parent_li).attr('class').split(/\s+/);
|
1318 |
+
for ( i = 0; i < classes.length; i++ ){
|
1319 |
+
if ( classes[i].substring(0, 3) === 'in-'){
|
1320 |
+
plugin.initialData.h_taxonomies.push(classes[i]);
|
1321 |
+
}
|
1322 |
+
if ( classes[i].substring(0, 4) === 'inf-' ){
|
1323 |
+
plugin.initialData.f_taxonomies.push(classes[i]);
|
1324 |
+
}
|
1325 |
+
}
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
|
1329 |
+
// Create the form and append it to the row
|
1330 |
+
plugin.createForm = function()
|
1331 |
+
{
|
1332 |
+
plugin.form = $(NestedPages.selectors.quickEditPostForm).clone();
|
1333 |
+
if ( $(plugin.parent_li).children('ol').length > 0 ){
|
1334 |
+
var child_ol = $(plugin.parent_li).children('ol');
|
1335 |
+
$(plugin.form).insertBefore(child_ol);
|
1336 |
+
} else {
|
1337 |
+
$(plugin.form).appendTo(plugin.parent_li);
|
1338 |
+
}
|
1339 |
+
$(plugin.form).siblings(NestedPages.selectors.row).hide();
|
1340 |
+
$(plugin.form).show();
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
|
1344 |
+
// Populate the new quick edit form
|
1345 |
+
plugin.populateForm = function()
|
1346 |
+
{
|
1347 |
+
$(plugin.form).find('.page_id').html('<em>ID:</em> ' + plugin.initialData.id);
|
1348 |
+
$(plugin.form).find('.np_id').val(plugin.initialData.id);
|
1349 |
+
$(plugin.form).find('.np_title').val(plugin.initialData.title);
|
1350 |
+
$(plugin.form).find('.np_slug').val(plugin.initialData.slug);
|
1351 |
+
$(plugin.form).find('.np_author select').val(plugin.initialData.author);
|
1352 |
+
$(plugin.form).find('.np_status').val(plugin.initialData.status);
|
1353 |
+
$(plugin.form).find('.np_nav_title').val(plugin.initialData.navtitle);
|
1354 |
+
$(plugin.form).find('.np_title_attribute').val(plugin.initialData.navtitleattr);
|
1355 |
+
$(plugin.form).find('.np_nav_css_classes').val(plugin.initialData.navcss);
|
1356 |
+
$(plugin.form).find('.post_password').val(plugin.initialData.password);
|
1357 |
+
$(plugin.form).find('.np_datepicker').val(plugin.initialData.datepicker);
|
1358 |
+
if ( plugin.initialData.cs === 'open' ) $(plugin.form).find('.np_cs').attr('checked', 'checked');
|
1359 |
+
|
1360 |
+
if ( plugin.initialData.template !== '' ){
|
1361 |
+
$(plugin.form).find('.np_template').val(plugin.initialData.template);
|
1362 |
+
} else {
|
1363 |
+
$(plugin.form).find('.np_template').val('default');
|
1364 |
+
}
|
1365 |
+
|
1366 |
+
if ( plugin.initialData.status === 'private' ){
|
1367 |
+
$(plugin.form).find('.post_password').attr('readonly', true);
|
1368 |
+
$(plugin.form).find('.keep_private').attr('checked', true);
|
1369 |
+
}
|
1370 |
+
|
1371 |
+
if ( plugin.initialData.npstatus === 'hide' ){
|
1372 |
+
$(plugin.form).find('.nested_pages_status').attr('checked', 'checked');
|
1373 |
+
} else {
|
1374 |
+
$(plugin.form).find('.nested_pages_status').removeAttr('checked');
|
1375 |
+
}
|
1376 |
+
|
1377 |
+
if ( plugin.initialData.navstatus === 'hide' ) {
|
1378 |
+
$(plugin.form).find('.np_nav_status').attr('checked', 'checked');
|
1379 |
+
} else {
|
1380 |
+
$(plugin.form).find('.np_nav_status').attr('checked', false);
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
if ( plugin.initialData.linktarget === "_blank" ) {
|
1384 |
+
$(plugin.form).find('.link_target').attr('checked', 'checked');
|
1385 |
+
} else {
|
1386 |
+
$(plugin.form).find('.link_target').attr('checked', false);
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
if ( plugin.initialData.status === "private" ) {
|
1390 |
+
$(plugin.form).find('.np_status').val('publish');
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
if ( plugin.initialData.sticky === 'sticky' ){
|
1394 |
+
$(plugin.form).find('.np-sticky').attr('checked', 'checked');
|
1395 |
+
} else {
|
1396 |
+
$(plugin.form).find('.np-sticky').removeAttr('checked');
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
// Date Fields
|
1400 |
+
if ( plugin.initialData.timeFormat === 'H:i' ){
|
1401 |
+
$(plugin.form).find('.np_time').val(plugin.initialData.timeTwentyFour);
|
1402 |
+
} else {
|
1403 |
+
$(plugin.form).find('.np_time').val(plugin.initialData.time);
|
1404 |
+
$(plugin.form).find('.np_ampm').val(plugin.initialData.ampm);
|
1405 |
+
$(plugin.form).find('select[name="mm"]').val(plugin.initialData.month);
|
1406 |
+
$(plugin.form).find('input[name="jj"]').val(plugin.initialData.day);
|
1407 |
+
$(plugin.form).find('input[name="aa"]').val(plugin.initialData.year);
|
1408 |
+
$(plugin.form).find('input[name="hh"]').val(plugin.initialData.hour);
|
1409 |
+
$(plugin.form).find('input[name="mn"]').val(plugin.initialData.minute);
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
// Populate Hierarchical Taxonomy Checkboxes
|
1413 |
+
if ( plugin.initialData.hasOwnProperty('h_taxonomies') ){
|
1414 |
+
var taxonomies = plugin.initialData.h_taxonomies;
|
1415 |
+
for ( i = 0; i < taxonomies.length; i++ ){
|
1416 |
+
var tax = '#' + taxonomies[i];
|
1417 |
+
$(plugin.form).find(tax).attr('checked', 'checked');
|
1418 |
+
}
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
$(plugin.form).find('.np_datepicker').datepicker({
|
1422 |
+
beforeShow: function(input, inst) {
|
1423 |
+
$('#ui-datepicker-div').addClass('nestedpages-datepicker');
|
1424 |
+
}
|
1425 |
+
});
|
1426 |
+
|
1427 |
+
plugin.formatter.showQuickEdit();
|
1428 |
+
$(plugin.form).show();
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
|
1432 |
+
// Populate the flat taxonomies
|
1433 |
+
plugin.populateFlatTaxonomies = function()
|
1434 |
+
{
|
1435 |
+
if ( !plugin.initialData.hasOwnProperty('f_taxonomies') ) return;
|
1436 |
+
plugin.createTaxonomyObject();
|
1437 |
+
plugin.getTermNames();
|
1438 |
+
plugin.setWPSuggest();
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
|
1442 |
+
// Create an object of taxonomies from class names
|
1443 |
+
plugin.createTaxonomyObject = function()
|
1444 |
+
{
|
1445 |
+
var out = "";
|
1446 |
+
var terms = {};
|
1447 |
+
for ( i = 0; i < plugin.initialData.f_taxonomies.length; i++ ){
|
1448 |
+
|
1449 |
+
// Get the term
|
1450 |
+
var singleTerm = plugin.initialData.f_taxonomies[i];
|
1451 |
+
|
1452 |
+
var tax_array = singleTerm.split('-'); // split the string into an array
|
1453 |
+
var splitter = tax_array.indexOf('nps'); // find the index of the name splitter
|
1454 |
+
var term = tax_array.splice(splitter + 1); // Splice off the name
|
1455 |
+
term = term.join('-'); // Join the name back into a string
|
1456 |
+
|
1457 |
+
|
1458 |
+
// Get the taxonomy
|
1459 |
+
var tax = singleTerm.split('-').splice(0, splitter);
|
1460 |
+
tax.shift('inf');
|
1461 |
+
var taxonomy = tax.join('-');
|
1462 |
+
|
1463 |
+
// Add taxonomy array to object
|
1464 |
+
if ( !(taxonomy in terms) ){
|
1465 |
+
terms[taxonomy] = [];
|
1466 |
+
}
|
1467 |
+
// push term to taxonomy array
|
1468 |
+
var term_array = terms[taxonomy];
|
1469 |
+
term_array.push(term);
|
1470 |
+
}
|
1471 |
+
plugin.flatTerms = terms;
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
|
1475 |
+
// Get the taxonomy names from the ids
|
1476 |
+
plugin.getTermNames = function()
|
1477 |
+
{
|
1478 |
+
$.ajax({
|
1479 |
+
url: NestedPages.jsData.ajaxurl,
|
1480 |
+
type: 'post',
|
1481 |
+
datatype: 'json',
|
1482 |
+
data : {
|
1483 |
+
action : NestedPages.formActions.getTaxonomies,
|
1484 |
+
nonce : NestedPages.jsData.nonce,
|
1485 |
+
terms : plugin.flatTerms
|
1486 |
+
},
|
1487 |
+
success: function(data){
|
1488 |
+
plugin.termNames = data.terms;
|
1489 |
+
plugin.populateFlatTaxonomyFields();
|
1490 |
+
}
|
1491 |
+
});
|
1492 |
+
}
|
1493 |
+
|
1494 |
+
|
1495 |
+
// Populate the flat taxonomy fields in the form
|
1496 |
+
plugin.populateFlatTaxonomyFields = function()
|
1497 |
+
{
|
1498 |
+
if ( !plugin.termNames ) return;
|
1499 |
+
$.each(plugin.termNames, function(i, v){
|
1500 |
+
var textarea = $('#' + i + '-quickedit');
|
1501 |
+
$(textarea).val(v.join(','));
|
1502 |
+
});
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
|
1506 |
+
// Initialize WP Auto Suggest on Flat Taxonomy fields
|
1507 |
+
plugin.setWPSuggest = function()
|
1508 |
+
{
|
1509 |
+
var tagfields = $(plugin.form).find('[data-autotag]');
|
1510 |
+
$.each(tagfields, function(i, v){
|
1511 |
+
var taxonomy = $(this).attr('data-taxonomy');
|
1512 |
+
$(this).suggest(ajaxurl + '?action=ajax-tag-search&tax=' + taxonomy , {multiple:true, multipleSep: ","});
|
1513 |
+
});
|
1514 |
+
}
|
1515 |
+
|
1516 |
+
|
1517 |
+
// Save the quick edit
|
1518 |
+
plugin.save = function()
|
1519 |
+
{
|
1520 |
+
plugin.toggleLoading(true);
|
1521 |
+
|
1522 |
+
$.ajax({
|
1523 |
+
url: NestedPages.jsData.ajaxurl,
|
1524 |
+
type: 'post',
|
1525 |
+
datatype: 'json',
|
1526 |
+
data: $(plugin.form).find('form').serialize() + '&action=' + NestedPages.formActions.quickEditPost + '&nonce=' + NestedPages.jsData.nonce + '&syncmenu=' + NestedPages.jsData.syncmenu + '&post_type=' + NestedPages.jsData.posttype,
|
1527 |
+
success: function(data){
|
1528 |
+
if (data.status === 'error'){
|
1529 |
+
plugin.toggleLoading(false);
|
1530 |
+
$(plugin.form).find(NestedPages.selectors.quickEditErrorDiv).text(data.message).show();
|
1531 |
+
} else {
|
1532 |
+
plugin.toggleLoading(false);
|
1533 |
+
plugin.newData = data.post_data;
|
1534 |
+
plugin.updatePostRow();
|
1535 |
+
}
|
1536 |
+
},
|
1537 |
+
error: function(data){
|
1538 |
+
console.log(data);
|
1539 |
+
}
|
1540 |
+
});
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
|
1544 |
+
// Update the Row after saving quick edit data
|
1545 |
+
plugin.updatePostRow = function()
|
1546 |
+
{
|
1547 |
+
plugin.row = $(plugin.button).parents('.row-inner');
|
1548 |
+
|
1549 |
+
$(plugin.row).find('.title').text(plugin.newData.post_title);
|
1550 |
+
$(plugin.row).find('.np-view-button').attr('href', plugin.newData.permalink);
|
1551 |
+
|
1552 |
+
var status = $(plugin.row).find('.status');
|
1553 |
+
if ( (plugin.newData._status !== 'publish') && (plugin.newData._status !== 'future') ){
|
1554 |
+
$(status).text('(' + plugin.newData._status + ')');
|
1555 |
+
} else if (plugin.newData.keep_private === 'private') {
|
1556 |
+
$(status).text('(' + plugin.newData.keep_private + ')');
|
1557 |
+
} else {
|
1558 |
+
$(status).text('');
|
1559 |
+
}
|
1560 |
+
|
1561 |
+
// Password Lock Icon
|
1562 |
+
if ( plugin.newData.post_password !== "" && typeof plugin.newData.post_password !== 'undefined'){
|
1563 |
+
var statustext = $(status).text();
|
1564 |
+
statustext += ' <i class="np-icon-lock"></i>';
|
1565 |
+
$(status).html(statustext);
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
// Hide / Show in Nav
|
1569 |
+
var nav_status = $(plugin.row).find('.nav-status');
|
1570 |
+
if ( (plugin.newData.nav_status == 'hide') ){
|
1571 |
+
$(nav_status).text('(Hidden)');
|
1572 |
+
} else {
|
1573 |
+
$(nav_status).text('');
|
1574 |
+
}
|
1575 |
+
|
1576 |
+
// Hide / Show in Nested Pages
|
1577 |
+
var li = $(plugin.row).parent('li');
|
1578 |
+
if ( (plugin.newData.np_status == 'hide') ){
|
1579 |
+
$(li).addClass('np-hide');
|
1580 |
+
$(plugin.row).find('.status').after('<i class="np-icon-eye-blocked"></i>');
|
1581 |
+
} else {
|
1582 |
+
$(li).removeClass('np-hide');
|
1583 |
+
$(plugin.row).find('.np-icon-eye-blocked').remove();
|
1584 |
+
}
|
1585 |
+
|
1586 |
+
// Sticky
|
1587 |
+
var sticky = $(plugin.row).find('.sticky');
|
1588 |
+
if ( (plugin.newData.sticky == 'sticky') ){
|
1589 |
+
$(sticky).show();
|
1590 |
+
} else {
|
1591 |
+
$(sticky).hide();
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
// Author for Non-Hierarchical Types
|
1595 |
+
if ( !NestedPages.jsData.hierarchical ){
|
1596 |
+
$(plugin.row).find('.np-author-display').text(plugin.newData.author_name);
|
1597 |
+
}
|
1598 |
+
|
1599 |
+
var button = $(plugin.row).find(NestedPages.selectors.quickEditOpen);
|
1600 |
+
|
1601 |
+
$(button).attr('data-id', plugin.newData.post_id);
|
1602 |
+
$(button).attr('data-template', plugin.newData.page_template);
|
1603 |
+
$(button).attr('data-title', plugin.newData.post_title);
|
1604 |
+
$(button).attr('data-slug', plugin.newData.post_name);
|
1605 |
+
$(button).attr('data-commentstatus', plugin.newData.comment_status);
|
1606 |
+
$(button).attr('data-status', plugin.newData._status);
|
1607 |
+
$(button).attr('data-sticky', plugin.newData.sticky);
|
1608 |
+
|
1609 |
+
// Private Status
|
1610 |
+
if ( plugin.newData.keep_private === 'private' ) {
|
1611 |
+
$(button).attr('data-status', 'private');
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
$(button).attr('data-author', plugin.newData.post_author);
|
1615 |
+
$(button).attr('data-np-status', plugin.newData.np_status);
|
1616 |
+
$(button).attr('data-password', plugin.newData.post_password);
|
1617 |
+
|
1618 |
+
$(button).attr('data-navstatus', plugin.newData.nav_status);
|
1619 |
+
$(button).attr('data-navtitle', plugin.newData.np_nav_title);
|
1620 |
+
$(button).attr('data-linktarget', plugin.newData.link_target);
|
1621 |
+
$(button).attr('data-navtitleattr', plugin.newData.np_title_attribute);
|
1622 |
+
$(button).attr('data-navcss', plugin.newData.np_nav_css_classes);
|
1623 |
+
|
1624 |
+
$(button).attr('data-month', plugin.newData.mm);
|
1625 |
+
$(button).attr('data-day', plugin.newData.jj);
|
1626 |
+
$(button).attr('data-year', plugin.newData.aa);
|
1627 |
+
$(button).attr('data-hour', plugin.newData.hh);
|
1628 |
+
$(button).attr('data-minute', plugin.newData.mn);
|
1629 |
+
$(button).attr('data-datepicker', plugin.newData.np_date);
|
1630 |
+
$(button).attr('data-time', plugin.newData.np_time);
|
1631 |
+
$(button).attr('data-formattedtime', plugin.newData.np_time);
|
1632 |
+
$(button).attr('data-ampm', plugin.newData.np_ampm);
|
1633 |
+
|
1634 |
+
plugin.removeTaxonomyClasses();
|
1635 |
+
plugin.addCategoryClasses();
|
1636 |
+
plugin.addHierarchicalClasses();
|
1637 |
+
plugin.addFlatClasses();
|
1638 |
+
plugin.addStatusClass();
|
1639 |
+
|
1640 |
+
plugin.formatter.removeQuickEdit();
|
1641 |
+
plugin.formatter.flashRow(plugin.row);
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
|
1645 |
+
// Add Status Class
|
1646 |
+
plugin.addStatusClass = function()
|
1647 |
+
{
|
1648 |
+
var statuses = ['published', 'draft', 'pending', 'future'];
|
1649 |
+
for ( i = 0; i < statuses.length; i++ ){
|
1650 |
+
$(plugin.row).removeClass(statuses[i]);
|
1651 |
+
}
|
1652 |
+
$(plugin.row).addClass(plugin.newData._status);
|
1653 |
+
}
|
1654 |
+
|
1655 |
+
|
1656 |
+
// Remove Taxonomy Classes from the updated row
|
1657 |
+
plugin.removeTaxonomyClasses = function()
|
1658 |
+
{
|
1659 |
+
taxonomies = [];
|
1660 |
+
var classes = $(plugin.row).attr('class').split(/\s+/);
|
1661 |
+
for ( i = 0; i < classes.length; i++ ){
|
1662 |
+
if ( classes[i].substring(0, 3) === 'in-'){ // hierarchical
|
1663 |
+
$(plugin.row).removeClass(classes[i]);
|
1664 |
+
}
|
1665 |
+
if ( classes[i].substring(0, 4) === 'inf-'){ // flat
|
1666 |
+
$(plugin.row).removeClass(classes[i]);
|
1667 |
+
}
|
1668 |
+
}
|
1669 |
+
}
|
1670 |
+
|
1671 |
+
|
1672 |
+
// Add Category Classes to the Row
|
1673 |
+
plugin.addCategoryClasses = function()
|
1674 |
+
{
|
1675 |
+
if ( !plugin.newData.hasOwnProperty('post_category') ) return;
|
1676 |
+
var cats = plugin.newData.post_category;
|
1677 |
+
for ( i = 0; i < cats.length; i++ ){
|
1678 |
+
var taxclass = 'in-category-' + cats[i];
|
1679 |
+
$(plugin.row).addClass(taxclass);
|
1680 |
+
}
|
1681 |
+
}
|
1682 |
+
|
1683 |
+
|
1684 |
+
// Add hierarchical taxonomy classes to the row
|
1685 |
+
plugin.addHierarchicalClasses = function()
|
1686 |
+
{
|
1687 |
+
if ( !plugin.newData.hasOwnProperty('tax_input') ) return;
|
1688 |
+
var taxonomies = plugin.newData.tax_input;
|
1689 |
+
$.each(taxonomies, function(tax, terms){
|
1690 |
+
for (i = 0; i < terms.length; i++){
|
1691 |
+
var taxclass = 'in-' + tax + '-' + terms[i];
|
1692 |
+
$(plugin.row).addClass(taxclass);
|
1693 |
+
}
|
1694 |
+
});
|
1695 |
+
}
|
1696 |
+
|
1697 |
+
|
1698 |
+
// Add flat taxonomy classes to the row
|
1699 |
+
plugin.addFlatClasses = function()
|
1700 |
+
{
|
1701 |
+
if ( !plugin.newData.hasOwnProperty('flat_tax') ) return;
|
1702 |
+
var taxonomies = plugin.newData.flat_tax;
|
1703 |
+
$.each(taxonomies, function(tax, terms){
|
1704 |
+
for (i = 0; i < terms.length; i++){
|
1705 |
+
var taxclass = 'inf-' + tax + '-nps-' + terms[i];
|
1706 |
+
$(plugin.row).addClass(taxclass);
|
1707 |
+
}
|
1708 |
+
});
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
|
1712 |
+
// Toggle Form Loading State
|
1713 |
+
plugin.toggleLoading = function(loading)
|
1714 |
+
{
|
1715 |
+
if ( loading ){
|
1716 |
+
$(NestedPages.selectors.quickEditErrorDiv).hide();
|
1717 |
+
$(plugin.saveButton).attr('disabled', 'disabled');
|
1718 |
+
$(NestedPages.selectors.quickEditLoadingIndicator).show();
|
1719 |
+
return;
|
1720 |
+
}
|
1721 |
+
$(plugin.saveButton).attr('disabled', false);
|
1722 |
+
$(NestedPages.selectors.quickEditLoadingIndicator).hide();
|
1723 |
+
}
|
1724 |
+
|
1725 |
+
|
1726 |
+
|
1727 |
+
return plugin.init();
|
1728 |
+
|
1729 |
+
|
1730 |
+
}
|
1731 |
+
var NestedPages = NestedPages || {};
|
1732 |
+
|
1733 |
+
/**
|
1734 |
+
* Quick Edit functionality for links
|
1735 |
+
* @package Nested Pages
|
1736 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
1737 |
+
*/
|
1738 |
+
NestedPages.QuickEditLink = function()
|
1739 |
+
{
|
1740 |
+
var plugin = this;
|
1741 |
+
var $ = jQuery;
|
1742 |
+
|
1743 |
+
plugin.formatter = new NestedPages.Formatter;
|
1744 |
+
plugin.button = ''; // The Active Quick Edit Button
|
1745 |
+
plugin.postData = ''; // Data for Post being edited (before update)
|
1746 |
+
plugin.newPostData = ''; // Data after update
|
1747 |
+
plugin.form = ''; // The newly created Quick Edit Form
|
1748 |
+
|
1749 |
+
|
1750 |
+
plugin.init = function()
|
1751 |
+
{
|
1752 |
+
plugin.bindEvents();
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
|
1756 |
+
plugin.bindEvents = function()
|
1757 |
+
{
|
1758 |
+
$(document).on('click', NestedPages.selectors.quickEditButtonLink, function(e){
|
1759 |
+
e.preventDefault();
|
1760 |
+
plugin.formatter.removeQuickEdit();
|
1761 |
+
plugin.button = $(this);
|
1762 |
+
plugin.openQuickEdit();
|
1763 |
+
});
|
1764 |
+
$(document).on('click', NestedPages.selectors.quickEditLinkSaveButton, function(e){
|
1765 |
+
e.preventDefault();
|
1766 |
+
plugin.submitForm();
|
1767 |
+
});
|
1768 |
+
$(document).on('keydown', function(e){
|
1769 |
+
if ( e.keyCode === 27 ) plugin.formatter.removeQuickEdit();
|
1770 |
+
});
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
|
1774 |
+
// Open the Quick Edit Form
|
1775 |
+
plugin.openQuickEdit = function()
|
1776 |
+
{
|
1777 |
+
plugin.setData();
|
1778 |
+
plugin.createForm();
|
1779 |
+
plugin.populateForm();
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
|
1783 |
+
// Set the Quick Edit Data
|
1784 |
+
plugin.setData = function()
|
1785 |
+
{
|
1786 |
+
plugin.postData = {
|
1787 |
+
id : $(plugin.button).attr('data-id'),
|
1788 |
+
url : $(plugin.button).attr('data-url'),
|
1789 |
+
title : $(plugin.button).attr('data-title'),
|
1790 |
+
status : $(plugin.button).attr('data-status'),
|
1791 |
+
navstatus : $(plugin.button).attr('data-navstatus'),
|
1792 |
+
npstatus : $(plugin.button).attr('data-np-status'),
|
1793 |
+
linktarget : $(plugin.button).attr('data-linktarget'),
|
1794 |
+
parentid : $(plugin.button).attr('data-parentid'),
|
1795 |
+
navtitleattr : $(plugin.button).attr('data-navtitleattr'),
|
1796 |
+
navcss : $(plugin.button).attr('data-navcss'),
|
1797 |
+
navtype : $(plugin.button).attr('data-nav-type'),
|
1798 |
+
navobject : $(plugin.button).attr('data-nav-object'),
|
1799 |
+
navobjectid : $(plugin.button).attr('data-nav-object-id'),
|
1800 |
+
navoriginallink : $(plugin.button).attr('data-nav-original-link'),
|
1801 |
+
navoriginaltitle : $(plugin.button).attr('data-nav-original-title')
|
1802 |
+
};
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
|
1806 |
+
// Create the quick edit form
|
1807 |
+
plugin.createForm = function()
|
1808 |
+
{
|
1809 |
+
var parent_li = $(plugin.button).closest(NestedPages.selectors.row).parent('li');
|
1810 |
+
plugin.form = $(NestedPages.selectors.quickEditLinkForm).clone();
|
1811 |
+
|
1812 |
+
// Append the form to the list item
|
1813 |
+
if ( $(parent_li).children('ol').length > 0 ){
|
1814 |
+
var child_ol = $(parent_li).children('ol');
|
1815 |
+
$(plugin.form).insertBefore(child_ol);
|
1816 |
+
} else {
|
1817 |
+
$(plugin.form).appendTo(parent_li);
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
var row = $(plugin.form).siblings(NestedPages.selectors.row).hide();
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
|
1824 |
+
// Populate the Quick Edit form with the post data
|
1825 |
+
plugin.populateForm = function()
|
1826 |
+
{
|
1827 |
+
$(plugin.form).find('.np_id').val(plugin.postData.id);
|
1828 |
+
$(plugin.form).find('.np_title').val(plugin.postData.title);
|
1829 |
+
$(plugin.form).find('.np_author select').val(plugin.postData.author);
|
1830 |
+
$(plugin.form).find('.np_status').val(plugin.postData.status);
|
1831 |
+
$(plugin.form).find('.np_content').val(plugin.postData.url);
|
1832 |
+
$(plugin.form).find('.np_parent_id').val(plugin.postData.parentid);
|
1833 |
+
$(plugin.form).find('.np_title_attribute').val(plugin.postData.navtitleattr);
|
1834 |
+
$(plugin.form).find('.np_nav_css_classes').val(plugin.postData.navcss);
|
1835 |
+
|
1836 |
+
if ( plugin.postData.npstatus === 'hide' ){
|
1837 |
+
$(plugin.form).find('.np_status').prop('checked', 'checked');
|
1838 |
+
} else {
|
1839 |
+
$(plugin.form).find('.np_status').removeAttr('checked');
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
if ( plugin.postData.navstatus === 'hide' ) {
|
1843 |
+
$(plugin.form).find('.np_nav_status').prop('checked', 'checked');
|
1844 |
+
} else {
|
1845 |
+
$(plugin.form).find('.np_nav_status').removeAttr('checked');
|
1846 |
+
}
|
1847 |
+
|
1848 |
+
if ( plugin.postData.linktarget === "_blank" ) {
|
1849 |
+
$(plugin.form).find('.link_target').prop('checked', 'checked');
|
1850 |
+
} else {
|
1851 |
+
$(plugin.form).find('.link_target').removeAttr('checked');
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
// Relationship Links
|
1855 |
+
if ( plugin.postData.navobject !== 'custom' && plugin.postData.navobject !== '' ){
|
1856 |
+
var html = '<div class="form-control original-link">Original: <a href="' + plugin.postData.navoriginallink + '" target="_blank">' + plugin.postData.navoriginaltitle + '</a></div>';
|
1857 |
+
$(plugin.form).find('[data-url-field]').remove();
|
1858 |
+
$(html).insertAfter($(plugin.form).find('h3'));
|
1859 |
+
$(plugin.form).find('[data-np-menu-object-input]').val(plugin.postData.navobject);
|
1860 |
+
$(plugin.form).find('[data-np-menu-objectid-input]').val(plugin.postData.navobjectid);
|
1861 |
+
$(plugin.form).find('[data-np-menu-type-input]').val(plugin.postData.navtype);
|
1862 |
+
$(plugin.form).find('h3').text('Link: ' + plugin.postData.navoriginaltitle);
|
1863 |
+
} else {
|
1864 |
+
$(plugin.form).find('h3').text('Link');
|
1865 |
+
$(plugin.form).find('[data-np-menu-object-input]').val('custom');
|
1866 |
+
$(plugin.form).find('[data-np-menu-type-input]').val('custom');
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
plugin.formatter.showQuickEdit();
|
1870 |
+
$(plugin.form).show();
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
|
1874 |
+
// Submit the form
|
1875 |
+
plugin.submitForm = function()
|
1876 |
+
{
|
1877 |
+
plugin.toggleLoading(true);
|
1878 |
+
|
1879 |
+
$.ajax({
|
1880 |
+
url: NestedPages.jsData.ajaxurl,
|
1881 |
+
type: 'post',
|
1882 |
+
datatype: 'json',
|
1883 |
+
data: $(plugin.form).find('form').serialize() + '&action=' + NestedPages.formActions.quickEditLink + '&nonce=' + NestedPages.jsData.nonce + '&syncmenu=' + NestedPages.jsData.syncmenu + '&post_type=' + NestedPages.jsData.posttype,
|
1884 |
+
success: function(data){
|
1885 |
+
if (data.status === 'error'){
|
1886 |
+
plugin.toggleLoading(false);
|
1887 |
+
$(plugin.form).find(NestedPages.selectors.quickEditErrorDiv).text(data.message).show();
|
1888 |
+
} else {
|
1889 |
+
plugin.toggleLoading(false);
|
1890 |
+
plugin.newPostData = data.post_data;
|
1891 |
+
plugin.updateRow();
|
1892 |
+
}
|
1893 |
+
},
|
1894 |
+
error: function(data){
|
1895 |
+
plugin.toggleLoading(false);
|
1896 |
+
$(plugin.form).find(NestedPages.selectors.quickEditErrorDiv).text('The form could not be saved at this time.').show();
|
1897 |
+
}
|
1898 |
+
});
|
1899 |
+
}
|
1900 |
+
|
1901 |
+
|
1902 |
+
// Update the row after successfully saving quick edit data
|
1903 |
+
plugin.updateRow = function()
|
1904 |
+
{
|
1905 |
+
console.log(plugin.newPostData);
|
1906 |
+
var row = $(plugin.form).siblings('.row');
|
1907 |
+
$(row).find('.title').html(plugin.newPostData.post_title + ' <i class="np-icon-link"></i>');
|
1908 |
+
|
1909 |
+
var status = $(row).find('.status');
|
1910 |
+
if ( (plugin.newPostData._status !== 'publish') && (plugin.newPostData._status !== 'future') ){
|
1911 |
+
$(status).text('(' + plugin.newPostData._status + ')');
|
1912 |
+
} else {
|
1913 |
+
$(status).text('');
|
1914 |
+
}
|
1915 |
+
|
1916 |
+
// Hide / Show in Nav
|
1917 |
+
var nav_status = $(row).find('.nav-status');
|
1918 |
+
if ( (plugin.newPostData.nav_status == 'hide') ){
|
1919 |
+
$(nav_status).text('(' + NestedPages.jsData.hiddenText + ')');
|
1920 |
+
} else {
|
1921 |
+
$(nav_status).text('');
|
1922 |
+
}
|
1923 |
+
|
1924 |
+
// Hide / Show in Nested Pages
|
1925 |
+
var li = $(row).parent('li');
|
1926 |
+
if ( (plugin.newPostData.np_status == 'hide') ){
|
1927 |
+
$(li).addClass('np-hide');
|
1928 |
+
$(row).find('.status').after('<i class="np-icon-eye-blocked"></i>');
|
1929 |
+
} else {
|
1930 |
+
$(li).removeClass('np-hide');
|
1931 |
+
$(row).find('.np-icon-eye-blocked').remove();
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
var button = $(row).find(NestedPages.selectors.quickEditButtonLink);
|
1935 |
+
|
1936 |
+
$(button).attr('data-id', plugin.newPostData.post_id);
|
1937 |
+
$(button).attr('data-title', plugin.newPostData.post_title);
|
1938 |
+
$(button).attr('data-url', plugin.newPostData.post_content);
|
1939 |
+
$(button).attr('data-status', plugin.newPostData._status);
|
1940 |
+
$(button).attr('data-navstatus', plugin.newPostData.nav_status);
|
1941 |
+
$(button).attr('data-np-status', plugin.newPostData.np_status);
|
1942 |
+
$(button).attr('data-linkTarget', plugin.newPostData.linkTarget);
|
1943 |
+
$(button).attr('data-navtitleattr', plugin.newPostData.titleAttribute);
|
1944 |
+
$(button).attr('data-navcss', plugin.newPostData.cssClasses);
|
1945 |
+
|
1946 |
+
plugin.formatter.removeQuickEdit();
|
1947 |
+
plugin.formatter.flashRow(row);
|
1948 |
+
}
|
1949 |
+
|
1950 |
+
|
1951 |
+
// Toggle loading state in form
|
1952 |
+
plugin.toggleLoading = function(loading)
|
1953 |
+
{
|
1954 |
+
$('.row').removeClass('np-updated').removeClass('np-updated-show');
|
1955 |
+
if ( loading ){
|
1956 |
+
$(NestedPages.selectors.quickEditErrorDiv).hide();
|
1957 |
+
$(NestedPages.selectors.quickEditLinkSaveButton).attr('disabled', 'disabled');
|
1958 |
+
$(NestedPages.selectors.quickEditLoadingIndicator).show();
|
1959 |
+
return;
|
1960 |
+
}
|
1961 |
+
$(NestedPages.selectors.quickEditLinkSaveButton).attr('disabled', false);
|
1962 |
+
$(NestedPages.selectors.quickEditLoadingIndicator).hide();
|
1963 |
+
}
|
1964 |
+
|
1965 |
+
|
1966 |
+
return plugin.init();
|
1967 |
+
|
1968 |
+
}
|
1969 |
+
var NestedPages = NestedPages || {};
|
1970 |
+
|
1971 |
+
/**
|
1972 |
+
* Post clone functionality
|
1973 |
+
* @package Nested Pages
|
1974 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
1975 |
+
*/
|
1976 |
+
NestedPages.Clone = function()
|
1977 |
+
{
|
1978 |
+
var plugin = this;
|
1979 |
+
var $ = jQuery;
|
1980 |
+
|
1981 |
+
plugin.parent_id = ''; // The parent/source post ID
|
1982 |
+
plugin.parent_title = ''; // The parent title
|
1983 |
+
plugin.parentLi = null;
|
1984 |
+
|
1985 |
+
plugin.formatter = new NestedPages.Formatter;
|
1986 |
+
|
1987 |
+
plugin.init = function()
|
1988 |
+
{
|
1989 |
+
plugin.bindEvents();
|
1990 |
+
}
|
1991 |
+
|
1992 |
+
|
1993 |
+
plugin.bindEvents = function()
|
1994 |
+
{
|
1995 |
+
$(document).on('click', NestedPages.selectors.cloneButton, function(e){
|
1996 |
+
e.preventDefault();
|
1997 |
+
plugin.parent_id = $(this).attr('data-id');
|
1998 |
+
plugin.parent_title = $(this).attr('data-parentname');
|
1999 |
+
plugin.parentLi = $(this).parent('.row').parent('.page-row').parent('.npList');
|
2000 |
+
plugin.openModal();
|
2001 |
+
});
|
2002 |
+
$(document).on('click', NestedPages.selectors.confirmClone, function(e){
|
2003 |
+
e.preventDefault();
|
2004 |
+
plugin.clone();
|
2005 |
+
});
|
2006 |
+
}
|
2007 |
+
|
2008 |
+
// Open the modal with clone options
|
2009 |
+
plugin.openModal = function()
|
2010 |
+
{
|
2011 |
+
$(NestedPages.selectors.cloneModal).find('[data-clone-parent]').text(plugin.parent_title);
|
2012 |
+
$(NestedPages.selectors.cloneModal).modal('show');
|
2013 |
+
}
|
2014 |
+
|
2015 |
+
|
2016 |
+
// Clone the post
|
2017 |
+
plugin.clone = function()
|
2018 |
+
{
|
2019 |
+
plugin.toggleLoading(true);
|
2020 |
+
$.ajax({
|
2021 |
+
url : NestedPages.jsData.ajaxurl,
|
2022 |
+
type : 'post',
|
2023 |
+
data : {
|
2024 |
+
action : NestedPages.formActions.clonePost,
|
2025 |
+
parent_id : plugin.parent_id,
|
2026 |
+
quantity : $(NestedPages.selectors.cloneQuantity).val(),
|
2027 |
+
status : $(NestedPages.selectors.cloneStatus).val(),
|
2028 |
+
author : $(NestedPages.selectors.cloneAuthor).find('select').val(),
|
2029 |
+
nonce : NestedPages.jsData.nonce,
|
2030 |
+
posttype : NestedPages.jsData.posttype
|
2031 |
+
},
|
2032 |
+
success : function(data){
|
2033 |
+
plugin.toggleLoading(false);
|
2034 |
+
$(NestedPages.selectors.cloneModal).modal('hide');
|
2035 |
+
location.reload();
|
2036 |
+
}
|
2037 |
+
});
|
2038 |
+
}
|
2039 |
+
|
2040 |
+
|
2041 |
+
// Toggle Loading
|
2042 |
+
plugin.toggleLoading = function(loading)
|
2043 |
+
{
|
2044 |
+
if ( loading ){
|
2045 |
+
$(NestedPages.selectors.cloneModal).find('[data-clone-loading]').show();
|
2046 |
+
$(NestedPages.selectors.confirmClone).attr('disabled', 'disabled');
|
2047 |
+
return;
|
2048 |
+
}
|
2049 |
+
$(NestedPages.selectors.cloneModal).find('[data-clone-loading]').hide();
|
2050 |
+
$(NestedPages.selectors.confirmClone).attr('disabled', false);
|
2051 |
+
}
|
2052 |
+
|
2053 |
+
return plugin.init();
|
2054 |
+
}
|
2055 |
+
var NestedPages = NestedPages || {};
|
2056 |
+
|
2057 |
+
/**
|
2058 |
+
* Tab functionality
|
2059 |
+
* @package Nested Pages
|
2060 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2061 |
+
*/
|
2062 |
+
NestedPages.Tabs = function()
|
2063 |
+
{
|
2064 |
+
var plugin = this;
|
2065 |
+
var $ = jQuery;
|
2066 |
+
|
2067 |
+
plugin.activeContent = '';
|
2068 |
+
plugin.activeButton = '';
|
2069 |
+
|
2070 |
+
plugin.init = function()
|
2071 |
+
{
|
2072 |
+
plugin.bindEvents();
|
2073 |
+
}
|
2074 |
+
|
2075 |
+
|
2076 |
+
plugin.bindEvents = function()
|
2077 |
+
{
|
2078 |
+
$(document).on('click', NestedPages.selectors.tabButton, function(e){
|
2079 |
+
e.preventDefault();
|
2080 |
+
plugin.activeButton = $(this);
|
2081 |
+
plugin.toggleTabs();
|
2082 |
+
});
|
2083 |
+
}
|
2084 |
+
|
2085 |
+
|
2086 |
+
plugin.toggleTabs = function()
|
2087 |
+
{
|
2088 |
+
plugin.activeContent = $(plugin.activeButton).attr('href');
|
2089 |
+
$(NestedPages.selectors.tabContent).hide();
|
2090 |
+
$(plugin.activeContent).show();
|
2091 |
+
$(plugin.activeButton).parents(NestedPages.selectors.tabButtonParent).find(NestedPages.selectors.tabButton).removeClass('active');
|
2092 |
+
$(plugin.activeButton).addClass('active');
|
2093 |
+
}
|
2094 |
+
|
2095 |
+
return plugin.init();
|
2096 |
+
}
|
2097 |
+
/**
|
2098 |
+
* Primary Nested Pages Initialization
|
2099 |
+
* @package Nested Pages
|
2100 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2101 |
+
*/
|
2102 |
+
|
2103 |
+
jQuery(document).ready(function(){
|
2104 |
+
new NestedPages.Factory;
|
2105 |
+
});
|
2106 |
+
|
2107 |
+
var NestedPages = NestedPages || {};
|
2108 |
+
|
2109 |
+
|
2110 |
+
// DOM Selectors
|
2111 |
+
NestedPages.selectors = {
|
2112 |
+
childToggle : '.child-toggle', // Child Toggle Buttons
|
2113 |
+
childToggleLink : '.child-toggle a', // Actual link in button
|
2114 |
+
toggleAll : '.nestedpages-toggleall', // Toggle All Button
|
2115 |
+
toggleHidden : '.np-toggle-hidden', // Toggle Hidden Pages
|
2116 |
+
toggleStatus : '.np-toggle-publish', // Toggle Published Pages
|
2117 |
+
lists : '.nplist', // OL elements
|
2118 |
+
rows : '.page-row', // Page Row,
|
2119 |
+
row : '.row', // Inner row div element
|
2120 |
+
sortable : '.sortable', // Sortable List
|
2121 |
+
notSortable : '.no-sort', // Unsortable List
|
2122 |
+
handle : '.handle', // Sortable Handle
|
2123 |
+
published : '.published', // Published Rows
|
2124 |
+
hiddenRows : '.np-hide', // Hidden Rows
|
2125 |
+
errorDiv : '#np-error', // Error Alert
|
2126 |
+
loadingIndicator : '#nested-loading', // Loading Indicator,
|
2127 |
+
syncCheckbox : '.np-sync-menu', // Sync menu checkbox
|
2128 |
+
syncForm: '.np-sync-menu-cont', // The form/container for the sync menu element
|
2129 |
+
ajaxError : '[data-nestedpages-error]', // AJAX error notification
|
2130 |
+
|
2131 |
+
// Responsive Toggle
|
2132 |
+
toggleEditButtons : '.np-toggle-edit', // Button that toggles responsive buttons
|
2133 |
+
|
2134 |
+
// Bulk Actions
|
2135 |
+
bulkActionsHeader : '.nestedpages-list-header',
|
2136 |
+
bulkActionsForm : '[data-np-bulk-form]',
|
2137 |
+
bulkActionsCheckbox : '[data-np-bulk-checkbox]',
|
2138 |
+
bulkActionsIds : '[data-np-bulk-ids]',
|
2139 |
+
bulkActionRedirectIds : '[data-np-bulk-redirect-ids]',
|
2140 |
+
hiddenItemCount : '[data-np-hidden-count]',
|
2141 |
+
hiddenItemCountParent : '[data-np-hidden-count-parent]',
|
2142 |
+
bulkEditForm : '[data-np-bulk-edit-form]', // The primary bulk edit form
|
2143 |
+
bulkEditTitles : '[data-np-bulk-titles]', // Titles to perform bulk edits on (includes hidden ids),
|
2144 |
+
bulkEditRemoveItem : '[data-np-remove-bulk-item]', // Remove an item from bulk edit
|
2145 |
+
bulkEditCancel : '[data-np-cancel-bulk-edit]', // Cancel button in bulk edit form
|
2146 |
+
bulkEditLinkCount : '[data-bulk-edit-link-count]', // Count of selected links in bulk edit
|
2147 |
+
|
2148 |
+
// Quick Edit
|
2149 |
+
quickEditOverlay : '.np-inline-overlay', // The inline modal
|
2150 |
+
quickEditLoadingIndicator : '.np-qe-loading', // Loading indicator in Quick Edit
|
2151 |
+
quickEditErrorDiv : '.np-quickedit-error', // Error Div in Quick Edit
|
2152 |
+
quickEditCancel : '.np-cancel-quickedit', // Cancel button in quick edit
|
2153 |
+
quickEditToggleTaxonomies : '.np-toggle-taxonomies', // Toggle Taxonomies in Quick Edit
|
2154 |
+
quickEditToggleMenuOptions : '.np-toggle-menuoptions', // Toggle Menu Options in Quick Edit
|
2155 |
+
|
2156 |
+
// Quick Edit - Links
|
2157 |
+
quickEditButtonLink : '.np-quick-edit-redirect', // Button to open link quick edit
|
2158 |
+
quickEditLinkForm : '.quick-edit-form-redirect', // Form for link quick edits
|
2159 |
+
quickEditLinkSaveButton : '.np-save-quickedit-redirect', // Save button in link quick edit form
|
2160 |
+
|
2161 |
+
// Quick Edit - Posts
|
2162 |
+
quickEditOpen : '.np-quick-edit', // Button to open post quick edit
|
2163 |
+
quickEditPostForm : '.quick-edit-form', // Form container
|
2164 |
+
quickEditSaveButton : '.np-save-quickedit', // Save button in quick edit (posts)
|
2165 |
+
|
2166 |
+
// Link Items
|
2167 |
+
openLinkModal : '.open-redirect-modal', // Opens new link modal
|
2168 |
+
linkModal : '#np-link-modal', // The add a link modal
|
2169 |
+
saveLink : '.np-save-link', // Save Link Button
|
2170 |
+
linkLoadingIndicator : '.np-link-loading', // Loading Indicator in Link Modal
|
2171 |
+
linkErrorDiv : '.np-new-link-error', // Error Div in Link Modal
|
2172 |
+
linkForm : '.np-new-link-form', // The form element for a new link
|
2173 |
+
|
2174 |
+
// Link Deletion
|
2175 |
+
linkDeleteButton : '[data-np-confirm-delete]',
|
2176 |
+
linkDeleteConfirmationButton : '[data-delete-confirmation]',
|
2177 |
+
linkDeleteConfirmationModal : '#np-delete-confirmation-modal',
|
2178 |
+
linkDeleteConfirmationModalText : '[data-np-link-delete-text]',
|
2179 |
+
|
2180 |
+
// New Page Items
|
2181 |
+
openPageModal : '.open-bulk-modal', // Opens the new page(s) modal
|
2182 |
+
newPageModal : '#np-bulk-modal', // The modal with the new page form
|
2183 |
+
newPageFormContainer : '.new-child-form', // The new page form container
|
2184 |
+
newPageForm : '.np-new-child-form', // The form element
|
2185 |
+
newPageSubmitButton : '.np-save-newchild', // Submit button in new page form
|
2186 |
+
newPageTitle : '.add-new-child-row', // Button to add a new page title field to the form
|
2187 |
+
newPageRemoveTitle : '.np-remove-child', // Button to remove a title field in the form
|
2188 |
+
addChildButton : '.add-new-child', // Button to add child page(s)
|
2189 |
+
newChildError : '.np-newchild-error', // Error div in new child quick edit
|
2190 |
+
cancelNewChildButton : '.np-cancel-newchild', // Cancel button in new child quick edit
|
2191 |
+
|
2192 |
+
// Clone
|
2193 |
+
cloneButton : '.clone-post', // Button to clone a post
|
2194 |
+
confirmClone : '[data-confirm-clone]', // Button in modal to confirm clone
|
2195 |
+
cloneModal : '#np-clone-modal', // Modal with clone options
|
2196 |
+
cloneQuantity : '[data-clone-quantity]', // Quantity to Clone
|
2197 |
+
cloneStatus : '[data-clone-status]', // Clone Status
|
2198 |
+
cloneAuthor : '[data-clone-author]', // Clone Author
|
2199 |
+
|
2200 |
+
// Tabs
|
2201 |
+
tabButtonParent : '[data-np-tabs]', // Tab Parent
|
2202 |
+
tabButton : '[data-np-tab]', // Tab Link
|
2203 |
+
tabContent : '[data-np-tab-pane]', // Tab Pane
|
2204 |
+
|
2205 |
+
// Thumbnails
|
2206 |
+
thumbnailContainer : '.np-thumbnail', // Container for Thumbnail
|
2207 |
+
thumbnailContainerLink : '.np-thumbnail.link', // Link Thumbnail Container
|
2208 |
+
|
2209 |
+
// Manual Sync Buttons
|
2210 |
+
manualMenuSync : '[data-np-manual-menu-sync]', // Button for Triggering Manual Menu Sync
|
2211 |
+
manualOrderSync : '[data-np-manual-order-sync]', // Button for Triggering Manual Order Sync
|
2212 |
+
|
2213 |
+
}
|
2214 |
+
|
2215 |
+
|
2216 |
+
// CSS Classes
|
2217 |
+
NestedPages.cssClasses = {
|
2218 |
+
iconToggleDown : 'np-icon-arrow-down',
|
2219 |
+
iconToggleRight : 'np-icon-arrow-right',
|
2220 |
+
noborder : 'no-border'
|
2221 |
+
}
|
2222 |
+
|
2223 |
+
|
2224 |
+
// JS Data
|
2225 |
+
NestedPages.jsData = {
|
2226 |
+
ajaxurl : ajaxurl,
|
2227 |
+
nonce : nestedpages.np_nonce,
|
2228 |
+
allPostTypes : nestedpages.post_types, // Localized data with all post types
|
2229 |
+
syncmenu : 'nosync', // Whether to sync the menu
|
2230 |
+
posttype : '', // current Screen's post type
|
2231 |
+
nestable : true, // boolean - whether post type is nestable
|
2232 |
+
sortable : true, // boolean - whether post type is sortable
|
2233 |
+
hierarchical : true, // boolean - whether post type is hierarchical
|
2234 |
+
expandText : nestedpages.expand_text, // Expand all button text
|
2235 |
+
collapseText : nestedpages.collapse_text, // Collapse all button text
|
2236 |
+
showHiddenText : nestedpages.show_hidden, // Show Hidden Pages Link Text
|
2237 |
+
hideHiddenText : nestedpages.hide_hidden, // Hide Hidden Pages Link Text
|
2238 |
+
quickEditText : nestedpages.quick_edit, // Quick Edit Button Text
|
2239 |
+
hiddenText : nestedpages.hidden, // Localized "Hidden"
|
2240 |
+
titleText : nestedpages.title, // Localized "Title"
|
2241 |
+
}
|
2242 |
+
|
2243 |
+
|
2244 |
+
// Form Actions
|
2245 |
+
NestedPages.formActions = {
|
2246 |
+
syncToggles : 'npnestToggle',
|
2247 |
+
syncNesting : 'npsort',
|
2248 |
+
syncMenu : 'npsyncMenu',
|
2249 |
+
newPage : 'npnewChild',
|
2250 |
+
quickEditLink : 'npquickEditLink',
|
2251 |
+
getTaxonomies : 'npgetTaxonomies',
|
2252 |
+
quickEditPost : 'npquickEdit',
|
2253 |
+
clonePost : 'npclonePost',
|
2254 |
+
search : 'npmenuSearch',
|
2255 |
+
newMenuItem : 'npnewMenuItem',
|
2256 |
+
manualMenuSync : 'npmanualMenuSync',
|
2257 |
+
postSearch: 'nppostSearch',
|
2258 |
+
wpmlTranslations : 'npWpmlTranslations'
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
|
2262 |
+
/**
|
2263 |
+
* Primary Nested Pages Class
|
2264 |
+
*/
|
2265 |
+
NestedPages.Factory = function()
|
2266 |
+
{
|
2267 |
+
var plugin = this;
|
2268 |
+
var $ = jQuery;
|
2269 |
+
|
2270 |
+
plugin.formatter = new NestedPages.Formatter;
|
2271 |
+
plugin.responsive = new NestedPages.Responsive;
|
2272 |
+
plugin.checkAll = new NestedPages.CheckAll;
|
2273 |
+
plugin.bulkActions = new NestedPages.BulkActions;
|
2274 |
+
plugin.menuToggle = new NestedPages.MenuToggle;
|
2275 |
+
plugin.pageToggle = new NestedPages.PageToggle;
|
2276 |
+
plugin.nesting = new NestedPages.Nesting;
|
2277 |
+
plugin.syncMenuSetting = new NestedPages.SyncMenuSetting;
|
2278 |
+
plugin.newPage = new NestedPages.NewPage;
|
2279 |
+
plugin.quickEditLink = new NestedPages.QuickEditLink;
|
2280 |
+
plugin.quickEditPost = new NestedPages.QuickEditPost;
|
2281 |
+
plugin.clone = new NestedPages.Clone;
|
2282 |
+
plugin.tabs = new NestedPages.Tabs;
|
2283 |
+
plugin.menuLinks = new NestedPages.MenuLinks;
|
2284 |
+
plugin.hiddenItemCount = new NestedPages.HiddenItemCount;
|
2285 |
+
plugin.confirmDelete = new NestedPages.ConfirmDelete;
|
2286 |
+
plugin.manualSync = new NestedPages.ManualSync;
|
2287 |
+
plugin.postSearch = new NestedPages.PostSearch;
|
2288 |
+
plugin.wpml = new NestedPages.Wpml;
|
2289 |
+
|
2290 |
+
plugin.init = function()
|
2291 |
+
{
|
2292 |
+
if ( nestedpages.settings_page ) return;
|
2293 |
+
plugin.bindEvents();
|
2294 |
+
plugin.setPostType();
|
2295 |
+
plugin.setMenuSync();
|
2296 |
+
plugin.setNestable();
|
2297 |
+
plugin.setSortable();
|
2298 |
+
plugin.formatter.updateSubMenuToggle();
|
2299 |
+
plugin.formatter.setBorders();
|
2300 |
+
plugin.formatter.setNestedMargins();
|
2301 |
+
plugin.nesting.initializeSortable();
|
2302 |
+
}
|
2303 |
+
|
2304 |
+
|
2305 |
+
plugin.bindEvents = function()
|
2306 |
+
{
|
2307 |
+
$(document).on('click', NestedPages.selectors.quickEditOverlay, function(e){
|
2308 |
+
plugin.formatter.removeQuickEdit();
|
2309 |
+
plugin.newPage.cancelNewPage();
|
2310 |
+
});
|
2311 |
+
$(document).ready(function(){
|
2312 |
+
plugin.formatter.hideAjaxError();
|
2313 |
+
plugin.formatter.sizeLinkThumbnails();
|
2314 |
+
});
|
2315 |
+
}
|
2316 |
+
|
2317 |
+
|
2318 |
+
// Set whether or not post type is nestable
|
2319 |
+
plugin.setNestable = function()
|
2320 |
+
{
|
2321 |
+
var nestable = false;
|
2322 |
+
$.each(NestedPages.jsData.allPostTypes, function(i, v){
|
2323 |
+
if ( v.name !== NestedPages.jsData.posttype ) return;
|
2324 |
+
if ( v.hierarchical === true ) nestable = true;
|
2325 |
+
if ( v.disable_nesting === true ) nestable = false;
|
2326 |
+
});
|
2327 |
+
NestedPages.jsData.nestable = nestable;
|
2328 |
+
}
|
2329 |
+
|
2330 |
+
|
2331 |
+
// Set whether or not post type is sortable
|
2332 |
+
plugin.setSortable = function()
|
2333 |
+
{
|
2334 |
+
var sortable = true;
|
2335 |
+
$.each(NestedPages.jsData.allPostTypes, function(i, v){
|
2336 |
+
if ( v.name !== NestedPages.jsData.posttype ) return;
|
2337 |
+
if ( typeof v.disable_sorting === 'undefined' || v.disable_sorting === '' ) return;
|
2338 |
+
if ( v.disable_sorting === "true" ) sortable = false;
|
2339 |
+
});
|
2340 |
+
NestedPages.jsData.sortable = sortable;
|
2341 |
+
}
|
2342 |
+
|
2343 |
+
|
2344 |
+
// Set the Screen's Post Type
|
2345 |
+
plugin.setPostType = function()
|
2346 |
+
{
|
2347 |
+
NestedPages.jsData.posttype = nestedpages.current_post_type;
|
2348 |
+
if ( typeof NestedPages.jsData.posttype === 'undefined' || NestedPages.jsData.posttype === '' ){
|
2349 |
+
NestedPages.jsData.posttype = $(NestedPages.selectors.sortable).attr('id').substring(3);
|
2350 |
+
}
|
2351 |
+
NestedPages.jsData.hierarchical = NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical;
|
2352 |
+
}
|
2353 |
+
|
2354 |
+
|
2355 |
+
// Set menu sync
|
2356 |
+
plugin.setMenuSync = function()
|
2357 |
+
{
|
2358 |
+
NestedPages.jsData.syncmenu = ( nestedpages.syncmenu === '1' ) ? 'sync' : 'nosync';
|
2359 |
+
}
|
2360 |
+
|
2361 |
+
|
2362 |
+
return plugin.init();
|
2363 |
+
}
|
2364 |
+
var NestedPages = NestedPages || {};
|
2365 |
+
|
2366 |
+
/**
|
2367 |
+
* Menu Item Selection in Modal Link Form
|
2368 |
+
* @package Nested Pages
|
2369 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2370 |
+
*/
|
2371 |
+
NestedPages.MenuLinks = function()
|
2372 |
+
{
|
2373 |
+
var plugin = this;
|
2374 |
+
var $ = jQuery;
|
2375 |
+
|
2376 |
+
plugin.typeButton = ''; // The Link Type selected button
|
2377 |
+
plugin.post = ''; // The new post created
|
2378 |
+
|
2379 |
+
plugin.formatter = new NestedPages.Formatter;
|
2380 |
+
|
2381 |
+
plugin.selectors = {
|
2382 |
+
form : '[data-np-menu-item-form]', // The form element
|
2383 |
+
typeSelect : '[data-np-menu-selection]', // Link in left column to choose type of link
|
2384 |
+
accordion : '[data-np-menu-accordion]', // Accordion of objects
|
2385 |
+
accordionItem : '[data-np-menu-accordion-item]', // Single item in the accordion
|
2386 |
+
formPlaceholder : '.np-menu-link-object-placeholder', // Placeholder element
|
2387 |
+
formDetails : '.np-menu-link-details', // Right pane form details
|
2388 |
+
searchResults : '[data-np-search-result]', // Appended search result rows
|
2389 |
+
defaultResults : '[data-default-result]', // Default results,
|
2390 |
+
originalLink : '[data-np-original-link]', // Original Link Preview
|
2391 |
+
saveButton : '[data-np-save-link]', // The Form Submit Button
|
2392 |
+
urlInputCont : '[data-np-menu-url-cont]', // Container for URL input (only for custom links)
|
2393 |
+
errorDiv : '[data-np-error]', // The error notification
|
2394 |
+
}
|
2395 |
+
|
2396 |
+
plugin.fields = {
|
2397 |
+
object : '[data-np-menu-object-input]', // The object (ex: post/category/custom)
|
2398 |
+
objectid : '[data-np-menu-objectid-input]', // ex: term id, post id
|
2399 |
+
itemType : '[data-np-menu-type-input]', // ex: post_type, taxonomy
|
2400 |
+
url : '[data-np-menu-url]', // custom url
|
2401 |
+
navigationLabel : '[data-np-menu-navigation-label]',
|
2402 |
+
titleAttribute : '[data-np-menu-title-attr]',
|
2403 |
+
cssClasses : '[data-np-menu-css-classes]',
|
2404 |
+
npStatus : '[data-np-menu-np-status]',
|
2405 |
+
linkTarget : '[data-np-menu-link-target]',
|
2406 |
+
menuTitle : '[data-np-menu-title]'
|
2407 |
+
}
|
2408 |
+
|
2409 |
+
plugin.search = new NestedPages.MenuSearch;
|
2410 |
+
|
2411 |
+
plugin.init = function()
|
2412 |
+
{
|
2413 |
+
plugin.bindEvents();
|
2414 |
+
}
|
2415 |
+
|
2416 |
+
plugin.bindEvents = function()
|
2417 |
+
{
|
2418 |
+
$(document).on('click', NestedPages.selectors.openLinkModal, function(e){
|
2419 |
+
e.preventDefault();
|
2420 |
+
plugin.postParent = $(this).attr('data-parentid');
|
2421 |
+
$(plugin.selectors.form).find('.parent_id').val($(this).attr('data-parentid'));
|
2422 |
+
plugin.openModal();
|
2423 |
+
});
|
2424 |
+
$(document).on('click', plugin.selectors.accordionItem, function(e){
|
2425 |
+
e.preventDefault();
|
2426 |
+
plugin.accordion($(this));
|
2427 |
+
});
|
2428 |
+
$(document).on('click', plugin.selectors.typeSelect, function(e){
|
2429 |
+
e.preventDefault();
|
2430 |
+
plugin.typeButton = $(this);
|
2431 |
+
plugin.setLinkType();
|
2432 |
+
});
|
2433 |
+
$(document).on('keyup', plugin.fields.navigationLabel, function(){
|
2434 |
+
plugin.updateTitle();
|
2435 |
+
});
|
2436 |
+
$(document).on('click', plugin.selectors.saveButton, function(e){
|
2437 |
+
e.preventDefault();
|
2438 |
+
plugin.submitForm();
|
2439 |
+
});
|
2440 |
+
$(document).on('keydown', function(e){
|
2441 |
+
if ( e.keyCode === 27 ) $('#np-link-modal').modal('hide');
|
2442 |
+
});
|
2443 |
+
}
|
2444 |
+
|
2445 |
+
// Open the Modal and Clear/Populate hidden fields
|
2446 |
+
plugin.openModal = function()
|
2447 |
+
{
|
2448 |
+
$(NestedPages.selectors.linkErrorDiv).hide();
|
2449 |
+
$(NestedPages.selectors.linkModal).find('input').val('');
|
2450 |
+
$(NestedPages.selectors.linkModal).find('.parent_id').val(plugin.postParent);
|
2451 |
+
plugin.clearForm();
|
2452 |
+
$(plugin.selectors.accordion).find('ul').hide();
|
2453 |
+
$(plugin.selectors.typeSelect).removeClass('active');
|
2454 |
+
$(NestedPages.selectors.linkModal).modal('show');
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
// Accordion Menu
|
2458 |
+
plugin.accordion = function(button)
|
2459 |
+
{
|
2460 |
+
plugin.clearForm();
|
2461 |
+
var submenu = $(button).siblings('ul');
|
2462 |
+
if ( $(submenu).is(':visible') ){
|
2463 |
+
$(button).removeClass('active');
|
2464 |
+
$(submenu).slideUp('fast');
|
2465 |
+
return;
|
2466 |
+
}
|
2467 |
+
$(plugin.selectors.accordionItem).removeClass('active');
|
2468 |
+
$(button).addClass('active');
|
2469 |
+
$(button).parents(plugin.selectors.accordion).find('ul').slideUp('fast');
|
2470 |
+
$(submenu).slideDown('fast');
|
2471 |
+
}
|
2472 |
+
|
2473 |
+
// Set the link type
|
2474 |
+
plugin.setLinkType = function()
|
2475 |
+
{
|
2476 |
+
if ( $(plugin.typeButton).hasClass('active') ){
|
2477 |
+
plugin.clearForm();
|
2478 |
+
return;
|
2479 |
+
}
|
2480 |
+
if ( $(plugin.typeButton).hasClass('np-custom-link') ){
|
2481 |
+
$(plugin.selectors.accordionItem).removeClass('active');
|
2482 |
+
$(plugin.selectors.accordion).find('ul').slideUp('fast');
|
2483 |
+
}
|
2484 |
+
$(plugin.selectors.formPlaceholder).hide();
|
2485 |
+
plugin.populateForm();
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
// Populate the form
|
2489 |
+
plugin.populateForm = function()
|
2490 |
+
{
|
2491 |
+
$(plugin.selectors.saveButton).show();
|
2492 |
+
$(plugin.selectors.typeSelect).removeClass('active');
|
2493 |
+
$(plugin.typeButton).addClass('active');
|
2494 |
+
$(plugin.fields.menuTitle).text($(plugin.typeButton).text()).val($(plugin.typeButton).text());
|
2495 |
+
$(plugin.selectors.form).find('h3').find('em').text($(plugin.typeButton).attr('data-np-object-name'));
|
2496 |
+
if ( $(plugin.typeButton).attr('data-np-permalink') !== "" ){
|
2497 |
+
$(plugin.selectors.form).find(plugin.selectors.urlInputCont).hide();
|
2498 |
+
$(plugin.selectors.form).find(plugin.selectors.originalLink).html('<a href="' + $(plugin.typeButton).attr('data-np-permalink') + '">' + $(plugin.typeButton).text() + '</a>');
|
2499 |
+
$(plugin.selectors.form).find(plugin.selectors.originalLink).parent('.original-link').show();
|
2500 |
+
} else {
|
2501 |
+
$(plugin.selectors.form).find(plugin.selectors.urlInputCont).show();
|
2502 |
+
$(plugin.selectors.form).find(plugin.selectors.originalLink).parent('.original-link').hide();
|
2503 |
+
}
|
2504 |
+
$(plugin.fields.object).val($(plugin.typeButton).attr('data-np-menu-object'));
|
2505 |
+
$(plugin.fields.objectid).val($(plugin.typeButton).attr('data-np-menu-objectid'));
|
2506 |
+
$(plugin.fields.itemType).val($(plugin.typeButton).attr('data-np-menu-type'));
|
2507 |
+
$(plugin.selectors.formDetails).show();
|
2508 |
+
}
|
2509 |
+
|
2510 |
+
// Clear the form
|
2511 |
+
plugin.clearForm = function()
|
2512 |
+
{
|
2513 |
+
$(plugin.selectors.form).find(plugin.selectors.errorDiv).hide();
|
2514 |
+
$(plugin.selectors.saveButton).hide();
|
2515 |
+
$(plugin.selectors.formDetails).hide();
|
2516 |
+
$(plugin.selectors.formPlaceholder).show();
|
2517 |
+
$(plugin.selectors.form).find('input').not('.parent_id').val('');
|
2518 |
+
$(plugin.selectors.form).find(plugin.fields.linkTarget).val('_blank');
|
2519 |
+
$(plugin.selectors.form).find('input[type="checkbox"]').attr('checked', false);
|
2520 |
+
$(plugin.selectors.typeSelect).removeClass('active');
|
2521 |
+
plugin.search.toggleLoading(false);
|
2522 |
+
$(plugin.selectors.searchResults).remove();
|
2523 |
+
$(plugin.selectors.defaultResults).show();
|
2524 |
+
}
|
2525 |
+
|
2526 |
+
// Update the title text
|
2527 |
+
plugin.updateTitle = function()
|
2528 |
+
{
|
2529 |
+
var value = $(plugin.fields.navigationLabel).val();
|
2530 |
+
var title = $(plugin.selectors.form).find('h3').find('span');
|
2531 |
+
if ( value !== "" ){
|
2532 |
+
$(plugin.fields.menuTitle).val(value);
|
2533 |
+
$(title).text(value);
|
2534 |
+
} else {
|
2535 |
+
$(plugin.fields.menuTitle).val($(plugin.typeButton).text());
|
2536 |
+
$(title).text($(plugin.typeButton).text());
|
2537 |
+
}
|
2538 |
+
}
|
2539 |
+
|
2540 |
+
// Submit the Form
|
2541 |
+
plugin.submitForm = function()
|
2542 |
+
{
|
2543 |
+
plugin.toggleLoading(true);
|
2544 |
+
$.ajax({
|
2545 |
+
url : NestedPages.jsData.ajaxurl,
|
2546 |
+
type : 'post',
|
2547 |
+
data: $(plugin.selectors.form).serialize() + '&action=' + NestedPages.formActions.newMenuItem + '&nonce=' + NestedPages.jsData.nonce + '&post_type=' + NestedPages.jsData.posttype + '&syncmenu=' + NestedPages.jsData.syncmenu,
|
2548 |
+
success : function(data){
|
2549 |
+
plugin.toggleLoading(false);
|
2550 |
+
if ( data.status === 'error' ){
|
2551 |
+
$(plugin.selectors.form).find(plugin.selectors.errorDiv).text(data.message).show();
|
2552 |
+
return;
|
2553 |
+
}
|
2554 |
+
plugin.post = data.post_data;
|
2555 |
+
plugin.createRow();
|
2556 |
+
},
|
2557 |
+
error : function(data){
|
2558 |
+
console.log(data);
|
2559 |
+
}
|
2560 |
+
});
|
2561 |
+
}
|
2562 |
+
|
2563 |
+
// Create the nested pages row for the new link
|
2564 |
+
plugin.createRow = function()
|
2565 |
+
{
|
2566 |
+
var html = '<li id="menuItem_' + plugin.post.id + '" class="page-row published';
|
2567 |
+
html += '">'
|
2568 |
+
|
2569 |
+
html += '<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner"><i class="np-icon-sub-menu"></i><i class="handle np-icon-menu"></i><a href="' + plugin.post.np_link_content + '" class="page-link page-title" target="_blank"><span class="title">' + plugin.post.menuTitle + ' <i class="np-icon-link"></i></span>';
|
2570 |
+
|
2571 |
+
// Quick Edit Button
|
2572 |
+
html += '</a><a href="#" class="np-toggle-edit"><i class="np-icon-pencil"></i></a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ';
|
2573 |
+
html += 'data-id="' + plugin.post.id + '"';
|
2574 |
+
html += 'data-parentid="' + plugin.post.parent_id + '"';
|
2575 |
+
html += 'data-title="' + plugin.post.menuTitle + '" ';
|
2576 |
+
html += 'data-url="' + plugin.post.url + '" ';
|
2577 |
+
html += 'data-status="publish" ';
|
2578 |
+
html += 'data-np-status="show" ';
|
2579 |
+
html += 'data-navstatus="show" ';
|
2580 |
+
html += 'data-navcss="' + plugin.post.cssClasses + '" ';
|
2581 |
+
html += 'data-navtitleattr="' + plugin.post.titleAttribute + '" ';
|
2582 |
+
html += 'data-nav-type="' + plugin.post.menuType + '" ';
|
2583 |
+
html += 'data-nav-object="' + plugin.post.objectType + '" ';
|
2584 |
+
html += 'data-nav-object-id="' + plugin.post.objectId + '" ';
|
2585 |
+
html += 'data-nav-original-link="' + plugin.post.original_link + '" ';
|
2586 |
+
html += 'data-nav-original-title="' + plugin.post.original_title + '" ';
|
2587 |
+
html += 'data-linktarget="' + plugin.post.link_target + '">';
|
2588 |
+
html += NestedPages.jsData.quickEditText;
|
2589 |
+
html += '</a>';
|
2590 |
+
|
2591 |
+
// Delete Link
|
2592 |
+
html += '<a href="' + plugin.post.delete_link + '" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>';
|
2593 |
+
|
2594 |
+
html += '</div></div></div></li>';
|
2595 |
+
|
2596 |
+
if ( plugin.post.parent_id === "0" ){
|
2597 |
+
$('.nplist:first li:first').after(html);
|
2598 |
+
} else {
|
2599 |
+
plugin.appendChildRow(html);
|
2600 |
+
}
|
2601 |
+
|
2602 |
+
$(NestedPages.selectors.linkModal).modal('hide');
|
2603 |
+
|
2604 |
+
plugin.row = $('#menuItem_' + plugin.post.id).find('.row');
|
2605 |
+
plugin.formatter.flashRow(plugin.row);
|
2606 |
+
}
|
2607 |
+
|
2608 |
+
// Append a new child link to the appropriate menu
|
2609 |
+
plugin.appendChildRow = function(html)
|
2610 |
+
{
|
2611 |
+
var parent_row = $('#menuItem_' + plugin.post.parent_id);
|
2612 |
+
if ( $(parent_row).children('ol').length === 0 ){
|
2613 |
+
html = '<ol class="sortable nplist" style="display:block;">' + html + '</ol>';
|
2614 |
+
$(parent_row).append(html);
|
2615 |
+
} else {
|
2616 |
+
$(parent_row).find('ol:first').prepend(html);
|
2617 |
+
}
|
2618 |
+
plugin.formatter.updateSubMenuToggle();
|
2619 |
+
}
|
2620 |
+
|
2621 |
+
// Toggle Loading
|
2622 |
+
plugin.toggleLoading = function(loading)
|
2623 |
+
{
|
2624 |
+
if ( loading ){
|
2625 |
+
$(plugin.selectors.form).find(plugin.selectors.errorDiv).hide();
|
2626 |
+
$(plugin.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show();
|
2627 |
+
$(plugin.selectors.saveButton).attr('disabled', 'disabled');
|
2628 |
+
return;
|
2629 |
+
}
|
2630 |
+
$(plugin.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide();
|
2631 |
+
$(plugin.selectors.saveButton).attr('disabled', false);
|
2632 |
+
}
|
2633 |
+
|
2634 |
+
return plugin.init();
|
2635 |
+
}
|
2636 |
+
var NestedPages = NestedPages || {};
|
2637 |
+
|
2638 |
+
/**
|
2639 |
+
* Menu Item Search in Modal Link Form
|
2640 |
+
* @package Nested Pages
|
2641 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2642 |
+
*/
|
2643 |
+
NestedPages.MenuSearch = function()
|
2644 |
+
{
|
2645 |
+
var plugin = this;
|
2646 |
+
var $ = jQuery;
|
2647 |
+
|
2648 |
+
plugin.selectors = {
|
2649 |
+
searchForms : '*[data-np-menu-search]', // Search form selector
|
2650 |
+
defaultResults : '[data-default-result]', // Default results list items
|
2651 |
+
loadingIndicator : '.np-menu-search-loading', // loading indicator
|
2652 |
+
noResults : '.np-menu-search-noresults', // No results
|
2653 |
+
searchType : 'data-search-type', // The search object type (post_type, taxonomy)
|
2654 |
+
searchObject : 'data-search-object', // The object to search (post, category, etc)
|
2655 |
+
searchResults : '[data-np-search-result]', // Appended search result rows
|
2656 |
+
}
|
2657 |
+
|
2658 |
+
plugin.activeForm = ''; // The active form
|
2659 |
+
plugin.results = ''; // Search results
|
2660 |
+
plugin.defaultResults = ''; // The default, loaded results
|
2661 |
+
plugin.searchType = ''; // The type of search (post_type, taxonomy)
|
2662 |
+
plugin.searchObject = ''; // The object being searched (post, category, post_tag, etc…)
|
2663 |
+
|
2664 |
+
plugin.init = function()
|
2665 |
+
{
|
2666 |
+
plugin.bindEvents();
|
2667 |
+
}
|
2668 |
+
|
2669 |
+
plugin.bindEvents = function()
|
2670 |
+
{
|
2671 |
+
$(document).on('keyup', plugin.selectors.searchForms, function(){
|
2672 |
+
plugin.activeForm = $(this);
|
2673 |
+
$(plugin.selectors.searchResults).remove();
|
2674 |
+
plugin.performSearch();
|
2675 |
+
});
|
2676 |
+
}
|
2677 |
+
|
2678 |
+
|
2679 |
+
// Perform the search
|
2680 |
+
plugin.performSearch = function()
|
2681 |
+
{
|
2682 |
+
plugin.defaultResults = $(plugin.activeForm).parent('li').siblings(plugin.selectors.defaultResults);
|
2683 |
+
if ( $(plugin.activeForm).val().length > 2 ){
|
2684 |
+
$(plugin.defaultResults).hide();
|
2685 |
+
plugin.toggleLoading(true);
|
2686 |
+
plugin.query();
|
2687 |
+
return;
|
2688 |
+
}
|
2689 |
+
plugin.toggleLoading(false);
|
2690 |
+
$(plugin.defaultResults).show();
|
2691 |
+
}
|
2692 |
+
|
2693 |
+
|
2694 |
+
// Query Search
|
2695 |
+
plugin.query = function()
|
2696 |
+
{
|
2697 |
+
plugin.searchType = $(plugin.activeForm).attr(plugin.selectors.searchType);
|
2698 |
+
plugin.searchObject = $(plugin.activeForm).attr(plugin.selectors.searchObject);
|
2699 |
+
$.ajax({
|
2700 |
+
url: NestedPages.jsData.ajaxurl,
|
2701 |
+
type: 'post',
|
2702 |
+
datatype: 'json',
|
2703 |
+
data: {
|
2704 |
+
action : NestedPages.formActions.search,
|
2705 |
+
nonce : NestedPages.jsData.nonce,
|
2706 |
+
term : $(plugin.activeForm).val(),
|
2707 |
+
searchType : plugin.searchType,
|
2708 |
+
searchObject : plugin.searchObject,
|
2709 |
+
},
|
2710 |
+
success: function(data){
|
2711 |
+
console.log(data);
|
2712 |
+
if ( data.results ){
|
2713 |
+
plugin.results = data.results;
|
2714 |
+
plugin.toggleLoading(false);
|
2715 |
+
if ( plugin.searchType === 'post_type' ){
|
2716 |
+
plugin.appendPosts();
|
2717 |
+
} else {
|
2718 |
+
plugin.appendTaxonomies();
|
2719 |
+
}
|
2720 |
+
} else {
|
2721 |
+
plugin.toggleLoading(false);
|
2722 |
+
$(plugin.activeForm).siblings(plugin.selectors.noResults).show();
|
2723 |
+
}
|
2724 |
+
}
|
2725 |
+
});
|
2726 |
+
}
|
2727 |
+
|
2728 |
+
|
2729 |
+
// Append post type results
|
2730 |
+
plugin.appendPosts = function()
|
2731 |
+
{
|
2732 |
+
var html = "";
|
2733 |
+
$.each(plugin.results, function(i, v){
|
2734 |
+
html += '<li data-np-search-result><a href="#" data-np-menu-object="' + plugin.searchObject + '" data-np-menu-type="post_type" data-np-menu-objectid="' + v.ID + '" data-np-permalink="' + v.permalink + '" data-np-object-name="' + v.singular_name + '" data-np-menu-selection>' + v.post_title + '</a></li>';
|
2735 |
+
});
|
2736 |
+
$(html).insertAfter($(plugin.activeForm).parent('li'));
|
2737 |
+
plugin.toggleLoading(false);
|
2738 |
+
}
|
2739 |
+
|
2740 |
+
|
2741 |
+
// Append taxonomy results
|
2742 |
+
plugin.appendTaxonomies = function()
|
2743 |
+
{
|
2744 |
+
var html = "";
|
2745 |
+
$.each(plugin.results, function(i, v){
|
2746 |
+
html += '<li data-np-search-result><a href="#" data-np-menu-object="' + plugin.searchObject + '" data-np-menu-type="post_type" data-np-menu-objectid="' + v.term_id + '" data-np-permalink="' + v.permalink + '" data-np-object-name="' + v.taxonomy + '" data-np-menu-selection>' + v.name + '</a></li>';
|
2747 |
+
});
|
2748 |
+
$(html).insertAfter($(plugin.activeForm).parent('li'));
|
2749 |
+
plugin.toggleLoading(false);
|
2750 |
+
}
|
2751 |
+
|
2752 |
+
|
2753 |
+
// Toggle the loading indicator
|
2754 |
+
plugin.toggleLoading = function(loading)
|
2755 |
+
{
|
2756 |
+
var loadingIndicator = $(plugin.activeForm).siblings(plugin.selectors.loadingIndicator);
|
2757 |
+
$(plugin.selectors.noResults).hide();
|
2758 |
+
if ( loading ){
|
2759 |
+
$(loadingIndicator).show();
|
2760 |
+
return;
|
2761 |
+
}
|
2762 |
+
$(loadingIndicator).hide();
|
2763 |
+
}
|
2764 |
+
|
2765 |
+
return plugin.init();
|
2766 |
+
}
|
2767 |
+
/**
|
2768 |
+
* Empty Trash Functionality
|
2769 |
+
* @package Nested Pages
|
2770 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2771 |
+
*/
|
2772 |
+
jQuery(document).ready(function(){
|
2773 |
+
new NestedPagesTrash;
|
2774 |
+
});
|
2775 |
+
|
2776 |
+
var NestedPagesTrash = function()
|
2777 |
+
{
|
2778 |
+
var plugin = this;
|
2779 |
+
var $ = jQuery;
|
2780 |
+
|
2781 |
+
// DOM Selectors
|
2782 |
+
plugin.trashButton = '.np-empty-trash'; // Trash Link
|
2783 |
+
plugin.confirmButton = '.np-trash-confirm'; // Confirm button in modal
|
2784 |
+
plugin.warningModal = '#np-trash-modal'; // Modal with empty confirmation
|
2785 |
+
plugin.errorAlert = '#np-error'; // Alert Error Notification
|
2786 |
+
plugin.loadingIndicator = '#nested-loading'; // Loading Indication
|
2787 |
+
plugin.trashLinks = '.np-trash-links';
|
2788 |
+
plugin.postType = $('#np-trash-posttype').val();
|
2789 |
+
|
2790 |
+
// JS Data
|
2791 |
+
plugin.nonce = nestedpages.np_nonce;
|
2792 |
+
plugin.formAction = 'npEmptyTrash';
|
2793 |
+
|
2794 |
+
|
2795 |
+
// Initialization
|
2796 |
+
plugin.init = function(){
|
2797 |
+
plugin.bindEvents();
|
2798 |
+
}
|
2799 |
+
|
2800 |
+
// Bind Events
|
2801 |
+
plugin.bindEvents = function(){
|
2802 |
+
$(document).on('click', plugin.trashButton, function(e){
|
2803 |
+
e.preventDefault();
|
2804 |
+
$(plugin.warningModal).modal('show');
|
2805 |
+
});
|
2806 |
+
$(document).on('click', plugin.confirmButton, function(e){
|
2807 |
+
e.preventDefault();
|
2808 |
+
plugin.confirmEmpty();
|
2809 |
+
});
|
2810 |
+
}
|
2811 |
+
|
2812 |
+
// Confirm Trash Empty
|
2813 |
+
plugin.confirmEmpty = function(){
|
2814 |
+
plugin.loading(true);
|
2815 |
+
$(plugin.warningModal).hide();
|
2816 |
+
$(plugin.errorAlert).hide();
|
2817 |
+
plugin.emptyTrash();
|
2818 |
+
}
|
2819 |
+
|
2820 |
+
// Empty the Trash
|
2821 |
+
plugin.emptyTrash = function(){
|
2822 |
+
$.ajax({
|
2823 |
+
url: ajaxurl,
|
2824 |
+
type: 'post',
|
2825 |
+
datatype: 'json',
|
2826 |
+
data: {
|
2827 |
+
action : plugin.formAction,
|
2828 |
+
nonce : plugin.nonce,
|
2829 |
+
posttype : plugin.postType
|
2830 |
+
},
|
2831 |
+
success: function(data){
|
2832 |
+
plugin.loading(false);
|
2833 |
+
if (data.status === 'error'){
|
2834 |
+
$(plugin.errorAlert).text(data.message).show();
|
2835 |
+
} else {
|
2836 |
+
$(plugin.trashLinks).hide();
|
2837 |
+
}
|
2838 |
+
}
|
2839 |
+
});
|
2840 |
+
}
|
2841 |
+
|
2842 |
+
// Loading Indication
|
2843 |
+
plugin.loading = function(loading){
|
2844 |
+
if ( loading ){
|
2845 |
+
$(plugin.loadingIndicator).show();
|
2846 |
+
return;
|
2847 |
+
}
|
2848 |
+
$(plugin.loadingIndicator).hide();
|
2849 |
+
}
|
2850 |
+
|
2851 |
+
return plugin.init();
|
2852 |
+
}
|
2853 |
+
|
2854 |
+
var NestedPages = NestedPages || {};
|
2855 |
+
|
2856 |
+
/**
|
2857 |
+
* Confirm deletion of links
|
2858 |
+
* @package Nested Pages
|
2859 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2860 |
+
*/
|
2861 |
+
NestedPages.ConfirmDelete = function()
|
2862 |
+
{
|
2863 |
+
var plugin = this;
|
2864 |
+
var $ = jQuery;
|
2865 |
+
|
2866 |
+
// JS Data
|
2867 |
+
plugin.deleteLink = ''; // Link for deleting the item
|
2868 |
+
|
2869 |
+
plugin.bindEvents = function()
|
2870 |
+
{
|
2871 |
+
$(document).on('click', NestedPages.selectors.linkDeleteButton, function(e){
|
2872 |
+
e.preventDefault();
|
2873 |
+
plugin.confirmSingle($(this));
|
2874 |
+
});
|
2875 |
+
$(document).on('click', NestedPages.selectors.linkDeleteConfirmationButton, function(e){
|
2876 |
+
e.preventDefault();
|
2877 |
+
if ( !$(this).hasClass('bulk') ){
|
2878 |
+
plugin.deleteSingle();
|
2879 |
+
return;
|
2880 |
+
}
|
2881 |
+
plugin.deleteMultiple();
|
2882 |
+
});
|
2883 |
+
$(document).on('submit', NestedPages.selectors.bulkActionsForm, function(e){
|
2884 |
+
plugin.confirmMultiple(e);
|
2885 |
+
});
|
2886 |
+
}
|
2887 |
+
|
2888 |
+
// Confirm a single link deletion
|
2889 |
+
plugin.confirmSingle = function(button)
|
2890 |
+
{
|
2891 |
+
plugin.deleteLink = $(button).attr('href');
|
2892 |
+
$(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular);
|
2893 |
+
$(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass('bulk');
|
2894 |
+
$(NestedPages.selectors.linkDeleteConfirmationModal).modal('show');
|
2895 |
+
}
|
2896 |
+
|
2897 |
+
// Confirm Multiple link deletion
|
2898 |
+
plugin.confirmMultiple = function(event)
|
2899 |
+
{
|
2900 |
+
if ( $('select[name="np_bulk_action"]').val() !== 'trash' ) return;
|
2901 |
+
var linkCount = $(NestedPages.selectors.bulkActionRedirectIds).val();
|
2902 |
+
if ( linkCount === '' ) return;
|
2903 |
+
event.preventDefault();
|
2904 |
+
$(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation);
|
2905 |
+
$(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass('bulk');
|
2906 |
+
$(NestedPages.selectors.linkDeleteConfirmationModal).modal('show');
|
2907 |
+
}
|
2908 |
+
|
2909 |
+
// Submit the form to delete multiple
|
2910 |
+
plugin.deleteMultiple = function()
|
2911 |
+
{
|
2912 |
+
$(NestedPages.selectors.bulkActionsForm)[0].submit();
|
2913 |
+
}
|
2914 |
+
|
2915 |
+
// Delete the single
|
2916 |
+
plugin.deleteSingle = function()
|
2917 |
+
{
|
2918 |
+
window.location.replace(plugin.deleteLink);
|
2919 |
+
}
|
2920 |
+
|
2921 |
+
return plugin.bindEvents();
|
2922 |
+
}
|
2923 |
+
|
2924 |
+
var NestedPages = NestedPages || {};
|
2925 |
+
|
2926 |
+
/**
|
2927 |
+
* Manual Sync functionality for nested view
|
2928 |
+
* @package Nested Pages
|
2929 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
2930 |
+
*/
|
2931 |
+
NestedPages.ManualSync = function()
|
2932 |
+
{
|
2933 |
+
var plugin = this;
|
2934 |
+
var $ = jQuery;
|
2935 |
+
|
2936 |
+
plugin.activeBtn = '';
|
2937 |
+
|
2938 |
+
plugin.bindEvents = function()
|
2939 |
+
{
|
2940 |
+
$(document).on('click', NestedPages.selectors.manualMenuSync, function(e){
|
2941 |
+
e.preventDefault();
|
2942 |
+
plugin.activeBtn = $(this);
|
2943 |
+
plugin.syncMenu();
|
2944 |
+
});
|
2945 |
+
$(document).on('click', NestedPages.selectors.manualOrderSync, function(e){
|
2946 |
+
e.preventDefault();
|
2947 |
+
plugin.activeBtn = $(this);
|
2948 |
+
plugin.syncOrder();
|
2949 |
+
});
|
2950 |
+
}
|
2951 |
+
|
2952 |
+
plugin.syncMenu = function()
|
2953 |
+
{
|
2954 |
+
plugin.loading(true);
|
2955 |
+
|
2956 |
+
$.ajax({
|
2957 |
+
url: ajaxurl,
|
2958 |
+
type: 'post',
|
2959 |
+
datatype: 'json',
|
2960 |
+
data: {
|
2961 |
+
action : NestedPages.formActions.manualMenuSync,
|
2962 |
+
nonce : NestedPages.jsData.nonce,
|
2963 |
+
post_type : NestedPages.jsData.posttype,
|
2964 |
+
syncmenu : 'sync'
|
2965 |
+
},
|
2966 |
+
success: function(data){
|
2967 |
+
if (data.status === 'error'){
|
2968 |
+
$(NestedPages.selectors.errorDiv).text(data.message).show();
|
2969 |
+
$(NestedPages.selectors.loadingIndicator).hide();
|
2970 |
+
} else {
|
2971 |
+
plugin.loading(false);
|
2972 |
+
}
|
2973 |
+
}
|
2974 |
+
});
|
2975 |
+
}
|
2976 |
+
|
2977 |
+
plugin.syncOrder = function()
|
2978 |
+
{
|
2979 |
+
plugin.loading(true);
|
2980 |
+
var nestingClass = new NestedPages.Nesting;
|
2981 |
+
nestingClass.syncNesting(true, plugin.loading(false));
|
2982 |
+
}
|
2983 |
+
|
2984 |
+
plugin.loading = function(loading)
|
2985 |
+
{
|
2986 |
+
if ( loading ){
|
2987 |
+
$(plugin.activeBtn).addClass('disabled');
|
2988 |
+
$(NestedPages.selectors.loadingIndicator).show();
|
2989 |
+
return;
|
2990 |
+
}
|
2991 |
+
$(plugin.activeBtn).removeClass('disabled');
|
2992 |
+
$(NestedPages.selectors.loadingIndicator).hide();
|
2993 |
+
}
|
2994 |
+
|
2995 |
+
return plugin.bindEvents();
|
2996 |
+
}
|
2997 |
+
var NestedPages = NestedPages || {};
|
2998 |
+
|
2999 |
+
/**
|
3000 |
+
* Perform an AJAX search for posts by type
|
3001 |
+
* @package Nested Pages
|
3002 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
3003 |
+
*/
|
3004 |
+
NestedPages.PostSearch = function()
|
3005 |
+
{
|
3006 |
+
var plugin = this;
|
3007 |
+
var $ = jQuery;
|
3008 |
+
|
3009 |
+
plugin.selectors = {
|
3010 |
+
input : 'data-nestedpages-post-search',
|
3011 |
+
form : 'data-nestedpages-post-search-form',
|
3012 |
+
loadingIndicator : 'data-nestedpages-loading',
|
3013 |
+
noResults : 'data-nestedpages-no-results',
|
3014 |
+
results: 'data-nestedpages-search-results'
|
3015 |
+
}
|
3016 |
+
|
3017 |
+
plugin.changed = false;
|
3018 |
+
plugin.activeInput = ''; // The active input
|
3019 |
+
plugin.results = ''; // Search results
|
3020 |
+
plugin.defaultResults = ''; // The default, loaded results
|
3021 |
+
plugin.postType = ''; // The type of search (post_type, taxonomy)
|
3022 |
+
plugin.activeForm = '';
|
3023 |
+
|
3024 |
+
plugin.bindEvents = function()
|
3025 |
+
{
|
3026 |
+
$('['+ plugin.selectors.input + ']').on('input', function(){
|
3027 |
+
plugin.activeInput = $(this);
|
3028 |
+
plugin.setOptions();
|
3029 |
+
if ( !plugin.changed ) plugin.setDefaultResults();
|
3030 |
+
if ( $(this).val() === '' ) {
|
3031 |
+
$(plugin.activeForm).find('[' + plugin.selectors.noResults + ']').hide();
|
3032 |
+
plugin.showDefaultResults();
|
3033 |
+
return;
|
3034 |
+
}
|
3035 |
+
plugin.query();
|
3036 |
+
});
|
3037 |
+
}
|
3038 |
+
|
3039 |
+
/**
|
3040 |
+
* Set the default results
|
3041 |
+
*/
|
3042 |
+
plugin.setDefaultResults = function()
|
3043 |
+
{
|
3044 |
+
plugin.defaultResults = $(plugin.activeForm).find('[' + plugin.selectors.results + ']').html();
|
3045 |
+
plugin.changed = true;
|
3046 |
+
}
|
3047 |
+
|
3048 |
+
/**
|
3049 |
+
* Show the default results
|
3050 |
+
*/
|
3051 |
+
plugin.showDefaultResults = function()
|
3052 |
+
{
|
3053 |
+
$(plugin.activeForm).find('[' + plugin.selectors.results + ']').html(plugin.defaultResults);
|
3054 |
+
}
|
3055 |
+
|
3056 |
+
/**
|
3057 |
+
* Set the options
|
3058 |
+
*/
|
3059 |
+
plugin.setOptions = function()
|
3060 |
+
{
|
3061 |
+
plugin.postType = $(plugin.activeInput).attr(plugin.selectors.input);
|
3062 |
+
plugin.activeForm = $(plugin.activeInput).parents('[' + plugin.selectors.form + ']');
|
3063 |
+
}
|
3064 |
+
|
3065 |
+
// Perform the search
|
3066 |
+
plugin.performSearch = function()
|
3067 |
+
{
|
3068 |
+
plugin.defaultResults = $(plugin.activeForm).parent('li').siblings(plugin.selectors.defaultResults);
|
3069 |
+
if ( $(plugin.activeForm).val().length > 2 ){
|
3070 |
+
$(plugin.defaultResults).hide();
|
3071 |
+
plugin.toggleLoading(true);
|
3072 |
+
plugin.query();
|
3073 |
+
return;
|
3074 |
+
}
|
3075 |
+
plugin.toggleLoading(false);
|
3076 |
+
$(plugin.defaultResults).show();
|
3077 |
+
}
|
3078 |
+
|
3079 |
+
|
3080 |
+
// Query Search
|
3081 |
+
plugin.query = function()
|
3082 |
+
{
|
3083 |
+
$(plugin.activeForm).find('[' + plugin.selectors.results + ']').empty();
|
3084 |
+
plugin.toggleLoading(true);
|
3085 |
+
$.ajax({
|
3086 |
+
url: NestedPages.jsData.ajaxurl,
|
3087 |
+
type: 'post',
|
3088 |
+
datatype: 'json',
|
3089 |
+
data: {
|
3090 |
+
action : NestedPages.formActions.postSearch,
|
3091 |
+
nonce : NestedPages.jsData.nonce,
|
3092 |
+
term : $(plugin.activeInput).val(),
|
3093 |
+
postType : plugin.postType
|
3094 |
+
},
|
3095 |
+
success: function(data){
|
3096 |
+
if ( data.results ){
|
3097 |
+
plugin.results = data.results;
|
3098 |
+
plugin.loadResults();
|
3099 |
+
plugin.toggleLoading(false);
|
3100 |
+
} else {
|
3101 |
+
plugin.toggleLoading(false);
|
3102 |
+
$(plugin.activeForm).find('[' + plugin.selectors.noResults + ']').show();
|
3103 |
+
}
|
3104 |
+
}
|
3105 |
+
});
|
3106 |
+
}
|
3107 |
+
|
3108 |
+
// Load the results into view
|
3109 |
+
plugin.loadResults = function()
|
3110 |
+
{
|
3111 |
+
var html = "<ul>";
|
3112 |
+
$.each(plugin.results, function(i, v){
|
3113 |
+
html += '<li><a href="#" data-assignment-page-id="' + v.ID + '" data-assignment-page-title="' + v.post_title + '">' + v.post_title + '</a></li>';
|
3114 |
+
});
|
3115 |
+
html += '</ul>';
|
3116 |
+
$(plugin.activeForm).find('[' + plugin.selectors.results + ']').html(html);
|
3117 |
+
plugin.toggleLoading(false);
|
3118 |
+
}
|
3119 |
+
|
3120 |
+
// Toggle the loading indicator
|
3121 |
+
plugin.toggleLoading = function(loading)
|
3122 |
+
{
|
3123 |
+
var loadingIndicator = $(plugin.activeForm).find('[' + plugin.selectors.loadingIndicator + ']');
|
3124 |
+
var noResults = $(plugin.activeForm).find('[' + plugin.selectors.noResults + ']');
|
3125 |
+
$(noResults).hide();
|
3126 |
+
if ( loading ){
|
3127 |
+
$(loadingIndicator).show();
|
3128 |
+
return;
|
3129 |
+
}
|
3130 |
+
$(loadingIndicator).hide();
|
3131 |
+
}
|
3132 |
+
|
3133 |
+
return plugin.bindEvents();
|
3134 |
+
}
|
3135 |
+
var NestedPages = NestedPages || {};
|
3136 |
+
|
3137 |
+
/**
|
3138 |
+
* WPML functionality
|
3139 |
+
* @package Nested Pages
|
3140 |
+
* @author Kyle Phillips - https://github.com/kylephillips/wp-nested-pages
|
3141 |
+
*/
|
3142 |
+
NestedPages.Wpml = function()
|
3143 |
+
{
|
3144 |
+
var plugin = this;
|
3145 |
+
var $ = jQuery;
|
3146 |
+
|
3147 |
+
plugin.button = null; // The quick edit button with all the data-attributes for the post
|
3148 |
+
plugin.postData = null; // Object containing post data
|
3149 |
+
plugin.modal = null; // The modal element
|
3150 |
+
plugin.parent_li = null; // The post's nested pages list element
|
3151 |
+
plugin.formatter = new NestedPages.Formatter;
|
3152 |
+
|
3153 |
+
plugin.selectors = {
|
3154 |
+
translationsBtn : 'data-nestedpages-translations',
|
3155 |
+
modal : 'data-np-wpml-translations-modal',
|
3156 |
+
title : 'data-wmpl-translation-title',
|
3157 |
+
table : 'data-np-wpml-translations-modal-table'
|
3158 |
+
}
|
3159 |
+
|
3160 |
+
plugin.bindEvents = function()
|
3161 |
+
{
|
3162 |
+
if ( !nestedpages.wpml ) return;
|
3163 |
+
$(document).on('click', '[' + plugin.selectors.translationsBtn + ']', function(e){
|
3164 |
+
e.preventDefault();
|
3165 |
+
plugin.createTranslationsModal($(this));
|
3166 |
+
});
|
3167 |
+
}
|
3168 |
+
|
3169 |
+
/**
|
3170 |
+
* Create the translations modal
|
3171 |
+
*/
|
3172 |
+
plugin.createTranslationsModal = function(button)
|
3173 |
+
{
|
3174 |
+
plugin.parent_li = $(button).closest(NestedPages.selectors.row).parent('li');
|
3175 |
+
plugin.button = $(button).siblings(NestedPages.selectors.quickEditOpen);
|
3176 |
+
plugin.postData = {
|
3177 |
+
id : $(plugin.button).attr('data-id'),
|
3178 |
+
title : $(plugin.button).attr('data-title'),
|
3179 |
+
slug : $(plugin.button).attr('data-slug')
|
3180 |
+
}
|
3181 |
+
plugin.modal = $('[' + plugin.selectors.modal + ']').clone();
|
3182 |
+
|
3183 |
+
if ( $(plugin.parent_li).children('ol').length > 0 ){
|
3184 |
+
var child_ol = $(plugin.parent_li).children('ol');
|
3185 |
+
$(plugin.modal).insertBefore(child_ol);
|
3186 |
+
} else {
|
3187 |
+
$(plugin.modal).appendTo(plugin.parent_li);
|
3188 |
+
}
|
3189 |
+
$(plugin.modal).find('[' + plugin.selectors.title + ']').text(plugin.postData.title);
|
3190 |
+
plugin.formatter.showQuickEdit();
|
3191 |
+
$(plugin.modal).show();
|
3192 |
+
plugin.getTranslationData();
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
/**
|
3196 |
+
* Get the Translation Data for the Post
|
3197 |
+
*/
|
3198 |
+
plugin.getTranslationData = function()
|
3199 |
+
{
|
3200 |
+
$.ajax({
|
3201 |
+
url: NestedPages.jsData.ajaxurl,
|
3202 |
+
type: 'post',
|
3203 |
+
datatype: 'json',
|
3204 |
+
data : {
|
3205 |
+
action : NestedPages.formActions.wpmlTranslations,
|
3206 |
+
post_id : plugin.postData.id,
|
3207 |
+
nonce : NestedPages.jsData.nonce
|
3208 |
+
},
|
3209 |
+
success: function(data){
|
3210 |
+
if ( data.status === 'success' ){
|
3211 |
+
plugin.populateModal(data.translations);
|
3212 |
+
} else {
|
3213 |
+
$(plugin.modal).find(NestedPages.selectors.quickEditErrorDiv).text(data.message).show();
|
3214 |
+
plugin.toggleLoading(false);
|
3215 |
+
}
|
3216 |
+
}
|
3217 |
+
});
|
3218 |
+
}
|
3219 |
+
|
3220 |
+
/**
|
3221 |
+
* Open the Modal
|
3222 |
+
*/
|
3223 |
+
plugin.populateModal = function(translations)
|
3224 |
+
{
|
3225 |
+
var html = '<tbody>';
|
3226 |
+
$.each(translations, function(i, v){
|
3227 |
+
var translation = translations[i];
|
3228 |
+
html += '<tr>';
|
3229 |
+
html += '<td><img src="' + translation.country_flag_url + '" alt="' + translation.translated_name + '" /> ' + translation.translated_name + '</td>';
|
3230 |
+
html += '<td>';
|
3231 |
+
if ( translation.has_translation && translation.edit_link ){
|
3232 |
+
html += '<a href="' + translation.edit_link + '">' + translation.translation.post_title + ' (' + nestedpages.edit + ')</a>';
|
3233 |
+
} else {
|
3234 |
+
html += '<a href="' + translation.add_link + '" class="np-btn">+ ' + nestedpages.add_translation + '</a>';
|
3235 |
+
}
|
3236 |
+
html += '</td>';
|
3237 |
+
html += '</tr>';
|
3238 |
+
});
|
3239 |
+
html += '</tbody>';
|
3240 |
+
$(plugin.modal).find('[' + plugin.selectors.table + ']').html(html);
|
3241 |
+
plugin.toggleLoading(false);
|
3242 |
+
}
|
3243 |
+
|
3244 |
+
/**
|
3245 |
+
* Toggle the Loading State
|
3246 |
+
*/
|
3247 |
+
plugin.toggleLoading = function(loading)
|
3248 |
+
{
|
3249 |
+
if ( loading ){
|
3250 |
+
$(plugin.modal).addClass('loading');
|
3251 |
+
return;
|
3252 |
+
}
|
3253 |
+
$(plugin.modal).removeClass('loading');
|
3254 |
+
}
|
3255 |
+
|
3256 |
+
|
3257 |
+
return plugin.bindEvents();
|
3258 |
+
}
|
assets/js/nestedpages.min.js
CHANGED
@@ -1,2 +1 @@
|
|
1 |
-
var NestedPages=NestedPages||{};NestedPages.Responsive=function(){var e=this,t=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.toggleEditButtons,function(a){a.preventDefault(),e.toggleEdit(t(this))}),t(window).resize(function(){e.timer(function(){t(".action-buttons").removeAttr("style"),t(".np-toggle-edit").removeClass("active")},500)})},e.toggleEdit=function(e){var a=t(e).siblings(".action-buttons");return t(a).is(":visible")?(t(e).removeClass("active"),void t(a).hide()):(t(e).addClass("active"),void t(a).show())},e.timer=function(){var e=0;return function(t,a){clearTimeout(e),e=setTimeout(t,a)}}(),e.init()};var NestedPages=NestedPages||{};NestedPages.Formatter=function(){var e=this,t=jQuery;e.updateSubMenuToggle=function(){for(var e=t(NestedPages.selectors.childToggle),a=0;a<e.length;a++){var s=e[a],n=t(s).parent(".row").parent("li");if(t(n).children("ol").length>0){var o=t(n).children("ol:visible").length>0?NestedPages.cssClasses.iconToggleDown:NestedPages.cssClasses.iconToggleRight;t(s).html('<div class="child-toggle-spacer"></div><a href="#"><i class="'+o+'"></i></a>'),t(n).children("ol").children(".np-hide").length>0&&0===t(n).children("ol").children(".np-hide.shown").length?t(s).find("a").hide():t(n).children("ol").children(".np-hide").length>0&&t(n).children("ol").children(".np-hide.shown").length>0&&t(s).find("a").show()}else t(s).empty().html('<div class="child-toggle-spacer"></div>')}},e.setBorders=function(){t(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),t.each(t(NestedPages.selectors.lists),function(){t(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},e.setNestedMargins=function(){t.each(t(NestedPages.selectors.lists),function(e,a){var s=t(this).parents(NestedPages.selectors.lists).length,n=0;if(NestedPages.jsData.sortable||(n=10),s>0){var n=20*s+n;return void t(this).find(".row-inner").css("padding-left",n+"px")}return NestedPages.jsData.sortable?void t(this).find(".row-inner").css("padding-left","0px"):void t(this).find(".row-inner").css("padding-left","10px")})},e.updatePlaceholderWidth=function(a){if(NestedPages.jsData.nestable){var s=t(a.placeholder).parents("ol").length,n=t(NestedPages.selectors.sortable).width(),o=40*s-40,i=n-o;t(a.placeholder).width(i).css("margin-left",o+"px")}e.updateListVisibility(a)},e.updateListVisibility=function(e){var a=t(e.placeholder).parent("ol");t(a).is(":visible")||(t(a).addClass("nplist"),t(a).show())},e.removeQuickEdit=function(){t(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),t(".sortable .quick-edit").remove(),t(".row").show()},e.showQuickEdit=function(){t("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){t(".np-inline-overlay").addClass("active")},50)},e.flashRow=function(a){t(a).addClass("np-updated"),e.setBorders(),setTimeout(function(){t(a).addClass("np-updated-show")},1500)},e.showAjaxError=function(e){t(NestedPages.selectors.ajaxError).find("p").text(e),t(NestedPages.selectors.ajaxError).show()},e.hideAjaxError=function(e){t(NestedPages.selectors.ajaxError).hide()},e.sizeLinkThumbnails=function(){var e=t(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),a=t(e).width(),s=t(e).height();t.each(t(NestedPages.selectors.thumbnailContainerLink),function(){t(this).width(a),t(this).height(s)})}};var NestedPages=NestedPages||{};NestedPages.CheckAll=function(){var e=this,t=jQuery;return e.activeCheckbox="",e.selectors={checkbox:"[data-np-check-all]"},e.bindEvents=function(){t(document).on("change",e.selectors.checkbox,function(){e.activeCheckbox=t(this),e.toggleCheckboxes()}),t(document).on("change","input[type=checkbox]",function(){e.checkAllStatus(t(this))})},e.init=function(){e.bindEvents()},e.toggleCheckboxes=function(){var a=!!t(e.activeCheckbox).is(":checked"),s=t(e.activeCheckbox).attr("data-np-check-all"),n=t('*[name="'+s+'"]');t.each(n,function(){var e=t(this).parents(NestedPages.selectors.rows);t(this).prop("checked",a),t(e).hasClass("np-hide")&&!t(e).is(":visible")&&t(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),e.toggleCheckAll()},e.toggleCheckAll=function(){var a=t(e.activeCheckbox).attr("data-np-check-all"),s=t('*[name="'+a+'"]').length,n=t(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length,o=t(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length;s=s-n+o;var i=t('*[name="'+a+'"]:checked').length;return s==i?(t(e.activeCheckbox).prop("checked",!0),void t(e.activeCheckbox).removeClass("check-all-partial")):i>0?void t(e.activeCheckbox).addClass("check-all-partial"):(t(e.activeCheckbox).attr("checked",!1),void t(e.activeCheckbox).removeClass("check-all-partial"))},e.checkAllStatus=function(a){var s=t(a).attr("name"),n=t('*[data-np-check-all="'+s+'"]');0!==n.length&&(e.activeCheckbox=t(n)[0],e.toggleCheckAll())},e.init()};var NestedPages=NestedPages||{};NestedPages.BulkActions=function(){var e=this,t=jQuery;return e.selectedNumber=0,e.selectedLinks=[],e.selectedPosts=[],e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleBulkForm()}),t(document).on("submit",NestedPages.selectors.bulkActionsForm,function(a){"edit"===t("select[name=np_bulk_action]").val()&&(a.preventDefault(),e.toggleBulkEdit(!0))}),t(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(a){a.preventDefault();var s=t(this).siblings("input[type=hidden]").val();e.uncheckBulkItem(s)}),t(document).on("click",NestedPages.selectors.bulkEditCancel,function(t){t.preventDefault(),e.uncheckAllBulkItems()})},e.toggleBulkForm=function(){var a=!1,s="",n="";return e.selectedPosts=[],e.selectedLinks=[],t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){if(t(this).is(":checked")){var o=t(this).parents(NestedPages.selectors.rows);if(a=!0,t(this).parent("div").hasClass("np-check-all")||t(o).hasClass("post-type-np-redirect")||(s+=t(this).val()+","),t(o).hasClass("post-type-np-redirect")&&(n+=t(this).val()+",",e.selectedLinks.push(t(this).val())),"np-redirect"!==t(this).attr("data-np-post-type")&&!t(this).parent("div").hasClass("np-check-all")){var i=[];i.title=t(this).attr("data-np-bulk-checkbox"),i.id=t(this).val(),e.selectedPosts.push(i)}}}),e.setBulkEditPosts(),e.toggleEditOption(),e.toggleLinkCountAlert(),a?(t(NestedPages.selectors.bulkActionsForm).show(),t(NestedPages.selectors.bulkActionsIds).val(s),t(NestedPages.selectors.bulkActionRedirectIds).val(n),void e.setSelectedNumber()):(t(NestedPages.selectors.bulkActionsIds).val(""),void t(NestedPages.selectors.bulkActionsForm).hide())},e.setBulkEditPosts=function(){for(var a="",s=0;s<e.selectedPosts.length;s++)a+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>×</a>',a+=e.selectedPosts[s].title,a+='<input type="hidden" name="post_ids[]" value="'+e.selectedPosts[s].id+'"></li>';t(NestedPages.selectors.bulkEditTitles).html(a)},e.uncheckBulkItem=function(a){t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){t(this).val()==a&&t(this).prop("checked",!1).change()}),0===t(NestedPages.selectors.bulkEditRemoveItem).length&&e.toggleBulkEdit(!1)},e.uncheckAllBulkItems=function(){t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){t(this).prop("checked",!1).change()}),e.toggleBulkEdit(!1)},e.setSelectedNumber=function(){var e=t(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,a=t(NestedPages.selectors.bulkActionsForm).find("select option").first();t(a).text(nestedpages.bulk_actions+" ("+e+")")},e.toggleEditOption=function(){var a=t(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,s=t(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");return 0===a?(t(s).prop("disabled",!0),t(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void e.toggleBulkEdit(!1)):void t(s).prop("disabled",!1)},e.toggleBulkEdit=function(a){return e.toggleLinkCountAlert(),a?(t(NestedPages.selectors.bulkEditForm).show(),t(NestedPages.selectors.bulkActionsForm).hide(),void e.setWPSuggest()):(t(NestedPages.selectors.bulkEditForm).hide(),t(NestedPages.selectors.bulkActionsForm).show(),t(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),t(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),void e.resetBulkEditFields())},e.toggleLinkCountAlert=function(){var a=e.selectedLinks.length;return 0===a?void t(NestedPages.selectors.bulkEditLinkCount).parent("div").hide():void t(NestedPages.selectors.bulkEditLinkCount).parent("div").show()},e.setWPSuggest=function(){var e=t(NestedPages.selectors.bulkEditForm).find("[data-autotag]");t.each(e,function(e,a){var s=t(this).attr("data-taxonomy");t(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+s,{multiple:!0,multipleSep:","})})},e.resetBulkEditFields=function(){var e=t(NestedPages.selectors.bulkEditForm).find("select");t.each(e,function(){t(this).find("option").first().prop("selected",!0)});var a=t(NestedPages.selectors.bulkEditForm).find(".cat-checklist");t.each(a,function(){t(this).find("input[type=checkbox]").prop("checked",!1)})},e.init()};var NestedPages=NestedPages||{};NestedPages.HiddenItemCount=function(){var e=this,t=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),t(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),t(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var e=0;return t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){if(t(this).is(":checked")){if(t(this).parent("div").hasClass("np-check-all"))return;var a=t(this).closest(".page-row");t(a).is(":visible")||e++}}),e<1?void t(NestedPages.selectors.hiddenItemCountParent).hide():(t(NestedPages.selectors.hiddenItemCount).text(e),void t(NestedPages.selectors.hiddenItemCountParent).show())},e.init()};var NestedPages=NestedPages||{};NestedPages.MenuToggle=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.bindEvents=function(){t(document).on("click",NestedPages.selectors.childToggleLink,function(a){a.preventDefault(),e.toggleSingleMenu(t(this))}),t(document).on("click",NestedPages.selectors.toggleAll,function(t){t.preventDefault(),e.toggleAllMenus()})},e.toggleSingleMenu=function(a){var s=t(a).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");t(a).find("i").toggleClass(NestedPages.cssClasses.iconToggleDown).toggleClass(NestedPages.cssClasses.iconToggleRight),t(s).toggle(),e.formatter.setBorders(),e.formatter.setNestedMargins(),e.syncUserToggles()},e.toggleAllMenus=function(){var a=NestedPages.selectors.toggleAll;return"closed"===t(a).attr("data-toggle")?(t(NestedPages.selectors.lists).show(),t(a).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),t(NestedPages.selectors.childToggle).find("i").removeClass(NestedPages.cssClasses.iconToggleRight).addClass(NestedPages.cssClasses.iconToggleDown),e.formatter.setBorders(),void e.syncUserToggles()):(t(NestedPages.selectors.lists).not(t(NestedPages.selectors.lists)[0]).hide(),t(a).attr("data-toggle","closed").text(NestedPages.jsData.expandText),t(NestedPages.selectors.childToggle).find("i").removeClass(NestedPages.cssClasses.iconToggleDown).addClass(NestedPages.cssClasses.iconToggleRight),e.formatter.setBorders(),void e.syncUserToggles())},e.visibleRowIDs=function(){var e=[],a=t(NestedPages.selectors.rows+":visible");return t.each(a,function(a,s){var n=t(this).attr("id");e.push(n.replace("menuItem_",""))}),e},e.syncUserToggles=function(){t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:e.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},e.bindEvents()};var NestedPages=NestedPages||{};NestedPages.PageToggle=function(){var e=this,t=jQuery;return e.activeButton="",e.formatter=new NestedPages.Formatter,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.toggleHidden,function(a){a.preventDefault(),e.activeButton=t(this),e.toggleHidden()}),t(document).on("click",NestedPages.selectors.toggleStatus,function(a){a.preventDefault(),e.toggleStatus(t(this))})},e.toggleHidden=function(){var a=t(e.activeButton),s=t(a).attr("href");return console.log(s),"#show"==s?(t(a).attr("href","#hide").text(NestedPages.jsData.showHiddenText),t(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),e.formatter.updateSubMenuToggle(),void e.formatter.setBorders()):void("#hide"==s&&(t(a).attr("href","#show").text(NestedPages.jsData.hideHiddenText),t(NestedPages.selectors.hiddenRows).addClass("shown").show(),e.formatter.updateSubMenuToggle(),e.formatter.setBorders()))},e.toggleStatus=function(e){var a=t(e).attr("href");return a=a.substring(1),t(NestedPages.selectors.syncCheckbox).attr("disabled",!1),t(NestedPages.selectors.toggleStatus).removeClass("active"),t(e).addClass("active"),"draft"==a&&(t(NestedPages.selectors.syncCheckbox).attr("disabled",!0),t("."+a).addClass("nested-visible")),"all"==a?void t(NestedPages.selectors.rows).show():(t(NestedPages.selectors.rows).hide(),void t("."+a).show())},e.init()};var NestedPages=NestedPages||{};NestedPages.Nesting=function(){var e=this,t=jQuery;e.formatter=new NestedPages.Formatter,e.initializeSortable=function(){maxLevels=NestedPages.jsData.nestable?0:1,t(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",maxLevels:maxLevels,tabSize:56,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(t,a){e.formatter.updatePlaceholderWidth(a)},stop:function(t,a){setTimeout(function(){e.formatter.updateSubMenuToggle(),e.formatter.setBorders(),e.formatter.setNestedMargins()},100),e.syncNesting()}})},e.disableNesting=function(){t(NestedPages.selectors.sortable).sortable("destroy")},e.syncNesting=function(a,s){if("1"!==nestedpages.manual_order_sync||a){t(NestedPages.selectors.errorDiv).hide(),t(NestedPages.selectors.loadingIndicator).show(),list=t(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}),e.disableNesting();var n=NestedPages.jsData.syncmenu;"1"===nestedpages.manual_menu_sync&&(n="nosync"),t.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:list,post_type:NestedPages.jsData.posttype,syncmenu:n},success:function(a,s){if(e.initializeSortable(),"error"===a.status)t(NestedPages.selectors.errorDiv).text(a.message).show(),t(NestedPages.selectors.loadingIndicator).hide();else{if(s&&"function"==typeof s)return void s();t(NestedPages.selectors.loadingIndicator).hide()}}})}}};var NestedPages=NestedPages||{};NestedPages.SyncMenuSetting=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&e.syncSetting()}),t(document).on("change",NestedPages.selectors.syncCheckbox,function(){e.syncSetting()})},e.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==t(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=t(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",t.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(t){"error"===t.status&&e.formatter.showAjaxError(t.message)}}))},e.bindEvents()};var NestedPages=NestedPages||{};NestedPages.NewPage=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.parent_id=0,e.posts="",e.form="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.openPageModal,function(t){t.preventDefault(),e.openModal()}),t(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),t(document).on("click",NestedPages.selectors.newPageSubmitButton,function(a){a.preventDefault(),e.submitForm(t(this))}),t(document).on("click",NestedPages.selectors.newPageTitle,function(a){a.preventDefault(),e.addTitleField(t(this))}),t(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(a){a.preventDefault(),e.removeTitleField(t(this))}),t(document).on("click",NestedPages.selectors.addChildButton,function(a){a.preventDefault(),e.openQuickEdit(t(this))}),t(NestedPages.selectors.newPageModal).on("hide.bs.modal",function(){e.cancelNewPage()}),t(NestedPages.selectors.newPageModal).on("shown.bs.modal",function(){e.modalOpened(t(this))}),t(document).on("click",NestedPages.selectors.cancelNewChildButton,function(a){a.preventDefault(),e.cancelNewPage(),t(NestedPages.selectors.newPageModal).modal("hide")})},e.openModal=function(){var a=t(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);t(a).addClass("in-modal"),t(NestedPages.selectors.newPageModal).find(".modal-body").html(a),t(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),t(NestedPages.selectors.newPageModal).find(".page_parent_id").val(e.parent_id),t(NestedPages.selectors.newPageModal).modal("show")},e.modalOpened=function(e){t(e).find(".np_title").focus(),t(e).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},e.openQuickEdit=function(a){var s=t(a).closest(NestedPages.selectors.row).parent("li"),n=t(NestedPages.selectors.newPageFormContainer).clone();if(t(s).children("ol").length>0){var o=t(s).children("ol");t(n).insertBefore(o)}else t(n).appendTo(s);t(n).siblings(NestedPages.selectors.row).hide(),e.formatter.showQuickEdit(),t(n).find(".parent_name").html("<em>Parent:</em> "+t(a).attr("data-parentname")),t(n).find(".page_parent_id").val(t(a).attr("data-id")),t(n).show(),t(n).find(".np_title").focus(),t(n).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},e.cancelNewPage=function(){e.formatter.removeQuickEdit(),t(NestedPages.selectors.newChildError).hide(),t(NestedPages.selectors.newPageModal).find(".modal-body").empty(),t(NestedPages.selectors.sortable).find(".new-child").remove(),t(NestedPages.selectors.row).show()},e.addTitleField=function(e){var a=t(e).parents("form"),s=t(e).siblings(".new-page-titles").children("li").length+1,n='<li><i class="handle np-icon-menu"></i><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="'+s+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';t(e).siblings(".new-page-titles").append(n);t(a).find(".np_title").last().focus(),t(a).find(NestedPages.selectors.newPageTitle).prop("tabindex",s++),t(".new-page-titles").sortable({items:"li",handle:".handle"})},e.removeTitleField=function(e){t(e).parents(".new-child-row").parent("li").remove()},e.submitForm=function(a){e.toggleLoading(!0),e.form=t(a).parents("form");var s=!!t(a).hasClass("add-edit");t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:t(e.form).serialize()+"&action="+NestedPages.formActions.newPage+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(a){if("error"===a.status)return e.toggleLoading(!1),void t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show();if(s===!0){var n=a.new_pages[0].edit_link;return n=n.replace(/&/g,"&"),void window.location.replace(n)}e.toggleLoading(!1),e.posts=a.new_pages,e.addPosts()},error:function(a){console.log(a),e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},e.addPosts=function(){var a=t(e.form).parent(".new-child").parent(".page-row");if(0===t(a).children("ol").length&&t(a).append('<ol class="nplist"></ol>'),t(e.form).hasClass("in-modal"))var s=t(".nplist.sortable li.page-row:first");else var s=t(a).children("ol");for(i=0;i<e.posts.length;i++)e.appendRows(s,e.posts[i]);t(s).show(),e.formatter.updateSubMenuToggle(),e.cancelNewPage(),t(NestedPages.selectors.newPageModal).modal("hide")},e.appendRows=function(e,a){var s='<li id="menuItem_'+a.id+'" class="page-row';"publish"===a.status&&(s+=" published"),s+='">',NestedPages.jsData.hierarchical?(s+='<div class="row">',s+='<div class="child-toggle"></div>'):(s+='<div class="row non-hierarchical">',s+='<div class="non-hierarchical-spacer"></div>'),s+='<div class="row-inner">',s+='<i class="np-icon-sub-menu"></i><i class="handle np-icon-menu"></i>',s+='<a href="'+a.edit_link+'" class="page-link page-title">',s+='<span class="title">'+a.title+"</span>",s+="Publish"!==a.status?'<span class="status">('+a.status+")</span>":'<span class="status"></span>',s+='<span class="nav-status">',"hide"===a.np_nav_status&&(s+=" "+nestedpages.hidden),s+="</span>",s+='<span class="edit-indicator"><i class="np-icon-pencil"></i>Edit</span>',s+="</a>",NestedPages.jsData.hierarchical||(s+='<div class="np-post-columns">',s+='<ul class="np-post-info">',s+='<li><span class="np-author-display">'+a.author_formatted+"</span></li>",s+="<li>"+a.date_formatted+"</li>",s+="</ul>",s+="</div>"),t(".nplist").first().hasClass("has-yoast")&&(s+='<span class="np-seo-indicator na"></span>'),s+='<div class="action-buttons">',s+='<a href="#" class="np-btn open-redirect-modal" data-parentid="'+a.id+'"><i class="np-icon-link"></i></a>',s+='<a href="#" class="np-btn add-new-child" data-id="'+a.id+'" data-parentname="'+a.title+'">'+nestedpages.add_child_short+"</a>",s+='<a href="#" class="np-btn np-quick-edit" data-id="'+a.id+'" data-template="'+a.page_template+'" data-title="'+a.title+'" data-slug="'+a.slug+'" data-commentstatus="closed" data-status="'+a.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+a.author+'" data-template="'+a.template+'" data-month="'+a.month+'" data-day="'+a.day+'" data-year="'+a.year+'" data-hour="'+a.hour+'" data-minute="'+a.minute+'" data-datepicker="'+a.datepicker+'" data-time="'+a.time+'" data-formattedtime="'+a.formattedtime+'" data-ampm="'+a.ampm+'">'+nestedpages.quick_edit+"</a>",s+='<a href="'+a.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",s+='<a href="'+a.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',s+="</div><!-- .action-buttons -->",s+="</div><!-- .row-inner --></div><!-- .row -->",s+="</li>",t(e).append(s)},e.toggleLoading=function(e){return e?(t(NestedPages.selectors.quickEditErrorDiv).hide(),t(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void t(NestedPages.selectors.quickEditLoadingIndicator).show()):(t(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),void t(NestedPages.selectors.quickEditLoadingIndicator).hide())},e.init()};var NestedPages=NestedPages||{};NestedPages.QuickEditPost=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.button="",e.initialData="",e.parent_li="",e.form="",e.flatTerms="",e.termNames="",e.saveButton="",e.newData="",e.row="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.quickEditOpen,function(a){a.preventDefault(),e.button=t(this),e.openForm()}),t(document).on("click",NestedPages.selectors.quickEditCancel,function(t){t.preventDefault(),e.formatter.removeQuickEdit()}),t(document).on("click",NestedPages.selectors.quickEditToggleTaxonomies,function(e){e.preventDefault(),t(this).parents("form").find(".np-taxonomies").toggle()}),t(document).on("click",NestedPages.selectors.quickEditToggleMenuOptions,function(e){e.preventDefault(),t(this).parents("form").find(".np-menuoptions").toggle()}),t(document).on("change",".keep_private",function(){this.checked?t(".post_password").val("").prop("readonly",!0):t(".post_password").prop("readonly",!1)}),t(document).on("click",NestedPages.selectors.quickEditSaveButton,function(a){a.preventDefault(),e.saveButton=t(this),e.save()}),t(document).on("keydown",function(t){27===t.keyCode&&e.formatter.removeQuickEdit()})},e.openForm=function(){e.setInitialData(),e.createForm(),e.populateForm(),e.populateFlatTaxonomies()},e.setInitialData=function(){e.initialData={id:t(e.button).attr("data-id"),title:t(e.button).attr("data-title"),slug:t(e.button).attr("data-slug"),author:t(e.button).attr("data-author"),cs:t(e.button).attr("data-commentstatus"),status:t(e.button).attr("data-status"),template:t(e.button).attr("data-template"),month:t(e.button).attr("data-month"),day:t(e.button).attr("data-day"),year:t(e.button).attr("data-year"),hour:t(e.button).attr("data-hour"),minute:t(e.button).attr("data-minute"),navstatus:t(e.button).attr("data-navstatus"),npstatus:t(e.button).attr("data-np-status"),navtitle:t(e.button).attr("data-navtitle"),navtitleattr:t(e.button).attr("data-navtitleattr"),navcss:t(e.button).attr("data-navcss"),linktarget:t(e.button).attr("data-linktarget"),password:t(e.button).attr("data-password"),datepicker:t(e.button).attr("data-datepicker"),time:t(e.button).attr("data-formattedtime"),timeTwentyFour:t(e.button).attr("data-time"),ampm:t(e.button).attr("data-ampm"),timeFormat:t(e.button).attr("data-timeformat")},e.initialData.h_taxonomies=[],e.initialData.f_taxonomies=[],e.parent_li=t(e.button).closest(NestedPages.selectors.row).parent("li");var a=t(e.parent_li).attr("class").split(/\s+/);for(i=0;i<a.length;i++)"in-"===a[i].substring(0,3)&&e.initialData.h_taxonomies.push(a[i]),"inf-"===a[i].substring(0,4)&&e.initialData.f_taxonomies.push(a[i])},e.createForm=function(){if(e.form=t(NestedPages.selectors.quickEditPostForm).clone(),t(e.parent_li).children("ol").length>0){var a=t(e.parent_li).children("ol");t(e.form).insertBefore(a)}else t(e.form).appendTo(e.parent_li);t(e.form).siblings(NestedPages.selectors.row).hide(),t(e.form).show()},e.populateForm=function(){if(t(e.form).find(".page_id").html("<em>ID:</em> "+e.initialData.id),t(e.form).find(".np_id").val(e.initialData.id),t(e.form).find(".np_title").val(e.initialData.title),t(e.form).find(".np_slug").val(e.initialData.slug),t(e.form).find(".np_author select").val(e.initialData.author),t(e.form).find(".np_status").val(e.initialData.status),t(e.form).find(".np_nav_title").val(e.initialData.navtitle),t(e.form).find(".np_title_attribute").val(e.initialData.navtitleattr),t(e.form).find(".np_nav_css_classes").val(e.initialData.navcss),t(e.form).find(".post_password").val(e.initialData.password),t(e.form).find(".np_datepicker").val(e.initialData.datepicker),"open"===e.initialData.cs&&t(e.form).find(".np_cs").attr("checked","checked"),""!==e.initialData.template?t(e.form).find(".np_template").val(e.initialData.template):t(e.form).find(".np_template").val("default"),"private"===e.initialData.status&&(t(e.form).find(".post_password").attr("readonly",!0),t(e.form).find(".keep_private").attr("checked",!0)),"hide"===e.initialData.npstatus?t(e.form).find(".np_status").attr("checked","checked"):t(e.form).find(".np_status").removeAttr("checked"),"hide"===e.initialData.navstatus?t(e.form).find(".np_nav_status").attr("checked","checked"):t(e.form).find(".np_nav_status").attr("checked",!1),"_blank"===e.initialData.linktarget?t(e.form).find(".link_target").attr("checked","checked"):t(e.form).find(".link_target").attr("checked",!1),"private"===e.initialData.status&&t(e.form).find(".np_status").val("publish"),"H:i"===e.initialData.timeFormat?t(e.form).find(".np_time").val(e.initialData.timeTwentyFour):(t(e.form).find(".np_time").val(e.initialData.time),t(e.form).find(".np_ampm").val(e.initialData.ampm),t(e.form).find('select[name="mm"]').val(e.initialData.month),t(e.form).find('input[name="jj"]').val(e.initialData.day),t(e.form).find('input[name="aa"]').val(e.initialData.year),t(e.form).find('input[name="hh"]').val(e.initialData.hour),t(e.form).find('input[name="mn"]').val(e.initialData.minute)),e.initialData.hasOwnProperty("h_taxonomies")){var a=e.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];t(e.form).find(s).attr("checked","checked")}}t(e.form).find(".np_datepicker").datepicker({beforeShow:function(e,a){t("#ui-datepicker-div").addClass("nestedpages-datepicker")}}),e.formatter.showQuickEdit(),t(e.form).show()},e.populateFlatTaxonomies=function(){e.initialData.hasOwnProperty("f_taxonomies")&&(e.createTaxonomyObject(),e.getTermNames(),e.setWPSuggest())},e.createTaxonomyObject=function(){var t={};for(i=0;i<e.initialData.f_taxonomies.length;i++){var a=e.initialData.f_taxonomies[i],s=a.split("-"),n=s.indexOf("nps"),o=s.splice(n+1);o=o.join("-");var r=a.split("-").splice(0,n);r.shift("inf");var d=r.join("-");d in t||(t[d]=[]);var l=t[d];l.push(o)}e.flatTerms=t},e.getTermNames=function(){t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:e.flatTerms},success:function(t){e.termNames=t.terms,e.populateFlatTaxonomyFields()}})},e.populateFlatTaxonomyFields=function(){e.termNames&&t.each(e.termNames,function(e,a){var s=t("#"+e+"-quickedit");t(s).val(a.join(","))})},e.setWPSuggest=function(){var a=t(e.form).find("[data-autotag]");t.each(a,function(e,a){var s=t(this).attr("data-taxonomy");t(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+s,{multiple:!0,multipleSep:","})})},e.save=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:t(e.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(a){"error"===a.status?(e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show()):(e.toggleLoading(!1),e.newData=a.post_data,e.updatePostRow())},error:function(e){console.log(e)}})},e.updatePostRow=function(){e.row=t(e.button).parents(".row-inner"),t(e.row).find(".title").text(e.newData.post_title),t(e.row).find(".np-view-button").attr("href",e.newData.permalink);var a=t(e.row).find(".status");if("publish"!==e.newData._status&&"future"!==e.newData._status?t(a).text("("+e.newData._status+")"):"private"===e.newData.keep_private?t(a).text("("+e.newData.keep_private+")"):t(a).text(""),""!==e.newData.post_password&&"undefined"!=typeof e.newData.post_password){var s=t(a).text();s+=' <i class="np-icon-lock"></i>',t(a).html(s)}var n=t(e.row).find(".nav-status");"hide"==e.newData.nav_status?t(n).text("(Hidden)"):t(n).text("");var o=t(e.row).parent("li");"hide"==e.newData.np_status?(t(o).addClass("np-hide"),t(e.row).find(".status").after('<i class="np-icon-eye-blocked"></i>')):(t(o).removeClass("np-hide"),t(e.row).find(".np-icon-eye-blocked").remove()),NestedPages.jsData.hierarchical||t(e.row).find(".np-author-display").text(e.newData.author_name);var i=t(e.row).find(NestedPages.selectors.quickEditOpen);t(i).attr("data-id",e.newData.post_id),t(i).attr("data-template",e.newData.page_template),t(i).attr("data-title",e.newData.post_title),t(i).attr("data-slug",e.newData.post_name),t(i).attr("data-commentstatus",e.newData.comment_status),t(i).attr("data-status",e.newData._status),"private"===e.newData.keep_private&&t(i).attr("data-status","private"),t(i).attr("data-author",e.newData.post_author),t(i).attr("data-np-status",e.newData.np_status),
|
2 |
-
t(i).attr("data-password",e.newData.post_password),t(i).attr("data-navstatus",e.newData.nav_status),t(i).attr("data-navtitle",e.newData.np_nav_title),t(i).attr("data-linktarget",e.newData.link_target),t(i).attr("data-navtitleattr",e.newData.np_title_attribute),t(i).attr("data-navcss",e.newData.np_nav_css_classes),t(i).attr("data-month",e.newData.mm),t(i).attr("data-day",e.newData.jj),t(i).attr("data-year",e.newData.aa),t(i).attr("data-hour",e.newData.hh),t(i).attr("data-minute",e.newData.mn),t(i).attr("data-datepicker",e.newData.np_date),t(i).attr("data-time",e.newData.np_time),t(i).attr("data-formattedtime",e.newData.np_time),t(i).attr("data-ampm",e.newData.np_ampm),e.removeTaxonomyClasses(),e.addCategoryClasses(),e.addHierarchicalClasses(),e.addFlatClasses(),e.addStatusClass(),e.formatter.removeQuickEdit(),e.formatter.flashRow(e.row)},e.addStatusClass=function(){var a=["published","draft","pending","future"];for(i=0;i<a.length;i++)t(e.row).removeClass(a[i]);t(e.row).addClass(e.newData._status)},e.removeTaxonomyClasses=function(){taxonomies=[];var a=t(e.row).attr("class").split(/\s+/);for(i=0;i<a.length;i++)"in-"===a[i].substring(0,3)&&t(e.row).removeClass(a[i]),"inf-"===a[i].substring(0,4)&&t(e.row).removeClass(a[i])},e.addCategoryClasses=function(){if(e.newData.hasOwnProperty("post_category")){var a=e.newData.post_category;for(i=0;i<a.length;i++){var s="in-category-"+a[i];t(e.row).addClass(s)}}},e.addHierarchicalClasses=function(){if(e.newData.hasOwnProperty("tax_input")){var a=e.newData.tax_input;t.each(a,function(a,s){for(i=0;i<s.length;i++){var n="in-"+a+"-"+s[i];t(e.row).addClass(n)}})}},e.addFlatClasses=function(){if(e.newData.hasOwnProperty("flat_tax")){var a=e.newData.flat_tax;t.each(a,function(a,s){for(i=0;i<s.length;i++){var n="inf-"+a+"-nps-"+s[i];t(e.row).addClass(n)}})}},e.toggleLoading=function(a){return a?(t(NestedPages.selectors.quickEditErrorDiv).hide(),t(e.saveButton).attr("disabled","disabled"),void t(NestedPages.selectors.quickEditLoadingIndicator).show()):(t(e.saveButton).attr("disabled",!1),void t(NestedPages.selectors.quickEditLoadingIndicator).hide())},e.init()};var NestedPages=NestedPages||{};NestedPages.QuickEditLink=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.button="",e.postData="",e.newPostData="",e.form="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.quickEditButtonLink,function(a){a.preventDefault(),e.formatter.removeQuickEdit(),e.button=t(this),e.openQuickEdit()}),t(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(t){t.preventDefault(),e.submitForm()}),t(document).on("keydown",function(t){27===t.keyCode&&e.formatter.removeQuickEdit()})},e.openQuickEdit=function(){e.setData(),e.createForm(),e.populateForm()},e.setData=function(){e.postData={id:t(e.button).attr("data-id"),url:t(e.button).attr("data-url"),title:t(e.button).attr("data-title"),status:t(e.button).attr("data-status"),navstatus:t(e.button).attr("data-navstatus"),npstatus:t(e.button).attr("data-np-status"),linktarget:t(e.button).attr("data-linktarget"),parentid:t(e.button).attr("data-parentid"),navtitleattr:t(e.button).attr("data-navtitleattr"),navcss:t(e.button).attr("data-navcss"),navtype:t(e.button).attr("data-nav-type"),navobject:t(e.button).attr("data-nav-object"),navobjectid:t(e.button).attr("data-nav-object-id"),navoriginallink:t(e.button).attr("data-nav-original-link"),navoriginaltitle:t(e.button).attr("data-nav-original-title")}},e.createForm=function(){var a=t(e.button).closest(NestedPages.selectors.row).parent("li");if(e.form=t(NestedPages.selectors.quickEditLinkForm).clone(),t(a).children("ol").length>0){var s=t(a).children("ol");t(e.form).insertBefore(s)}else t(e.form).appendTo(a);t(e.form).siblings(NestedPages.selectors.row).hide()},e.populateForm=function(){if(t(e.form).find(".np_id").val(e.postData.id),t(e.form).find(".np_title").val(e.postData.title),t(e.form).find(".np_author select").val(e.postData.author),t(e.form).find(".np_status").val(e.postData.status),t(e.form).find(".np_content").val(e.postData.url),t(e.form).find(".np_parent_id").val(e.postData.parentid),t(e.form).find(".np_title_attribute").val(e.postData.navtitleattr),t(e.form).find(".np_nav_css_classes").val(e.postData.navcss),"hide"===e.postData.npstatus?t(e.form).find(".np_status").prop("checked","checked"):t(e.form).find(".np_status").removeAttr("checked"),"hide"===e.postData.navstatus?t(e.form).find(".np_nav_status").prop("checked","checked"):t(e.form).find(".np_nav_status").removeAttr("checked"),"_blank"===e.postData.linktarget?t(e.form).find(".link_target").prop("checked","checked"):t(e.form).find(".link_target").removeAttr("checked"),"custom"!==e.postData.navobject&&""!==e.postData.navobject){var a='<div class="form-control original-link">Original: <a href="'+e.postData.navoriginallink+'" target="_blank">'+e.postData.navoriginaltitle+"</a></div>";t(e.form).find("[data-url-field]").remove(),t(a).insertAfter(t(e.form).find("h3")),t(e.form).find("[data-np-menu-object-input]").val(e.postData.navobject),t(e.form).find("[data-np-menu-objectid-input]").val(e.postData.navobjectid),t(e.form).find("[data-np-menu-type-input]").val(e.postData.navtype),t(e.form).find("h3").text("Link: "+e.postData.navoriginaltitle)}else t(e.form).find("h3").text("Link"),t(e.form).find("[data-np-menu-object-input]").val("custom"),t(e.form).find("[data-np-menu-type-input]").val("custom");e.formatter.showQuickEdit(),t(e.form).show()},e.submitForm=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:t(e.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(a){"error"===a.status?(e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show()):(e.toggleLoading(!1),e.newPostData=a.post_data,e.updateRow())},error:function(a){e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},e.updateRow=function(){console.log(e.newPostData);var a=t(e.form).siblings(".row");t(a).find(".title").html(e.newPostData.post_title+' <i class="np-icon-link"></i>');var s=t(a).find(".status");"publish"!==e.newPostData._status&&"future"!==e.newPostData._status?t(s).text("("+e.newPostData._status+")"):t(s).text("");var n=t(a).find(".nav-status");"hide"==e.newPostData.nav_status?t(n).text("("+NestedPages.jsData.hiddenText+")"):t(n).text("");var o=t(a).parent("li");"hide"==e.newPostData.np_status?(t(o).addClass("np-hide"),t(a).find(".status").after('<i class="np-icon-eye-blocked"></i>')):(t(o).removeClass("np-hide"),t(a).find(".np-icon-eye-blocked").remove());var i=t(a).find(NestedPages.selectors.quickEditButtonLink);t(i).attr("data-id",e.newPostData.post_id),t(i).attr("data-title",e.newPostData.post_title),t(i).attr("data-url",e.newPostData.post_content),t(i).attr("data-status",e.newPostData._status),t(i).attr("data-navstatus",e.newPostData.nav_status),t(i).attr("data-np-status",e.newPostData.np_status),t(i).attr("data-linkTarget",e.newPostData.linkTarget),t(i).attr("data-navtitleattr",e.newPostData.titleAttribute),t(i).attr("data-navcss",e.newPostData.cssClasses),e.formatter.removeQuickEdit(),e.formatter.flashRow(a)},e.toggleLoading=function(e){return t(".row").removeClass("np-updated").removeClass("np-updated-show"),e?(t(NestedPages.selectors.quickEditErrorDiv).hide(),t(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void t(NestedPages.selectors.quickEditLoadingIndicator).show()):(t(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),void t(NestedPages.selectors.quickEditLoadingIndicator).hide())},e.init()};var NestedPages=NestedPages||{};NestedPages.Clone=function(){var e=this,t=jQuery;return e.parent_id="",e.parent_title="",e.parentLi=null,e.formatter=new NestedPages.Formatter,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.cloneButton,function(a){a.preventDefault(),e.parent_id=t(this).attr("data-id"),e.parent_title=t(this).attr("data-parentname"),e.parentLi=t(this).parent(".row").parent(".page-row").parent(".npList"),e.openModal()}),t(document).on("click",NestedPages.selectors.confirmClone,function(t){t.preventDefault(),e.clone()})},e.openModal=function(){t(NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(e.parent_title),t(NestedPages.selectors.cloneModal).modal("show")},e.clone=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:e.parent_id,quantity:t(NestedPages.selectors.cloneQuantity).val(),status:t(NestedPages.selectors.cloneStatus).val(),author:t(NestedPages.selectors.cloneAuthor).find("select").val(),nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(a){e.toggleLoading(!1),t(NestedPages.selectors.cloneModal).modal("hide"),location.reload()}})},e.toggleLoading=function(e){return e?(t(NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void t(NestedPages.selectors.confirmClone).attr("disabled","disabled")):(t(NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),void t(NestedPages.selectors.confirmClone).attr("disabled",!1))},e.init()};var NestedPages=NestedPages||{};NestedPages.Tabs=function(){var e=this,t=jQuery;return e.activeContent="",e.activeButton="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.tabButton,function(a){a.preventDefault(),e.activeButton=t(this),e.toggleTabs()})},e.toggleTabs=function(){e.activeContent=t(e.activeButton).attr("href"),t(NestedPages.selectors.tabContent).hide(),t(e.activeContent).show(),t(e.activeButton).parents(NestedPages.selectors.tabButtonParent).find(NestedPages.selectors.tabButton).removeClass("active"),t(e.activeButton).addClass("active")},e.init()},jQuery(document).ready(function(){new NestedPages.Factory});var NestedPages=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]",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",quickEditToggleTaxonomies:".np-toggle-taxonomies",quickEditToggleMenuOptions:".np-toggle-menuoptions",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",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={iconToggleDown:"np-icon-arrow-down",iconToggleRight:"np-icon-arrow-right",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",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch"},NestedPages.Factory=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.responsive=new NestedPages.Responsive,e.checkAll=new NestedPages.CheckAll,e.bulkActions=new NestedPages.BulkActions,e.menuToggle=new NestedPages.MenuToggle,e.pageToggle=new NestedPages.PageToggle,e.nesting=new NestedPages.Nesting,e.syncMenuSetting=new NestedPages.SyncMenuSetting,e.newPage=new NestedPages.NewPage,e.quickEditLink=new NestedPages.QuickEditLink,e.quickEditPost=new NestedPages.QuickEditPost,e.clone=new NestedPages.Clone,e.tabs=new NestedPages.Tabs,e.menuLinks=new NestedPages.MenuLinks,e.hiddenItemCount=new NestedPages.HiddenItemCount,e.confirmDelete=new NestedPages.ConfirmDelete,e.manualSync=new NestedPages.ManualSync,e.postSearch=new NestedPages.PostSearch,e.init=function(){nestedpages.settings_page||(e.bindEvents(),e.setPostType(),e.setMenuSync(),e.setNestable(),e.setSortable(),e.formatter.updateSubMenuToggle(),e.formatter.setBorders(),e.formatter.setNestedMargins(),e.nesting.initializeSortable())},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.quickEditOverlay,function(t){e.formatter.removeQuickEdit(),e.newPage.cancelNewPage()}),t(document).ready(function(){e.formatter.hideAjaxError(),e.formatter.sizeLinkThumbnails()})},e.setNestable=function(){var e=!1;t.each(NestedPages.jsData.allPostTypes,function(t,a){a.name===NestedPages.jsData.posttype&&(a.hierarchical===!0&&(e=!0),a.disable_nesting===!0&&(e=!1))}),NestedPages.jsData.nestable=e},e.setSortable=function(){var e=!0;t.each(NestedPages.jsData.allPostTypes,function(t,a){a.name===NestedPages.jsData.posttype&&"undefined"!=typeof a.disable_sorting&&""!==a.disable_sorting&&"true"===a.disable_sorting&&(e=!1)}),NestedPages.jsData.sortable=e},e.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,"undefined"!=typeof NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=t(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},e.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},e.init()};var NestedPages=NestedPages||{};NestedPages.MenuLinks=function(){var e=this,t=jQuery;return e.typeButton="",e.post="",e.formatter=new NestedPages.Formatter,e.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]"},e.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]"},e.search=new NestedPages.MenuSearch,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.openLinkModal,function(a){a.preventDefault(),e.postParent=t(this).attr("data-parentid"),t(e.selectors.form).find(".parent_id").val(t(this).attr("data-parentid")),e.openModal()}),t(document).on("click",e.selectors.accordionItem,function(a){a.preventDefault(),e.accordion(t(this))}),t(document).on("click",e.selectors.typeSelect,function(a){a.preventDefault(),e.typeButton=t(this),e.setLinkType()}),t(document).on("keyup",e.fields.navigationLabel,function(){e.updateTitle()}),t(document).on("click",e.selectors.saveButton,function(t){t.preventDefault(),e.submitForm()}),t(document).on("keydown",function(e){27===e.keyCode&&t("#np-link-modal").modal("hide")})},e.openModal=function(){t(NestedPages.selectors.linkErrorDiv).hide(),t(NestedPages.selectors.linkModal).find("input").val(""),t(NestedPages.selectors.linkModal).find(".parent_id").val(e.postParent),e.clearForm(),t(e.selectors.accordion).find("ul").hide(),t(e.selectors.typeSelect).removeClass("active"),t(NestedPages.selectors.linkModal).modal("show")},e.accordion=function(a){e.clearForm();var s=t(a).siblings("ul");return t(s).is(":visible")?(t(a).removeClass("active"),void t(s).slideUp("fast")):(t(e.selectors.accordionItem).removeClass("active"),t(a).addClass("active"),t(a).parents(e.selectors.accordion).find("ul").slideUp("fast"),void t(s).slideDown("fast"))},e.setLinkType=function(){return t(e.typeButton).hasClass("active")?void e.clearForm():(t(e.typeButton).hasClass("np-custom-link")&&(t(e.selectors.accordionItem).removeClass("active"),t(e.selectors.accordion).find("ul").slideUp("fast")),t(e.selectors.formPlaceholder).hide(),void e.populateForm())},e.populateForm=function(){t(e.selectors.saveButton).show(),t(e.selectors.typeSelect).removeClass("active"),t(e.typeButton).addClass("active"),t(e.fields.menuTitle).text(t(e.typeButton).text()).val(t(e.typeButton).text()),t(e.selectors.form).find("h3").find("em").text(t(e.typeButton).attr("data-np-object-name")),""!==t(e.typeButton).attr("data-np-permalink")?(t(e.selectors.form).find(e.selectors.urlInputCont).hide(),t(e.selectors.form).find(e.selectors.originalLink).html('<a href="'+t(e.typeButton).attr("data-np-permalink")+'">'+t(e.typeButton).text()+"</a>"),t(e.selectors.form).find(e.selectors.originalLink).parent(".original-link").show()):(t(e.selectors.form).find(e.selectors.urlInputCont).show(),t(e.selectors.form).find(e.selectors.originalLink).parent(".original-link").hide()),t(e.fields.object).val(t(e.typeButton).attr("data-np-menu-object")),t(e.fields.objectid).val(t(e.typeButton).attr("data-np-menu-objectid")),t(e.fields.itemType).val(t(e.typeButton).attr("data-np-menu-type")),t(e.selectors.formDetails).show()},e.clearForm=function(){t(e.selectors.form).find(e.selectors.errorDiv).hide(),t(e.selectors.saveButton).hide(),t(e.selectors.formDetails).hide(),t(e.selectors.formPlaceholder).show(),t(e.selectors.form).find("input").not(".parent_id").val(""),t(e.selectors.form).find(e.fields.linkTarget).val("_blank"),t(e.selectors.form).find('input[type="checkbox"]').attr("checked",!1),t(e.selectors.typeSelect).removeClass("active"),e.search.toggleLoading(!1),t(e.selectors.searchResults).remove(),t(e.selectors.defaultResults).show()},e.updateTitle=function(){var a=t(e.fields.navigationLabel).val(),s=t(e.selectors.form).find("h3").find("span");""!==a?(t(e.fields.menuTitle).val(a),t(s).text(a)):(t(e.fields.menuTitle).val(t(e.typeButton).text()),t(s).text(t(e.typeButton).text()))},e.submitForm=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:t(e.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(a){return e.toggleLoading(!1),"error"===a.status?void t(e.selectors.form).find(e.selectors.errorDiv).text(a.message).show():(e.post=a.post_data,void e.createRow())},error:function(e){console.log(e)}})},e.createRow=function(){var a='<li id="menuItem_'+e.post.id+'" class="page-row published';a+='">',a+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner"><i class="np-icon-sub-menu"></i><i class="handle np-icon-menu"></i><a href="'+e.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+e.post.menuTitle+' <i class="np-icon-link"></i></span>',a+='</a><a href="#" class="np-toggle-edit"><i class="np-icon-pencil"></i></a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',a+='data-id="'+e.post.id+'"',a+='data-parentid="'+e.post.parent_id+'"',a+='data-title="'+e.post.menuTitle+'" ',a+='data-url="'+e.post.url+'" ',a+='data-status="publish" ',a+='data-np-status="show" ',a+='data-navstatus="show" ',a+='data-navcss="'+e.post.cssClasses+'" ',a+='data-navtitleattr="'+e.post.titleAttribute+'" ',a+='data-nav-type="'+e.post.menuType+'" ',a+='data-nav-object="'+e.post.objectType+'" ',a+='data-nav-object-id="'+e.post.objectId+'" ',a+='data-nav-original-link="'+e.post.original_link+'" ',a+='data-nav-original-title="'+e.post.original_title+'" ',a+='data-linktarget="'+e.post.link_target+'">',a+=NestedPages.jsData.quickEditText,a+="</a>",a+='<a href="'+e.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',a+="</div></div></div></li>","0"===e.post.parent_id?t(".nplist:first li:first").after(a):e.appendChildRow(a),t(NestedPages.selectors.linkModal).modal("hide"),e.row=t("#menuItem_"+e.post.id).find(".row"),e.formatter.flashRow(e.row)},e.appendChildRow=function(a){var s=t("#menuItem_"+e.post.parent_id);0===t(s).children("ol").length?(a='<ol class="sortable nplist" style="display:block;">'+a+"</ol>",t(s).append(a)):t(s).find("ol:first").prepend(a),e.formatter.updateSubMenuToggle()},e.toggleLoading=function(a){return a?(t(e.selectors.form).find(e.selectors.errorDiv).hide(),t(e.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void t(e.selectors.saveButton).attr("disabled","disabled")):(t(e.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),void t(e.selectors.saveButton).attr("disabled",!1))},e.init()};var NestedPages=NestedPages||{};NestedPages.MenuSearch=function(){var e=this,t=jQuery;return e.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]"},e.activeForm="",e.results="",e.defaultResults="",e.searchType="",e.searchObject="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("keyup",e.selectors.searchForms,function(){e.activeForm=t(this),t(e.selectors.searchResults).remove(),e.performSearch()})},e.performSearch=function(){return e.defaultResults=t(e.activeForm).parent("li").siblings(e.selectors.defaultResults),t(e.activeForm).val().length>2?(t(e.defaultResults).hide(),e.toggleLoading(!0),void e.query()):(e.toggleLoading(!1),void t(e.defaultResults).show())},e.query=function(){e.searchType=t(e.activeForm).attr(e.selectors.searchType),e.searchObject=t(e.activeForm).attr(e.selectors.searchObject),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:t(e.activeForm).val(),searchType:e.searchType,searchObject:e.searchObject},success:function(a){console.log(a),a.results?(e.results=a.results,e.toggleLoading(!1),"post_type"===e.searchType?e.appendPosts():e.appendTaxonomies()):(e.toggleLoading(!1),t(e.activeForm).siblings(e.selectors.noResults).show())}})},e.appendPosts=function(){var a="";t.each(e.results,function(t,s){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+e.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+s.ID+'" data-np-permalink="'+s.permalink+'" data-np-object-name="'+s.singular_name+'" data-np-menu-selection>'+s.post_title+"</a></li>"}),t(a).insertAfter(t(e.activeForm).parent("li")),e.toggleLoading(!1)},e.appendTaxonomies=function(){var a="";t.each(e.results,function(t,s){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+e.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+s.term_id+'" data-np-permalink="'+s.permalink+'" data-np-object-name="'+s.taxonomy+'" data-np-menu-selection>'+s.name+"</a></li>"}),t(a).insertAfter(t(e.activeForm).parent("li")),e.toggleLoading(!1)},e.toggleLoading=function(a){var s=t(e.activeForm).siblings(e.selectors.loadingIndicator);return t(e.selectors.noResults).hide(),a?void t(s).show():void t(s).hide()},e.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPagesTrash=function(){var e=this,t=jQuery;return e.trashButton=".np-empty-trash",e.confirmButton=".np-trash-confirm",e.warningModal="#np-trash-modal",e.errorAlert="#np-error",e.loadingIndicator="#nested-loading",e.trashLinks=".np-trash-links",e.postType=t("#np-trash-posttype").val(),e.nonce=nestedpages.np_nonce,e.formAction="npEmptyTrash",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",e.trashButton,function(a){a.preventDefault(),t(e.warningModal).modal("show")}),t(document).on("click",e.confirmButton,function(t){t.preventDefault(),e.confirmEmpty()})},e.confirmEmpty=function(){e.loading(!0),t(e.warningModal).hide(),t(e.errorAlert).hide(),e.emptyTrash()},e.emptyTrash=function(){t.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:e.formAction,nonce:e.nonce,posttype:e.postType},success:function(a){e.loading(!1),"error"===a.status?t(e.errorAlert).text(a.message).show():t(e.trashLinks).hide()}})},e.loading=function(a){return a?void t(e.loadingIndicator).show():void t(e.loadingIndicator).hide()},e.init()},NestedPages=NestedPages||{};NestedPages.ConfirmDelete=function(){var e=this,t=jQuery;return e.deleteLink="",e.bindEvents=function(){t(document).on("click",NestedPages.selectors.linkDeleteButton,function(a){a.preventDefault(),e.confirmSingle(t(this))}),t(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(a){return a.preventDefault(),t(this).hasClass("bulk")?void e.deleteMultiple():void e.deleteSingle()}),t(document).on("submit",NestedPages.selectors.bulkActionsForm,function(t){e.confirmMultiple(t)})},e.confirmSingle=function(a){e.deleteLink=t(a).attr("href"),t(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),t(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),t(NestedPages.selectors.linkDeleteConfirmationModal).modal("show")},e.confirmMultiple=function(e){if("trash"===t('select[name="np_bulk_action"]').val()){var a=t(NestedPages.selectors.bulkActionRedirectIds).val();""!==a&&(e.preventDefault(),t(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),t(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),t(NestedPages.selectors.linkDeleteConfirmationModal).modal("show"))}},e.deleteMultiple=function(){t(NestedPages.selectors.bulkActionsForm)[0].submit()},e.deleteSingle=function(){window.location.replace(e.deleteLink)},e.bindEvents()};var NestedPages=NestedPages||{};NestedPages.ManualSync=function(){var e=this,t=jQuery;return e.activeBtn="",e.bindEvents=function(){t(document).on("click",NestedPages.selectors.manualMenuSync,function(a){a.preventDefault(),e.activeBtn=t(this),e.syncMenu()}),t(document).on("click",NestedPages.selectors.manualOrderSync,function(a){a.preventDefault(),e.activeBtn=t(this),e.syncOrder()})},e.syncMenu=function(){e.loading(!0),t.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(a){"error"===a.status?(t(NestedPages.selectors.errorDiv).text(a.message).show(),t(NestedPages.selectors.loadingIndicator).hide()):e.loading(!1)}})},e.syncOrder=function(){e.loading(!0);var t=new NestedPages.Nesting;t.syncNesting(!0,e.loading(!1))},e.loading=function(a){return a?(t(e.activeBtn).addClass("disabled"),void t(NestedPages.selectors.loadingIndicator).show()):(t(e.activeBtn).removeClass("disabled"),void t(NestedPages.selectors.loadingIndicator).hide())},e.bindEvents()};var NestedPages=NestedPages||{};NestedPages.PostSearch=function(){var e=this,t=jQuery;return e.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"},e.changed=!1,e.activeInput="",e.results="",e.defaultResults="",e.postType="",e.activeForm="",e.bindEvents=function(){t("["+e.selectors.input+"]").on("input",function(){return e.activeInput=t(this),e.setOptions(),e.changed||e.setDefaultResults(),""===t(this).val()?(t(e.activeForm).find("["+e.selectors.noResults+"]").hide(),void e.showDefaultResults()):void e.query()})},e.setDefaultResults=function(){e.defaultResults=t(e.activeForm).find("["+e.selectors.results+"]").html(),e.changed=!0},e.showDefaultResults=function(){t(e.activeForm).find("["+e.selectors.results+"]").html(e.defaultResults)},e.setOptions=function(){e.postType=t(e.activeInput).attr(e.selectors.input),e.activeForm=t(e.activeInput).parents("["+e.selectors.form+"]")},e.performSearch=function(){return e.defaultResults=t(e.activeForm).parent("li").siblings(e.selectors.defaultResults),t(e.activeForm).val().length>2?(t(e.defaultResults).hide(),e.toggleLoading(!0),void e.query()):(e.toggleLoading(!1),void t(e.defaultResults).show())},e.query=function(){t(e.activeForm).find("["+e.selectors.results+"]").empty(),e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:t(e.activeInput).val(),postType:e.postType},success:function(a){a.results?(e.results=a.results,e.loadResults(),e.toggleLoading(!1)):(e.toggleLoading(!1),t(e.activeForm).find("["+e.selectors.noResults+"]").show())}})},e.loadResults=function(){var a="<ul>";t.each(e.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>",t(e.activeForm).find("["+e.selectors.results+"]").html(a),e.toggleLoading(!1)},e.toggleLoading=function(a){var s=t(e.activeForm).find("["+e.selectors.loadingIndicator+"]"),n=t(e.activeForm).find("["+e.selectors.noResults+"]");return t(n).hide(),a?void t(s).show():void t(s).hide()},e.bindEvents()};
|
1 |
+
var NestedPages=NestedPages||{};NestedPages.Responsive=function(){var e=this,t=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.toggleEditButtons,function(a){a.preventDefault(),e.toggleEdit(t(this))}),t(window).resize(function(){e.timer(function(){t(".action-buttons").removeAttr("style"),t(".np-toggle-edit").removeClass("active")},500)})},e.toggleEdit=function(e){var a=t(e).siblings(".action-buttons");if(t(a).is(":visible"))return t(e).removeClass("active"),void t(a).hide();t(e).addClass("active"),t(a).show()},e.timer=function(){var e=0;return function(t,a){clearTimeout(e),e=setTimeout(t,a)}}(),e.init()},(NestedPages=NestedPages||{}).Formatter=function(){var e=this,t=jQuery;e.updateSubMenuToggle=function(){for(var e=t(NestedPages.selectors.childToggle),a=0;a<e.length;a++){var s=e[a],n=t(s).parent(".row").parent("li");if(t(n).children("ol").length>0){var o=t(n).children("ol:visible").length>0?NestedPages.cssClasses.iconToggleDown:NestedPages.cssClasses.iconToggleRight;t(s).html('<div class="child-toggle-spacer"></div><a href="#"><i class="'+o+'"></i></a>'),t(n).children("ol").children(".np-hide").length>0&&0===t(n).children("ol").children(".np-hide.shown").length?t(s).find("a").hide():t(n).children("ol").children(".np-hide").length>0&&t(n).children("ol").children(".np-hide.shown").length>0&&t(s).find("a").show()}else t(s).empty().html('<div class="child-toggle-spacer"></div>')}},e.setBorders=function(){t(NestedPages.selectors.rows).removeClass(NestedPages.cssClasses.noborder),t.each(t(NestedPages.selectors.lists),function(){t(this).find(".page-row:visible:first").addClass(NestedPages.cssClasses.noborder)})},e.setNestedMargins=function(){t.each(t(NestedPages.selectors.lists),function(e,a){var s=t(this).parents(NestedPages.selectors.lists).length,n=0;if(NestedPages.jsData.sortable||(n=10),s>0){n=20*s+n;t(this).find(".row-inner").css("padding-left",n+"px")}else NestedPages.jsData.sortable?t(this).find(".row-inner").css("padding-left","0px"):t(this).find(".row-inner").css("padding-left","10px")})},e.updatePlaceholderWidth=function(a){if(NestedPages.jsData.nestable){var s=40*t(a.placeholder).parents("ol").length-40,n=t(NestedPages.selectors.sortable).width()-s;t(a.placeholder).width(n).css("margin-left",s+"px")}e.updateListVisibility(a)},e.updateListVisibility=function(e){var a=t(e.placeholder).parent("ol");t(a).is(":visible")||(t(a).addClass("nplist"),t(a).show())},e.removeQuickEdit=function(){t(NestedPages.selectors.quickEditOverlay).removeClass("active").remove(),t(".sortable .quick-edit").remove(),t(".row").show()},e.showQuickEdit=function(){t("body").append('<div class="np-inline-overlay"></div>'),setTimeout(function(){t(".np-inline-overlay").addClass("active")},50)},e.flashRow=function(a){t(a).addClass("np-updated"),e.setBorders(),setTimeout(function(){t(a).addClass("np-updated-show")},1500)},e.showAjaxError=function(e){t(NestedPages.selectors.ajaxError).find("p").text(e),t(NestedPages.selectors.ajaxError).show()},e.hideAjaxError=function(e){t(NestedPages.selectors.ajaxError).hide()},e.sizeLinkThumbnails=function(){var e=t(NestedPages.selectors.thumbnailContainer).not(NestedPages.selectors.thumbnailContainerLink).first().find("img"),a=t(e).width(),s=t(e).height();t.each(t(NestedPages.selectors.thumbnailContainerLink),function(){t(this).width(a),t(this).height(s)})}},(NestedPages=NestedPages||{}).CheckAll=function(){var e=this,t=jQuery;return e.activeCheckbox="",e.selectors={checkbox:"[data-np-check-all]"},e.bindEvents=function(){t(document).on("change",e.selectors.checkbox,function(){e.activeCheckbox=t(this),e.toggleCheckboxes()}),t(document).on("change","input[type=checkbox]",function(){e.checkAllStatus(t(this))})},e.init=function(){e.bindEvents()},e.toggleCheckboxes=function(){var a=!!t(e.activeCheckbox).is(":checked"),s=t(e.activeCheckbox).attr("data-np-check-all"),n=t('*[name="'+s+'"]');t.each(n,function(){var e=t(this).parents(NestedPages.selectors.rows);t(this).prop("checked",a),t(e).hasClass("np-hide")&&!t(e).is(":visible")&&t(e).find(NestedPages.selectors.bulkActionsCheckbox).prop("checked",!1)}),e.toggleCheckAll()},e.toggleCheckAll=function(){var a=t(e.activeCheckbox).attr("data-np-check-all"),s=t('*[name="'+a+'"]').length;s=s-t(".np-hide").find(NestedPages.selectors.bulkActionsCheckbox).length+t(".np-hide:visible").find(NestedPages.selectors.bulkActionsCheckbox).length;var n=t('*[name="'+a+'"]:checked').length;if(s==n)return t(e.activeCheckbox).prop("checked",!0),void t(e.activeCheckbox).removeClass("check-all-partial");n>0?t(e.activeCheckbox).addClass("check-all-partial"):(t(e.activeCheckbox).attr("checked",!1),t(e.activeCheckbox).removeClass("check-all-partial"))},e.checkAllStatus=function(a){var s=t(a).attr("name"),n=t('*[data-np-check-all="'+s+'"]');0!==n.length&&(e.activeCheckbox=t(n)[0],e.toggleCheckAll())},e.init()},(NestedPages=NestedPages||{}).BulkActions=function(){var e=this,t=jQuery;return e.selectedNumber=0,e.selectedLinks=[],e.selectedPosts=[],e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleBulkForm()}),t(document).on("submit",NestedPages.selectors.bulkActionsForm,function(a){"edit"===t("select[name=np_bulk_action]").val()&&(a.preventDefault(),e.toggleBulkEdit(!0))}),t(document).on("click",NestedPages.selectors.bulkEditRemoveItem,function(a){a.preventDefault();var s=t(this).siblings("input[type=hidden]").val();e.uncheckBulkItem(s)}),t(document).on("click",NestedPages.selectors.bulkEditCancel,function(t){t.preventDefault(),e.uncheckAllBulkItems()})},e.toggleBulkForm=function(){var a=!1,s="",n="";if(e.selectedPosts=[],e.selectedLinks=[],t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){if(t(this).is(":checked")){var o=t(this).parents(NestedPages.selectors.rows);if(a=!0,t(this).parent("div").hasClass("np-check-all")||t(o).hasClass("post-type-np-redirect")||(s+=t(this).val()+","),t(o).hasClass("post-type-np-redirect")&&(n+=t(this).val()+",",e.selectedLinks.push(t(this).val())),"np-redirect"!==t(this).attr("data-np-post-type")&&!t(this).parent("div").hasClass("np-check-all")){var i=[];i.title=t(this).attr("data-np-bulk-checkbox"),i.id=t(this).val(),e.selectedPosts.push(i)}}}),e.setBulkEditPosts(),e.toggleEditOption(),e.toggleLinkCountAlert(),a)return t(NestedPages.selectors.bulkActionsForm).show(),t(NestedPages.selectors.bulkActionsIds).val(s),t(NestedPages.selectors.bulkActionRedirectIds).val(n),void e.setSelectedNumber();t(NestedPages.selectors.bulkActionsIds).val(""),t(NestedPages.selectors.bulkActionsForm).hide()},e.setBulkEditPosts=function(){for(var a="",s=0;s<e.selectedPosts.length;s++)a+='<li><a href="#" class="np-remove" data-np-remove-bulk-item>×</a>',a+=e.selectedPosts[s].title,a+='<input type="hidden" name="post_ids[]" value="'+e.selectedPosts[s].id+'"></li>';t(NestedPages.selectors.bulkEditTitles).html(a)},e.uncheckBulkItem=function(a){t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){t(this).val()==a&&t(this).prop("checked",!1).change()}),0===t(NestedPages.selectors.bulkEditRemoveItem).length&&e.toggleBulkEdit(!1)},e.uncheckAllBulkItems=function(){t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){t(this).prop("checked",!1).change()}),e.toggleBulkEdit(!1)},e.setSelectedNumber=function(){var e=t(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").length,a=t(NestedPages.selectors.bulkActionsForm).find("select option").first();t(a).text(nestedpages.bulk_actions+" ("+e+")")},e.toggleEditOption=function(){var a=t(NestedPages.selectors.bulkActionsCheckbox+":checked").not(".np-check-all input").not(".np-redirect-bulk").length,s=t(NestedPages.selectors.bulkActionsForm).find("select option[value=edit]");if(0===a)return t(s).prop("disabled",!0),t(NestedPages.selectors.bulkActionsForm).find("select option").first().prop("selected",!0),void e.toggleBulkEdit(!1);t(s).prop("disabled",!1)},e.toggleBulkEdit=function(a){if(e.toggleLinkCountAlert(),a)return t(NestedPages.selectors.bulkEditForm).show(),t(NestedPages.selectors.bulkActionsForm).hide(),void e.setWPSuggest();t(NestedPages.selectors.bulkEditForm).hide(),t(NestedPages.selectors.bulkActionsForm).show(),t(NestedPages.selectors.bulkEditLinkCount).parent("div").hide(),t(NestedPages.selectors.bulkActionsForm).find("select option").first().text(nestedpages.bulk_actions),e.resetBulkEditFields()},e.toggleLinkCountAlert=function(){0!==e.selectedLinks.length?t(NestedPages.selectors.bulkEditLinkCount).parent("div").show():t(NestedPages.selectors.bulkEditLinkCount).parent("div").hide()},e.setWPSuggest=function(){var e=t(NestedPages.selectors.bulkEditForm).find("[data-autotag]");t.each(e,function(e,a){var s=t(this).attr("data-taxonomy");t(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+s,{multiple:!0,multipleSep:","})})},e.resetBulkEditFields=function(){var e=t(NestedPages.selectors.bulkEditForm).find("select");t.each(e,function(){t(this).find("option").first().prop("selected",!0)});var a=t(NestedPages.selectors.bulkEditForm).find(".cat-checklist");t.each(a,function(){t(this).find("input[type=checkbox]").prop("checked",!1)})},e.init()},(NestedPages=NestedPages||{}).HiddenItemCount=function(){var e=this,t=jQuery;return e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("change",NestedPages.selectors.bulkActionsCheckbox,function(){e.toggleHiddenCount()}),t(document).on("click",NestedPages.selectors.toggleAll,function(){e.toggleHiddenCount()}),t(document).on("click",NestedPages.selectors.pageToggle,function(){e.toggleHiddenCount()})},e.toggleHiddenCount=function(){var e=0;t.each(t(NestedPages.selectors.bulkActionsCheckbox),function(){if(t(this).is(":checked")){if(t(this).parent("div").hasClass("np-check-all"))return;var a=t(this).closest(".page-row");t(a).is(":visible")||e++}}),e<1?t(NestedPages.selectors.hiddenItemCountParent).hide():(t(NestedPages.selectors.hiddenItemCount).text(e),t(NestedPages.selectors.hiddenItemCountParent).show())},e.init()},(NestedPages=NestedPages||{}).MenuToggle=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.bindEvents=function(){t(document).on("click",NestedPages.selectors.childToggleLink,function(a){a.preventDefault(),e.toggleSingleMenu(t(this))}),t(document).on("click",NestedPages.selectors.toggleAll,function(t){t.preventDefault(),e.toggleAllMenus()})},e.toggleSingleMenu=function(a){var s=t(a).parent(NestedPages.selectors.childToggle).parent(NestedPages.selectors.row).siblings("ol");t(a).find("i").toggleClass(NestedPages.cssClasses.iconToggleDown).toggleClass(NestedPages.cssClasses.iconToggleRight),t(s).toggle(),e.formatter.setBorders(),e.formatter.setNestedMargins(),e.syncUserToggles()},e.toggleAllMenus=function(){var a=NestedPages.selectors.toggleAll;if("closed"===t(a).attr("data-toggle"))return t(NestedPages.selectors.lists).show(),t(a).attr("data-toggle","opened").text(NestedPages.jsData.collapseText),t(NestedPages.selectors.childToggle).find("i").removeClass(NestedPages.cssClasses.iconToggleRight).addClass(NestedPages.cssClasses.iconToggleDown),e.formatter.setBorders(),void e.syncUserToggles();t(NestedPages.selectors.lists).not(t(NestedPages.selectors.lists)[0]).hide(),t(a).attr("data-toggle","closed").text(NestedPages.jsData.expandText),t(NestedPages.selectors.childToggle).find("i").removeClass(NestedPages.cssClasses.iconToggleDown).addClass(NestedPages.cssClasses.iconToggleRight),e.formatter.setBorders(),e.syncUserToggles()},e.visibleRowIDs=function(){var e=[],a=t(NestedPages.selectors.rows+":visible");return t.each(a,function(a,s){var n=t(this).attr("id");e.push(n.replace("menuItem_",""))}),e},e.syncUserToggles=function(){t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncToggles,nonce:NestedPages.jsData.nonce,ids:e.visibleRowIDs(),posttype:NestedPages.jsData.posttype},success:function(e){"success"!==e.status&&console.log("There was an error saving toggled pages.")}})},e.bindEvents()},(NestedPages=NestedPages||{}).PageToggle=function(){var e=this,t=jQuery;return e.activeButton="",e.formatter=new NestedPages.Formatter,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.toggleHidden,function(a){a.preventDefault(),e.activeButton=t(this),e.toggleHidden()}),t(document).on("click",NestedPages.selectors.toggleStatus,function(a){a.preventDefault(),e.toggleStatus(t(this))})},e.toggleHidden=function(){var a=t(e.activeButton),s=t(a).attr("href");if("#show"==s)return t(a).attr("href","#hide").text(NestedPages.jsData.showHiddenText),t(NestedPages.selectors.hiddenRows).removeClass("shown").hide(),e.formatter.updateSubMenuToggle(),void e.formatter.setBorders();"#hide"==s&&(t(a).attr("href","#show").text(NestedPages.jsData.hideHiddenText),t(NestedPages.selectors.hiddenRows).addClass("shown").show(),e.formatter.updateSubMenuToggle(),e.formatter.setBorders())},e.toggleStatus=function(e){var a=t(e).attr("href");a=a.substring(1),t(NestedPages.selectors.syncCheckbox).attr("disabled",!1),t(NestedPages.selectors.toggleStatus).removeClass("active"),t(e).addClass("active"),"draft"==a&&(t(NestedPages.selectors.syncCheckbox).attr("disabled",!0),t("."+a).addClass("nested-visible")),"all"!=a?(t(NestedPages.selectors.rows).hide(),t("."+a).show()):t(NestedPages.selectors.rows).show()},e.init()},(NestedPages=NestedPages||{}).Nesting=function(){var e=this,t=jQuery;e.formatter=new NestedPages.Formatter,e.initializeSortable=function(){maxLevels=NestedPages.jsData.nestable?0:1,t(NestedPages.selectors.sortable).not(NestedPages.selectors.notSortable).nestedSortable({items:NestedPages.selectors.rows,toleranceElement:"> .row",handle:NestedPages.selectors.handle,placeholder:"ui-sortable-placeholder",maxLevels:maxLevels,tabSize:56,start:function(e,t){t.placeholder.height(t.item.height())},sort:function(t,a){e.formatter.updatePlaceholderWidth(a)},stop:function(t,a){setTimeout(function(){e.formatter.updateSubMenuToggle(),e.formatter.setBorders(),e.formatter.setNestedMargins()},100),e.syncNesting()}})},e.disableNesting=function(){t(NestedPages.selectors.sortable).sortable("destroy")},e.syncNesting=function(a,s){if("1"!==nestedpages.manual_order_sync||a){t(NestedPages.selectors.errorDiv).hide(),t(NestedPages.selectors.loadingIndicator).show(),list=t(NestedPages.selectors.sortable).nestedSortable("toHierarchy",{startDepthCount:0}),e.disableNesting();var n=NestedPages.jsData.syncmenu;"1"===nestedpages.manual_menu_sync&&(n="nosync"),t.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.syncNesting,nonce:NestedPages.jsData.nonce,list:list,post_type:NestedPages.jsData.posttype,syncmenu:n},success:function(a,s){if(e.initializeSortable(),"error"===a.status)t(NestedPages.selectors.errorDiv).text(a.message).show(),t(NestedPages.selectors.loadingIndicator).hide();else{if(s&&"function"==typeof s)return void s();t(NestedPages.selectors.loadingIndicator).hide()}}})}}},(NestedPages=NestedPages||{}).SyncMenuSetting=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).ready(function(){"1"!==nestedpages.manual_menu_sync&&"1"===nestedpages.syncmenu&&e.syncSetting()}),t(document).on("change",NestedPages.selectors.syncCheckbox,function(){e.syncSetting()})},e.syncSetting=function(){"page"===NestedPages.jsData.posttype&&0!==t(NestedPages.selectors.syncCheckbox).length&&(NestedPages.jsData.syncmenu=t(NestedPages.selectors.syncCheckbox).is(":checked")?"sync":"nosync",t.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(t){"error"===t.status&&e.formatter.showAjaxError(t.message)}}))},e.bindEvents()},(NestedPages=NestedPages||{}).NewPage=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.parent_id=0,e.posts="",e.form="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.openPageModal,function(t){t.preventDefault(),e.openModal()}),t(document).on("submit",NestedPages.selectors.newPageForm,function(e){e.preventDefault()}),t(document).on("click",NestedPages.selectors.newPageSubmitButton,function(a){a.preventDefault(),e.submitForm(t(this))}),t(document).on("click",NestedPages.selectors.newPageTitle,function(a){a.preventDefault(),e.addTitleField(t(this))}),t(document).on("click",NestedPages.selectors.newPageRemoveTitle,function(a){a.preventDefault(),e.removeTitleField(t(this))}),t(document).on("click",NestedPages.selectors.addChildButton,function(a){a.preventDefault(),e.openQuickEdit(t(this))}),t(NestedPages.selectors.newPageModal).on("hide.bs.modal",function(){e.cancelNewPage()}),t(NestedPages.selectors.newPageModal).on("shown.bs.modal",function(){e.modalOpened(t(this))}),t(document).on("click",NestedPages.selectors.cancelNewChildButton,function(a){a.preventDefault(),e.cancelNewPage(),t(NestedPages.selectors.newPageModal).modal("hide")})},e.openModal=function(){var a=t(NestedPages.selectors.newPageFormContainer).clone().find(NestedPages.selectors.newPageForm);t(a).addClass("in-modal"),t(NestedPages.selectors.newPageModal).find(".modal-body").html(a),t(NestedPages.selectors.newPageModal).find("h3").text(nestedpages.add_multiple),t(NestedPages.selectors.newPageModal).find(".page_parent_id").val(e.parent_id),t(NestedPages.selectors.newPageModal).modal("show")},e.modalOpened=function(e){t(e).find(".np_title").focus(),t(e).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},e.openQuickEdit=function(a){var s=t(a).closest(NestedPages.selectors.row).parent("li"),n=t(NestedPages.selectors.newPageFormContainer).clone();if(t(s).children("ol").length>0){var o=t(s).children("ol");t(n).insertBefore(o)}else t(n).appendTo(s);t(n).siblings(NestedPages.selectors.row).hide(),e.formatter.showQuickEdit(),t(n).find(".parent_name").html("<em>Parent:</em> "+t(a).attr("data-parentname")),t(n).find(".page_parent_id").val(t(a).attr("data-id")),t(n).show(),t(n).find(".np_title").focus(),t(n).find(NestedPages.selectors.newPageTitle).prop("tabindex","2")},e.cancelNewPage=function(){e.formatter.removeQuickEdit(),t(NestedPages.selectors.newChildError).hide(),t(NestedPages.selectors.newPageModal).find(".modal-body").empty(),t(NestedPages.selectors.sortable).find(".new-child").remove(),t(NestedPages.selectors.row).show()},e.addTitleField=function(e){var a=t(e).parents("form"),s=t(e).siblings(".new-page-titles").children("li").length+1,n='<li><i class="handle np-icon-menu"></i><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="'+s+'" /><a href="#" class="button-secondary np-remove-child">-</a></div></div></li>';t(e).siblings(".new-page-titles").append(n);t(a).find(".np_title").last().focus(),t(a).find(NestedPages.selectors.newPageTitle).prop("tabindex",s++),t(".new-page-titles").sortable({items:"li",handle:".handle"})},e.removeTitleField=function(e){t(e).parents(".new-child-row").parent("li").remove()},e.submitForm=function(a){e.toggleLoading(!0),e.form=t(a).parents("form");var s=!!t(a).hasClass("add-edit");t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:t(e.form).serialize()+"&action="+NestedPages.formActions.newPage+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(a){if("error"===a.status)return e.toggleLoading(!1),void t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show();if(!0===s){var n=a.new_pages[0].edit_link;return n=n.replace(/&/g,"&"),void window.location.replace(n)}e.toggleLoading(!1),e.posts=a.new_pages,e.addPosts()},error:function(a){console.log(a),e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},e.addPosts=function(){var a=t(e.form).parent(".new-child").parent(".page-row");if(0===t(a).children("ol").length&&t(a).append('<ol class="nplist"></ol>'),t(e.form).hasClass("in-modal"))s=t(".nplist.sortable li.page-row:first");else var s=t(a).children("ol");for(i=0;i<e.posts.length;i++)e.appendRows(s,e.posts[i]);t(s).show(),e.formatter.updateSubMenuToggle(),e.formatter.setNestedMargins(),e.cancelNewPage(),t(NestedPages.selectors.newPageModal).modal("hide")},e.appendRows=function(e,a){var s='<li id="menuItem_'+a.id+'" class="page-row';"publish"===a.status&&(s+=" published"),s+='">',NestedPages.jsData.hierarchical?(s+='<div class="row">',s+='<div class="child-toggle"></div>'):(s+='<div class="row non-hierarchical">',s+='<div class="non-hierarchical-spacer"></div>'),s+='<div class="row-inner">',s+='<i class="np-icon-sub-menu"></i><i class="handle np-icon-menu"></i>',s+='<a href="'+a.edit_link+'" class="page-link page-title">',s+='<span class="title">'+a.title+"</span>","Publish"!==a.status?s+='<span class="status">('+a.status+")</span>":s+='<span class="status"></span>',s+='<span class="nav-status">',"hide"===a.np_nav_status&&(s+=" "+nestedpages.hidden),s+="</span>",s+='<span class="edit-indicator"><i class="np-icon-pencil"></i>Edit</span>',s+="</a>",NestedPages.jsData.hierarchical||(s+='<div class="np-post-columns">',s+='<ul class="np-post-info">',s+='<li><span class="np-author-display">'+a.author_formatted+"</span></li>",s+="<li>"+a.date_formatted+"</li>",s+="</ul>",s+="</div>"),t(".nplist").first().hasClass("has-yoast")&&(s+='<span class="np-seo-indicator na"></span>'),s+='<div class="action-buttons">',s+='<a href="#" class="np-btn open-redirect-modal" data-parentid="'+a.id+'"><i class="np-icon-link"></i></a>',s+='<a href="#" class="np-btn add-new-child" data-id="'+a.id+'" data-parentname="'+a.title+'">'+nestedpages.add_child_short+"</a>",s+='<a href="#" class="np-btn np-quick-edit" data-id="'+a.id+'" data-template="'+a.page_template+'" data-title="'+a.title+'" data-slug="'+a.slug+'" data-commentstatus="closed" data-status="'+a.status.toLowerCase()+'" data-np-status="show"\tdata-navstatus="show" data-author="'+a.author+'" data-template="'+a.template+'" data-month="'+a.month+'" data-day="'+a.day+'" data-year="'+a.year+'" data-hour="'+a.hour+'" data-minute="'+a.minute+'" data-datepicker="'+a.datepicker+'" data-time="'+a.time+'" data-formattedtime="'+a.formattedtime+'" data-ampm="'+a.ampm+'">'+nestedpages.quick_edit+"</a>",s+='<a href="'+a.view_link+'" class="np-btn" target="_blank">'+nestedpages.view+"</a>",s+='<a href="'+a.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',s+="</div>\x3c!-- .action-buttons --\x3e",s+="</div>\x3c!-- .row-inner --\x3e</div>\x3c!-- .row --\x3e",s+="</li>",t(e).append(s)},e.toggleLoading=function(e){if(e)return t(NestedPages.selectors.quickEditErrorDiv).hide(),t(NestedPages.selectors.newPageSubmitButton).attr("disabled","disabled"),void t(NestedPages.selectors.quickEditLoadingIndicator).show();t(NestedPages.selectors.newPageSubmitButton).attr("disabled",!1),t(NestedPages.selectors.quickEditLoadingIndicator).hide()},e.init()},(NestedPages=NestedPages||{}).QuickEditPost=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.button="",e.initialData="",e.parent_li="",e.form="",e.flatTerms="",e.termNames="",e.saveButton="",e.newData="",e.row="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.quickEditOpen,function(a){a.preventDefault(),e.button=t(this),e.openForm()}),t(document).on("click",NestedPages.selectors.quickEditCancel,function(t){t.preventDefault(),e.formatter.removeQuickEdit()}),t(document).on("click",NestedPages.selectors.quickEditToggleTaxonomies,function(e){e.preventDefault(),t(this).parents("form").find(".np-taxonomies").toggle()}),t(document).on("click",NestedPages.selectors.quickEditToggleMenuOptions,function(e){e.preventDefault(),t(this).parents("form").find(".np-menuoptions").toggle()}),t(document).on("change",".keep_private",function(){this.checked?t(".post_password").val("").prop("readonly",!0):t(".post_password").prop("readonly",!1)}),t(document).on("click",NestedPages.selectors.quickEditSaveButton,function(a){a.preventDefault(),e.saveButton=t(this),e.save()}),t(document).on("keydown",function(t){27===t.keyCode&&e.formatter.removeQuickEdit()})},e.openForm=function(){e.setInitialData(),e.createForm(),e.populateForm(),e.populateFlatTaxonomies()},e.setInitialData=function(){e.initialData={id:t(e.button).attr("data-id"),title:t(e.button).attr("data-title"),slug:t(e.button).attr("data-slug"),author:t(e.button).attr("data-author"),cs:t(e.button).attr("data-commentstatus"),status:t(e.button).attr("data-status"),template:t(e.button).attr("data-template"),month:t(e.button).attr("data-month"),day:t(e.button).attr("data-day"),year:t(e.button).attr("data-year"),hour:t(e.button).attr("data-hour"),minute:t(e.button).attr("data-minute"),navstatus:t(e.button).attr("data-navstatus"),npstatus:t(e.button).attr("data-np-status"),navtitle:t(e.button).attr("data-navtitle"),navtitleattr:t(e.button).attr("data-navtitleattr"),navcss:t(e.button).attr("data-navcss"),linktarget:t(e.button).attr("data-linktarget"),password:t(e.button).attr("data-password"),datepicker:t(e.button).attr("data-datepicker"),time:t(e.button).attr("data-formattedtime"),timeTwentyFour:t(e.button).attr("data-time"),ampm:t(e.button).attr("data-ampm"),timeFormat:t(e.button).attr("data-timeformat"),sticky:t(e.button).attr("data-sticky")},e.initialData.h_taxonomies=[],e.initialData.f_taxonomies=[],e.parent_li=t(e.button).closest(NestedPages.selectors.row).parent("li");var a=t(e.parent_li).attr("class").split(/\s+/);for(i=0;i<a.length;i++)"in-"===a[i].substring(0,3)&&e.initialData.h_taxonomies.push(a[i]),"inf-"===a[i].substring(0,4)&&e.initialData.f_taxonomies.push(a[i])},e.createForm=function(){if(e.form=t(NestedPages.selectors.quickEditPostForm).clone(),t(e.parent_li).children("ol").length>0){var a=t(e.parent_li).children("ol");t(e.form).insertBefore(a)}else t(e.form).appendTo(e.parent_li);t(e.form).siblings(NestedPages.selectors.row).hide(),t(e.form).show()},e.populateForm=function(){if(t(e.form).find(".page_id").html("<em>ID:</em> "+e.initialData.id),t(e.form).find(".np_id").val(e.initialData.id),t(e.form).find(".np_title").val(e.initialData.title),t(e.form).find(".np_slug").val(e.initialData.slug),t(e.form).find(".np_author select").val(e.initialData.author),t(e.form).find(".np_status").val(e.initialData.status),t(e.form).find(".np_nav_title").val(e.initialData.navtitle),t(e.form).find(".np_title_attribute").val(e.initialData.navtitleattr),t(e.form).find(".np_nav_css_classes").val(e.initialData.navcss),t(e.form).find(".post_password").val(e.initialData.password),t(e.form).find(".np_datepicker").val(e.initialData.datepicker),"open"===e.initialData.cs&&t(e.form).find(".np_cs").attr("checked","checked"),""!==e.initialData.template?t(e.form).find(".np_template").val(e.initialData.template):t(e.form).find(".np_template").val("default"),"private"===e.initialData.status&&(t(e.form).find(".post_password").attr("readonly",!0),t(e.form).find(".keep_private").attr("checked",!0)),"hide"===e.initialData.npstatus?t(e.form).find(".nested_pages_status").attr("checked","checked"):t(e.form).find(".nested_pages_status").removeAttr("checked"),"hide"===e.initialData.navstatus?t(e.form).find(".np_nav_status").attr("checked","checked"):t(e.form).find(".np_nav_status").attr("checked",!1),"_blank"===e.initialData.linktarget?t(e.form).find(".link_target").attr("checked","checked"):t(e.form).find(".link_target").attr("checked",!1),"private"===e.initialData.status&&t(e.form).find(".np_status").val("publish"),"sticky"===e.initialData.sticky?t(e.form).find(".np-sticky").attr("checked","checked"):t(e.form).find(".np-sticky").removeAttr("checked"),"H:i"===e.initialData.timeFormat?t(e.form).find(".np_time").val(e.initialData.timeTwentyFour):(t(e.form).find(".np_time").val(e.initialData.time),t(e.form).find(".np_ampm").val(e.initialData.ampm),t(e.form).find('select[name="mm"]').val(e.initialData.month),t(e.form).find('input[name="jj"]').val(e.initialData.day),t(e.form).find('input[name="aa"]').val(e.initialData.year),t(e.form).find('input[name="hh"]').val(e.initialData.hour),t(e.form).find('input[name="mn"]').val(e.initialData.minute)),e.initialData.hasOwnProperty("h_taxonomies")){var a=e.initialData.h_taxonomies;for(i=0;i<a.length;i++){var s="#"+a[i];t(e.form).find(s).attr("checked","checked")}}t(e.form).find(".np_datepicker").datepicker({beforeShow:function(e,a){t("#ui-datepicker-div").addClass("nestedpages-datepicker")}}),e.formatter.showQuickEdit(),t(e.form).show()},e.populateFlatTaxonomies=function(){e.initialData.hasOwnProperty("f_taxonomies")&&(e.createTaxonomyObject(),e.getTermNames(),e.setWPSuggest())},e.createTaxonomyObject=function(){var t={};for(i=0;i<e.initialData.f_taxonomies.length;i++){var a=e.initialData.f_taxonomies[i],s=a.split("-"),n=s.indexOf("nps"),o=s.splice(n+1);o=o.join("-");var r=a.split("-").splice(0,n);r.shift("inf");var l=r.join("-");l in t||(t[l]=[]),t[l].push(o)}e.flatTerms=t},e.getTermNames=function(){t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.getTaxonomies,nonce:NestedPages.jsData.nonce,terms:e.flatTerms},success:function(t){e.termNames=t.terms,e.populateFlatTaxonomyFields()}})},e.populateFlatTaxonomyFields=function(){e.termNames&&t.each(e.termNames,function(e,a){var s=t("#"+e+"-quickedit");t(s).val(a.join(","))})},e.setWPSuggest=function(){var a=t(e.form).find("[data-autotag]");t.each(a,function(e,a){var s=t(this).attr("data-taxonomy");t(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+s,{multiple:!0,multipleSep:","})})},e.save=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:t(e.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditPost+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(a){"error"===a.status?(e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show()):(e.toggleLoading(!1),e.newData=a.post_data,e.updatePostRow())},error:function(e){console.log(e)}})},e.updatePostRow=function(){e.row=t(e.button).parents(".row-inner"),t(e.row).find(".title").text(e.newData.post_title),t(e.row).find(".np-view-button").attr("href",e.newData.permalink);var a=t(e.row).find(".status");if("publish"!==e.newData._status&&"future"!==e.newData._status?t(a).text("("+e.newData._status+")"):"private"===e.newData.keep_private?t(a).text("("+e.newData.keep_private+")"):t(a).text(""),""!==e.newData.post_password&&void 0!==e.newData.post_password){var s=t(a).text();s+=' <i class="np-icon-lock"></i>',t(a).html(s)}var n=t(e.row).find(".nav-status");"hide"==e.newData.nav_status?t(n).text("(Hidden)"):t(n).text("");var o=t(e.row).parent("li");"hide"==e.newData.np_status?(t(o).addClass("np-hide"),t(e.row).find(".status").after('<i class="np-icon-eye-blocked"></i>')):(t(o).removeClass("np-hide"),t(e.row).find(".np-icon-eye-blocked").remove());var i=t(e.row).find(".sticky");"sticky"==e.newData.sticky?t(i).show():t(i).hide(),NestedPages.jsData.hierarchical||t(e.row).find(".np-author-display").text(e.newData.author_name);var r=t(e.row).find(NestedPages.selectors.quickEditOpen);t(r).attr("data-id",e.newData.post_id),t(r).attr("data-template",e.newData.page_template),t(r).attr("data-title",e.newData.post_title),t(r).attr("data-slug",e.newData.post_name),t(r).attr("data-commentstatus",e.newData.comment_status),t(r).attr("data-status",e.newData._status),t(r).attr("data-sticky",e.newData.sticky),"private"===e.newData.keep_private&&t(r).attr("data-status","private"),t(r).attr("data-author",e.newData.post_author),t(r).attr("data-np-status",e.newData.np_status),t(r).attr("data-password",e.newData.post_password),t(r).attr("data-navstatus",e.newData.nav_status),t(r).attr("data-navtitle",e.newData.np_nav_title),t(r).attr("data-linktarget",e.newData.link_target),t(r).attr("data-navtitleattr",e.newData.np_title_attribute),t(r).attr("data-navcss",e.newData.np_nav_css_classes),t(r).attr("data-month",e.newData.mm),t(r).attr("data-day",e.newData.jj),t(r).attr("data-year",e.newData.aa),t(r).attr("data-hour",e.newData.hh),t(r).attr("data-minute",e.newData.mn),t(r).attr("data-datepicker",e.newData.np_date),t(r).attr("data-time",e.newData.np_time),t(r).attr("data-formattedtime",e.newData.np_time),t(r).attr("data-ampm",e.newData.np_ampm),e.removeTaxonomyClasses(),e.addCategoryClasses(),e.addHierarchicalClasses(),e.addFlatClasses(),e.addStatusClass(),e.formatter.removeQuickEdit(),e.formatter.flashRow(e.row)},e.addStatusClass=function(){var a=["published","draft","pending","future"];for(i=0;i<a.length;i++)t(e.row).removeClass(a[i]);t(e.row).addClass(e.newData._status)},e.removeTaxonomyClasses=function(){taxonomies=[];var a=t(e.row).attr("class").split(/\s+/);for(i=0;i<a.length;i++)"in-"===a[i].substring(0,3)&&t(e.row).removeClass(a[i]),"inf-"===a[i].substring(0,4)&&t(e.row).removeClass(a[i])},e.addCategoryClasses=function(){if(e.newData.hasOwnProperty("post_category")){var a=e.newData.post_category;for(i=0;i<a.length;i++){var s="in-category-"+a[i];t(e.row).addClass(s)}}},e.addHierarchicalClasses=function(){if(e.newData.hasOwnProperty("tax_input")){var a=e.newData.tax_input;t.each(a,function(a,s){for(i=0;i<s.length;i++){var n="in-"+a+"-"+s[i];t(e.row).addClass(n)}})}},e.addFlatClasses=function(){if(e.newData.hasOwnProperty("flat_tax")){var a=e.newData.flat_tax;t.each(a,function(a,s){for(i=0;i<s.length;i++){var n="inf-"+a+"-nps-"+s[i];t(e.row).addClass(n)}})}},e.toggleLoading=function(a){if(a)return t(NestedPages.selectors.quickEditErrorDiv).hide(),t(e.saveButton).attr("disabled","disabled"),void t(NestedPages.selectors.quickEditLoadingIndicator).show();t(e.saveButton).attr("disabled",!1),t(NestedPages.selectors.quickEditLoadingIndicator).hide()},e.init()},(NestedPages=NestedPages||{}).QuickEditLink=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.button="",e.postData="",e.newPostData="",e.form="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.quickEditButtonLink,function(a){a.preventDefault(),e.formatter.removeQuickEdit(),e.button=t(this),e.openQuickEdit()}),t(document).on("click",NestedPages.selectors.quickEditLinkSaveButton,function(t){t.preventDefault(),e.submitForm()}),t(document).on("keydown",function(t){27===t.keyCode&&e.formatter.removeQuickEdit()})},e.openQuickEdit=function(){e.setData(),e.createForm(),e.populateForm()},e.setData=function(){e.postData={id:t(e.button).attr("data-id"),url:t(e.button).attr("data-url"),title:t(e.button).attr("data-title"),status:t(e.button).attr("data-status"),navstatus:t(e.button).attr("data-navstatus"),npstatus:t(e.button).attr("data-np-status"),linktarget:t(e.button).attr("data-linktarget"),parentid:t(e.button).attr("data-parentid"),navtitleattr:t(e.button).attr("data-navtitleattr"),navcss:t(e.button).attr("data-navcss"),navtype:t(e.button).attr("data-nav-type"),navobject:t(e.button).attr("data-nav-object"),navobjectid:t(e.button).attr("data-nav-object-id"),navoriginallink:t(e.button).attr("data-nav-original-link"),navoriginaltitle:t(e.button).attr("data-nav-original-title")}},e.createForm=function(){var a=t(e.button).closest(NestedPages.selectors.row).parent("li");if(e.form=t(NestedPages.selectors.quickEditLinkForm).clone(),t(a).children("ol").length>0){var s=t(a).children("ol");t(e.form).insertBefore(s)}else t(e.form).appendTo(a);t(e.form).siblings(NestedPages.selectors.row).hide()},e.populateForm=function(){if(t(e.form).find(".np_id").val(e.postData.id),t(e.form).find(".np_title").val(e.postData.title),t(e.form).find(".np_author select").val(e.postData.author),t(e.form).find(".np_status").val(e.postData.status),t(e.form).find(".np_content").val(e.postData.url),t(e.form).find(".np_parent_id").val(e.postData.parentid),t(e.form).find(".np_title_attribute").val(e.postData.navtitleattr),t(e.form).find(".np_nav_css_classes").val(e.postData.navcss),"hide"===e.postData.npstatus?t(e.form).find(".np_status").prop("checked","checked"):t(e.form).find(".np_status").removeAttr("checked"),"hide"===e.postData.navstatus?t(e.form).find(".np_nav_status").prop("checked","checked"):t(e.form).find(".np_nav_status").removeAttr("checked"),"_blank"===e.postData.linktarget?t(e.form).find(".link_target").prop("checked","checked"):t(e.form).find(".link_target").removeAttr("checked"),"custom"!==e.postData.navobject&&""!==e.postData.navobject){var a='<div class="form-control original-link">Original: <a href="'+e.postData.navoriginallink+'" target="_blank">'+e.postData.navoriginaltitle+"</a></div>";t(e.form).find("[data-url-field]").remove(),t(a).insertAfter(t(e.form).find("h3")),t(e.form).find("[data-np-menu-object-input]").val(e.postData.navobject),t(e.form).find("[data-np-menu-objectid-input]").val(e.postData.navobjectid),t(e.form).find("[data-np-menu-type-input]").val(e.postData.navtype),t(e.form).find("h3").text("Link: "+e.postData.navoriginaltitle)}else t(e.form).find("h3").text("Link"),t(e.form).find("[data-np-menu-object-input]").val("custom"),t(e.form).find("[data-np-menu-type-input]").val("custom");e.formatter.showQuickEdit(),t(e.form).show()},e.submitForm=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:t(e.form).find("form").serialize()+"&action="+NestedPages.formActions.quickEditLink+"&nonce="+NestedPages.jsData.nonce+"&syncmenu="+NestedPages.jsData.syncmenu+"&post_type="+NestedPages.jsData.posttype,success:function(a){"error"===a.status?(e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show()):(e.toggleLoading(!1),e.newPostData=a.post_data,e.updateRow())},error:function(a){e.toggleLoading(!1),t(e.form).find(NestedPages.selectors.quickEditErrorDiv).text("The form could not be saved at this time.").show()}})},e.updateRow=function(){console.log(e.newPostData);var a=t(e.form).siblings(".row");t(a).find(".title").html(e.newPostData.post_title+' <i class="np-icon-link"></i>');var s=t(a).find(".status");"publish"!==e.newPostData._status&&"future"!==e.newPostData._status?t(s).text("("+e.newPostData._status+")"):t(s).text("");var n=t(a).find(".nav-status");"hide"==e.newPostData.nav_status?t(n).text("("+NestedPages.jsData.hiddenText+")"):t(n).text("");var o=t(a).parent("li");"hide"==e.newPostData.np_status?(t(o).addClass("np-hide"),t(a).find(".status").after('<i class="np-icon-eye-blocked"></i>')):(t(o).removeClass("np-hide"),t(a).find(".np-icon-eye-blocked").remove());var i=t(a).find(NestedPages.selectors.quickEditButtonLink);t(i).attr("data-id",e.newPostData.post_id),t(i).attr("data-title",e.newPostData.post_title),t(i).attr("data-url",e.newPostData.post_content),t(i).attr("data-status",e.newPostData._status),t(i).attr("data-navstatus",e.newPostData.nav_status),t(i).attr("data-np-status",e.newPostData.np_status),t(i).attr("data-linkTarget",e.newPostData.linkTarget),t(i).attr("data-navtitleattr",e.newPostData.titleAttribute),t(i).attr("data-navcss",e.newPostData.cssClasses),e.formatter.removeQuickEdit(),e.formatter.flashRow(a)},e.toggleLoading=function(e){if(t(".row").removeClass("np-updated").removeClass("np-updated-show"),e)return t(NestedPages.selectors.quickEditErrorDiv).hide(),t(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled","disabled"),void t(NestedPages.selectors.quickEditLoadingIndicator).show();t(NestedPages.selectors.quickEditLinkSaveButton).attr("disabled",!1),t(NestedPages.selectors.quickEditLoadingIndicator).hide()},e.init()},(NestedPages=NestedPages||{}).Clone=function(){var e=this,t=jQuery;return e.parent_id="",e.parent_title="",e.parentLi=null,e.formatter=new NestedPages.Formatter,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.cloneButton,function(a){a.preventDefault(),e.parent_id=t(this).attr("data-id"),e.parent_title=t(this).attr("data-parentname"),e.parentLi=t(this).parent(".row").parent(".page-row").parent(".npList"),e.openModal()}),t(document).on("click",NestedPages.selectors.confirmClone,function(t){t.preventDefault(),e.clone()})},e.openModal=function(){t(NestedPages.selectors.cloneModal).find("[data-clone-parent]").text(e.parent_title),t(NestedPages.selectors.cloneModal).modal("show")},e.clone=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:{action:NestedPages.formActions.clonePost,parent_id:e.parent_id,quantity:t(NestedPages.selectors.cloneQuantity).val(),status:t(NestedPages.selectors.cloneStatus).val(),author:t(NestedPages.selectors.cloneAuthor).find("select").val(),nonce:NestedPages.jsData.nonce,posttype:NestedPages.jsData.posttype},success:function(a){e.toggleLoading(!1),t(NestedPages.selectors.cloneModal).modal("hide"),location.reload()}})},e.toggleLoading=function(e){if(e)return t(NestedPages.selectors.cloneModal).find("[data-clone-loading]").show(),void t(NestedPages.selectors.confirmClone).attr("disabled","disabled");t(NestedPages.selectors.cloneModal).find("[data-clone-loading]").hide(),t(NestedPages.selectors.confirmClone).attr("disabled",!1)},e.init()},(NestedPages=NestedPages||{}).Tabs=function(){var e=this,t=jQuery;return e.activeContent="",e.activeButton="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.tabButton,function(a){a.preventDefault(),e.activeButton=t(this),e.toggleTabs()})},e.toggleTabs=function(){e.activeContent=t(e.activeButton).attr("href"),t(NestedPages.selectors.tabContent).hide(),t(e.activeContent).show(),t(e.activeButton).parents(NestedPages.selectors.tabButtonParent).find(NestedPages.selectors.tabButton).removeClass("active"),t(e.activeButton).addClass("active")},e.init()},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]",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",quickEditToggleTaxonomies:".np-toggle-taxonomies",quickEditToggleMenuOptions:".np-toggle-menuoptions",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",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={iconToggleDown:"np-icon-arrow-down",iconToggleRight:"np-icon-arrow-right",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",quickEditLink:"npquickEditLink",getTaxonomies:"npgetTaxonomies",quickEditPost:"npquickEdit",clonePost:"npclonePost",search:"npmenuSearch",newMenuItem:"npnewMenuItem",manualMenuSync:"npmanualMenuSync",postSearch:"nppostSearch",wpmlTranslations:"npWpmlTranslations"},NestedPages.Factory=function(){var e=this,t=jQuery;return e.formatter=new NestedPages.Formatter,e.responsive=new NestedPages.Responsive,e.checkAll=new NestedPages.CheckAll,e.bulkActions=new NestedPages.BulkActions,e.menuToggle=new NestedPages.MenuToggle,e.pageToggle=new NestedPages.PageToggle,e.nesting=new NestedPages.Nesting,e.syncMenuSetting=new NestedPages.SyncMenuSetting,e.newPage=new NestedPages.NewPage,e.quickEditLink=new NestedPages.QuickEditLink,e.quickEditPost=new NestedPages.QuickEditPost,e.clone=new NestedPages.Clone,e.tabs=new NestedPages.Tabs,e.menuLinks=new NestedPages.MenuLinks,e.hiddenItemCount=new NestedPages.HiddenItemCount,e.confirmDelete=new NestedPages.ConfirmDelete,e.manualSync=new NestedPages.ManualSync,e.postSearch=new NestedPages.PostSearch,e.wpml=new NestedPages.Wpml,e.init=function(){nestedpages.settings_page||(e.bindEvents(),e.setPostType(),e.setMenuSync(),e.setNestable(),e.setSortable(),e.formatter.updateSubMenuToggle(),e.formatter.setBorders(),e.formatter.setNestedMargins(),e.nesting.initializeSortable())},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.quickEditOverlay,function(t){e.formatter.removeQuickEdit(),e.newPage.cancelNewPage()}),t(document).ready(function(){e.formatter.hideAjaxError(),e.formatter.sizeLinkThumbnails()})},e.setNestable=function(){var e=!1;t.each(NestedPages.jsData.allPostTypes,function(t,a){a.name===NestedPages.jsData.posttype&&(!0===a.hierarchical&&(e=!0),!0===a.disable_nesting&&(e=!1))}),NestedPages.jsData.nestable=e},e.setSortable=function(){var e=!0;t.each(NestedPages.jsData.allPostTypes,function(t,a){a.name===NestedPages.jsData.posttype&&void 0!==a.disable_sorting&&""!==a.disable_sorting&&"true"===a.disable_sorting&&(e=!1)}),NestedPages.jsData.sortable=e},e.setPostType=function(){NestedPages.jsData.posttype=nestedpages.current_post_type,void 0!==NestedPages.jsData.posttype&&""!==NestedPages.jsData.posttype||(NestedPages.jsData.posttype=t(NestedPages.selectors.sortable).attr("id").substring(3)),NestedPages.jsData.hierarchical=NestedPages.jsData.allPostTypes[NestedPages.jsData.posttype].hierarchical},e.setMenuSync=function(){NestedPages.jsData.syncmenu="1"===nestedpages.syncmenu?"sync":"nosync"},e.init()},(NestedPages=NestedPages||{}).MenuLinks=function(){var e=this,t=jQuery;return e.typeButton="",e.post="",e.formatter=new NestedPages.Formatter,e.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]"},e.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]"},e.search=new NestedPages.MenuSearch,e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",NestedPages.selectors.openLinkModal,function(a){a.preventDefault(),e.postParent=t(this).attr("data-parentid"),t(e.selectors.form).find(".parent_id").val(t(this).attr("data-parentid")),e.openModal()}),t(document).on("click",e.selectors.accordionItem,function(a){a.preventDefault(),e.accordion(t(this))}),t(document).on("click",e.selectors.typeSelect,function(a){a.preventDefault(),e.typeButton=t(this),e.setLinkType()}),t(document).on("keyup",e.fields.navigationLabel,function(){e.updateTitle()}),t(document).on("click",e.selectors.saveButton,function(t){t.preventDefault(),e.submitForm()}),t(document).on("keydown",function(e){27===e.keyCode&&t("#np-link-modal").modal("hide")})},e.openModal=function(){t(NestedPages.selectors.linkErrorDiv).hide(),t(NestedPages.selectors.linkModal).find("input").val(""),t(NestedPages.selectors.linkModal).find(".parent_id").val(e.postParent),e.clearForm(),t(e.selectors.accordion).find("ul").hide(),t(e.selectors.typeSelect).removeClass("active"),t(NestedPages.selectors.linkModal).modal("show")},e.accordion=function(a){e.clearForm();var s=t(a).siblings("ul");if(t(s).is(":visible"))return t(a).removeClass("active"),void t(s).slideUp("fast");t(e.selectors.accordionItem).removeClass("active"),t(a).addClass("active"),t(a).parents(e.selectors.accordion).find("ul").slideUp("fast"),t(s).slideDown("fast")},e.setLinkType=function(){t(e.typeButton).hasClass("active")?e.clearForm():(t(e.typeButton).hasClass("np-custom-link")&&(t(e.selectors.accordionItem).removeClass("active"),t(e.selectors.accordion).find("ul").slideUp("fast")),t(e.selectors.formPlaceholder).hide(),e.populateForm())},e.populateForm=function(){t(e.selectors.saveButton).show(),t(e.selectors.typeSelect).removeClass("active"),t(e.typeButton).addClass("active"),t(e.fields.menuTitle).text(t(e.typeButton).text()).val(t(e.typeButton).text()),t(e.selectors.form).find("h3").find("em").text(t(e.typeButton).attr("data-np-object-name")),""!==t(e.typeButton).attr("data-np-permalink")?(t(e.selectors.form).find(e.selectors.urlInputCont).hide(),t(e.selectors.form).find(e.selectors.originalLink).html('<a href="'+t(e.typeButton).attr("data-np-permalink")+'">'+t(e.typeButton).text()+"</a>"),t(e.selectors.form).find(e.selectors.originalLink).parent(".original-link").show()):(t(e.selectors.form).find(e.selectors.urlInputCont).show(),t(e.selectors.form).find(e.selectors.originalLink).parent(".original-link").hide()),t(e.fields.object).val(t(e.typeButton).attr("data-np-menu-object")),t(e.fields.objectid).val(t(e.typeButton).attr("data-np-menu-objectid")),t(e.fields.itemType).val(t(e.typeButton).attr("data-np-menu-type")),t(e.selectors.formDetails).show()},e.clearForm=function(){t(e.selectors.form).find(e.selectors.errorDiv).hide(),t(e.selectors.saveButton).hide(),t(e.selectors.formDetails).hide(),t(e.selectors.formPlaceholder).show(),t(e.selectors.form).find("input").not(".parent_id").val(""),t(e.selectors.form).find(e.fields.linkTarget).val("_blank"),t(e.selectors.form).find('input[type="checkbox"]').attr("checked",!1),t(e.selectors.typeSelect).removeClass("active"),e.search.toggleLoading(!1),t(e.selectors.searchResults).remove(),t(e.selectors.defaultResults).show()},e.updateTitle=function(){var a=t(e.fields.navigationLabel).val(),s=t(e.selectors.form).find("h3").find("span");""!==a?(t(e.fields.menuTitle).val(a),t(s).text(a)):(t(e.fields.menuTitle).val(t(e.typeButton).text()),t(s).text(t(e.typeButton).text()))},e.submitForm=function(){e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",data:t(e.selectors.form).serialize()+"&action="+NestedPages.formActions.newMenuItem+"&nonce="+NestedPages.jsData.nonce+"&post_type="+NestedPages.jsData.posttype+"&syncmenu="+NestedPages.jsData.syncmenu,success:function(a){e.toggleLoading(!1),"error"!==a.status?(e.post=a.post_data,e.createRow()):t(e.selectors.form).find(e.selectors.errorDiv).text(a.message).show()},error:function(e){console.log(e)}})},e.createRow=function(){var a='<li id="menuItem_'+e.post.id+'" class="page-row published';a+='">',a+='<div class="row"><div class="child-toggle"><div class="child-toggle-spacer"></div></div><div class="row-inner"><i class="np-icon-sub-menu"></i><i class="handle np-icon-menu"></i><a href="'+e.post.np_link_content+'" class="page-link page-title" target="_blank"><span class="title">'+e.post.menuTitle+' <i class="np-icon-link"></i></span>',a+='</a><a href="#" class="np-toggle-edit"><i class="np-icon-pencil"></i></a><div class="action-buttons"><a href="#" class="np-btn np-quick-edit-redirect" ',a+='data-id="'+e.post.id+'"',a+='data-parentid="'+e.post.parent_id+'"',a+='data-title="'+e.post.menuTitle+'" ',a+='data-url="'+e.post.url+'" ',a+='data-status="publish" ',a+='data-np-status="show" ',a+='data-navstatus="show" ',a+='data-navcss="'+e.post.cssClasses+'" ',a+='data-navtitleattr="'+e.post.titleAttribute+'" ',a+='data-nav-type="'+e.post.menuType+'" ',a+='data-nav-object="'+e.post.objectType+'" ',a+='data-nav-object-id="'+e.post.objectId+'" ',a+='data-nav-original-link="'+e.post.original_link+'" ',a+='data-nav-original-title="'+e.post.original_title+'" ',a+='data-linktarget="'+e.post.link_target+'">',a+=NestedPages.jsData.quickEditText,a+="</a>",a+='<a href="'+e.post.delete_link+'" class="np-btn np-btn-trash"><i class="np-icon-remove"></i></a>',a+="</div></div></div></li>","0"===e.post.parent_id?t(".nplist:first li:first").after(a):e.appendChildRow(a),t(NestedPages.selectors.linkModal).modal("hide"),e.row=t("#menuItem_"+e.post.id).find(".row"),e.formatter.flashRow(e.row)},e.appendChildRow=function(a){var s=t("#menuItem_"+e.post.parent_id);0===t(s).children("ol").length?(a='<ol class="sortable nplist" style="display:block;">'+a+"</ol>",t(s).append(a)):t(s).find("ol:first").prepend(a),e.formatter.updateSubMenuToggle()},e.toggleLoading=function(a){if(a)return t(e.selectors.form).find(e.selectors.errorDiv).hide(),t(e.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).show(),void t(e.selectors.saveButton).attr("disabled","disabled");t(e.selectors.form).find(NestedPages.selectors.quickEditLoadingIndicator).hide(),t(e.selectors.saveButton).attr("disabled",!1)},e.init()},(NestedPages=NestedPages||{}).MenuSearch=function(){var e=this,t=jQuery;return e.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]"},e.activeForm="",e.results="",e.defaultResults="",e.searchType="",e.searchObject="",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("keyup",e.selectors.searchForms,function(){e.activeForm=t(this),t(e.selectors.searchResults).remove(),e.performSearch()})},e.performSearch=function(){if(e.defaultResults=t(e.activeForm).parent("li").siblings(e.selectors.defaultResults),t(e.activeForm).val().length>2)return t(e.defaultResults).hide(),e.toggleLoading(!0),void e.query();e.toggleLoading(!1),t(e.defaultResults).show()},e.query=function(){e.searchType=t(e.activeForm).attr(e.selectors.searchType),e.searchObject=t(e.activeForm).attr(e.selectors.searchObject),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.search,nonce:NestedPages.jsData.nonce,term:t(e.activeForm).val(),searchType:e.searchType,searchObject:e.searchObject},success:function(a){console.log(a),a.results?(e.results=a.results,e.toggleLoading(!1),"post_type"===e.searchType?e.appendPosts():e.appendTaxonomies()):(e.toggleLoading(!1),t(e.activeForm).siblings(e.selectors.noResults).show())}})},e.appendPosts=function(){var a="";t.each(e.results,function(t,s){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+e.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+s.ID+'" data-np-permalink="'+s.permalink+'" data-np-object-name="'+s.singular_name+'" data-np-menu-selection>'+s.post_title+"</a></li>"}),t(a).insertAfter(t(e.activeForm).parent("li")),e.toggleLoading(!1)},e.appendTaxonomies=function(){var a="";t.each(e.results,function(t,s){a+='<li data-np-search-result><a href="#" data-np-menu-object="'+e.searchObject+'" data-np-menu-type="post_type" data-np-menu-objectid="'+s.term_id+'" data-np-permalink="'+s.permalink+'" data-np-object-name="'+s.taxonomy+'" data-np-menu-selection>'+s.name+"</a></li>"}),t(a).insertAfter(t(e.activeForm).parent("li")),e.toggleLoading(!1)},e.toggleLoading=function(a){var s=t(e.activeForm).siblings(e.selectors.loadingIndicator);t(e.selectors.noResults).hide(),a?t(s).show():t(s).hide()},e.init()},jQuery(document).ready(function(){new NestedPagesTrash});var NestedPagesTrash=function(){var e=this,t=jQuery;return e.trashButton=".np-empty-trash",e.confirmButton=".np-trash-confirm",e.warningModal="#np-trash-modal",e.errorAlert="#np-error",e.loadingIndicator="#nested-loading",e.trashLinks=".np-trash-links",e.postType=t("#np-trash-posttype").val(),e.nonce=nestedpages.np_nonce,e.formAction="npEmptyTrash",e.init=function(){e.bindEvents()},e.bindEvents=function(){t(document).on("click",e.trashButton,function(a){a.preventDefault(),t(e.warningModal).modal("show")}),t(document).on("click",e.confirmButton,function(t){t.preventDefault(),e.confirmEmpty()})},e.confirmEmpty=function(){e.loading(!0),t(e.warningModal).hide(),t(e.errorAlert).hide(),e.emptyTrash()},e.emptyTrash=function(){t.ajax({url:ajaxurl,type:"post",datatype:"json",data:{action:e.formAction,nonce:e.nonce,posttype:e.postType},success:function(a){e.loading(!1),"error"===a.status?t(e.errorAlert).text(a.message).show():t(e.trashLinks).hide()}})},e.loading=function(a){a?t(e.loadingIndicator).show():t(e.loadingIndicator).hide()},e.init()};(NestedPages=NestedPages||{}).ConfirmDelete=function(){var e=this,t=jQuery;return e.deleteLink="",e.bindEvents=function(){t(document).on("click",NestedPages.selectors.linkDeleteButton,function(a){a.preventDefault(),e.confirmSingle(t(this))}),t(document).on("click",NestedPages.selectors.linkDeleteConfirmationButton,function(a){a.preventDefault(),t(this).hasClass("bulk")?e.deleteMultiple():e.deleteSingle()}),t(document).on("submit",NestedPages.selectors.bulkActionsForm,function(t){e.confirmMultiple(t)})},e.confirmSingle=function(a){e.deleteLink=t(a).attr("href"),t(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation_singular),t(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.delete).removeClass("bulk"),t(NestedPages.selectors.linkDeleteConfirmationModal).modal("show")},e.confirmMultiple=function(e){"trash"===t('select[name="np_bulk_action"]').val()&&""!==t(NestedPages.selectors.bulkActionRedirectIds).val()&&(e.preventDefault(),t(NestedPages.selectors.linkDeleteConfirmationModalText).text(nestedpages.link_delete_confirmation),t(NestedPages.selectors.linkDeleteConfirmationButton).text(nestedpages.trash_delete_links).addClass("bulk"),t(NestedPages.selectors.linkDeleteConfirmationModal).modal("show"))},e.deleteMultiple=function(){t(NestedPages.selectors.bulkActionsForm)[0].submit()},e.deleteSingle=function(){window.location.replace(e.deleteLink)},e.bindEvents()},(NestedPages=NestedPages||{}).ManualSync=function(){var e=this,t=jQuery;return e.activeBtn="",e.bindEvents=function(){t(document).on("click",NestedPages.selectors.manualMenuSync,function(a){a.preventDefault(),e.activeBtn=t(this),e.syncMenu()}),t(document).on("click",NestedPages.selectors.manualOrderSync,function(a){a.preventDefault(),e.activeBtn=t(this),e.syncOrder()})},e.syncMenu=function(){e.loading(!0),t.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(a){"error"===a.status?(t(NestedPages.selectors.errorDiv).text(a.message).show(),t(NestedPages.selectors.loadingIndicator).hide()):e.loading(!1)}})},e.syncOrder=function(){e.loading(!0),(new NestedPages.Nesting).syncNesting(!0,e.loading(!1))},e.loading=function(a){if(a)return t(e.activeBtn).addClass("disabled"),void t(NestedPages.selectors.loadingIndicator).show();t(e.activeBtn).removeClass("disabled"),t(NestedPages.selectors.loadingIndicator).hide()},e.bindEvents()},(NestedPages=NestedPages||{}).PostSearch=function(){var e=this,t=jQuery;return e.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"},e.changed=!1,e.activeInput="",e.results="",e.defaultResults="",e.postType="",e.activeForm="",e.bindEvents=function(){t("["+e.selectors.input+"]").on("input",function(){if(e.activeInput=t(this),e.setOptions(),e.changed||e.setDefaultResults(),""===t(this).val())return t(e.activeForm).find("["+e.selectors.noResults+"]").hide(),void e.showDefaultResults();e.query()})},e.setDefaultResults=function(){e.defaultResults=t(e.activeForm).find("["+e.selectors.results+"]").html(),e.changed=!0},e.showDefaultResults=function(){t(e.activeForm).find("["+e.selectors.results+"]").html(e.defaultResults)},e.setOptions=function(){e.postType=t(e.activeInput).attr(e.selectors.input),e.activeForm=t(e.activeInput).parents("["+e.selectors.form+"]")},e.performSearch=function(){if(e.defaultResults=t(e.activeForm).parent("li").siblings(e.selectors.defaultResults),t(e.activeForm).val().length>2)return t(e.defaultResults).hide(),e.toggleLoading(!0),void e.query();e.toggleLoading(!1),t(e.defaultResults).show()},e.query=function(){t(e.activeForm).find("["+e.selectors.results+"]").empty(),e.toggleLoading(!0),t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.postSearch,nonce:NestedPages.jsData.nonce,term:t(e.activeInput).val(),postType:e.postType},success:function(a){a.results?(e.results=a.results,e.loadResults(),e.toggleLoading(!1)):(e.toggleLoading(!1),t(e.activeForm).find("["+e.selectors.noResults+"]").show())}})},e.loadResults=function(){var a="<ul>";t.each(e.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>",t(e.activeForm).find("["+e.selectors.results+"]").html(a),e.toggleLoading(!1)},e.toggleLoading=function(a){var s=t(e.activeForm).find("["+e.selectors.loadingIndicator+"]"),n=t(e.activeForm).find("["+e.selectors.noResults+"]");t(n).hide(),a?t(s).show():t(s).hide()},e.bindEvents()},(NestedPages=NestedPages||{}).Wpml=function(){var e=this,t=jQuery;return e.button=null,e.postData=null,e.modal=null,e.parent_li=null,e.formatter=new NestedPages.Formatter,e.selectors={translationsBtn:"data-nestedpages-translations",modal:"data-np-wpml-translations-modal",title:"data-wmpl-translation-title",table:"data-np-wpml-translations-modal-table"},e.bindEvents=function(){nestedpages.wpml&&t(document).on("click","["+e.selectors.translationsBtn+"]",function(a){a.preventDefault(),e.createTranslationsModal(t(this))})},e.createTranslationsModal=function(a){if(e.parent_li=t(a).closest(NestedPages.selectors.row).parent("li"),e.button=t(a).siblings(NestedPages.selectors.quickEditOpen),e.postData={id:t(e.button).attr("data-id"),title:t(e.button).attr("data-title"),slug:t(e.button).attr("data-slug")},e.modal=t("["+e.selectors.modal+"]").clone(),t(e.parent_li).children("ol").length>0){var s=t(e.parent_li).children("ol");t(e.modal).insertBefore(s)}else t(e.modal).appendTo(e.parent_li);t(e.modal).find("["+e.selectors.title+"]").text(e.postData.title),e.formatter.showQuickEdit(),t(e.modal).show(),e.getTranslationData()},e.getTranslationData=function(){t.ajax({url:NestedPages.jsData.ajaxurl,type:"post",datatype:"json",data:{action:NestedPages.formActions.wpmlTranslations,post_id:e.postData.id,nonce:NestedPages.jsData.nonce},success:function(a){"success"===a.status?e.populateModal(a.translations):(t(e.modal).find(NestedPages.selectors.quickEditErrorDiv).text(a.message).show(),e.toggleLoading(!1))}})},e.populateModal=function(a){var s="<tbody>";t.each(a,function(e,t){var n=a[e];s+="<tr>",s+='<td><img src="'+n.country_flag_url+'" alt="'+n.translated_name+'" /> '+n.translated_name+"</td>",s+="<td>",n.has_translation&&n.edit_link?s+='<a href="'+n.edit_link+'">'+n.translation.post_title+" ("+nestedpages.edit+")</a>":s+='<a href="'+n.add_link+'" class="np-btn">+ '+nestedpages.add_translation+"</a>",s+="</td>",s+="</tr>"}),s+="</tbody>",t(e.modal).find("["+e.selectors.table+"]").html(s),e.toggleLoading(!1)},e.toggleLoading=function(a){a?t(e.modal).addClass("loading"):t(e.modal).removeClass("loading")},e.bindEvents()};
|
|
assets/js/nestedpages.settings.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var NestedPages=NestedPages||{};NestedPages.Settings=function(){var e=this,t=jQuery;return e.selectors={postTypeToggle:"[data-toggle-nestedpages-pt-settings]",postTypeCheckbox:"[data-nestedpages-
|
1 |
+
var NestedPages=NestedPages||{};NestedPages.Settings=function(){var e=this,t=jQuery;return e.selectors={postTypeToggle:"[data-toggle-nestedpages-pt-settings]",postTypeCheckbox:"[data-nestedpages-settings-row-checkbox]",customFieldsCheckbox:"[data-toggle-nestedpages-cf-settings]",standardFieldsCheckbox:"[data-toggle-nestedpages-sf-settings]",taxonomiesFieldCheckbox:"[data-hide-taxonomies]",thumbnailsCheckbox:"[data-enable-thumbnails]",menuEnabledOption:"[data-menu-enabled-option]",disableMenuCheckbox:"[data-disable-menu-checkbox]",disableAutoCheckbox:"[data-menu-disable-auto-checkbox]",assignPostTypeCheckbox:"[data-nestedpages-assign-post-type]",assignPostTypeId:"[data-nested-pages-assign-post-type-id]",assignPostTypeTitle:"[data-nested-pages-assign-post-type-title]",assignPostTypeOption:"[data-assignment-page-id]",assignPostTypeRemove:"[data-nestedpages-page-pt-assignment-remove]",assignPostTypeSelection:"[data-nestedpages-page-pt-assignment-selection]"},e.bindEvents=function(){t(document).ready(function(){e.toggleAllSettingsButtons(),e.toogleAllFieldSettings(".custom-fields"),e.toogleAllFieldSettings(".standard-fields"),e.toggleMenuCheckboxes(),e.toggleHideCheckbox(),e.toggleAssignPostType()}),t(document).on("click",e.selectors.postTypeToggle,function(s){s.preventDefault(),e.toggleRow(t(this))}),t(document).on("change",e.selectors.postTypeCheckbox,function(){e.toggleSettingsButton(t(this))}),t(document).on("change",e.selectors.customFieldsCheckbox,function(){e.toogleFieldSettings(t(this),".custom-fields")}),t(document).on("change",e.selectors.standardFieldsCheckbox,function(){e.toogleFieldSettings(t(this),".standard-fields")}),t(document).on("change",e.selectors.taxonomiesFieldCheckbox,function(){e.toggleTaxonomyCheckboxes(t(this))}),t(document).on("change",e.selectors.thumbnailsCheckbox,function(){e.toggleThumbnailSettings(t(this))}),t(document).on("change",e.selectors.disableMenuCheckbox,function(){e.toggleMenuCheckboxes()}),t(document).on("change",e.selectors.disableAutoCheckbox,function(){e.toggleHideCheckbox()}),t(document).on("change",e.selectors.assignPostTypeCheckbox,function(){e.toggleAssignPostType()}),t(document).on("click",e.selectors.assignPostTypeOption,function(s){s.preventDefault(),e.chooseAssignPostType(t(this))}),t(document).on("click",e.selectors.assignPostTypeRemove,function(s){s.preventDefault(),e.removeAssignPostType(t(this))})},e.toggleRow=function(e){t(e).parent(".head").siblings(".body").toggle(),t(e).parents(".row-container").toggleClass("active")},e.toggleSettingsButton=function(s){var n=t(s).parents(".head").find(e.selectors.postTypeToggle);if(t(s).is(":checked"))return t(n).show(),void t(n).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!1);t(n).hide(),t(n).parents(".head").siblings(".body").hide(),t(n).parents(".row-container").removeClass("active"),t(n).parents(".head").siblings(".body").find('input[type="checkbox"]').attr("checked",!1),t(n).parents(".head").siblings(".body").find('input[type="hidden"]').attr("disabled",!0),t(n).parents(".head").siblings(".body").find("select").val(!1)},e.toggleAllSettingsButtons=function(){var s=t(e.selectors.postTypeCheckbox);t.each(s,function(){e.toggleSettingsButton(t(this))})},e.toogleFieldSettings=function(e,s){var n=t(e).parents(".body").find(s);t(e).is(":checked")?t(n).show():t(n).hide()},e.toogleAllFieldSettings=function(s){n=t(e.selectors.customFieldsCheckbox);if(".standard-fields"==s)var n=t(e.selectors.standardFieldsCheckbox);t.each(n,function(){e.toogleFieldSettings(t(this),s)})},e.toggleTaxonomyCheckboxes=function(e){var s=t(e).parents("ul").find(t("*[data-taxonomy-single]"));t(e).is(":checked")?t(s).hide():t(s).show()},e.toggleThumbnailSettings=function(e){var s=t(e).parents(".field").find(t("*[data-thumbnail-options]"));t(e).is(":checked")?t(s).show():t(s).hide()},e.toggleMenuCheckboxes=function(){var s=t(e.selectors.disableMenuCheckbox),n=t(e.selectors.menuEnabledOption);t(s).is(":checked")?t(n).hide():t(n).show()},e.toggleHideCheckbox=function(){var s=t(e.selectors.disableAutoCheckbox),n=t("[data-menu-hide-checkbox]");t(s).is(":checked")?t(n).hide():t(n).show()},e.toggleAssignPostType=function(){var s=t(e.selectors.assignPostTypeCheckbox);t.each(s,function(){var e=t(this),s=t(this).parents(".field").find(".nestedpages-assignment-display");t(e).is(":checked")?t(s).show():t(s).hide()})},e.chooseAssignPostType=function(s){var n=t(s).attr("data-assignment-page-id"),o=t(s).attr("data-assignment-page-title"),i=t(s).parents(".field"),a=nestedpages.currently_assigned_to+" "+o+' <a href="#" data-nestedpages-page-pt-assignment-remove>('+nestedpages.remove+")</a>";t(i).find(e.selectors.assignPostTypeId).val(n),t(i).find(e.selectors.assignPostTypeTitle).val(o),t(i).find(e.selectors.assignPostTypeSelection).html(a).show(),t(i).find("[data-nestedpages-post-search-form]").hide()},e.removeAssignPostType=function(s){var n=t(s).parents(".field");t(n).find(e.selectors.assignPostTypeSelection).hide(),t(n).find("[data-nestedpages-post-search-form]").show(),t(n).find(e.selectors.assignPostTypeId).val(""),t(n).find(e.selectors.assignPostTypeTitle).val("")},e.init=function(){e.bindEvents()},e.init()},new NestedPages.Settings;
|
composer.json
CHANGED
@@ -2,12 +2,11 @@
|
|
2 |
"name": "kylephillips/nestedpages",
|
3 |
"description": "Nested Pages for WordPress",
|
4 |
"keywords": ["wordpress", "plugin", "nested pages"],
|
5 |
-
"homepage": "
|
6 |
"license": "GPL",
|
7 |
"authors": [
|
8 |
{
|
9 |
"name": "Kyle Phillips",
|
10 |
-
"email": "support@nestedpages.com",
|
11 |
"homepage": "https://github.com/kylephillips"
|
12 |
}
|
13 |
],
|
2 |
"name": "kylephillips/nestedpages",
|
3 |
"description": "Nested Pages for WordPress",
|
4 |
"keywords": ["wordpress", "plugin", "nested pages"],
|
5 |
+
"homepage": "https://nestedpages.com",
|
6 |
"license": "GPL",
|
7 |
"authors": [
|
8 |
{
|
9 |
"name": "Kyle Phillips",
|
|
|
10 |
"homepage": "https://github.com/kylephillips"
|
11 |
}
|
12 |
],
|
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:
|
7 |
Author: Kyle Phillips
|
8 |
Author URI: https://github.com/kylephillips
|
9 |
Text Domain: wp-nested-pages
|
@@ -12,7 +12,7 @@ License: GPLv2 or later.
|
|
12 |
Copyright: Kyle Phillips
|
13 |
*/
|
14 |
|
15 |
-
/* Copyright
|
16 |
|
17 |
This program is free software; you can redistribute it and/or modify
|
18 |
it under the terms of the GNU General Public License, version 2, as
|
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: 2.0.1
|
7 |
Author: Kyle Phillips
|
8 |
Author URI: https://github.com/kylephillips
|
9 |
Text Domain: wp-nested-pages
|
12 |
Copyright: Kyle Phillips
|
13 |
*/
|
14 |
|
15 |
+
/* Copyright 2017 Kyle Phillips (email : support@nestedpages.com)
|
16 |
|
17 |
This program is free software; you can redistribute it and/or modify
|
18 |
it under the terms of the GNU General Public License, version 2, as
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: kylephillips
|
|
3 |
Donate link: http://nestedpages.com/
|
4 |
Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.7.
|
8 |
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -99,6 +99,17 @@ As of version 1.6, yes. Visit Settings > Nested Pages > Post Types to configure
|
|
99 |
|
100 |
== Changelog ==
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
= 1.7.1 =
|
103 |
* Bug fix where saving post type options was enabling all post types
|
104 |
|
@@ -422,6 +433,16 @@ After installing Nested Pages, a new menu will be available with the name `Neste
|
|
422 |
|
423 |
**Hiding Pages in the Menu:** To hide a page from the Nested Pages menu, click “Quick Edit” on it’s row, select “Hide in Nav Menu”, and click “update”. If menu sync is disabled, enable it now to sync the setting. Hidden pages are marked “(Hidden)”. If a page with child pages is hidden from the menu, all of it’s child pages will also be hidden.
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
= Filters =
|
426 |
|
427 |
* `the_title($title, $post_id, $view)` – Standard title filter. Applied to the title displayed in the nested interface. A third paramater, $view, is passed to check if the current title is being displayed in the nested view.
|
3 |
Donate link: http://nestedpages.com/
|
4 |
Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.8
|
7 |
+
Stable tag: 1.7.1
|
8 |
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
99 |
|
100 |
== Changelog ==
|
101 |
|
102 |
+
= 2.0.1 =
|
103 |
+
* WPML compatibility added (Limited support, see the "More Information" section for important notes on support).
|
104 |
+
* Important upgrade note: Custom links within the Nested Pages interface are disabled if WPML is installed and enabled. This is a potential breaking change, so please remove all custom links before updating. Links may be added back to menus by using the default WordPress Appearance > Menus editor.
|
105 |
+
* Sort/Order options on non-page post type listings may now be added/removed. All options are hidden by default. To enable these, visit Settings > Nested Pages > Post Types. Under the desired post type, options may be enabled under the "Sort Options" row.
|
106 |
+
* Bug fix where pages hidden from the Nested Pages view where displaying.
|
107 |
+
* "Sticky" checkbox added to quick edit form under non-hierarchical post types.
|
108 |
+
* Adds query optimizations to the listing view, reducing the overall number of queries made.
|
109 |
+
|
110 |
+
= 2.0.0 =
|
111 |
+
* WPML beta release
|
112 |
+
|
113 |
= 1.7.1 =
|
114 |
* Bug fix where saving post type options was enabling all post types
|
115 |
|
433 |
|
434 |
**Hiding Pages in the Menu:** To hide a page from the Nested Pages menu, click “Quick Edit” on it’s row, select “Hide in Nav Menu”, and click “update”. If menu sync is disabled, enable it now to sync the setting. Hidden pages are marked “(Hidden)”. If a page with child pages is hidden from the menu, all of it’s child pages will also be hidden.
|
435 |
|
436 |
+
|
437 |
+
= WPML Compatibility =
|
438 |
+
|
439 |
+
As of version 2.0.1, some features of Nested Pages are compatible with WPML. There are some important exceptions to take note of before upgrading to version 2 if WPML is installed, or if installing WPML on an existing Nested Pages enabled site.
|
440 |
+
|
441 |
+
**WPML and menu support:** Certain features within Nested Pages are disabled if WPML is installed and enabled. This is due to the complexity of menu synchronization across languages. While automatic menu sync remains available for the site's primary language, additional languages must be synchronized using WPML's menu synchronization methods. If menu sync is enabled within Nested Pages, a "Sync WPML Menus" link is available on non-primary language screens for convenience.
|
442 |
+
|
443 |
+
**Custom Links:** Custom links within Nested Pages are disabled on installs with WPML. Custom links may be added through the traditional Appearance > Menus interface. This ensures that WPML menus synchronize successfully across languages.
|
444 |
+
|
445 |
+
|
446 |
= Filters =
|
447 |
|
448 |
* `the_title($title, $post_id, $view)` – Standard title filter. Applied to the title displayed in the nested interface. A third paramater, $view, is passed to check if the current title is being displayed in the nested view.
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit56f1aa73876d57e9dead1f33d820aeb4::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -54,9 +54,15 @@ class ClassLoader
|
|
54 |
private $useIncludePath = false;
|
55 |
private $classMap = array();
|
56 |
|
|
|
|
|
57 |
public function getPrefixes()
|
58 |
{
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
public function getPrefixesPsr4()
|
@@ -143,6 +149,8 @@ class ClassLoader
|
|
143 |
* @param string $prefix The prefix/namespace, with trailing '\\'
|
144 |
* @param array|string $paths The PSR-0 base directories
|
145 |
* @param bool $prepend Whether to prepend the directories
|
|
|
|
|
146 |
*/
|
147 |
public function addPsr4($prefix, $paths, $prepend = false)
|
148 |
{
|
@@ -202,10 +210,13 @@ class ClassLoader
|
|
202 |
* Registers a set of PSR-4 directories for a given namespace,
|
203 |
* replacing any others previously set for this namespace.
|
204 |
*
|
205 |
-
* @param string $prefix
|
206 |
-
* @param array|string $paths
|
|
|
|
|
207 |
*/
|
208 |
-
public function setPsr4($prefix, $paths)
|
|
|
209 |
if (!$prefix) {
|
210 |
$this->fallbackDirsPsr4 = (array) $paths;
|
211 |
} else {
|
@@ -239,6 +250,27 @@ class ClassLoader
|
|
239 |
return $this->useIncludePath;
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
/**
|
243 |
* Registers this instance as an autoloader.
|
244 |
*
|
@@ -290,6 +322,9 @@ class ClassLoader
|
|
290 |
if (isset($this->classMap[$class])) {
|
291 |
return $this->classMap[$class];
|
292 |
}
|
|
|
|
|
|
|
293 |
|
294 |
$file = $this->findFileWithExtension($class, '.php');
|
295 |
|
@@ -316,7 +351,7 @@ class ClassLoader
|
|
316 |
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
317 |
if (0 === strpos($class, $prefix)) {
|
318 |
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
319 |
-
if (
|
320 |
return $file;
|
321 |
}
|
322 |
}
|
@@ -326,7 +361,7 @@ class ClassLoader
|
|
326 |
|
327 |
// PSR-4 fallback dirs
|
328 |
foreach ($this->fallbackDirsPsr4 as $dir) {
|
329 |
-
if (
|
330 |
return $file;
|
331 |
}
|
332 |
}
|
@@ -345,7 +380,7 @@ class ClassLoader
|
|
345 |
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
346 |
if (0 === strpos($class, $prefix)) {
|
347 |
foreach ($dirs as $dir) {
|
348 |
-
if (
|
349 |
return $file;
|
350 |
}
|
351 |
}
|
@@ -355,7 +390,7 @@ class ClassLoader
|
|
355 |
|
356 |
// PSR-0 fallback dirs
|
357 |
foreach ($this->fallbackDirsPsr0 as $dir) {
|
358 |
-
if (
|
359 |
return $file;
|
360 |
}
|
361 |
}
|
54 |
private $useIncludePath = false;
|
55 |
private $classMap = array();
|
56 |
|
57 |
+
private $classMapAuthoritative = false;
|
58 |
+
|
59 |
public function getPrefixes()
|
60 |
{
|
61 |
+
if (!empty($this->prefixesPsr0)) {
|
62 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
63 |
+
}
|
64 |
+
|
65 |
+
return array();
|
66 |
}
|
67 |
|
68 |
public function getPrefixesPsr4()
|
149 |
* @param string $prefix The prefix/namespace, with trailing '\\'
|
150 |
* @param array|string $paths The PSR-0 base directories
|
151 |
* @param bool $prepend Whether to prepend the directories
|
152 |
+
*
|
153 |
+
* @throws \InvalidArgumentException
|
154 |
*/
|
155 |
public function addPsr4($prefix, $paths, $prepend = false)
|
156 |
{
|
210 |
* Registers a set of PSR-4 directories for a given namespace,
|
211 |
* replacing any others previously set for this namespace.
|
212 |
*
|
213 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
214 |
+
* @param array|string $paths The PSR-4 base directories
|
215 |
+
*
|
216 |
+
* @throws \InvalidArgumentException
|
217 |
*/
|
218 |
+
public function setPsr4($prefix, $paths)
|
219 |
+
{
|
220 |
if (!$prefix) {
|
221 |
$this->fallbackDirsPsr4 = (array) $paths;
|
222 |
} else {
|
250 |
return $this->useIncludePath;
|
251 |
}
|
252 |
|
253 |
+
/**
|
254 |
+
* Turns off searching the prefix and fallback directories for classes
|
255 |
+
* that have not been registered with the class map.
|
256 |
+
*
|
257 |
+
* @param bool $classMapAuthoritative
|
258 |
+
*/
|
259 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
260 |
+
{
|
261 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Should class lookup fail if not found in the current class map?
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function isClassMapAuthoritative()
|
270 |
+
{
|
271 |
+
return $this->classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
/**
|
275 |
* Registers this instance as an autoloader.
|
276 |
*
|
322 |
if (isset($this->classMap[$class])) {
|
323 |
return $this->classMap[$class];
|
324 |
}
|
325 |
+
if ($this->classMapAuthoritative) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
|
329 |
$file = $this->findFileWithExtension($class, '.php');
|
330 |
|
351 |
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
if (0 === strpos($class, $prefix)) {
|
353 |
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
return $file;
|
356 |
}
|
357 |
}
|
361 |
|
362 |
// PSR-4 fallback dirs
|
363 |
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
return $file;
|
366 |
}
|
367 |
}
|
380 |
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
if (0 === strpos($class, $prefix)) {
|
382 |
foreach ($dirs as $dir) {
|
383 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
return $file;
|
385 |
}
|
386 |
}
|
390 |
|
391 |
// PSR-0 fallback dirs
|
392 |
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
return $file;
|
395 |
}
|
396 |
}
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit236886854fb2275d6b0b4224182e20cd
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
@@ -44,7 +44,7 @@ class ComposerAutoloaderInit236886854fb2275d6b0b4224182e20cd
|
|
44 |
}
|
45 |
}
|
46 |
|
47 |
-
function
|
48 |
{
|
49 |
require $file;
|
50 |
}
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit56f1aa73876d57e9dead1f33d820aeb4
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit56f1aa73876d57e9dead1f33d820aeb4', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit56f1aa73876d57e9dead1f33d820aeb4', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
44 |
}
|
45 |
}
|
46 |
|
47 |
+
function composerRequire56f1aa73876d57e9dead1f33d820aeb4($file)
|
48 |
{
|
49 |
require $file;
|
50 |
}
|