Version Description
- Make hidden page not clickable. Fixes https://wordpress.org/support/topic/hide-the-page
- Load icons localy instead. Fixes https://wordpress.org/support/topic/styles-loading-icon-pngs-over-http-instead-of-https
Download this release
Release Info
Developer | eskapism |
Plugin | Admin Menu Tree Page View |
Version | 2.6.9 |
Comparing to | |
See all releases |
Code changes from version 2.6.8 to 2.6.9
- css/page-small-minus.gif +0 -0
- css/page-small-minus.png +0 -0
- css/page-small-plus.gif +0 -0
- css/page-small-plus.png +0 -0
- css/page-small.gif +0 -0
- css/page-small.png +0 -0
- css/styles.css +27 -13
- css/ui-icons_222222_256x240.png +0 -0
- css/ui-icons_cccccc_256x240.png +0 -0
- css/ui-icons_cccccc_256x240.png.1 +0 -0
- index.php +60 -61
- readme.txt +10 -6
css/page-small-minus.gif
DELETED
Binary file
|
css/page-small-minus.png
ADDED
Binary file
|
css/page-small-plus.gif
DELETED
Binary file
|
css/page-small-plus.png
ADDED
Binary file
|
css/page-small.gif
DELETED
Binary file
|
css/page-small.png
ADDED
Binary file
|
css/styles.css
CHANGED
@@ -26,16 +26,19 @@ li.toplevel_page_admin-menu-tree-page-tree_main .wp-submenu a {
|
|
26 |
|
27 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li {
|
28 |
position: relative;
|
|
|
29 |
}
|
|
|
30 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-has-childs.admin-menu-tree-page-view-opened {
|
31 |
margin-bottom: 2px;
|
32 |
}
|
33 |
|
34 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li div > a {
|
35 |
-
background: transparent url(page-small.
|
36 |
padding-left: 19px;
|
37 |
padding-right: 8px;
|
38 |
margin:1px 0;
|
|
|
39 |
}
|
40 |
.js.folded #adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li div > a {
|
41 |
padding-left: 19px;
|
@@ -67,7 +70,7 @@ li.toplevel_page_admin-menu-tree-page-tree_main .wp-submenu a {
|
|
67 |
right: 0px;
|
68 |
width: 16px;
|
69 |
height: 16px;
|
70 |
-
background: transparent url(
|
71 |
padding: 2px;
|
72 |
}
|
73 |
|
@@ -79,7 +82,7 @@ li.toplevel_page_admin-menu-tree-page-tree_main .wp-submenu a {
|
|
79 |
}
|
80 |
|
81 |
#adminmenu li ul.admin-menu-tree-page-tree a:hover .admin-menu-tree-page-view-edit:hover {
|
82 |
-
/* background-image: url(
|
83 |
}
|
84 |
|
85 |
#adminmenu li ul.admin-menu-tree-page-tree a .admin-menu-tree-page-view-view-link {
|
@@ -88,10 +91,10 @@ li.toplevel_page_admin-menu-tree-page-tree_main .wp-submenu a {
|
|
88 |
|
89 |
/* sublevels */
|
90 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-opened > div > div > a {
|
91 |
-
background-image: url(page-small-minus.
|
92 |
}
|
93 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-closed > div > div > a {
|
94 |
-
background-image: url(page-small-plus.
|
95 |
}
|
96 |
|
97 |
|
@@ -206,8 +209,7 @@ span.admin-menu-tree-page-tree_headline {
|
|
206 |
position: absolute;
|
207 |
width: 16px;
|
208 |
height: 16px;
|
209 |
-
|
210 |
-
background: transparent url(http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_222222_256x240.png) no-repeat -16px -126px;
|
211 |
top: 3px;
|
212 |
left: 3px;
|
213 |
}
|
@@ -230,7 +232,10 @@ span.admin-menu-tree-page-tree_headline {
|
|
230 |
font-size: 0.8em;
|
231 |
margin-right: 0.75ex;
|
232 |
padding: 1px 4px;
|
|
|
|
|
233 |
}
|
|
|
234 |
.admin-menu-tree-page-view-status-password {
|
235 |
background-color: #25b61a;
|
236 |
}
|
@@ -247,7 +252,7 @@ span.admin-menu-tree-page-tree_headline {
|
|
247 |
width: 13px;
|
248 |
height: 11px;
|
249 |
float: left;
|
250 |
-
background: url(
|
251 |
}
|
252 |
|
253 |
.admin-menu-tree-page-filter {
|
@@ -282,7 +287,7 @@ span.admin-menu-tree-page-tree_headline {
|
|
282 |
display: none;
|
283 |
width: 16px;
|
284 |
height: 16px;
|
285 |
-
background: transparent url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_cccccc_256x240.png) no-repeat -32px -194px;
|
286 |
position: absolute;
|
287 |
top: 5px;
|
288 |
right: 15px;
|
@@ -369,6 +374,7 @@ ul.admin-menu-tree-page-tree span.child-count {
|
|
369 |
line-height: 1.3;
|
370 |
margin-top: -8px;
|
371 |
color: #464646;
|
|
|
372 |
}
|
373 |
.amtpv-editpopup-hover {
|
374 |
display: block;
|
@@ -502,21 +508,20 @@ ul.admin-menu-tree-page-tree span.child-count {
|
|
502 |
margin-right: 4px;
|
503 |
}
|
504 |
|
505 |
-
|
506 |
.amtpv-editpopup-addpages-headline {
|
507 |
font-weight: bold;
|
508 |
}
|
509 |
|
510 |
-
|
511 |
.amtpv-linkwrap {
|
512 |
border-bottom: 1px solid transparent !important;
|
513 |
border-top: 1px solid transparent !important;
|
514 |
}
|
|
|
515 |
.amtpv-linkwrap-hover {
|
516 |
background: rgba(0,0,0,.3);
|
517 |
}
|
518 |
|
519 |
-
.amtpv-editpopup-is-working {
|
520 |
background: rgba(46, 162, 204, .3);
|
521 |
}
|
522 |
.amtpv-editpopup-is-working > a {
|
@@ -548,10 +553,12 @@ ul.admin-menu-tree-page-tree span.child-count {
|
|
548 |
overflow: auto;
|
549 |
background-color: transparent;
|
550 |
}
|
|
|
551 |
.amtpv-editpopup-addpages-names-ul li {
|
552 |
/* clear: both; */
|
553 |
float: left;
|
554 |
width: 100%;
|
|
|
555 |
/* -moz-user-select: text !important; */
|
556 |
}
|
557 |
#adminmenu li .amtpv-editpopup-addpages-names-ul span {
|
@@ -608,4 +615,11 @@ ul.amtpv-editpopup-addpages-names-ul .ui-state-highlight {
|
|
608 |
#adminmenuwrap #adminmenu #menu-pages .wp-submenu,
|
609 |
#adminmenu .wp-submenu li {
|
610 |
overflow: visible !important;
|
611 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li {
|
28 |
position: relative;
|
29 |
+
margin-bottom: -2px;
|
30 |
}
|
31 |
+
|
32 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-has-childs.admin-menu-tree-page-view-opened {
|
33 |
margin-bottom: 2px;
|
34 |
}
|
35 |
|
36 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li div > a {
|
37 |
+
background: transparent url(page-small.png) no-repeat 7px 3px !important;
|
38 |
padding-left: 19px;
|
39 |
padding-right: 8px;
|
40 |
margin:1px 0;
|
41 |
+
line-height: 1.2;
|
42 |
}
|
43 |
.js.folded #adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li div > a {
|
44 |
padding-left: 19px;
|
70 |
right: 0px;
|
71 |
width: 16px;
|
72 |
height: 16px;
|
73 |
+
background: transparent url(ui-icons_cccccc_256x240.png) no-repeat -16px -126px;
|
74 |
padding: 2px;
|
75 |
}
|
76 |
|
82 |
}
|
83 |
|
84 |
#adminmenu li ul.admin-menu-tree-page-tree a:hover .admin-menu-tree-page-view-edit:hover {
|
85 |
+
/* background-image: url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_222222_256x240.png); */
|
86 |
}
|
87 |
|
88 |
#adminmenu li ul.admin-menu-tree-page-tree a .admin-menu-tree-page-view-view-link {
|
91 |
|
92 |
/* sublevels */
|
93 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-opened > div > div > a {
|
94 |
+
background-image: url(page-small-minus.png) !important;
|
95 |
}
|
96 |
#adminmenu li .wp-submenu ul.admin-menu-tree-page-tree li.admin-menu-tree-page-view-closed > div > div > a {
|
97 |
+
background-image: url(page-small-plus.png) !important;
|
98 |
}
|
99 |
|
100 |
|
209 |
position: absolute;
|
210 |
width: 16px;
|
211 |
height: 16px;
|
212 |
+
background: transparent url(ui-icons_222222_256x240.png) no-repeat -16px -126px;
|
|
|
213 |
top: 3px;
|
214 |
left: 3px;
|
215 |
}
|
232 |
font-size: 0.8em;
|
233 |
margin-right: 0.75ex;
|
234 |
padding: 1px 4px;
|
235 |
+
position: relative;
|
236 |
+
top: -1px;
|
237 |
}
|
238 |
+
|
239 |
.admin-menu-tree-page-view-status-password {
|
240 |
background-color: #25b61a;
|
241 |
}
|
252 |
width: 13px;
|
253 |
height: 11px;
|
254 |
float: left;
|
255 |
+
background: url(ui-icons_cccccc_256x240.png) no-repeat -194px -98px;
|
256 |
}
|
257 |
|
258 |
.admin-menu-tree-page-filter {
|
287 |
display: none;
|
288 |
width: 16px;
|
289 |
height: 16px;
|
290 |
+
background: transparent url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/ui-darkness/images/ui-icons_cccccc_256x240.png) no-repeat -32px -194px;
|
291 |
position: absolute;
|
292 |
top: 5px;
|
293 |
right: 15px;
|
374 |
line-height: 1.3;
|
375 |
margin-top: -8px;
|
376 |
color: #464646;
|
377 |
+
z-index: 999;
|
378 |
}
|
379 |
.amtpv-editpopup-hover {
|
380 |
display: block;
|
508 |
margin-right: 4px;
|
509 |
}
|
510 |
|
|
|
511 |
.amtpv-editpopup-addpages-headline {
|
512 |
font-weight: bold;
|
513 |
}
|
514 |
|
|
|
515 |
.amtpv-linkwrap {
|
516 |
border-bottom: 1px solid transparent !important;
|
517 |
border-top: 1px solid transparent !important;
|
518 |
}
|
519 |
+
|
520 |
.amtpv-linkwrap-hover {
|
521 |
background: rgba(0,0,0,.3);
|
522 |
}
|
523 |
|
524 |
+
.amtpv-editpopup-is-working {
|
525 |
background: rgba(46, 162, 204, .3);
|
526 |
}
|
527 |
.amtpv-editpopup-is-working > a {
|
553 |
overflow: auto;
|
554 |
background-color: transparent;
|
555 |
}
|
556 |
+
|
557 |
.amtpv-editpopup-addpages-names-ul li {
|
558 |
/* clear: both; */
|
559 |
float: left;
|
560 |
width: 100%;
|
561 |
+
margin-bottom: 0 !important;
|
562 |
/* -moz-user-select: text !important; */
|
563 |
}
|
564 |
#adminmenu li .amtpv-editpopup-addpages-names-ul span {
|
615 |
#adminmenuwrap #adminmenu #menu-pages .wp-submenu,
|
616 |
#adminmenu .wp-submenu li {
|
617 |
overflow: visible !important;
|
618 |
+
}
|
619 |
+
|
620 |
+
/* fix from https://wordpress.org/support/topic/hide-the-page?replies=2#post-6173092,
|
621 |
+
* to avoid accidental clicks on the admin-menu-tree-page-tree link
|
622 |
+
*/
|
623 |
+
a[href="edit.php?post_type=page&page=admin-menu-tree-page-tree"] {
|
624 |
+
display:none !important;
|
625 |
+
}
|
css/ui-icons_222222_256x240.png
ADDED
Binary file
|
css/ui-icons_cccccc_256x240.png
ADDED
Binary file
|
css/ui-icons_cccccc_256x240.png.1
ADDED
Binary file
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Admin Menu Tree Page View
|
4 |
Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
|
5 |
Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
|
6 |
-
Version: 2.6.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
@@ -12,7 +12,7 @@ License: GPL2
|
|
12 |
/* Copyright 2010 Pär Thernström (email: par.thernstrom@gmail.com)
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
-
it under the terms of the GNU General Public License, version 2, as
|
16 |
published by the Free Software Foundation.
|
17 |
|
18 |
This program is distributed in the hope that it will be useful,
|
@@ -38,7 +38,7 @@ add_action('wp_ajax_admin_menu_tree_page_view_move_page', 'admin_menu_tree_page_
|
|
38 |
|
39 |
function admin_menu_tree_page_view_admin_init() {
|
40 |
|
41 |
-
define( "admin_menu_tree_page_view_VERSION", "2.6.
|
42 |
define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
|
43 |
define( "admin_menu_tree_page_view_DIR", WP_PLUGIN_DIR . '/admin-menu-tree-page-view/' );
|
44 |
|
@@ -86,10 +86,10 @@ function admin_menu_tree_page_view_admin_head() {
|
|
86 |
* I know, I know. Should have made a class from the beginning...
|
87 |
*/
|
88 |
class admin_menu_tree_page_view {
|
89 |
-
|
90 |
public static $arr_all_pages_id_parent;
|
91 |
public static $one_page_parents;
|
92 |
-
|
93 |
static function get_all_pages_id_parent() {
|
94 |
if (!isset(admin_menu_tree_page_view::$arr_all_pages_id_parent)) {
|
95 |
// get all pages, once, to spare some queries looking for children
|
@@ -104,21 +104,21 @@ class admin_menu_tree_page_view {
|
|
104 |
}
|
105 |
return admin_menu_tree_page_view::$arr_all_pages_id_parent;
|
106 |
}
|
107 |
-
|
108 |
static function get_post_ancestors($post_to_check_parents_for) {
|
109 |
-
|
110 |
if ( ! isset(admin_menu_tree_page_view::$one_page_parents) ) {
|
111 |
-
|
112 |
wp_cache_delete($post_to_check_parents_for, 'posts');
|
113 |
$one_page_parents = get_post_ancestors($post_to_check_parents_for);
|
114 |
admin_menu_tree_page_view::$one_page_parents = $one_page_parents;
|
115 |
-
|
116 |
}
|
117 |
-
|
118 |
return admin_menu_tree_page_view::$one_page_parents;
|
119 |
-
|
120 |
}
|
121 |
-
|
122 |
}
|
123 |
|
124 |
function admin_menu_tree_page_view_get_pages($args) {
|
@@ -145,7 +145,7 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
145 |
$edit_link = get_edit_post_link($one_page->ID);
|
146 |
$title = get_the_title($one_page->ID);
|
147 |
$title = esc_html($title);
|
148 |
-
|
149 |
// add num of children to the title
|
150 |
// @done: this is still being done for each page, even if it does not have children. can we check if it has before?
|
151 |
// we could fetch all pages once and store them in an array and then just check if the array has our id in it. yeah. let's do that.
|
@@ -163,7 +163,7 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
163 |
} else {
|
164 |
$post_children_count = 0;
|
165 |
}
|
166 |
-
|
167 |
$class = "";
|
168 |
if (isset($_GET["action"]) && $_GET["action"] == "edit" && isset($_GET["post"]) && $_GET["post"] == $one_page->ID) {
|
169 |
$class = "current";
|
@@ -190,10 +190,10 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
190 |
$str_child_output = admin_menu_tree_page_view_get_pages($args_childs);
|
191 |
$class .= " admin-menu-tree-page-view-has-childs";
|
192 |
}
|
193 |
-
|
194 |
// determine if ul should be opened or closed
|
195 |
$isOpened = FALSE;
|
196 |
-
|
197 |
// check cookie first
|
198 |
$cookie_opened = isset($_COOKIE["admin-menu-tree-page-view-open-posts"]) ? $_COOKIE["admin-menu-tree-page-view-open-posts"] : ""; // 2,95,n
|
199 |
$cookie_opened = explode(",", $cookie_opened);
|
@@ -204,13 +204,13 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
204 |
|
205 |
// if post with id get[post] is a parent of the current post, show it
|
206 |
if ( $_GET["post"] != $one_page->ID ) {
|
207 |
-
|
208 |
$post_to_check_parents_for = $_GET["post"];
|
209 |
|
210 |
// seems to be a problem with get_post_ancestors (yes, it's in the trac too)
|
211 |
// Long time since I wrote this, but perhaps this is the problem (adding for future reference):
|
212 |
// http://core.trac.wordpress.org/ticket/10381
|
213 |
-
|
214 |
// @done: this is done several times. only do it once please
|
215 |
// before: 441. after: 43
|
216 |
$one_page_parents = admin_menu_tree_page_view::get_post_ancestors($post_to_check_parents_for);
|
@@ -226,10 +226,10 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
226 |
$class .= " admin-menu-tree-page-view-opened";
|
227 |
} elseif ($post_children_count>0) {
|
228 |
$class .= " admin-menu-tree-page-view-closed";
|
229 |
-
}
|
230 |
-
|
231 |
$class .= " nestedSortable";
|
232 |
-
|
233 |
$output .= "<li class='$class'>";
|
234 |
// first div used for nestedSortable
|
235 |
$output .= "<div>";
|
@@ -247,19 +247,19 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
247 |
$output .= "<span class='amtpv-draghandle'></span>";
|
248 |
|
249 |
$output .= "</a>";
|
250 |
-
|
251 |
-
|
252 |
// popup edit div
|
253 |
$output .= "
|
254 |
<div class='amtpv-editpopup'>
|
255 |
<div class='amtpv-editpopup-editview'>
|
256 |
<div class='amtpv-editpopup-edit' data-link='".$edit_link."'>".__("Edit", 'admin-menu-tree-page-view')."</div>
|
257 |
-
|
|
258 |
<div class='amtpv-editpopup-view' data-link='".$permalink."'>".__("View", 'admin-menu-tree-page-view')."</div>
|
259 |
</div>
|
260 |
<div class='amtpv-editpopup-add'>".__("Add new page", 'admin-menu-tree-page-view')."<br />
|
261 |
<div class='amtpv-editpopup-add-after'>".__("After", 'admin-menu-tree-page-view')."</div>
|
262 |
-
|
|
263 |
<div class='amtpv-editpopup-add-inside'>".__("Inside", 'admin-menu-tree-page-view')."</div>
|
264 |
</div>
|
265 |
<div class='amtpv-editpopup-postid'>".__("Post ID:", 'admin-menu-tree-page-view')." " . $one_page->ID."</div>
|
@@ -274,15 +274,15 @@ function admin_menu_tree_page_view_get_pages($args) {
|
|
274 |
|
275 |
// add child articles
|
276 |
$output .= $str_child_output;
|
277 |
-
|
278 |
$output .= "</li>";
|
279 |
}
|
280 |
-
|
281 |
// if this is a child listing, add ul
|
282 |
if (isset($args["child_of"]) && $args["child_of"] && $output != "") {
|
283 |
$output = "<ul class='admin-menu-tree-page-tree_childs'>$output</ul>";
|
284 |
}
|
285 |
-
|
286 |
return $output;
|
287 |
}
|
288 |
|
@@ -330,10 +330,10 @@ function admin_menu_tree_page_view_admin_menu() {
|
|
330 |
|
331 |
function admin_menu_tree_page_page() {
|
332 |
?>
|
333 |
-
|
334 |
<h2>Admin Menu Tree Page View</h2>
|
335 |
<p>Nothing to see here. Move along! :)</p>
|
336 |
-
|
337 |
<?php
|
338 |
}
|
339 |
|
@@ -350,7 +350,7 @@ function admin_menu_tree_page_view_add_page() {
|
|
350 |
|
351 |
/*
|
352 |
(
|
353 |
-
[action] => cms_tpv_add_page
|
354 |
[pageID] => cms-tpv-1318
|
355 |
type
|
356 |
)
|
@@ -380,13 +380,13 @@ function admin_menu_tree_page_view_add_page() {
|
|
380 |
|
381 |
if (!function_exists("admin_menu_tree_page_view_add_page_after")) {
|
382 |
function admin_menu_tree_page_view_add_page_after($ref_post_id, $page_title, $post_type, $post_status = "draft") {
|
383 |
-
|
384 |
global $wpdb;
|
385 |
-
|
386 |
$ref_post = get_post($ref_post_id);
|
387 |
// update menu_order of all pages below our page
|
388 |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+2 WHERE post_parent = %d AND menu_order >= %d AND id <> %d ", $ref_post->post_parent, $ref_post->menu_order, $ref_post->ID ) );
|
389 |
-
|
390 |
// create a new page and then goto it
|
391 |
$post_new = array();
|
392 |
$post_new["menu_order"] = $ref_post->menu_order+1;
|
@@ -400,7 +400,7 @@ function admin_menu_tree_page_view_add_page() {
|
|
400 |
return $newPostID;
|
401 |
}
|
402 |
}
|
403 |
-
|
404 |
$ref_post_id = $ref_post->ID;
|
405 |
$loopNum = 0;
|
406 |
foreach ($page_titles as $one_page_title) {
|
@@ -412,7 +412,7 @@ function admin_menu_tree_page_view_add_page() {
|
|
412 |
}
|
413 |
$loopNum++;
|
414 |
}
|
415 |
-
|
416 |
|
417 |
} else if ( "inside" == $type ) {
|
418 |
|
@@ -423,12 +423,12 @@ function admin_menu_tree_page_view_add_page() {
|
|
423 |
function admin_menu_tree_page_view_add_page_inside($ref_post_id, $page_title, $post_type, $post_status = "draft") {
|
424 |
|
425 |
global $wpdb;
|
426 |
-
|
427 |
$ref_post = get_post($ref_post_id);
|
428 |
|
429 |
// update menu_order, so our new post is the only one with order 0
|
430 |
-
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE post_parent = %d", $ref_post->ID) );
|
431 |
-
|
432 |
$post_new = array();
|
433 |
$post_new["menu_order"] = 0;
|
434 |
$post_new["post_parent"] = $ref_post->ID;
|
@@ -439,10 +439,10 @@ function admin_menu_tree_page_view_add_page() {
|
|
439 |
$post_new["post_type"] = $post_type;
|
440 |
$newPostID = wp_insert_post($post_new);
|
441 |
return $newPostID;
|
442 |
-
|
443 |
}
|
444 |
}
|
445 |
-
|
446 |
// add reversed
|
447 |
$ref_post_id = $ref_post->ID;
|
448 |
$page_titles = array_reverse($page_titles);
|
@@ -459,7 +459,7 @@ function admin_menu_tree_page_view_add_page() {
|
|
459 |
$post_id_to_return = $newPostID;
|
460 |
|
461 |
}
|
462 |
-
|
463 |
if ($post_id_to_return) {
|
464 |
// return editlink for the newly created page
|
465 |
$editLink = get_edit_post_link($post_id_to_return, '');
|
@@ -495,25 +495,25 @@ function admin_menu_tree_page_view_move_page() {
|
|
495 |
/*
|
496 |
the node that was moved,
|
497 |
the reference node in the move,
|
498 |
-
the new position relative to the reference node (one of "before", "after" or "inside"),
|
499 |
inside = man placerar den under en sida som inte har några barn?
|
500 |
*/
|
501 |
|
502 |
global $wpdb;
|
503 |
-
|
504 |
$node_id = (int) $_POST["post_to_update_id"]; // the node that was moved
|
505 |
$ref_node_id = (int) $_POST["aboveOrNextPostID"];
|
506 |
$type = $_POST["direction"];
|
507 |
-
|
508 |
$_POST["skip_sitepress_actions"] = true; // sitepress.class.php->save_post_actions
|
509 |
-
|
510 |
if ($node_id && $ref_node_id) {
|
511 |
#echo "\nnode_id: $node_id";
|
512 |
-
#echo "\ntype: $type";
|
513 |
-
|
514 |
$post_node = get_post($node_id);
|
515 |
$post_ref_node = get_post($ref_node_id);
|
516 |
-
|
517 |
// first check that post_node (moved post) is not in trash. we do not move them
|
518 |
if ($post_node->post_status == "trash") {
|
519 |
exit;
|
@@ -521,7 +521,7 @@ function admin_menu_tree_page_view_move_page() {
|
|
521 |
|
522 |
if ( "inside" == $type ) {
|
523 |
// note: inside does not exist for Admin Menu Tree Page View
|
524 |
-
|
525 |
// post_node is moved inside ref_post_node
|
526 |
// add ref_post_node as parent to post_node and set post_nodes menu_order to 0
|
527 |
// @todo: shouldn't menu order of existing items be changed?
|
@@ -531,11 +531,11 @@ function admin_menu_tree_page_view_move_page() {
|
|
531 |
"post_parent" => $post_ref_node->ID
|
532 |
);
|
533 |
wp_update_post( $post_to_save );
|
534 |
-
|
535 |
echo "did inside";
|
536 |
-
|
537 |
} elseif ( "up" == $type ) {
|
538 |
-
|
539 |
// post_node is placed before ref_post_node
|
540 |
// update menu_order of all pages with a menu order more than or equal ref_node_post and with the same parent as ref_node_post
|
541 |
// we do this so there will be room for our page if it's the first page
|
@@ -545,7 +545,7 @@ function admin_menu_tree_page_view_move_page() {
|
|
545 |
// update menu order with +1 for all pages below ref_node, this should fix the problem with "unmovable" pages because of
|
546 |
// multiple pages with the same menu order (...which is not the fault of this plugin!)
|
547 |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE menu_order >= %d", $post_ref_node->menu_order+1) );
|
548 |
-
|
549 |
$post_to_save = array(
|
550 |
"ID" => $post_node->ID,
|
551 |
"menu_order" => $post_ref_node->menu_order,
|
@@ -556,9 +556,9 @@ function admin_menu_tree_page_view_move_page() {
|
|
556 |
echo "did before";
|
557 |
|
558 |
} elseif ( "down" == $type ) {
|
559 |
-
|
560 |
// post_node is placed after ref_post_node
|
561 |
-
|
562 |
// update menu_order of all posts with the same parent ref_post_node and with a menu_order of the same as ref_post_node, but do not include ref_post_node
|
563 |
// +2 since multiple can have same menu order and we want our moved post to have a unique "spot"
|
564 |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+2 WHERE post_parent = %d AND menu_order >= %d AND id <> %d ", $post_ref_node->post_parent, $post_ref_node->menu_order, $post_ref_node->ID ) );
|
@@ -572,17 +572,16 @@ function admin_menu_tree_page_view_move_page() {
|
|
572 |
"post_parent" => $post_ref_node->post_parent
|
573 |
);
|
574 |
wp_update_post( $post_to_save );
|
575 |
-
|
576 |
echo "did after";
|
577 |
}
|
578 |
-
|
579 |
#echo "ok"; // I'm done here!
|
580 |
-
|
581 |
} else {
|
582 |
// error
|
583 |
-
}
|
584 |
echo 1;
|
585 |
die();
|
586 |
|
587 |
} // move post
|
588 |
-
|
3 |
Plugin Name: Admin Menu Tree Page View
|
4 |
Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
|
5 |
Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
|
6 |
+
Version: 2.6.9
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
12 |
/* Copyright 2010 Pär Thernström (email: par.thernstrom@gmail.com)
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License, version 2, as
|
16 |
published by the Free Software Foundation.
|
17 |
|
18 |
This program is distributed in the hope that it will be useful,
|
38 |
|
39 |
function admin_menu_tree_page_view_admin_init() {
|
40 |
|
41 |
+
define( "admin_menu_tree_page_view_VERSION", "2.6.9" );
|
42 |
define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
|
43 |
define( "admin_menu_tree_page_view_DIR", WP_PLUGIN_DIR . '/admin-menu-tree-page-view/' );
|
44 |
|
86 |
* I know, I know. Should have made a class from the beginning...
|
87 |
*/
|
88 |
class admin_menu_tree_page_view {
|
89 |
+
|
90 |
public static $arr_all_pages_id_parent;
|
91 |
public static $one_page_parents;
|
92 |
+
|
93 |
static function get_all_pages_id_parent() {
|
94 |
if (!isset(admin_menu_tree_page_view::$arr_all_pages_id_parent)) {
|
95 |
// get all pages, once, to spare some queries looking for children
|
104 |
}
|
105 |
return admin_menu_tree_page_view::$arr_all_pages_id_parent;
|
106 |
}
|
107 |
+
|
108 |
static function get_post_ancestors($post_to_check_parents_for) {
|
109 |
+
|
110 |
if ( ! isset(admin_menu_tree_page_view::$one_page_parents) ) {
|
111 |
+
|
112 |
wp_cache_delete($post_to_check_parents_for, 'posts');
|
113 |
$one_page_parents = get_post_ancestors($post_to_check_parents_for);
|
114 |
admin_menu_tree_page_view::$one_page_parents = $one_page_parents;
|
115 |
+
|
116 |
}
|
117 |
+
|
118 |
return admin_menu_tree_page_view::$one_page_parents;
|
119 |
+
|
120 |
}
|
121 |
+
|
122 |
}
|
123 |
|
124 |
function admin_menu_tree_page_view_get_pages($args) {
|
145 |
$edit_link = get_edit_post_link($one_page->ID);
|
146 |
$title = get_the_title($one_page->ID);
|
147 |
$title = esc_html($title);
|
148 |
+
|
149 |
// add num of children to the title
|
150 |
// @done: this is still being done for each page, even if it does not have children. can we check if it has before?
|
151 |
// we could fetch all pages once and store them in an array and then just check if the array has our id in it. yeah. let's do that.
|
163 |
} else {
|
164 |
$post_children_count = 0;
|
165 |
}
|
166 |
+
|
167 |
$class = "";
|
168 |
if (isset($_GET["action"]) && $_GET["action"] == "edit" && isset($_GET["post"]) && $_GET["post"] == $one_page->ID) {
|
169 |
$class = "current";
|
190 |
$str_child_output = admin_menu_tree_page_view_get_pages($args_childs);
|
191 |
$class .= " admin-menu-tree-page-view-has-childs";
|
192 |
}
|
193 |
+
|
194 |
// determine if ul should be opened or closed
|
195 |
$isOpened = FALSE;
|
196 |
+
|
197 |
// check cookie first
|
198 |
$cookie_opened = isset($_COOKIE["admin-menu-tree-page-view-open-posts"]) ? $_COOKIE["admin-menu-tree-page-view-open-posts"] : ""; // 2,95,n
|
199 |
$cookie_opened = explode(",", $cookie_opened);
|
204 |
|
205 |
// if post with id get[post] is a parent of the current post, show it
|
206 |
if ( $_GET["post"] != $one_page->ID ) {
|
207 |
+
|
208 |
$post_to_check_parents_for = $_GET["post"];
|
209 |
|
210 |
// seems to be a problem with get_post_ancestors (yes, it's in the trac too)
|
211 |
// Long time since I wrote this, but perhaps this is the problem (adding for future reference):
|
212 |
// http://core.trac.wordpress.org/ticket/10381
|
213 |
+
|
214 |
// @done: this is done several times. only do it once please
|
215 |
// before: 441. after: 43
|
216 |
$one_page_parents = admin_menu_tree_page_view::get_post_ancestors($post_to_check_parents_for);
|
226 |
$class .= " admin-menu-tree-page-view-opened";
|
227 |
} elseif ($post_children_count>0) {
|
228 |
$class .= " admin-menu-tree-page-view-closed";
|
229 |
+
}
|
230 |
+
|
231 |
$class .= " nestedSortable";
|
232 |
+
|
233 |
$output .= "<li class='$class'>";
|
234 |
// first div used for nestedSortable
|
235 |
$output .= "<div>";
|
247 |
$output .= "<span class='amtpv-draghandle'></span>";
|
248 |
|
249 |
$output .= "</a>";
|
250 |
+
|
251 |
+
|
252 |
// popup edit div
|
253 |
$output .= "
|
254 |
<div class='amtpv-editpopup'>
|
255 |
<div class='amtpv-editpopup-editview'>
|
256 |
<div class='amtpv-editpopup-edit' data-link='".$edit_link."'>".__("Edit", 'admin-menu-tree-page-view')."</div>
|
257 |
+
|
|
258 |
<div class='amtpv-editpopup-view' data-link='".$permalink."'>".__("View", 'admin-menu-tree-page-view')."</div>
|
259 |
</div>
|
260 |
<div class='amtpv-editpopup-add'>".__("Add new page", 'admin-menu-tree-page-view')."<br />
|
261 |
<div class='amtpv-editpopup-add-after'>".__("After", 'admin-menu-tree-page-view')."</div>
|
262 |
+
|
|
263 |
<div class='amtpv-editpopup-add-inside'>".__("Inside", 'admin-menu-tree-page-view')."</div>
|
264 |
</div>
|
265 |
<div class='amtpv-editpopup-postid'>".__("Post ID:", 'admin-menu-tree-page-view')." " . $one_page->ID."</div>
|
274 |
|
275 |
// add child articles
|
276 |
$output .= $str_child_output;
|
277 |
+
|
278 |
$output .= "</li>";
|
279 |
}
|
280 |
+
|
281 |
// if this is a child listing, add ul
|
282 |
if (isset($args["child_of"]) && $args["child_of"] && $output != "") {
|
283 |
$output = "<ul class='admin-menu-tree-page-tree_childs'>$output</ul>";
|
284 |
}
|
285 |
+
|
286 |
return $output;
|
287 |
}
|
288 |
|
330 |
|
331 |
function admin_menu_tree_page_page() {
|
332 |
?>
|
333 |
+
|
334 |
<h2>Admin Menu Tree Page View</h2>
|
335 |
<p>Nothing to see here. Move along! :)</p>
|
336 |
+
|
337 |
<?php
|
338 |
}
|
339 |
|
350 |
|
351 |
/*
|
352 |
(
|
353 |
+
[action] => cms_tpv_add_page
|
354 |
[pageID] => cms-tpv-1318
|
355 |
type
|
356 |
)
|
380 |
|
381 |
if (!function_exists("admin_menu_tree_page_view_add_page_after")) {
|
382 |
function admin_menu_tree_page_view_add_page_after($ref_post_id, $page_title, $post_type, $post_status = "draft") {
|
383 |
+
|
384 |
global $wpdb;
|
385 |
+
|
386 |
$ref_post = get_post($ref_post_id);
|
387 |
// update menu_order of all pages below our page
|
388 |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+2 WHERE post_parent = %d AND menu_order >= %d AND id <> %d ", $ref_post->post_parent, $ref_post->menu_order, $ref_post->ID ) );
|
389 |
+
|
390 |
// create a new page and then goto it
|
391 |
$post_new = array();
|
392 |
$post_new["menu_order"] = $ref_post->menu_order+1;
|
400 |
return $newPostID;
|
401 |
}
|
402 |
}
|
403 |
+
|
404 |
$ref_post_id = $ref_post->ID;
|
405 |
$loopNum = 0;
|
406 |
foreach ($page_titles as $one_page_title) {
|
412 |
}
|
413 |
$loopNum++;
|
414 |
}
|
415 |
+
|
416 |
|
417 |
} else if ( "inside" == $type ) {
|
418 |
|
423 |
function admin_menu_tree_page_view_add_page_inside($ref_post_id, $page_title, $post_type, $post_status = "draft") {
|
424 |
|
425 |
global $wpdb;
|
426 |
+
|
427 |
$ref_post = get_post($ref_post_id);
|
428 |
|
429 |
// update menu_order, so our new post is the only one with order 0
|
430 |
+
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE post_parent = %d", $ref_post->ID) );
|
431 |
+
|
432 |
$post_new = array();
|
433 |
$post_new["menu_order"] = 0;
|
434 |
$post_new["post_parent"] = $ref_post->ID;
|
439 |
$post_new["post_type"] = $post_type;
|
440 |
$newPostID = wp_insert_post($post_new);
|
441 |
return $newPostID;
|
442 |
+
|
443 |
}
|
444 |
}
|
445 |
+
|
446 |
// add reversed
|
447 |
$ref_post_id = $ref_post->ID;
|
448 |
$page_titles = array_reverse($page_titles);
|
459 |
$post_id_to_return = $newPostID;
|
460 |
|
461 |
}
|
462 |
+
|
463 |
if ($post_id_to_return) {
|
464 |
// return editlink for the newly created page
|
465 |
$editLink = get_edit_post_link($post_id_to_return, '');
|
495 |
/*
|
496 |
the node that was moved,
|
497 |
the reference node in the move,
|
498 |
+
the new position relative to the reference node (one of "before", "after" or "inside"),
|
499 |
inside = man placerar den under en sida som inte har några barn?
|
500 |
*/
|
501 |
|
502 |
global $wpdb;
|
503 |
+
|
504 |
$node_id = (int) $_POST["post_to_update_id"]; // the node that was moved
|
505 |
$ref_node_id = (int) $_POST["aboveOrNextPostID"];
|
506 |
$type = $_POST["direction"];
|
507 |
+
|
508 |
$_POST["skip_sitepress_actions"] = true; // sitepress.class.php->save_post_actions
|
509 |
+
|
510 |
if ($node_id && $ref_node_id) {
|
511 |
#echo "\nnode_id: $node_id";
|
512 |
+
#echo "\ntype: $type";
|
513 |
+
|
514 |
$post_node = get_post($node_id);
|
515 |
$post_ref_node = get_post($ref_node_id);
|
516 |
+
|
517 |
// first check that post_node (moved post) is not in trash. we do not move them
|
518 |
if ($post_node->post_status == "trash") {
|
519 |
exit;
|
521 |
|
522 |
if ( "inside" == $type ) {
|
523 |
// note: inside does not exist for Admin Menu Tree Page View
|
524 |
+
|
525 |
// post_node is moved inside ref_post_node
|
526 |
// add ref_post_node as parent to post_node and set post_nodes menu_order to 0
|
527 |
// @todo: shouldn't menu order of existing items be changed?
|
531 |
"post_parent" => $post_ref_node->ID
|
532 |
);
|
533 |
wp_update_post( $post_to_save );
|
534 |
+
|
535 |
echo "did inside";
|
536 |
+
|
537 |
} elseif ( "up" == $type ) {
|
538 |
+
|
539 |
// post_node is placed before ref_post_node
|
540 |
// update menu_order of all pages with a menu order more than or equal ref_node_post and with the same parent as ref_node_post
|
541 |
// we do this so there will be room for our page if it's the first page
|
545 |
// update menu order with +1 for all pages below ref_node, this should fix the problem with "unmovable" pages because of
|
546 |
// multiple pages with the same menu order (...which is not the fault of this plugin!)
|
547 |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+1 WHERE menu_order >= %d", $post_ref_node->menu_order+1) );
|
548 |
+
|
549 |
$post_to_save = array(
|
550 |
"ID" => $post_node->ID,
|
551 |
"menu_order" => $post_ref_node->menu_order,
|
556 |
echo "did before";
|
557 |
|
558 |
} elseif ( "down" == $type ) {
|
559 |
+
|
560 |
// post_node is placed after ref_post_node
|
561 |
+
|
562 |
// update menu_order of all posts with the same parent ref_post_node and with a menu_order of the same as ref_post_node, but do not include ref_post_node
|
563 |
// +2 since multiple can have same menu order and we want our moved post to have a unique "spot"
|
564 |
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = menu_order+2 WHERE post_parent = %d AND menu_order >= %d AND id <> %d ", $post_ref_node->post_parent, $post_ref_node->menu_order, $post_ref_node->ID ) );
|
572 |
"post_parent" => $post_ref_node->post_parent
|
573 |
);
|
574 |
wp_update_post( $post_to_save );
|
575 |
+
|
576 |
echo "did after";
|
577 |
}
|
578 |
+
|
579 |
#echo "ok"; // I'm done here!
|
580 |
+
|
581 |
} else {
|
582 |
// error
|
583 |
+
}
|
584 |
echo 1;
|
585 |
die();
|
586 |
|
587 |
} // move post
|
|
readme.txt
CHANGED
@@ -3,16 +3,16 @@ Contributors: eskapism, MarsApril
|
|
3 |
Donate link: http://eskapism.se/sida/donate/
|
4 |
Tags: admin, page, pages, page tree, hierarchy, cms, tree, view, admin menu, menu, change order, drag and drop
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 2.6.
|
8 |
|
9 |
Get a tree view of all your pages directly in the admin menu. Search, edit, view, re-order/sort and add pages – all is just one click away!
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
The Admin Menu Tree Page View WordPress plugin adds a page tree to all your pages – directly accessible in the admin menu.
|
14 |
-
This way all your pages will be available within just one click,
|
15 |
-
no matter where you are in the admin area.
|
16 |
|
17 |
You can also add pages directly in the tree and you can quickly find your pages by using the search box.
|
18 |
|
@@ -37,7 +37,7 @@ The plugin is translated into these languages:
|
|
37 |
- Slovak translation (thanks Branco)
|
38 |
- Italian
|
39 |
- Dutch
|
40 |
-
- Swedish
|
41 |
|
42 |
#### Donation and more plugins
|
43 |
* If you like this plugin don't forget to [donate to support further development](http://eskapism.se/sida/donate/).
|
@@ -60,6 +60,10 @@ Now the tree with the pages will be visible in the admin menu to the left.
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
63 |
= 2.6.8 =
|
64 |
- Added German translation. Thanks [Michael Thielemann](http://www.thielemann.eu).
|
65 |
|
3 |
Donate link: http://eskapism.se/sida/donate/
|
4 |
Tags: admin, page, pages, page tree, hierarchy, cms, tree, view, admin menu, menu, change order, drag and drop
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 2.6.9
|
8 |
|
9 |
Get a tree view of all your pages directly in the admin menu. Search, edit, view, re-order/sort and add pages – all is just one click away!
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
The Admin Menu Tree Page View WordPress plugin adds a page tree to all your pages – directly accessible in the admin menu.
|
14 |
+
This way all your pages will be available within just one click,
|
15 |
+
no matter where you are in the admin area.
|
16 |
|
17 |
You can also add pages directly in the tree and you can quickly find your pages by using the search box.
|
18 |
|
37 |
- Slovak translation (thanks Branco)
|
38 |
- Italian
|
39 |
- Dutch
|
40 |
+
- Swedish
|
41 |
|
42 |
#### Donation and more plugins
|
43 |
* If you like this plugin don't forget to [donate to support further development](http://eskapism.se/sida/donate/).
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 2.6.9 =
|
64 |
+
- Make hidden page not clickable. Fixes https://wordpress.org/support/topic/hide-the-page
|
65 |
+
- Load icons localy instead. Fixes https://wordpress.org/support/topic/styles-loading-icon-pngs-over-http-instead-of-https
|
66 |
+
|
67 |
= 2.6.8 =
|
68 |
- Added German translation. Thanks [Michael Thielemann](http://www.thielemann.eu).
|
69 |
|