7 */ |
7 */ |
8 |
8 |
9 /** Load WordPress Administration Bootstrap */ |
9 /** Load WordPress Administration Bootstrap */ |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
10 require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 if ( ! current_user_can( 'manage_links' ) ) |
11 if ( ! current_user_can( 'manage_links' ) ) |
12 wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) ); |
12 wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); |
13 |
13 |
14 $wp_list_table = _get_list_table('WP_Links_List_Table'); |
14 $wp_list_table = _get_list_table('WP_Links_List_Table'); |
15 |
15 |
16 // Handle bulk deletes |
16 // Handle bulk deletes |
17 $doaction = $wp_list_table->current_action(); |
17 $doaction = $wp_list_table->current_action(); |
18 |
18 |
19 if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { |
19 if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { |
20 check_admin_referer( 'bulk-bookmarks' ); |
20 check_admin_referer( 'bulk-bookmarks' ); |
21 |
21 |
|
22 $redirect_to = admin_url( 'link-manager.php' ); |
|
23 $bulklinks = (array) $_REQUEST['linkcheck']; |
|
24 |
22 if ( 'delete' == $doaction ) { |
25 if ( 'delete' == $doaction ) { |
23 $bulklinks = (array) $_REQUEST['linkcheck']; |
|
24 foreach ( $bulklinks as $link_id ) { |
26 foreach ( $bulklinks as $link_id ) { |
25 $link_id = (int) $link_id; |
27 $link_id = (int) $link_id; |
26 |
28 |
27 wp_delete_link( $link_id ); |
29 wp_delete_link( $link_id ); |
28 } |
30 } |
29 |
31 |
30 wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) ); |
32 $redirect_to = add_query_arg( 'deleted', count( $bulklinks ), $redirect_to ); |
31 exit; |
33 } else { |
|
34 /** This action is documented in wp-admin/edit-comments.php */ |
|
35 $redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $bulklinks ); |
32 } |
36 } |
|
37 wp_redirect( $redirect_to ); |
|
38 exit; |
33 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
39 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
34 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
40 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
35 exit; |
41 exit; |
36 } |
42 } |
37 |
43 |
55 '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>' |
61 '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>' |
56 ) ); |
62 ) ); |
57 |
63 |
58 get_current_screen()->set_help_sidebar( |
64 get_current_screen()->set_help_sidebar( |
59 '<p><strong>' . __('For more information:') . '</strong></p>' . |
65 '<p><strong>' . __('For more information:') . '</strong></p>' . |
60 '<p>' . __('<a href="https://codex.wordpress.org/Links_Screen" target="_blank">Documentation on Managing Links</a>') . '</p>' . |
66 '<p>' . __('<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>') . '</p>' . |
61 '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
67 '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
62 ); |
68 ); |
|
69 |
|
70 get_current_screen()->set_screen_reader_content( array( |
|
71 'heading_list' => __( 'Links list' ), |
|
72 ) ); |
63 |
73 |
64 include_once( ABSPATH . 'wp-admin/admin-header.php' ); |
74 include_once( ABSPATH . 'wp-admin/admin-header.php' ); |
65 |
75 |
66 if ( ! current_user_can('manage_links') ) |
76 if ( ! current_user_can('manage_links') ) |
67 wp_die(__("You do not have sufficient permissions to edit the links for this site.")); |
77 wp_die(__('Sorry, you are not allowed to edit the links for this site.')); |
68 |
78 |
69 ?> |
79 ?> |
70 |
80 |
71 <div class="wrap nosubsub"> |
81 <div class="wrap nosubsub"> |
72 <h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php |
82 <h1 class="wp-heading-inline"><?php |
73 if ( !empty($_REQUEST['s']) ) |
83 echo esc_html( $title ); |
74 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?> |
84 ?></h1> |
75 </h2> |
85 |
|
86 <a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a> |
|
87 |
|
88 <?php |
|
89 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
90 /* translators: %s: search keywords */ |
|
91 printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); |
|
92 } |
|
93 ?> |
|
94 |
|
95 <hr class="wp-header-end"> |
76 |
96 |
77 <?php |
97 <?php |
78 if ( isset($_REQUEST['deleted']) ) { |
98 if ( isset($_REQUEST['deleted']) ) { |
79 echo '<div id="message" class="updated notice is-dismissible"><p>'; |
99 echo '<div id="message" class="updated notice is-dismissible"><p>'; |
80 $deleted = (int) $_REQUEST['deleted']; |
100 $deleted = (int) $_REQUEST['deleted']; |