Admin Post Navigation - Version 1.1.1

Version Description

  • Add PHPDoc documentation
  • Note compatibility with WP 2.9+
  • Update copyright date
  • Update readme.txt (including adding Changelog)
Download this release

Release Info

Developer coffee2code
Plugin Icon 128x128 Admin Post Navigation
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1 to 1.1.1

Files changed (2) hide show
  1. admin-post-navigation.php +54 -6
  2. readme.txt +22 -7
admin-post-navigation.php CHANGED
@@ -1,7 +1,12 @@
1
  <?php
 
 
 
 
 
2
  /*
3
  Plugin Name: Admin Post Navigation
4
- Version: 1.1
5
  Plugin URI: http://coffee2code.com/wp-plugins/admin-post-navigation
6
  Author: Scott Reilly
7
  Author URI: http://coffee2code.com
@@ -17,7 +22,7 @@ category, etc, are not taken into consideration when determining the previous or
17
 
18
  NOTE: Be sure to save the post currently being edited before navigating away to the previous/next post.
19
 
20
- Compatible with WordPress 2.6+, 2.7+, 2.8+.
21
 
22
  =>> Read the accompanying readme.txt file for more information. Also, visit the plugin's homepage
23
  =>> for more information and the latest updates
@@ -25,12 +30,12 @@ Compatible with WordPress 2.6+, 2.7+, 2.8+.
25
  Installation:
26
 
27
  1. Download the file http://coffee2code.com/wp-plugins/admin-post-navigation.zip and unzip it into your
28
- /wp-content/plugins/ directory.
29
  2. Activate the plugin through the 'Plugins' admin menu in WordPress
30
  */
31
 
32
  /*
33
- Copyright (c) 2008-2009 by Scott Reilly (aka coffee2code)
34
 
35
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
36
  files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
@@ -51,6 +56,9 @@ class AdminPostNavigation {
51
  var $prev_text = '&laquo; Previous';
52
  var $next_text = 'Next &raquo;';
53
 
 
 
 
54
  function AdminPostNavigation() {
55
  global $pagenow;
56
  if ( is_admin() && 'post.php' == $pagenow ) {
@@ -67,6 +75,9 @@ class AdminPostNavigation {
67
  add_meta_box('adminpostnav', 'Post Navigation', array(&$this, 'add_meta_box'), 'post', 'side', 'core');
68
  }
69
 
 
 
 
70
  function add_meta_box( $object, $box ) {
71
  global $post_ID;
72
  $display = '';
@@ -89,6 +100,9 @@ class AdminPostNavigation {
89
  echo apply_filters('admin_post_nav', $display);
90
  }
91
 
 
 
 
92
  function add_css() {
93
  echo <<<CSS
94
  <style type="text/css">
@@ -103,8 +117,14 @@ class AdminPostNavigation {
103
  CSS;
104
  }
105
 
106
- // For those with JS enabled, the navigation links are moved next to the "Edit Post" header and the plugin's meta_box is hidden.
107
- // The fallback for non-JS people is that the plugin's meta_box is shown and the navigation links can be found there.
 
 
 
 
 
 
108
  function add_js() {
109
  echo <<<JS
110
  <script type="text/javascript">
@@ -117,6 +137,20 @@ CSS;
117
  JS;
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  function query($type = '<', $offset = 0, $limit = 15) {
121
  global $post_ID, $wpdb;
122
  if ( $type != '<' )
@@ -150,10 +184,24 @@ JS;
150
  return $result;
151
  }
152
 
 
 
 
 
 
 
 
153
  function next_post() {
154
  return $this->query('>');
155
  }
156
 
 
 
 
 
 
 
 
157
  function previous_post() {
158
  return $this->query('<');
159
  }
1
  <?php
2
+ /**
3
+ * @package Admin_Post_Navigation
4
+ * @author Scott Reilly
5
+ * @version 1.1.1
6
+ */
7
  /*
8
  Plugin Name: Admin Post Navigation
9
+ Version: 1.1.1
10
  Plugin URI: http://coffee2code.com/wp-plugins/admin-post-navigation
11
  Author: Scott Reilly
12
  Author URI: http://coffee2code.com
22
 
23
  NOTE: Be sure to save the post currently being edited before navigating away to the previous/next post.
24
 
25
+ Compatible with WordPress 2.6+, 2.7+, 2.8+, 2.9+.
26
 
27
  =>> Read the accompanying readme.txt file for more information. Also, visit the plugin's homepage
28
  =>> for more information and the latest updates
30
  Installation:
31
 
32
  1. Download the file http://coffee2code.com/wp-plugins/admin-post-navigation.zip and unzip it into your
33
+ /wp-content/plugins/ directory (or install via the built-in WordPress plugin installer).
34
  2. Activate the plugin through the 'Plugins' admin menu in WordPress
35
  */
36
 
37
  /*
38
+ Copyright (c) 2008-2010 by Scott Reilly (aka coffee2code)
39
 
40
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
41
  files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
56
  var $prev_text = '&laquo; Previous';
57
  var $next_text = 'Next &raquo;';
58
 
59
+ /**
60
+ * Class constructor: initializes class variables and adds actions and filters.
61
+ */
62
  function AdminPostNavigation() {
63
  global $pagenow;
64
  if ( is_admin() && 'post.php' == $pagenow ) {
75
  add_meta_box('adminpostnav', 'Post Navigation', array(&$this, 'add_meta_box'), 'post', 'side', 'core');
76
  }
77
 
78
+ /**
79
+ * Adds the content for the post navigation meta_box.
80
+ */
81
  function add_meta_box( $object, $box ) {
82
  global $post_ID;
83
  $display = '';
100
  echo apply_filters('admin_post_nav', $display);
101
  }
102
 
103
+ /**
104
+ * Outputs CSS within style tags
105
+ */
106
  function add_css() {
107
  echo <<<CSS
108
  <style type="text/css">
117
  CSS;
118
  }
119
 
120
+ /**
121
+ * Outputs the JavaScript used by the plugin.
122
+ *
123
+ * For those with JS enabled, the navigation links are moved next to the
124
+ * "Edit Post" header and the plugin's meta_box is hidden. The fallback
125
+ * for non-JS people is that the plugin's meta_box is shown and the
126
+ * navigation links can be found there.
127
+ */
128
  function add_js() {
129
  echo <<<JS
130
  <script type="text/javascript">
137
  JS;
138
  }
139
 
140
+ /**
141
+ * Returns the previous or next post relative to the current post.
142
+ *
143
+ * Currently, a previous/next post is determined by the next lower/higher
144
+ * valid post based on relative sequential post ID and which the user can
145
+ * edit. Other post criteria such as post type (draft, pending, etc),
146
+ * publish date, post author, category, etc, are not taken into
147
+ * consideration when determining the previous or next post.
148
+ *
149
+ * @param string $type (optional) Either '<' or '>', indicating previous or next post, respectively. Default is '<'.
150
+ * @param int $offset (optional) Offset. Default is 0.
151
+ * @param int $limit (optional) Limit. Default is 15.
152
+ * @return string
153
+ */
154
  function query($type = '<', $offset = 0, $limit = 15) {
155
  global $post_ID, $wpdb;
156
  if ( $type != '<' )
184
  return $result;
185
  }
186
 
187
+ /**
188
+ * Returns the next post relative to the current post.
189
+ *
190
+ * A convenience function that calls query().
191
+ *
192
+ * @return object The next post object.
193
+ */
194
  function next_post() {
195
  return $this->query('>');
196
  }
197
 
198
+ /**
199
+ * Returns the previous post relative to the current post.
200
+ *
201
+ * A convenience function that calls query().
202
+ *
203
+ * @return object The previous post object.
204
+ */
205
  function previous_post() {
206
  return $this->query('<');
207
  }
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Admin Post Navigation ===
2
- Contributors: Scott Reilly
3
- Donate link: http://coffee2code.com
4
- Tags: admin, navigation, post, next, previous, edit
5
  Requires at least: 2.6
6
- Tested up to: 2.8
7
- Stable tag: 1.1
8
- Version: 1.1
9
 
10
  Adds links to the next and previous posts when editing a post in the WordPress admin.
11
 
@@ -22,7 +22,7 @@ NOTE: Be sure to save the post currently being edited before navigating away to
22
 
23
  == Installation ==
24
 
25
- 1. Unzip `admin-post-navigation.zip` inside the `/wp-content/plugins/` directory for your site
26
  1. Activate the plugin through the 'Plugins' admin menu in WordPress
27
 
28
  == Screenshots ==
@@ -30,4 +30,19 @@ NOTE: Be sure to save the post currently being edited before navigating away to
30
  1. A screenshot of the previous/next links adjacent to the 'Edit Post' admin page header when Javascript is enabled.
31
  2. A screenshot of the previous/next links in their own 'Edit Post' admin page sidebar panel when Javascript is disabled for the admin user.
32
 
 
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  === Admin Post Navigation ===
2
+ Contributors: coffee2code
3
+ Donate link: http://coffee2code.com/donate
4
+ Tags: admin, navigation, post, next, previous, edit, coffee2code
5
  Requires at least: 2.6
6
+ Tested up to: 2.9.1
7
+ Stable tag: 1.1.1
8
+ Version: 1.1.1
9
 
10
  Adds links to the next and previous posts when editing a post in the WordPress admin.
11
 
22
 
23
  == Installation ==
24
 
25
+ 1. Unzip `admin-post-navigation.zip` inside the `/wp-content/plugins/` directory for your site (or install via the built-in WordPress plugin installer)
26
  1. Activate the plugin through the 'Plugins' admin menu in WordPress
27
 
28
  == Screenshots ==
30
  1. A screenshot of the previous/next links adjacent to the 'Edit Post' admin page header when Javascript is enabled.
31
  2. A screenshot of the previous/next links in their own 'Edit Post' admin page sidebar panel when Javascript is disabled for the admin user.
32
 
33
+ == Changelog ==
34
 
35
+ = 1.1.1 =
36
+ * Add PHPDoc documentation
37
+ * Note compatibility with WP 2.9+
38
+ * Update copyright date
39
+ * Update readme.txt (including adding Changelog)
40
+
41
+ = 1.1 =
42
+ * Add offset and limit arguments to query()
43
+ * Only get ID and post_title fields in query, not *
44
+ * Change the previous/next post query to ensure it only gets posts the user can edit
45
+ * Note compatibility with WP 2.8+
46
+
47
+ = 1.0 =
48
+ * Initial release