-
+ 90664A96EC1D26CE86AD8E99DA462F7E56744A397222D3EF6FA8FE901F31EA64EC9040127235FE9F4B4F7F1623F61E4F99D4F36BE3D87E32AB86A1BC2F1DACF3mp-wp/wp-admin/link-manager.php(0 . 0)(1 . 289)
52070 <?php
52071 /**
52072 * Link Management Administration Panel.
52073 *
52074 * @package WordPress
52075 * @subpackage Administration
52076 */
52077
52078 /** Load WordPress Administration Bootstrap */
52079 require_once ('admin.php');
52080
52081 // Handle bulk deletes
52082 if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
52083 check_admin_referer('bulk-bookmarks');
52084 $doaction = $_GET['action'] ? $_GET['action'] : $_GET['action2'];
52085
52086 if ( ! current_user_can('manage_links') )
52087 wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
52088
52089 if ( 'delete' == $doaction ) {
52090 foreach ( (array) $_GET['linkcheck'] as $link_id ) {
52091 $link_id = (int) $link_id;
52092
52093 wp_delete_link($link_id);
52094 }
52095
52096 wp_redirect( wp_get_referer() );
52097 exit;
52098 }
52099 } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
52100 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
52101 exit;
52102 }
52103
52104 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
52105
52106 if ( empty($cat_id) )
52107 $cat_id = 'all';
52108
52109 if ( empty($order_by) )
52110 $order_by = 'order_name';
52111
52112 $title = __('Edit Links');
52113 $this_file = $parent_file = 'link-manager.php';
52114 include_once ("./admin-header.php");
52115
52116 if (!current_user_can('manage_links'))
52117 wp_die(__("You do not have sufficient permissions to edit the links for this blog."));
52118
52119 switch ($order_by) {
52120 case 'order_id' :
52121 $sqlorderby = 'id';
52122 break;
52123 case 'order_url' :
52124 $sqlorderby = 'url';
52125 break;
52126 case 'order_desc' :
52127 $sqlorderby = 'description';
52128 break;
52129 case 'order_owner' :
52130 $sqlorderby = 'owner';
52131 break;
52132 case 'order_rating' :
52133 $sqlorderby = 'rating';
52134 break;
52135 case 'order_name' :
52136 default :
52137 $sqlorderby = 'name';
52138 break;
52139 } ?>
52140
52141 <div class="wrap nosubsub">
52142 <?php screen_icon(); ?>
52143 <h2><?php echo wp_specialchars( $title );
52144 if ( isset($_GET['s']) && $_GET['s'] )
52145 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
52146 </h2>
52147
52148 <?php
52149 if ( isset($_GET['deleted']) ) {
52150 echo '<div id="message" class="updated fade"><p>';
52151 $deleted = (int) $_GET['deleted'];
52152 printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
52153 echo '</p></div>';
52154 $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
52155 }
52156 ?>
52157
52158 <form class="search-form" action="" method="get">
52159 <p class="search-box">
52160 <label class="hidden" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
52161 <input type="text" class="search-input" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
52162 <input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
52163 </p>
52164 </form>
52165 <br class="clear" />
52166
52167 <form id="posts-filter" action="" method="get">
52168 <div class="tablenav">
52169
52170 <div class="alignleft actions">
52171 <select name="action">
52172 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
52173 <option value="delete"><?php _e('Delete'); ?></option>
52174 </select>
52175 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
52176
52177 <?php
52178 $categories = get_terms('link_category', "hide_empty=1");
52179 $select_cat = "<select name=\"cat_id\">\n";
52180 $select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
52181 foreach ((array) $categories as $cat)
52182 $select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n";
52183 $select_cat .= "</select>\n";
52184
52185 $select_order = "<select name=\"order_by\">\n";
52186 $select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' . __('Order by Link ID') . "</option>\n";
52187 $select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' . __('Order by Name') . "</option>\n";
52188 $select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' . __('Order by Address') . "</option>\n";
52189 $select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' . __('Order by Rating') . "</option>\n";
52190 $select_order .= "</select>\n";
52191
52192 echo $select_cat;
52193 echo $select_order;
52194
52195 ?>
52196 <input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
52197
52198 </div>
52199
52200 <br class="clear" />
52201 </div>
52202
52203 <div class="clear"></div>
52204
52205 <?php
52206 if ( 'all' == $cat_id )
52207 $cat_id = '';
52208 $args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0);
52209 if ( !empty($_GET['s']) )
52210 $args['search'] = $_GET['s'];
52211 $links = get_bookmarks( $args );
52212 if ( $links ) {
52213 $link_columns = get_column_headers('link-manager');
52214 $hidden = get_hidden_columns('link-manager');
52215 ?>
52216
52217 <?php wp_nonce_field('bulk-bookmarks') ?>
52218 <table class="widefat fixed" cellspacing="0">
52219 <thead>
52220 <tr>
52221 <?php print_column_headers('link-manager'); ?>
52222 </tr>
52223 </thead>
52224
52225 <tfoot>
52226 <tr>
52227 <?php print_column_headers('link-manager', false); ?>
52228 </tr>
52229 </tfoot>
52230
52231 <tbody>
52232 <?php
52233 $alt = 0;
52234
52235 foreach ($links as $link) {
52236 $link = sanitize_bookmark($link);
52237 $link->link_name = attribute_escape($link->link_name);
52238 $link->link_category = wp_get_link_cats($link->link_id);
52239 $short_url = str_replace('http://', '', $link->link_url);
52240 $short_url = str_replace('www.', '', $short_url);
52241 if ('/' == substr($short_url, -1))
52242 $short_url = substr($short_url, 0, -1);
52243 if (strlen($short_url) > 35)
52244 $short_url = substr($short_url, 0, 32).'...';
52245 $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
52246 $style = ($alt % 2) ? '' : ' class="alternate"';
52247 ++ $alt;
52248 $edit_link = get_edit_bookmark_link();
52249 ?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
52250 foreach($link_columns as $column_name=>$column_display_name) {
52251 $class = "class=\"column-$column_name\"";
52252
52253 $style = '';
52254 if ( in_array($column_name, $hidden) )
52255 $style = ' style="display:none;"';
52256 if ( 'visible' == $column_name )
52257 $style = empty($style) ? ' style="text-align: center;"' : ' style="text-align: center; display: none;"';
52258 $attributes = "$class$style";
52259
52260 switch($column_name) {
52261 case 'cb':
52262 echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></th>';
52263 break;
52264 case 'name':
52265
52266 echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) . "'>$link->link_name</a></strong><br />";
52267 $actions = array();
52268 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
52269 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
52270 $action_count = count($actions);
52271 $i = 0;
52272 echo '<div class="row-actions">';
52273 foreach ( $actions as $action => $linkaction ) {
52274 ++$i;
52275 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
52276 echo "<span class='$action'>$linkaction$sep</span>";
52277 }
52278 echo '</div>';
52279 echo '</td>';
52280 break;
52281 case 'url':
52282 echo "<td $attributes><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
52283 break;
52284 case 'categories':
52285 ?><td <?php echo $attributes ?>><?php
52286 $cat_names = array();
52287 foreach ($link->link_category as $category) {
52288 $cat = get_term($category, 'link_category', OBJECT, 'display');
52289 if ( is_wp_error( $cat ) )
52290 echo $cat->get_error_message();
52291 $cat_name = $cat->name;
52292 if ( $cat_id != $category )
52293 $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
52294 $cat_names[] = $cat_name;
52295 }
52296 echo implode(', ', $cat_names);
52297 ?></td><?php
52298 break;
52299 case 'rel':
52300 ?><td <?php echo $attributes ?>><?php echo $link->link_rel; ?></td><?php
52301 break;
52302 case 'visible':
52303 ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
52304 break;
52305 default:
52306 ?>
52307 <td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
52308 <?php
52309 break;
52310
52311 }
52312 }
52313 echo "\n </tr>\n";
52314 }
52315 ?>
52316 </tbody>
52317 </table>
52318
52319 <?php } else { ?>
52320 <p><?php _e('No links found.') ?></p>
52321 <?php } ?>
52322
52323 <div class="tablenav">
52324
52325 <div class="alignleft actions">
52326 <select name="action2">
52327 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
52328 <option value="delete"><?php _e('Delete'); ?></option>
52329 </select>
52330 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
52331 </div>
52332
52333 <br class="clear" />
52334 </div>
52335
52336 </form>
52337
52338 <div id="ajax-response"></div>
52339
52340 </div>
52341
52342 <script type="text/javascript">
52343 /* <![CDATA[ */
52344 (function($){
52345 $(document).ready(function(){
52346 $('#doaction, #doaction2').click(function(){
52347 if ( $('select[name^="action"]').val() == 'delete' ) {
52348 var m = '<?php echo js_escape(__("You are about to delete the selected links.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
52349 return showNotice.warn(m);
52350 }
52351 });
52352 });
52353 })(jQuery);
52354 columns.init('link-manager');
52355 /* ]]> */
52356 </script>
52357
52358 <?php include('admin-footer.php'); ?>