Changeset 1527897
- Timestamp:
- 11/04/2016 07:27:48 AM (9 years ago)
- Location:
- my-link-order/trunk
- Files:
-
- 2 edited
-
mylinkorder.php (modified) (12 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
my-link-order/trunk/mylinkorder.php
r1215408 r1527897 4 4 Plugin URI: http://www.geekyweekly.com/mylinkorder 5 5 Description: My Link Order allows you to set the order in which links and link categories will appear in the sidebar. Uses a drag and drop interface for ordering. Adds a widget with additional options for easy installation on widgetized themes. 6 Version: 4. 36 Version: 4.4.2 7 7 Author: Andrew Charlton 8 8 Author URI: http://www.geekyweekly.com 9 9 Author Email: [email protected] 10 10 */ 11 12 function mylinkorder_init() { 11 13 12 14 function mylinkorder_menu() … … 50 52 $catID = 0; 51 53 54 current_user_can('manage_links'); 55 52 56 if (isset($_POST['btnCats'])) 53 57 $catID = $_POST['cats']; 54 58 elseif (isset($_POST['hdnCatID'])) 55 59 $catID = $_POST['hdnCatID']; 60 61 if(!is_numeric($catID)) 62 return '<div id="message" class="error fade"><p>'. __('An error occured.', 'mylinkorder').'</p></div>'; 56 63 57 64 if (isset($_POST['btnReturnParent'])) … … 71 78 72 79 if (isset($_POST['btnOrderCats'])) { 80 check_admin_referer('update_cats_mylinkorder'); 73 81 $idString = $_POST['hdnMyLinkOrder']; 74 82 $catIDs = explode(",", $idString); 75 83 $result = count($catIDs); 76 for($i = 0; $i < =$result; $i++)84 for($i = 0; $i < $result; $i++) 77 85 { 78 86 $str = str_replace("id_", "", $catIDs[$i]); 87 88 if(!is_numeric($str)) 89 return '<div id="message" class="error fade"><p>'. __('An error occured, order has not been saved.', 'mylinkorder').'</p></div>'; 90 79 91 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_order = %d WHERE term_id = %d", $i, $str) ); 80 92 } … … 84 96 85 97 if (isset($_POST['btnOrderLinks'])) { 98 check_admin_referer('update_mylinkorder_'.$catID); 86 99 $idString = $_POST['hdnMyLinkOrder']; 87 100 $linkIDs = explode(",", $idString); 88 101 $result = count($linkIDs); 89 for($i = 0; $i < =$result; $i++)102 for($i = 0; $i < $result; $i++) 90 103 { 91 104 $str = str_replace("id_", "", $linkIDs[$i]); 105 106 if(!is_numeric($str)) 107 return '<div id="message" class="error fade"><p>'. __('An error occured, order has not been saved.', 'mylinkorder').'</p></div>'; 108 92 109 $wpdb->query($wpdb->prepare("UPDATE $wpdb->links SET link_order = %d WHERE link_id =%d ", $i, $str)); 93 110 } … … 108 125 $cat_name = $wpdb->get_var($wpdb->prepare("SELECT name FROM $wpdb->terms WHERE term_id= %d", $catID)); 109 126 ?> 127 <?php wp_nonce_field('update_mylinkorder_'.$catID); ?> 110 128 <h3><?php _e('Order Links for', 'mylinkorder') ?> <?php _e($cat_name) ?></h3> 111 129 … … 128 146 129 147 <p><?php _e('Choose a category from the drop down to order the links in that category or order the categories by dragging and dropping them.', 'mylinkorder') ?></p> 130 148 <?php wp_nonce_field('update_cats_mylinkorder'); ?> 131 149 <h3><?php _e('Order Links', 'mylinkorder') ?></h3> 132 150 … … 225 243 <?php 226 244 } 245 } 227 246 228 247 function mylinkorder_applyorderfilter($orderby, $args) … … 235 254 236 255 add_filter('get_terms_orderby', 'mylinkorder_applyorderfilter', 10, 2); 256 add_action('plugins_loaded', 'mylinkorder_init'); 237 257 add_action('init', 'mylinkorder_loadtranslation'); 238 258 … … 244 264 245 265 function __construct() { 246 $widget_ops = array('classname' => 'widget_mylinkorder ', 'description' => __( 'Enhanced Link widget provided by My Link Order') );266 $widget_ops = array('classname' => 'widget_mylinkorder widget_links', 'description' => __( 'Enhanced Link widget provided by My Link Order') ); 247 267 parent::__construct('mylinkorder', __('My Link Order'), $widget_ops); } 248 268 … … 273 293 274 294 $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); 275 mylinkorder_list_bookmarks(apply_filters('widget_links_args', array('title_before' => $before_title, 'title_after' => $after_title, 'class' => 'linkcat widget ',295 mylinkorder_list_bookmarks(apply_filters('widget_links_args', array('title_before' => $before_title, 'title_after' => $after_title, 'class' => 'linkcat widget ', 276 296 'category_before' => $before_widget, 'category_after' => $after_widget, 'exclude' => $exclude, 'include' => $include, 277 297 'title_li' => $title_li, 'category_orderby' => $category_orderby, 'category_order' => $category_order, 'orderby' => $orderby, 'order' => $order, … … 480 500 'title_before' => '<h2>', 'title_after' => '</h2>', 481 501 'category_orderby' => 'name', 'category_order' => 'ASC', 482 'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class ">',502 'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class widget_links">', 483 503 'category_after' => '</li>' 484 504 ); … … 668 688 669 689 $results = $wpdb->get_results($query); 670 690 671 691 $cache[ $key ] = $results; 672 692 wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); -
my-link-order/trunk/readme.txt
r1215408 r1527897 4 4 Tags: link, category, categories, order, sidebar, widget 5 5 Requires at least: 2.8 6 Tested up to: 4. 37 Stable tag: 4. 36 Tested up to: 4.4.2 7 Stable tag: 4.4.2 8 8 9 9 My Link Order allows you to set the order in which links and link categories will appear in the sidebar. … … 25 25 26 26 == Changelog == 27 = 4.4.2 = 28 * Permission check and security improvement. 27 29 = 4.3 = 28 30 * PHP7 constructor update
Note: See TracChangeset
for help on using the changeset viewer.