Admin Menu Tree Page View - Version 2.7.1

Version Description

(August 2018) = - Don't only rely on nonce when adding or moving pages, also check current user capability.

Download this release

Release Info

Developer eskapism
Plugin Icon wp plugin Admin Menu Tree Page View
Version 2.7.1
Comparing to
See all releases

Code changes from version 2.7 to 2.7.1

Files changed (4) hide show
  1. index.php +12 -2
  2. phpcs.xml +84 -0
  3. readme.txt +4 -1
  4. test.html +0 -32
index.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
 
2
  /*
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.7
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -341,15 +342,20 @@ function admin_menu_tree_page_page() {
341
 
342
 
343
 
 
344
  /**
345
  * Code from plugin CMS Tree Page View
346
  * http://wordpress.org/extend/plugins/cms-tree-page-view/
347
  * Used with permission! :)
348
  */
349
- function admin_menu_tree_page_view_add_page() {
350
 
351
  check_ajax_referer('admin-menu-tree-page-view', 'amtpv-nonce');
352
 
 
 
 
 
353
  global $wpdb;
354
 
355
  /*
@@ -487,6 +493,10 @@ function admin_menu_tree_page_view_move_page() {
487
 
488
  check_ajax_referer('admin-menu-tree-page-view', 'amtpv-nonce');
489
 
 
 
 
 
490
  /*
491
  Array ( [action] => admin_menu_tree_page_view_move_page [post_to_update_id] => 567 [direction] => down )
492
  */
1
  <?php
2
+
3
  /*
4
  Plugin Name: Admin Menu Tree Page View
5
  Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
6
  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!
7
+ Version: 2.7.1
8
  Author: Pär Thernström
9
  Author URI: http://eskapism.se/
10
  License: GPL2
342
 
343
 
344
 
345
+
346
  /**
347
  * Code from plugin CMS Tree Page View
348
  * http://wordpress.org/extend/plugins/cms-tree-page-view/
349
  * Used with permission! :)
350
  */
351
+ function admin_menu_tree_page_view_add_page ( ) {
352
 
353
  check_ajax_referer('admin-menu-tree-page-view', 'amtpv-nonce');
354
 
355
+ if ( ! current_user_can( 'edit_pages' ) ) {
356
+ wp_die( -1 );
357
+ }
358
+
359
  global $wpdb;
360
 
361
  /*
493
 
494
  check_ajax_referer('admin-menu-tree-page-view', 'amtpv-nonce');
495
 
496
+ if ( ! current_user_can( 'edit_pages' ) ) {
497
+ wp_die( -1 );
498
+ }
499
+
500
  /*
501
  Array ( [action] => admin_menu_tree_page_view_move_page [post_to_update_id] => 567 [direction] => down )
502
  */
phpcs.xml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="Example Project">
3
+ <description>A custom set of rules to check for a WPized WordPress project</description>
4
+
5
+ <!-- Exclude WP Core folders and files from being checked. -->
6
+ <exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
7
+ <exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
8
+ <exclude-pattern>/docroot/wp-*.php</exclude-pattern>
9
+ <exclude-pattern>/docroot/index.php</exclude-pattern>
10
+ <exclude-pattern>/docroot/xmlrpc.php</exclude-pattern>
11
+ <exclude-pattern>/docroot/wp-content/plugins/*</exclude-pattern>
12
+
13
+ <!-- Exclude the Composer Vendor directory. -->
14
+ <exclude-pattern>/vendor/*</exclude-pattern>
15
+
16
+ <!-- Exclude the Node Modules directory. -->
17
+ <exclude-pattern>/node_modules/*</exclude-pattern>
18
+
19
+ <!-- Exclude minified Javascript files. -->
20
+ <exclude-pattern>*.min.js</exclude-pattern>
21
+
22
+ <!-- Include the WordPress-Extra standard. -->
23
+ <rule ref="WordPress-Extra">
24
+ <!--
25
+ We may want a middle ground though. The best way to do this is add the
26
+ entire ruleset, then rule by rule, remove ones that don't suit a project.
27
+ We can do this by running `phpcs` with the '-s' flag, which allows us to
28
+ see the names of the sniffs reporting errors.
29
+ Once we know the sniff names, we can opt to exclude sniffs which don't
30
+ suit our project like so.
31
+
32
+ The below two examples just show how you can exclude rules.
33
+ They are not intended as advice about which sniffs to exclude.
34
+ -->
35
+
36
+ <!--
37
+ <exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
38
+ <exclude name="WordPress.Security.EscapeOutput"/>
39
+ -->
40
+ </rule>
41
+
42
+ <!-- Let's also check that everything is properly documented. -->
43
+ <rule ref="WordPress-Docs"/>
44
+
45
+ <!-- Add in some extra rules from other standards. -->
46
+ <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
47
+ <rule ref="Generic.Commenting.Todo"/>
48
+
49
+ <!-- Check for PHP cross-version compatibility. -->
50
+ <!--
51
+ To enable this, the PHPCompatibility standard needs
52
+ to be installed.
53
+ See the readme for installation instructions:
54
+ https://github.com/wimg/PHPCompatibility
55
+ -->
56
+ <!--
57
+ <config name="testVersion" value="5.2-"/>
58
+ <rule ref="PHPCompatibility"/>
59
+ -->
60
+
61
+ <!--
62
+ To get the optimal benefits of using WPCS, we should add a couple of
63
+ custom properties.
64
+ Adjust the values of these properties to fit our needs.
65
+
66
+ For information on additional custom properties available, check out
67
+ the wiki:
68
+ https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
69
+ -->
70
+ <config name="minimum_supported_wp_version" value="4.6"/>
71
+
72
+ <rule ref="WordPress.WP.I18n">
73
+ <properties>
74
+ <property name="text_domain" type="array" value="my-textdomain,library-textdomain"/>
75
+ </properties>
76
+ </rule>
77
+
78
+ <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
79
+ <properties>
80
+ <property name="prefixes" type="array" value="my_prefix"/>
81
+ </properties>
82
+ </rule>
83
+
84
+ </ruleset>
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.7
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
 
@@ -60,6 +60,9 @@ Now the tree with the pages will be visible in the admin menu to the left.
60
 
61
  == Changelog ==
62
 
 
 
 
63
  = 2.7 (January 2018) =
64
  - Add nonce check when moving page and adding new pages.
65
 
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.7.1
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
 
60
 
61
  == Changelog ==
62
 
63
+ = 2.7.1 (August 2018) =
64
+ - Don't only rely on nonce when adding or moving pages, also check current user capability.
65
+
66
  = 2.7 (January 2018) =
67
  - Add nonce check when moving page and adding new pages.
68
 
test.html DELETED
@@ -1,32 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en-US">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title></title>
6
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
7
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
8
- <script type="text/javascript" src="jquery.ui.nestedSortable.js"></script>
9
- </head>
10
- <body>
11
-
12
- <ul class="sortable">
13
- <li><div>Some content</div></li>
14
- <li><div>Some content</div>
15
- <ul>
16
- <li><div>Some sub-item content</div></li>
17
- <li><div>Some sub-item content</div></li>
18
- </ul>
19
- </li>
20
- <li><div>Some content</div></li>
21
- </ul>
22
- <script type="text/javascript">
23
-
24
- $(function() {
25
- $("ul.sortable").nestedSortable({
26
- listType: 'ul'
27
- });
28
- });
29
-
30
- </script>
31
- </body>
32
- </html>