Edit File by line
/home/barbar84/www/wp-admin
File: link.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Manage link administration actions.
[2] Fix | Delete
*
[3] Fix | Delete
* This page is accessed by the link management pages and handles the forms and
[4] Fix | Delete
* Ajax processes for link actions.
[5] Fix | Delete
*
[6] Fix | Delete
* @package WordPress
[7] Fix | Delete
* @subpackage Administration
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/** Load WordPress Administration Bootstrap */
[11] Fix | Delete
require_once __DIR__ . '/admin.php';
[12] Fix | Delete
[13] Fix | Delete
wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) );
[14] Fix | Delete
[15] Fix | Delete
if ( ! current_user_can( 'manage_links' ) ) {
[16] Fix | Delete
wp_link_manager_disabled_message();
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
if ( ! empty( $_POST['deletebookmarks'] ) ) {
[20] Fix | Delete
$action = 'deletebookmarks';
[21] Fix | Delete
}
[22] Fix | Delete
if ( ! empty( $_POST['move'] ) ) {
[23] Fix | Delete
$action = 'move';
[24] Fix | Delete
}
[25] Fix | Delete
if ( ! empty( $_POST['linkcheck'] ) ) {
[26] Fix | Delete
$linkcheck = $_POST['linkcheck'];
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
$this_file = admin_url( 'link-manager.php' );
[30] Fix | Delete
[31] Fix | Delete
switch ( $action ) {
[32] Fix | Delete
case 'deletebookmarks':
[33] Fix | Delete
check_admin_referer( 'bulk-bookmarks' );
[34] Fix | Delete
[35] Fix | Delete
// For each link id (in $linkcheck[]) change category to selected value.
[36] Fix | Delete
if ( count( $linkcheck ) === 0 ) {
[37] Fix | Delete
wp_redirect( $this_file );
[38] Fix | Delete
exit;
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
$deleted = 0;
[42] Fix | Delete
foreach ( $linkcheck as $link_id ) {
[43] Fix | Delete
$link_id = (int) $link_id;
[44] Fix | Delete
[45] Fix | Delete
if ( wp_delete_link( $link_id ) ) {
[46] Fix | Delete
$deleted++;
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
wp_redirect( "$this_file?deleted=$deleted" );
[51] Fix | Delete
exit;
[52] Fix | Delete
[53] Fix | Delete
case 'move':
[54] Fix | Delete
check_admin_referer( 'bulk-bookmarks' );
[55] Fix | Delete
[56] Fix | Delete
// For each link id (in $linkcheck[]) change category to selected value.
[57] Fix | Delete
if ( count( $linkcheck ) === 0 ) {
[58] Fix | Delete
wp_redirect( $this_file );
[59] Fix | Delete
exit;
[60] Fix | Delete
}
[61] Fix | Delete
$all_links = implode( ',', $linkcheck );
[62] Fix | Delete
/*
[63] Fix | Delete
* Should now have an array of links we can change:
[64] Fix | Delete
* $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
[65] Fix | Delete
*/
[66] Fix | Delete
[67] Fix | Delete
wp_redirect( $this_file );
[68] Fix | Delete
exit;
[69] Fix | Delete
[70] Fix | Delete
case 'add':
[71] Fix | Delete
check_admin_referer( 'add-bookmark' );
[72] Fix | Delete
[73] Fix | Delete
$redir = wp_get_referer();
[74] Fix | Delete
if ( add_link() ) {
[75] Fix | Delete
$redir = add_query_arg( 'added', 'true', $redir );
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
wp_redirect( $redir );
[79] Fix | Delete
exit;
[80] Fix | Delete
[81] Fix | Delete
case 'save':
[82] Fix | Delete
$link_id = (int) $_POST['link_id'];
[83] Fix | Delete
check_admin_referer( 'update-bookmark_' . $link_id );
[84] Fix | Delete
[85] Fix | Delete
edit_link( $link_id );
[86] Fix | Delete
[87] Fix | Delete
wp_redirect( $this_file );
[88] Fix | Delete
exit;
[89] Fix | Delete
[90] Fix | Delete
case 'delete':
[91] Fix | Delete
$link_id = (int) $_GET['link_id'];
[92] Fix | Delete
check_admin_referer( 'delete-bookmark_' . $link_id );
[93] Fix | Delete
[94] Fix | Delete
wp_delete_link( $link_id );
[95] Fix | Delete
[96] Fix | Delete
wp_redirect( $this_file );
[97] Fix | Delete
exit;
[98] Fix | Delete
[99] Fix | Delete
case 'edit':
[100] Fix | Delete
wp_enqueue_script( 'link' );
[101] Fix | Delete
wp_enqueue_script( 'xfn' );
[102] Fix | Delete
[103] Fix | Delete
if ( wp_is_mobile() ) {
[104] Fix | Delete
wp_enqueue_script( 'jquery-touch-punch' );
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
$parent_file = 'link-manager.php';
[108] Fix | Delete
$submenu_file = 'link-manager.php';
[109] Fix | Delete
$title = __( 'Edit Link' );
[110] Fix | Delete
[111] Fix | Delete
$link_id = (int) $_GET['link_id'];
[112] Fix | Delete
[113] Fix | Delete
$link = get_link_to_edit( $link_id );
[114] Fix | Delete
if ( ! $link ) {
[115] Fix | Delete
wp_die( __( 'Link not found.' ) );
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
require ABSPATH . 'wp-admin/edit-link-form.php';
[119] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[120] Fix | Delete
break;
[121] Fix | Delete
[122] Fix | Delete
default:
[123] Fix | Delete
break;
[124] Fix | Delete
}
[125] Fix | Delete
[126] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function