15
15
wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) );
17
if ( ! current_user_can('manage_links') )
17
if ( ! current_user_can( 'manage_links' ) ) {
18
18
wp_link_manager_disabled_message();
20
if ( !empty($_POST['deletebookmarks']) )
21
if ( ! empty( $_POST['deletebookmarks'] ) ) {
21
22
$action = 'deletebookmarks';
22
if ( !empty($_POST['move']) )
24
if ( ! empty( $_POST['move'] ) ) {
24
if ( !empty($_POST['linkcheck']) )
27
if ( ! empty( $_POST['linkcheck'] ) ) {
25
28
$linkcheck = $_POST['linkcheck'];
27
$this_file = admin_url('link-manager.php');
30
case 'deletebookmarks' :
31
check_admin_referer('bulk-bookmarks');
31
$this_file = admin_url( 'link-manager.php' );
34
case 'deletebookmarks':
35
check_admin_referer( 'bulk-bookmarks' );
33
37
// For each link id (in $linkcheck[]) change category to selected value.
34
if (count($linkcheck) == 0) {
35
wp_redirect($this_file);
38
if ( count( $linkcheck ) == 0 ) {
39
wp_redirect( $this_file );
40
foreach ($linkcheck as $link_id) {
44
foreach ( $linkcheck as $link_id ) {
41
45
$link_id = (int) $link_id;
43
if ( wp_delete_link($link_id) )
47
if ( wp_delete_link( $link_id ) ) {
47
wp_redirect("$this_file?deleted=$deleted");
52
wp_redirect( "$this_file?deleted=$deleted" );
51
check_admin_referer('bulk-bookmarks');
56
check_admin_referer( 'bulk-bookmarks' );
53
58
// For each link id (in $linkcheck[]) change category to selected value.
54
if (count($linkcheck) == 0) {
55
wp_redirect($this_file);
59
if ( count( $linkcheck ) == 0 ) {
60
wp_redirect( $this_file );
58
$all_links = join(',', $linkcheck);
63
$all_links = join( ',', $linkcheck );
60
65
* Should now have an array of links we can change:
61
66
* $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
64
wp_redirect($this_file);
69
wp_redirect( $this_file );
68
check_admin_referer('add-bookmark');
73
check_admin_referer( 'add-bookmark' );
70
75
$redir = wp_get_referer();
72
77
$redir = add_query_arg( 'added', 'true', $redir );
74
80
wp_redirect( $redir );
78
84
$link_id = (int) $_POST['link_id'];
79
check_admin_referer('update-bookmark_' . $link_id);
83
wp_redirect($this_file);
85
check_admin_referer( 'update-bookmark_' . $link_id );
87
edit_link( $link_id );
89
wp_redirect( $this_file );
87
93
$link_id = (int) $_GET['link_id'];
88
check_admin_referer('delete-bookmark_' . $link_id);
90
wp_delete_link($link_id);
92
wp_redirect($this_file);
94
check_admin_referer( 'delete-bookmark_' . $link_id );
96
wp_delete_link( $link_id );
98
wp_redirect( $this_file );
96
wp_enqueue_script('link');
97
wp_enqueue_script('xfn');
102
wp_enqueue_script( 'link' );
103
wp_enqueue_script( 'xfn' );
105
if ( wp_is_mobile() ) {
100
106
wp_enqueue_script( 'jquery-touch-punch' );
102
$parent_file = 'link-manager.php';
109
$parent_file = 'link-manager.php';
103
110
$submenu_file = 'link-manager.php';
104
$title = __('Edit Link');
111
$title = __( 'Edit Link' );
106
113
$link_id = (int) $_GET['link_id'];
108
if (!$link = get_link_to_edit($link_id))
109
wp_die(__('Link not found.'));
115
if ( ! $link = get_link_to_edit( $link_id ) ) {
116
wp_die( __( 'Link not found.' ) );
111
119
include( ABSPATH . 'wp-admin/edit-link-form.php' );
112
120
include( ABSPATH . 'wp-admin/admin-footer.php' );