pageMash > Page Management - Version 1.1.2

Version Description

Download this release

Release Info

Developer jmash
Plugin Icon wp plugin pageMash > Page Management
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.2

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: JoelStarnes
3
  Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide,
4
  Requires at least: 2.1
5
  Tested up to: 2.5
6
- Stable tag: 1.1.0
7
 
8
  Organise page order and manage page structure with this simple drag-and-drop Ajax interface.
9
 
@@ -51,6 +51,13 @@ Any good up-to-date browser should work fine. I test in Firefox, IE7, Safari and
51
 
52
  ==Change Log==
53
 
 
 
 
 
 
 
 
54
  * 1.1.0
55
  * Added quick rename
56
  * Externalised scripts
3
  Tags: order pages, ajax, re-order, drag-and-drop, admin, manage, page, pages, sidebar, header, hide,
4
  Requires at least: 2.1
5
  Tested up to: 2.5
6
+ Stable tag: 1.1.2
7
 
8
  Organise page order and manage page structure with this simple drag-and-drop Ajax interface.
9
 
51
 
52
  ==Change Log==
53
 
54
+ * 1.1.2
55
+ * Added Expand all | Collapse all buttons
56
+
57
+ * 1.1.1
58
+ * Fix a bug with console.log for safari
59
+ * Removed php code from js&css scripts to fix error
60
+
61
  * 1.1.0
62
  * Added quick rename
63
  * Externalised scripts
pagemash-css.php → pagemash.css RENAMED
@@ -1,8 +1,3 @@
1
- <?php
2
- header('Content-Type: text/css');
3
- require_once('../../../wp-config.php');
4
- global $instantUpdateFeature, $excludePagesFeature, $pageMash_abs_dir;
5
- ?>
6
  /* __ __ _
7
  WordPress Plugin | \/ | | |
8
  _ __ __ _ __ _ ___| \ / | __ _ ___| |__
@@ -23,17 +18,17 @@ body.wp-admin div#wpwrap div#wpcontent ul#pageMash_pages {
23
  }
24
  ul#pageMash_pages li.collapsed ul { display:none; }
25
  ul#pageMash_pages li.children {
26
- background-image: url('<?php echo $pageMash_abs_dir; ?>collapse.png');
27
  }
28
  ul#pageMash_pages li.collapsed.children {
29
- background-image: url('<?php echo $pageMash_abs_dir; ?>expand.png');
30
  }
31
  ul#pageMash_pages li {
32
  display:block;
33
  margin:2px 0 0 0;
34
  border-bottom:1px solid #aaa; border-right:1px solid #aaa; border-top:1px solid #ccc; border-left:1px solid #ccc;
35
  padding:4px 6px 4px 24px;
36
- background:#F1F1F1 url('<?php echo $pageMash_abs_dir; ?>page.png') no-repeat 4px 4px;
37
  list-style-type:none;
38
  }
39
  ul#pageMash_pages li span.title { font-weight: bold; }
 
 
 
 
 
1
  /* __ __ _
2
  WordPress Plugin | \/ | | |
3
  _ __ __ _ __ _ ___| \ / | __ _ ___| |__
18
  }
19
  ul#pageMash_pages li.collapsed ul { display:none; }
20
  ul#pageMash_pages li.children {
21
+ background-image: url('collapse.png');
22
  }
23
  ul#pageMash_pages li.collapsed.children {
24
+ background-image: url('expand.png');
25
  }
26
  ul#pageMash_pages li {
27
  display:block;
28
  margin:2px 0 0 0;
29
  border-bottom:1px solid #aaa; border-right:1px solid #aaa; border-top:1px solid #ccc; border-left:1px solid #ccc;
30
  padding:4px 6px 4px 24px;
31
+ background:#F1F1F1 url('page.png') no-repeat 4px 4px;
32
  list-style-type:none;
33
  }
34
  ul#pageMash_pages li span.title { font-weight: bold; }
pagemash-js.php → pagemash.js RENAMED
@@ -1,8 +1,3 @@
1
- <?php
2
- require_once('../../../wp-config.php');
3
- cache_javascript_headers();
4
- global $instantUpdateFeature, $excludePagesFeature, $pageMash_abs_dir;
5
- ?>
6
  /* __ __ _
7
  WordPress Plugin | \/ | | |
8
  _ __ __ _ __ _ ___| \ / | __ _ ___| |__
@@ -16,24 +11,15 @@
16
  */
17
 
18
  window.addEvent('domready', function(){
19
- // When logging debug messages with console.warn
20
- // if user doesn't have Firebug, write them to the DOM instead
21
- if (typeof console == "undefined") {
22
- // Create an unordered list to display warning messages
23
- var logsOutput = document.createElement('ul');
24
- $("debug_list").appendChild(logsOutput);
25
 
26
- // Define console.warn() function
27
- console = {
28
- warn: function(msg) {
29
- logsOutput.innerHTML += '<li>' + msg + '</li>';
30
- }
31
- };
32
- // Create an empty function for all other console methods
33
- var consoleMethods = ["log", "debug", "info", "error", "assert", "dir", "dirxml", "group",
34
- "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
35
- for (var i = 0; i < consoleMethods.length; ++i)
36
- console[consoleMethods[i]] = function() {}
37
  }
38
  });
39
 
@@ -63,7 +49,7 @@ var SaveList = function() {
63
  var theDump = sortIt.serialize();
64
  console.group('Database Update');
65
  console.time('Update Chronometer');
66
- new Ajax('<?php echo $pageMash_abs_dir; ?>saveList.php', {
67
  method: 'post',
68
  postBody: 'm='+Json.toString(theDump),
69
  // update: "debug_list",
@@ -87,12 +73,10 @@ var SaveList = function() {
87
  }).request();
88
  };
89
  /* toggle the remove class of grandparent */
90
- <?php if($excludePagesFeature): ?>
91
  var toggleRemove = function(el) {
92
  el.parentNode.parentNode.parentNode.toggleClass('remove');
93
  console.log("Page: '%s' has been %s", $E('span.title', el.parentNode.parentNode.parentNode).innerHTML, (el.parentNode.parentNode.hasClass('remove') ? 'HIDDEN': 'MADE VISIBLE' ));
94
  }
95
- <?php endif; ?>
96
 
97
 
98
  /* ******** dom ready ******** */
@@ -102,7 +86,6 @@ window.addEvent('domready', function(){
102
  onComplete: function(el) {
103
  el.setStyle('background-color', '#F1F1F1');
104
  sortIt.altColor();
105
- <?php if($instantUpdateFeature): ?>SaveList();<?php endif; ?>
106
 
107
  $ES('li','pageMash_pages').each(function(el) {
108
  if( el.getElement('ul') ){
@@ -131,13 +114,11 @@ window.addEvent('domready', function(){
131
  sortIt.altColor();
132
  $('update_status').setStyle('opacity', 0);
133
 
134
- <?php if(!$instantUpdateFeature): ?>
135
  $('pageMash_submit').addEvent('click', function(e){
136
  e = new Event(e);
137
  SaveList();
138
  e.stop();
139
  });
140
- <?php endif; ?>
141
 
142
  var pageMashInfo = new Fx.Slide('pageMashInfo');
143
  $('pageMashInfo_toggle').addEvent('click', function(e){
@@ -169,26 +150,38 @@ window.addEvent('domready', function(){
169
  e.stop();
170
  });
171
  });
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  /* disable drag text-selection for IE */
174
  if (typeof document.body.onselectstart!="undefined")
175
  document.body.onselectstart=function(){return false}
176
-
177
- /* InlineEdit: rename pages */
178
- $$('#pageMash_pages li span.title').each(function(el){ //#pageMash_pages li span.title
179
- el.setStyle('cursor','pointer');
180
- $E('a.rename', el.parentNode).addEvent('click',function(){
181
- el.inlineEdit({
182
- onStart:function(el){
183
- el.parentNode.addClass('renaming');
184
- },
185
- onComplete:function(el,oldContent,newContent){
186
- el.parentNode.removeClass('renaming').addClass('renamed');
187
- console.log("Page: '%s' has been RENAMED to: '%s'", oldContent, newContent);
188
- }
 
189
  });
190
  });
191
- });
192
-
193
- console.info("We're all up and running.")
194
  }); /* close dom ready */
 
 
 
 
 
1
  /* __ __ _
2
  WordPress Plugin | \/ | | |
3
  _ __ __ _ __ _ ___| \ / | __ _ ___| |__
11
  */
12
 
13
  window.addEvent('domready', function(){
14
+ // If user doesn't have Firebug, create empty functions for the console.
15
+ if (!window.console || !console.firebug)
16
+ {
17
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
18
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
 
19
 
20
+ window.console = {};
21
+ for (var i = 0; i < names.length; ++i)
22
+ window.console[names[i]] = function() {}
 
 
 
 
 
 
 
 
23
  }
24
  });
25
 
49
  var theDump = sortIt.serialize();
50
  console.group('Database Update');
51
  console.time('Update Chronometer');
52
+ new Ajax('../wp-content/plugins/pagemash/saveList.php', {
53
  method: 'post',
54
  postBody: 'm='+Json.toString(theDump),
55
  // update: "debug_list",
73
  }).request();
74
  };
75
  /* toggle the remove class of grandparent */
 
76
  var toggleRemove = function(el) {
77
  el.parentNode.parentNode.parentNode.toggleClass('remove');
78
  console.log("Page: '%s' has been %s", $E('span.title', el.parentNode.parentNode.parentNode).innerHTML, (el.parentNode.parentNode.hasClass('remove') ? 'HIDDEN': 'MADE VISIBLE' ));
79
  }
 
80
 
81
 
82
  /* ******** dom ready ******** */
86
  onComplete: function(el) {
87
  el.setStyle('background-color', '#F1F1F1');
88
  sortIt.altColor();
 
89
 
90
  $ES('li','pageMash_pages').each(function(el) {
91
  if( el.getElement('ul') ){
114
  sortIt.altColor();
115
  $('update_status').setStyle('opacity', 0);
116
 
 
117
  $('pageMash_submit').addEvent('click', function(e){
118
  e = new Event(e);
119
  SaveList();
120
  e.stop();
121
  });
 
122
 
123
  var pageMashInfo = new Fx.Slide('pageMashInfo');
124
  $('pageMashInfo_toggle').addEvent('click', function(e){
150
  e.stop();
151
  });
152
  });
153
+
154
+ $('collapse_all').addEvent('click', function(e){ e = new Event(e);
155
+ $ES('li','pageMash_pages').each(function(el) {
156
+ if(el.hasClass('children')) el.addClass('collapsed');
157
+ });
158
+ e.stop(); });
159
+
160
+ $('expand_all').addEvent('click', function(e){ e = new Event(e);
161
+ $ES('li','pageMash_pages').each(function(el) {
162
+ if(el.hasClass('children')) el.removeClass('collapsed');
163
+ });
164
+ e.stop(); });
165
 
166
  /* disable drag text-selection for IE */
167
  if (typeof document.body.onselectstart!="undefined")
168
  document.body.onselectstart=function(){return false}
169
+
170
+ /* InlineEdit: rename pages */
171
+ $$('#pageMash_pages li span.title').each(function(el){ //#pageMash_pages li span.title
172
+ el.setStyle('cursor','pointer');
173
+ $E('a.rename', el.parentNode).addEvent('click',function(){
174
+ el.inlineEdit({
175
+ onStart:function(el){
176
+ el.parentNode.addClass('renaming');
177
+ },
178
+ onComplete:function(el,oldContent,newContent){
179
+ el.parentNode.removeClass('renaming').addClass('renamed');
180
+ console.log("Page: '%s' has been RENAMED to: '%s'", oldContent, newContent);
181
+ }
182
+ });
183
  });
184
  });
185
+
186
+ console.info("We're all up and running.")
 
187
  }); /* close dom ready */
pagemash.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: pageMash
4
  Plugin URI: http://joelstarnes.co.uk/pagemash/
5
  Description: pageMash > pageManagement [WP_Admin > Manage > pageMash]
6
  Author: Joel Starnes
7
- Version: 1.1.0
8
  Author URI: http://joelstarnes.co.uk/
9
 
10
  CHANGELOG:
@@ -18,10 +18,8 @@ Release: Date: Description:
18
  1.0.3 18 Mar 2008 Fixed datatype bug causing array problems
19
  1.0.4 11 Apr 2008 removed shorthand PHP and updated CSS and JS headers to admin_print_scripts hook.
20
  1.1.0 24 Apr 2008 Added quick rename, externalised scripts, changed display of edit|hide|rename links, deregisters prototype
21
-
22
- FIXME:
23
- @fixme with instantUpdateFeature hide will not send the update
24
- @todo readme txt CMS, mass edit pages, exclude pages, manage, organise,
25
 
26
  */
27
  #########CONFIG OPTIONS############################################
@@ -31,11 +29,11 @@ $minlevel = 7; /*[deafult=7]*/
31
  $excludePagesFeature = true; /*[deafult=true]*/
32
  /* Allows you to set pages not to be listed */
33
 
34
- $instantUpdateFeature = false; /*[deafult=false]*/
35
- /* Updates the database instantly after a move using ajax
36
- otherwise it will wait for update button press.
37
- nb. this feature has not been optimised and enabling will cause
38
- much increased server load */
39
 
40
  ###################################################################
41
  /*
@@ -71,7 +69,7 @@ $pageMash_abs_dir = get_bloginfo('wpurl').'/'.$pageMash_rel_dir;
71
  function pageMash_getPages($post_parent){
72
  //this is a recurrsive function which calls itself to produce a nested list of elements
73
  //$post_parent should be 0 for root pages, or contain a pageID to return it's sub-pages
74
- global $wpdb, $wp_version, $excludePagesFeature, $excludePagesList;
75
  if($wp_version >= 2.1){ //get pages from database
76
  $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_parent = '$post_parent' ORDER BY menu_order");
77
  }else{
@@ -80,8 +78,13 @@ function pageMash_getPages($post_parent){
80
 
81
  if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them.
82
  echo (0 === $post_parent) ? '<ul id="pageMash_pages">' : '<ul>'; //add this ID only to root 'ul' element
83
- foreach ($pageposts as $page): //list pages, [the 'li' ID must be pm_'page ID'] ?>
84
- <li id="pm_<?php echo $page->ID;?>" <?php if(get_option('exclude_pages')){ if(in_array($page->ID, $excludePagesList)) echo 'class="remove"'; }//if page is in exclude list, add class remove ?>>
 
 
 
 
 
85
  <span class="title"><?php echo $page->post_title;?></span>
86
  <span class="pageMash_box">
87
  <span class="pageMash_more">&raquo;</span>
@@ -91,7 +94,9 @@ function pageMash_getPages($post_parent){
91
  <?php if($excludePagesFeature): ?>
92
  [<a href="#" title="Show|Hide" class="excludeLink" onclick="toggleRemove(this); return false">hide</a>]
93
  <?php endif; ?>
94
- [<a href="#" title="Rename Page" class="rename">Rename</a>]
 
 
95
  </span>
96
  </span>
97
  <?php pageMash_getPages($page->ID) //call this function to list any sub-pages (passing it the pageID) ?>
@@ -105,32 +110,31 @@ function pageMash_getPages($post_parent){
105
  }
106
 
107
  function pageMash_main(){
108
- global $instantUpdateFeature, $excludePagesFeature, $excludePagesList;
109
  if(!is_array(get_option('exclude_pages'))) $excludePagesList=array(); else $excludePagesList = get_option('exclude_pages'); //if it's empty set as an empty array
110
  ?>
111
  <div id="debug_list"></div>
112
  <div id="pageMash" class="wrap">
113
  <div id="pageMash_checkVersion" style="float:right; font-size:.7em; margin-top:5px;">
114
- version [1.1.0]
115
  </div>
116
  <h2 style="margin-bottom:0; clear:none;">pageMash - pageManagement</h2>
117
  <p style="margin-top:4px;">
118
  Just drag the pages <strong>up</strong> or <strong>down</strong> to change the page order and <strong>left</strong> or <strong>right</strong> to change the page's parent, then hit 'update'.<br />
119
- The icon to the left of each page shows if it has child pages, <strong>double click</strong> anywhere on that item to toggle <strong>expand|collapse</strong> of it's children.
120
  </p>
 
121
 
122
  <?php pageMash_getPages(0); //pass 0, as initial parent ?>
123
 
124
  <p class="submit">
125
  <div id="update_status" style="float:left; margin-left:40px; opacity:0;"></div>
126
- <?php if(!$instantUpdateFeature): ?>
127
  <input type="submit" id="pageMash_submit" tabindex="2" style="font-weight: bold; float:right;" value="Update" name="submit"/>
128
- <?php endif; ?>
129
  </p>
130
  <br style="margin-bottom: .8em;" />
131
  </div>
132
 
133
- <div class="wrap" style="width:160px; margin-bottom:0; padding:2px; text-align:center;"><a href="#" id="pageMashInfo_toggle" style="text-align:center;">Show|Hide Further Info</a></div>
134
  <div class="wrap" id="pageMashInfo" style="margin-top:-1px;">
135
  <h2>How to Use</h2>
136
  <p>pageMash works with the wp_list_pages function. The easiest way to use it is to put the pages widget in your sidebar [WP admin page > Presentation > Widgets]. Click the configure button on the widget and ensure that 'sort by' is set to 'page order'. Hey presto, you're done.</p>
@@ -148,29 +152,38 @@ function pageMash_main(){
148
 
149
  function pageMash_head(){
150
  //stylesheet & javascript to go in page header
151
- global $pageMash_rel_dir;
152
 
153
- wp_deregister_script('prototype');//remove prototype since it is incompatible with mootools
154
  wp_enqueue_script('pagemash_mootools', '/'.$pageMash_rel_dir.'nest-mootools.v1.11.js', false, false); //code is not compatible with other releases of moo
155
  wp_enqueue_script('pagemash_nested', '/'.$pageMash_rel_dir.'nested.js', array('pagemash_mootools'), false);
156
  wp_enqueue_script('pagemash_inlineEdit', '/'.$pageMash_rel_dir.'inlineEdit.v1.2.js', array('pagemash_mootools'), false);
157
- wp_enqueue_script('pagemash', '/'.$pageMash_rel_dir.'pagemash-js.php', array('pagemash_mootools'), false);
158
  add_action('admin_head', 'pageMash_add_css', 1);
159
-
160
  }
161
 
162
  function pageMash_add_css(){
163
- global $pageMash_abs_dir;
 
 
 
 
 
 
 
 
 
164
  ?>
165
- <link rel="stylesheet" type="text/css" href="<?php echo $pageMash_abs_dir ?>pagemash-css.php" />
166
- <!-- __ __ _
167
- WordPress Plugin | \/ | | |
168
- _ __ __ _ __ _ ___| \ / | __ _ ___| |__
169
- | '_ \ / _` |/ _` |/ _ \ |\/| |/ _` / __| '_ \
170
- | |_) | (_| | (_| | __/ | | | (_| \__ \ | | |
171
- | .__/ \__,_|\__, |\___|_| |_|\__,_|___/_| |_|
172
- | | __/ | Author: Joel Starnes
173
- |_| |___/ URL: pagemash.joelstarnes.co.uk
174
 
175
  >>pageMash Admin Page
176
  -->
4
  Plugin URI: http://joelstarnes.co.uk/pagemash/
5
  Description: pageMash > pageManagement [WP_Admin > Manage > pageMash]
6
  Author: Joel Starnes
7
+ Version: 1.1.2
8
  Author URI: http://joelstarnes.co.uk/
9
 
10
  CHANGELOG:
18
  1.0.3 18 Mar 2008 Fixed datatype bug causing array problems
19
  1.0.4 11 Apr 2008 removed shorthand PHP and updated CSS and JS headers to admin_print_scripts hook.
20
  1.1.0 24 Apr 2008 Added quick rename, externalised scripts, changed display of edit|hide|rename links, deregisters prototype
21
+ 1.1.1 29 Apr 2008 Fix a bug with console.log for safari, removed php code from js&css scripts to fix error
22
+ 1.1.2 24 May 2008 Added Expand all | Collapse all buttons
 
 
23
 
24
  */
25
  #########CONFIG OPTIONS############################################
29
  $excludePagesFeature = true; /*[deafult=true]*/
30
  /* Allows you to set pages not to be listed */
31
 
32
+ $renamePagesFeature = true; /*[deafult=true]*/
33
+ /* Lets you rename pages */
34
+
35
+ $CollapsePagesOnLoad = false; /*[deafult=true]*/
36
+ /* Collapse all parent pages on load */
37
 
38
  ###################################################################
39
  /*
69
  function pageMash_getPages($post_parent){
70
  //this is a recurrsive function which calls itself to produce a nested list of elements
71
  //$post_parent should be 0 for root pages, or contain a pageID to return it's sub-pages
72
+ global $wpdb, $wp_version, $excludePagesFeature, $excludePagesList, $renamePagesFeature;
73
  if($wp_version >= 2.1){ //get pages from database
74
  $pageposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_parent = '$post_parent' ORDER BY menu_order");
75
  }else{
78
 
79
  if ($pageposts == true){ //if $pageposts == true then it does have sub-page(s), so list them.
80
  echo (0 === $post_parent) ? '<ul id="pageMash_pages">' : '<ul>'; //add this ID only to root 'ul' element
81
+ foreach ($pageposts as $page): //list pages, [the 'li' ID must be pm_'page ID']
82
+ if(get_option('exclude_pages')){ //need this for first time run when exclude_pages are undefined
83
+ if(in_array($page->ID, $excludePagesList))
84
+ $liClass="remove"; //if page is in exclude list, add class remove
85
+ }
86
+ ?>
87
+ <li id="pm_<?php echo $page->ID;?>"<?php if($liClass) echo ' class="'.$liClass.'"'; ?>>
88
  <span class="title"><?php echo $page->post_title;?></span>
89
  <span class="pageMash_box">
90
  <span class="pageMash_more">&raquo;</span>
94
  <?php if($excludePagesFeature): ?>
95
  [<a href="#" title="Show|Hide" class="excludeLink" onclick="toggleRemove(this); return false">hide</a>]
96
  <?php endif; ?>
97
+ <?php if($renamePagesFeature): ?>
98
+ [<a href="#" title="Rename Page" class="rename">Rename</a>]
99
+ <?php endif; ?>
100
  </span>
101
  </span>
102
  <?php pageMash_getPages($page->ID) //call this function to list any sub-pages (passing it the pageID) ?>
110
  }
111
 
112
  function pageMash_main(){
113
+ global $excludePagesFeature, $excludePagesList;
114
  if(!is_array(get_option('exclude_pages'))) $excludePagesList=array(); else $excludePagesList = get_option('exclude_pages'); //if it's empty set as an empty array
115
  ?>
116
  <div id="debug_list"></div>
117
  <div id="pageMash" class="wrap">
118
  <div id="pageMash_checkVersion" style="float:right; font-size:.7em; margin-top:5px;">
119
+ version [1.1.2]
120
  </div>
121
  <h2 style="margin-bottom:0; clear:none;">pageMash - pageManagement</h2>
122
  <p style="margin-top:4px;">
123
  Just drag the pages <strong>up</strong> or <strong>down</strong> to change the page order and <strong>left</strong> or <strong>right</strong> to change the page's parent, then hit 'update'.<br />
124
+ The icon to the left of each page shows if it has child pages, <strong>double click</strong> on that item to toggle <strong>expand|collapse</strong> of it's children.
125
  </p>
126
+ <p><a href="#" id="expand_all">Expand All</a> | <a href="#" id="collapse_all">Collapse All</a></p>
127
 
128
  <?php pageMash_getPages(0); //pass 0, as initial parent ?>
129
 
130
  <p class="submit">
131
  <div id="update_status" style="float:left; margin-left:40px; opacity:0;"></div>
 
132
  <input type="submit" id="pageMash_submit" tabindex="2" style="font-weight: bold; float:right;" value="Update" name="submit"/>
 
133
  </p>
134
  <br style="margin-bottom: .8em;" />
135
  </div>
136
 
137
+ <div class="wrap" style="width:160px; margin-bottom:0; padding:0;"><p><a href="#" id="pageMashInfo_toggle">Show|Hide Further Info</a></p></div>
138
  <div class="wrap" id="pageMashInfo" style="margin-top:-1px;">
139
  <h2>How to Use</h2>
140
  <p>pageMash works with the wp_list_pages function. The easiest way to use it is to put the pages widget in your sidebar [WP admin page > Presentation > Widgets]. Click the configure button on the widget and ensure that 'sort by' is set to 'page order'. Hey presto, you're done.</p>
152
 
153
  function pageMash_head(){
154
  //stylesheet & javascript to go in page header
155
+ global $pageMash_rel_dir, $CollapsePagesOnLoad;
156
 
157
+ wp_deregister_script('prototype');//remove prototype since it is incompatible with mootools
158
  wp_enqueue_script('pagemash_mootools', '/'.$pageMash_rel_dir.'nest-mootools.v1.11.js', false, false); //code is not compatible with other releases of moo
159
  wp_enqueue_script('pagemash_nested', '/'.$pageMash_rel_dir.'nested.js', array('pagemash_mootools'), false);
160
  wp_enqueue_script('pagemash_inlineEdit', '/'.$pageMash_rel_dir.'inlineEdit.v1.2.js', array('pagemash_mootools'), false);
161
+ wp_enqueue_script('pagemash', '/'.$pageMash_rel_dir.'pagemash.js', array('pagemash_mootools'), false);
162
  add_action('admin_head', 'pageMash_add_css', 1);
163
+
164
  }
165
 
166
  function pageMash_add_css(){
167
+ global $pageMash_abs_dir, $CollapsePagesOnLoad;
168
+ if($CollapsePagesOnLoad): ?>
169
+ <script type="text/javascript" charset="utf-8">
170
+ window.addEvent('domready', function(){
171
+ $ES('li','pageMash_pages').each(function(el) {
172
+ if(el.hasClass('children')) el.addClass('collapsed');
173
+ });
174
+ });
175
+ </script>
176
+ <?php endif;
177
  ?>
178
+ <link rel="stylesheet" type="text/css" href="<?php echo $pageMash_abs_dir ?>pagemash.css" />
179
+ <!-- __ __ _
180
+ WordPress Plugin | \/ | | |
181
+ _ __ __ _ __ _ ___| \ / | __ _ ___| |__
182
+ | '_ \/ _` |/ _` |/ _ \ |\/| |/ _` / __| '_ \
183
+ | |_) (_| | (_| | __/ | | | (_| \__ \ | | |
184
+ | .__/\__,_|\__, |\___|_| |_|\__,_|___/_| |_|
185
+ | | __/ | Author: Joel Starnes
186
+ |_| |___/ URL: pagemash.joelstarnes.co.uk
187
 
188
  >>pageMash Admin Page
189
  -->
reorder.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- require('./../../../wp-config.php'); //run config to connect to database
3
-
4
- $order = explode(",", $_GET['order']); //cut up the coma delimited page IDs into array
5
- $position = 1;
6
- foreach ($order as $pageid):
7
- $postquery = "UPDATE $wpdb->posts SET menu_order='$position' WHERE ID='$pageid'"; //setup db query
8
- $wpdb->query($postquery); //update pages in db
9
- $position += 1; //increment position var
10
- endforeach;
11
-
12
- update_option("exclude_pages", $_GET['exclude'], '', 'yes');
13
-
14
- echo "pagemashed";
15
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
saveList.php CHANGED
@@ -14,7 +14,9 @@
14
  if(!$_POST['m']) die('no data'); //die if no data is sent
15
  error_reporting(E_ALL);
16
  require_once('myjson.php'); //JSON decode lib
17
- require_once('./../../../wp-config.php'); //config to connect to database
 
 
18
 
19
  global $wpdb, $excludePages;
20
  $excludePages = array();
@@ -46,7 +48,7 @@ function saveList($parent, $children) {
46
  $wpdb->query($postquery); //$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d, post_parent = %s WHERE ID = %d" ), $i, $parent, $id );
47
  echo $postquery;
48
  echo "\n";
49
-
50
  if (isset($v->children[0])) {saveList($id, $v->children);}
51
  $i++;
52
  }
14
  if(!$_POST['m']) die('no data'); //die if no data is sent
15
  error_reporting(E_ALL);
16
  require_once('myjson.php'); //JSON decode lib
17
+ //require_once('./../../../wp-config.php'); //config to connect to database
18
+ include_once "../../../wp-config.php";
19
+ include_once "../../../wp-settings.php";
20
 
21
  global $wpdb, $excludePages;
22
  $excludePages = array();
48
  $wpdb->query($postquery); //$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d, post_parent = %s WHERE ID = %d" ), $i, $parent, $id );
49
  echo $postquery;
50
  echo "\n";
51
+
52
  if (isset($v->children[0])) {saveList($id, $v->children);}
53
  $i++;
54
  }