Changeset 730333
- Timestamp:
- 06/23/2013 12:14:07 PM (13 years ago)
- Location:
- post-sorter/trunk
- Files:
-
- 5 edited
-
css/style.css (modified) (1 diff)
-
page/general.php (modified) (1 diff)
-
post_sorter.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
post-sorter/trunk/css/style.css
r730151 r730333 24 24 .post_sorter_form .controller { margin-top: 24px; clear: both; } 25 25 26 .post_sorter_form input[type="checkbox"], .post_sorter_form input[type="radio"] 26 .post_sorter_form input[type="checkbox"], 27 .post_sorter_form input[type="radio"] 27 28 { 28 29 margin-right: 16px; 29 30 } 30 31 31 .post_sorter_form textarea {} 32 .post_sorter_form textarea[readonly="readonly"] { background-color: #eee; } 32 .post_sorter_form input[type="text"], 33 .post_sorter_form textarea 34 { 35 width: 480px; 36 } 37 38 .post_sorter_form input[type="text"][readonly="readonly"], 39 .post_sorter_form textarea[readonly="readonly"] 40 { background-color: #eee; } -
post-sorter/trunk/page/general.php
r730151 r730333 54 54 <input name="post_sorter_arrows_enabled" id="post_sorter_arrows_enabled" type="checkbox" <?php checked( 1, get_option( 'post_sorter_arrows_enabled' ) )?> /> 55 55 <span class="hint"><?php _e( 'Allows quick sorting with arrow buttons in the sorting column', 'post_sorter' ) ?></span> 56 </td> 57 </tr> 58 <tr valign="top"> 59 <th scope="row"><label for="post_sorter_custom_types"><?php _e( 'Custom post types', 'post_sorter' ) ?></label>:</th> 60 <td> 61 <input name="post_sorter_custom_types" id="post_sorter_custom_types" type="text" value="<?php echo get_option( 'post_sorter_custom_types' ) ?>" /><br /> 62 <span class="hint"><?php _e( 'Enables sorting on the Sorting column for those types.<br />However, the sort column is shown on every post type. Example: <b>custom1, custom2</b>', 'post_sorter' ) ?></span> 56 63 </td> 57 64 </tr> -
post-sorter/trunk/post_sorter.php
r730151 r730333 4 4 Plugin URI: http://intellisys.org/ 5 5 Description: Plugin for easy sorting of posts and pages by numeric value, both ascending and descending. 6 Version: 1. 26 Version: 1.3 7 7 Author: Lyubomir Gardev 8 8 Author URI: http://rolice.intellisys.info/ … … 36 36 add_filter( 'manage_edit-page_sortable_columns', array( $this, 'add_sorter_sort' ) ); 37 37 38 $custom_types = get_option( 'post_sorter_custom_types' ); 39 $custom_types = explode( ',', sanitize_text_field( trim( str_replace( ' ', '', $custom_types ) ) ) ); 40 41 if( $custom_types && is_array( $custom_types ) ) 42 foreach( $custom_types as $t ) 43 add_filter( 'manage_edit-' . $t . '_sortable_columns', array( $this, 'add_sorter_sort' ) ); 38 44 39 45 //add_filter( 'request', array( $this, 'order_by_at_request' ) ); … … 210 216 } 211 217 212 $sql .= " INNERJOIN {$wpdb->postmeta} AS post_sorter ON ({$wpdb->posts}.ID = post_sorter.post_id AND post_sorter.meta_key = '" . POST_SORTER_META_KEY . "')";218 $sql .= "LEFT JOIN {$wpdb->postmeta} AS post_sorter ON ({$wpdb->posts}.ID = post_sorter.post_id AND post_sorter.meta_key = '" . POST_SORTER_META_KEY . "')"; 213 219 214 220 return $sql; … … 285 291 } 286 292 293 294 /** 295 * Saves settings for the plugin 296 */ 297 public function save_settings() { 298 if ( !current_user_can( 'manage_options' ) ) 299 return; 300 301 if ( empty( $_POST ) ) 302 return; 303 304 update_option( 'post_sorter_enabled', isset( $_POST['post_sorter_enabled'] ) ); 305 update_option( 'post_sorter_direction', isset( $_POST['post_sorter_direction'] ) && mb_strtoupper( $_POST['post_sorter_direction'] ) == 'DESC' ? 'DESC' : '' ); 306 307 $custom_types = isset($_POST['post_sorter_custom_types']) ? $_POST['post_sorter_custom_types'] : ''; // Get custom post types from $_POST or make it empty if no data is received 308 $custom_types = sanitize_text_field( trim( str_replace( ' ', '', $custom_types ) ) ); // cleanup, trimming and space removal 309 310 $custom_types = explode( ',', $custom_types ); // To be sure it explodable 311 312 update_option( 'post_sorter_arrows_enabled', isset( $_POST['post_sorter_arrows_enabled'] ) ); 313 update_option( 'post_sorter_custom_types', implode( ', ', $custom_types ) ); 314 315 update_option( 'post_sorter_custom_enabled', isset( $_POST['post_sorter_custom_enabled'] ) ); 316 $own_risk = get_option( 'post_sorter_custom_enabled' ); 317 318 update_option( 'post_sorter_join_clause', $own_risk ? $this->_sanitize_sql( $_POST['post_sorter_join_clause'] ) : '' ); 319 update_option( 'post_sorter_order_by_clause', $own_risk ? $this->_sanitize_sql( $_POST['post_sorter_order_by_clause'] ) : '' ); 320 } 321 287 322 /** 288 323 * Save a position for a given post. Data for post ID and position is retrieved from $_POST … … 337 372 338 373 return $sql; 339 }340 341 /**342 * Saves settings for the plugin343 */344 public function save_settings() {345 if ( !current_user_can( 'manage_options' ) )346 return;347 348 if ( empty( $_POST ) )349 return;350 351 update_option( 'post_sorter_enabled', isset( $_POST['post_sorter_enabled'] ) );352 update_option(353 'post_sorter_direction', isset( $_POST['post_sorter_direction'] ) && mb_strtoupper( $_POST['post_sorter_direction'] ) == 'DESC' ? 'DESC' : ''354 );355 356 update_option( 'post_sorter_arrows_enabled', isset( $_POST['post_sorter_arrows_enabled'] ) );357 358 update_option( 'post_sorter_custom_enabled', isset( $_POST['post_sorter_custom_enabled'] ) );359 $own_risk = get_option( 'post_sorter_custom_enabled' );360 361 update_option( 'post_sorter_join_clause', $own_risk ? $this->_sanitize_sql( $_POST['post_sorter_join_clause'] ) : '' );362 update_option( 'post_sorter_order_by_clause', $own_risk ? $this->_sanitize_sql( $_POST['post_sorter_order_by_clause'] ) : '' );363 374 } 364 375 -
post-sorter/trunk/readme.txt
r730173 r730333 5 5 Requires at least: 3.2 6 6 Tested up to: 3.5 7 Stable tag: 1. 27 Stable tag: 1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 67 67 == Changelog == 68 68 69 = 1.3 = 70 * Fixed a bug where custom post types disappear from the list. This problem was due to INNER join, but not OUTER. 71 * New option for custom post types in the settings. With it post sorter will know which custom post types it has to handle (it handles them already, but some functionality needs explicit telling). 72 69 73 = 1.2 = 70 74 * Fixed a ordering bug where the postmeta.meta_value is sorted as longtext, but not as unsigned int. -
post-sorter/trunk/uninstall.php
r730151 r730333 8 8 9 9 delete_option( 'post_sorter_arrows_enabled' ); 10 delete_option( 'post_sorter_custom_types' ); 10 11 11 12 delete_option( 'post_sorter_custom_enabled' );
Note: See TracChangeset
for help on using the changeset viewer.