Admin Post Navigation - Version 1.7.1

Version Description

  • Use string instead of variable to specify translation textdomain
  • Re-license as GPLv2 or later (from X11)
  • Add 'License' and 'License URI' header tags to readme.txt and plugin file
  • Add banner image for plugin page
  • Remove ending PHP close tag
  • Minor documentation tweaks
  • Note compatibility through WP 3.4+
Download this release

Release Info

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

Code changes from version 1.7 to 1.7.1

Files changed (2) hide show
  1. admin-post-navigation.php +28 -24
  2. readme.txt +26 -8
admin-post-navigation.php CHANGED
@@ -2,39 +2,46 @@
2
  /**
3
  * @package Admin_Post_Navigation
4
  * @author Scott Reilly
5
- * @version 1.7
6
  */
7
  /*
8
  Plugin Name: Admin Post Navigation
9
- Version: 1.7
10
  Plugin URI: http://coffee2code.com/wp-plugins/admin-post-navigation/
11
  Author: Scott Reilly
12
- Author URI: http://coffee2code.com
13
  Text Domain: admin-post-navigation
14
  Domain Path: /lang/
 
 
15
  Description: Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.
16
 
17
- Compatible with WordPress 3.0+, 3.1+, 3.2+, 3.3+.
18
 
19
  =>> Read the accompanying readme.txt file for instructions and documentation.
20
  =>> Also, visit the plugin's homepage for additional information and updates.
21
  =>> Or visit: http://wordpress.org/extend/plugins/admin-post-navigation/
 
 
 
22
  */
23
 
24
  /*
25
- Copyright (c) 2008-2012 by Scott Reilly (aka coffee2code)
26
 
27
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
28
- files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
29
- modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
30
- Software is furnished to do so, subject to the following conditions:
31
 
32
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
 
 
33
 
34
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
37
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38
  */
39
 
40
  if ( is_admin() && ! class_exists( 'c2c_AdminPostNavigation' ) ) :
@@ -45,7 +52,6 @@ class c2c_AdminPostNavigation {
45
  private static $next_text = '';
46
  private static $post_statuses = array( 'draft', 'future', 'pending', 'private', 'publish' ); // Filterable later
47
  private static $post_statuses_sql = '';
48
- private static $textdomain = 'admin-post-navigation';
49
 
50
  /**
51
  * Returns version of the plugin.
@@ -53,7 +59,7 @@ class c2c_AdminPostNavigation {
53
  * @since 1.7
54
  */
55
  public static function version() {
56
- return '1.7';
57
  }
58
 
59
  /**
@@ -70,10 +76,10 @@ class c2c_AdminPostNavigation {
70
  *
71
  */
72
  public static function register_post_page_hooks() {
73
- load_plugin_textdomain( self::$textdomain, false, basename( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'lang' );
74
 
75
- self::$prev_text = __( '← Previous', self::$textdomain );
76
- self::$next_text = __( 'Next →', self::$textdomain );
77
 
78
  add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_css' ) );
79
  add_action( 'admin_print_footer_scripts', array( __CLASS__, 'add_js' ) );
@@ -100,7 +106,7 @@ class c2c_AdminPostNavigation {
100
  self::$post_statuses_sql = "'" . implode( "', '", array_map( 'esc_sql', $post_statuses ) ) . "'";
101
  $label = self::_get_post_type_label( $post_type );
102
  if ( in_array( $post->post_status, $post_statuses ) )
103
- add_meta_box( 'adminpostnav', sprintf( __( '%s Navigation', self::$textdomain ), ucfirst( $post_type ) ), array( __CLASS__, 'add_meta_box' ), $post_type, 'side', 'core' );
104
  }
105
 
106
  /**
@@ -120,7 +126,7 @@ class c2c_AdminPostNavigation {
120
  if ( $prev ) {
121
  $post_title = strip_tags( get_the_title( $prev->ID ) ); /* If only the_title_attribute() accepted post ID as arg */
122
  $display .= '<a href="' . get_edit_post_link( $prev->ID ) . '" id="admin-post-nav-prev" title="' .
123
- esc_attr( sprintf( __( 'Previous %1$s: %2$s', self::$textdomain ), $context, $post_title ) ) .
124
  '" class="admin-post-nav-prev add-new-h2">' . self::$prev_text . '</a>';
125
  }
126
 
@@ -131,7 +137,7 @@ class c2c_AdminPostNavigation {
131
  $post_title = strip_tags( get_the_title( $next->ID ) ); /* If only the_title_attribute() accepted post ID as arg */
132
  $display .= '<a href="' . get_edit_post_link( $next->ID ) .
133
  '" id="admin-post-nav-next" title="' .
134
- esc_attr( sprintf( __( 'Next %1$s: %2$s', self::$textdomain ), $context, $post_title ) ).
135
  '" class="admin-post-nav-next add-new-h2">' . self::$next_text . '</a>';
136
  }
137
 
@@ -274,5 +280,3 @@ JS;
274
  c2c_AdminPostNavigation::init();
275
 
276
  endif; // end if !class_exists()
277
-
278
- ?>
2
  /**
3
  * @package Admin_Post_Navigation
4
  * @author Scott Reilly
5
+ * @version 1.7.1
6
  */
7
  /*
8
  Plugin Name: Admin Post Navigation
9
+ Version: 1.7.1
10
  Plugin URI: http://coffee2code.com/wp-plugins/admin-post-navigation/
11
  Author: Scott Reilly
12
+ Author URI: http://coffee2code.com/
13
  Text Domain: admin-post-navigation
14
  Domain Path: /lang/
15
+ License: GPLv2 or later
16
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
17
  Description: Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.
18
 
19
+ Compatible with WordPress 3.0 through 3.4+.
20
 
21
  =>> Read the accompanying readme.txt file for instructions and documentation.
22
  =>> Also, visit the plugin's homepage for additional information and updates.
23
  =>> Or visit: http://wordpress.org/extend/plugins/admin-post-navigation/
24
+
25
+ TODO:
26
+ * Add screen option allowing user selection of post navigation order
27
  */
28
 
29
  /*
30
+ Copyright (c) 2008-2012 by Scott Reilly (aka coffee2code)
31
 
32
+ This program is free software; you can redistribute it and/or
33
+ modify it under the terms of the GNU General Public License
34
+ as published by the Free Software Foundation; either version 2
35
+ of the License, or (at your option) any later version.
36
 
37
+ This program is distributed in the hope that it will be useful,
38
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
39
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40
+ GNU General Public License for more details.
41
 
42
+ You should have received a copy of the GNU General Public License
43
+ along with this program; if not, write to the Free Software
44
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
45
  */
46
 
47
  if ( is_admin() && ! class_exists( 'c2c_AdminPostNavigation' ) ) :
52
  private static $next_text = '';
53
  private static $post_statuses = array( 'draft', 'future', 'pending', 'private', 'publish' ); // Filterable later
54
  private static $post_statuses_sql = '';
 
55
 
56
  /**
57
  * Returns version of the plugin.
59
  * @since 1.7
60
  */
61
  public static function version() {
62
+ return '1.7.1';
63
  }
64
 
65
  /**
76
  *
77
  */
78
  public static function register_post_page_hooks() {
79
+ load_plugin_textdomain( 'admin-post-navigation', false, basename( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'lang' );
80
 
81
+ self::$prev_text = __( '&larr; Previous', 'admin-post-navigation' );
82
+ self::$next_text = __( 'Next &rarr;', 'admin-post-navigation' );
83
 
84
  add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_css' ) );
85
  add_action( 'admin_print_footer_scripts', array( __CLASS__, 'add_js' ) );
106
  self::$post_statuses_sql = "'" . implode( "', '", array_map( 'esc_sql', $post_statuses ) ) . "'";
107
  $label = self::_get_post_type_label( $post_type );
108
  if ( in_array( $post->post_status, $post_statuses ) )
109
+ add_meta_box( 'adminpostnav', sprintf( __( '%s Navigation', 'admin-post-navigation' ), ucfirst( $post_type ) ), array( __CLASS__, 'add_meta_box' ), $post_type, 'side', 'core' );
110
  }
111
 
112
  /**
126
  if ( $prev ) {
127
  $post_title = strip_tags( get_the_title( $prev->ID ) ); /* If only the_title_attribute() accepted post ID as arg */
128
  $display .= '<a href="' . get_edit_post_link( $prev->ID ) . '" id="admin-post-nav-prev" title="' .
129
+ esc_attr( sprintf( __( 'Previous %1$s: %2$s', 'admin-post-navigation' ), $context, $post_title ) ) .
130
  '" class="admin-post-nav-prev add-new-h2">' . self::$prev_text . '</a>';
131
  }
132
 
137
  $post_title = strip_tags( get_the_title( $next->ID ) ); /* If only the_title_attribute() accepted post ID as arg */
138
  $display .= '<a href="' . get_edit_post_link( $next->ID ) .
139
  '" id="admin-post-nav-next" title="' .
140
+ esc_attr( sprintf( __( 'Next %1$s: %2$s', 'admin-post-navigation' ), $context, $post_title ) ).
141
  '" class="admin-post-nav-next add-new-h2">' . self::$next_text . '</a>';
142
  }
143
 
280
  c2c_AdminPostNavigation::init();
281
 
282
  endif; // end if !class_exists()
 
 
readme.txt CHANGED
@@ -2,10 +2,12 @@
2
  Contributors: coffee2code
3
  Donate link: http://coffee2code.com/donate
4
  Tags: admin, navigation, post, next, previous, edit, post types, coffee2code
 
 
5
  Requires at least: 3.0
6
- Tested up to: 3.3
7
- Stable tag: 1.7
8
- Version: 1.7
9
 
10
  Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.
11
 
@@ -14,9 +16,9 @@ Adds links to navigate to the next and previous posts when editing a post in the
14
 
15
  Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.
16
 
17
- This plugin adds "<< Previous" and "Next >>" links to the "Edit Post" admin page, if a previous and next post are present, respectively. The link titles (visible when hovering over the links) reveal the title of the previous/next post. The links link to the "Edit Post" admin page for the previous/next posts so that you may edit them.
18
 
19
- Currently, a previous/next post is determined by the next lower/higher valid post based on relative sequential post ID and which the user can edit. Other post criteria such as post type (draft, pending, etc), publish date, post author, category, etc, are not taken into consideration when determining the previous or next post.
20
 
21
  NOTE: Be sure to save the post currently being edited before navigating away to the previous/next post.
22
 
@@ -130,10 +132,19 @@ function override_apn_display( $text ) {
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
 
 
 
133
  = 1.7 =
134
  * Add support for localization
135
- * Change to use post type label instead of post type name, when possible, in link title attribute
136
- * Change to use larr and rarr characters to denote direction of navigation
137
  * Enhanced styling of navigation links
138
  * Hook 'admin_enqueue_scripts' action instead of 'admin_head' to output CSS
139
  * Hook 'load-post.php' to add actions for the post.php page rather than using $pagenow
@@ -144,6 +155,7 @@ function override_apn_display( $text ) {
144
  * Note compatibility through WP 3.3+
145
  * Drop compatibility with versions of WP older than 3.0
146
  * Update screenshots for WP 3.3
 
147
  * Add link to plugin directory page to readme.txt
148
  * Minor code reformatting
149
  * Minor readme.txt reformatting
@@ -214,6 +226,12 @@ function override_apn_display( $text ) {
214
 
215
  == Upgrade Notice ==
216
 
 
 
 
 
 
 
217
  = 1.6.1 =
218
  Trivial update: noted compatibility through WP 3.2+
219
 
@@ -221,4 +239,4 @@ Trivial update: noted compatibility through WP 3.2+
221
  Feature update: added support for non-'post' post types; fixed so navigation only appears for posts of appropriate post status; implementation changes; renamed class; updated copyright date; other minor code changes.
222
 
223
  = 1.5 =
224
- Recommended update. Highlights: find prev/next post by ID rather than post_date, fix navigation logic, added numerous filters to allow for customizations, miscellaneous improvements, dropped pre-WP 2.8 compatibility, added verified WP 3.0 compatibility.
2
  Contributors: coffee2code
3
  Donate link: http://coffee2code.com/donate
4
  Tags: admin, navigation, post, next, previous, edit, post types, coffee2code
5
+ License: GPLv2 or later
6
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: 3.0
8
+ Tested up to: 3.4
9
+ Stable tag: 1.7.1
10
+ Version: 1.7.1
11
 
12
  Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.
13
 
16
 
17
  Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.
18
 
19
+ This plugin adds "&larr; Previous" and "Next &rarr;" links to the "Edit Post" admin page if a previous and next post are present, respectively. The link titles (visible when hovering over the links) reveal the title of the previous/next post. The links link to the "Edit Post" admin page for the previous/next posts so that you may edit them.
20
 
21
+ By default, a previous/next post is determined by the next lower/higher valid post based on relative sequential post ID and which the user can edit. Other post criteria such as post type (draft, pending, etc), publish date, post author, category, etc, are not taken into consideration when determining the previous or next post. How posts are navigated, and post types and post statuses to restrict navigation can be customized via filters (see Filters section).
22
 
23
  NOTE: Be sure to save the post currently being edited before navigating away to the previous/next post.
24
 
132
 
133
  == Changelog ==
134
 
135
+ = 1.7.1 =
136
+ * Use string instead of variable to specify translation textdomain
137
+ * Re-license as GPLv2 or later (from X11)
138
+ * Add 'License' and 'License URI' header tags to readme.txt and plugin file
139
+ * Add banner image for plugin page
140
+ * Remove ending PHP close tag
141
+ * Minor documentation tweaks
142
+ * Note compatibility through WP 3.4+
143
+
144
  = 1.7 =
145
  * Add support for localization
146
+ * Use post type label instead of post type name, when possible, in link title attribute
147
+ * Use larr/rarr characters to denote direction of navigation instead of larquo/rarquo
148
  * Enhanced styling of navigation links
149
  * Hook 'admin_enqueue_scripts' action instead of 'admin_head' to output CSS
150
  * Hook 'load-post.php' to add actions for the post.php page rather than using $pagenow
155
  * Note compatibility through WP 3.3+
156
  * Drop compatibility with versions of WP older than 3.0
157
  * Update screenshots for WP 3.3
158
+ * Tweak plugin description
159
  * Add link to plugin directory page to readme.txt
160
  * Minor code reformatting
161
  * Minor readme.txt reformatting
226
 
227
  == Upgrade Notice ==
228
 
229
+ = 1.7.1 =
230
+ Trivial update: noted compatibility through WP 3.4+; explicitly stated license
231
+
232
+ = 1.7 =
233
+ Recommended update: enhanced styling of navigation links; added support for localization; noted compatibility through WP 3.3+; and more
234
+
235
  = 1.6.1 =
236
  Trivial update: noted compatibility through WP 3.2+
237
 
239
  Feature update: added support for non-'post' post types; fixed so navigation only appears for posts of appropriate post status; implementation changes; renamed class; updated copyright date; other minor code changes.
240
 
241
  = 1.5 =
242
+ Recommended update. Highlights: find prev/next post by ID rather than post_date, fix navigation logic, added numerous filters to allow for customizations, miscellaneous improvements, dropped pre-WP 2.8 compatibility, added verified WP 3.0 compatibility.