[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Link Management Administration Screen. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** Load WordPress Administration Bootstrap */ 10 require_once __DIR__ . '/admin.php'; 11 if ( ! current_user_can( 'manage_links' ) ) { 12 wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); 13 } 14 15 $wp_list_table = _get_list_table( 'WP_Links_List_Table' ); 16 17 // Handle bulk deletes. 18 $doaction = $wp_list_table->current_action(); 19 20 if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { 21 check_admin_referer( 'bulk-bookmarks' ); 22 23 $redirect_to = admin_url( 'link-manager.php' ); 24 $bulklinks = (array) $_REQUEST['linkcheck']; 25 26 if ( 'delete' === $doaction ) { 27 foreach ( $bulklinks as $link_id ) { 28 $link_id = (int) $link_id; 29 30 wp_delete_link( $link_id ); 31 } 32 33 $redirect_to = add_query_arg( 'deleted', count( $bulklinks ), $redirect_to ); 34 } else { 35 $screen = get_current_screen()->id; 36 37 /** This action is documented in wp-admin/edit.php */ 38 $redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $bulklinks ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 39 } 40 wp_redirect( $redirect_to ); 41 exit; 42 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 43 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 44 exit; 45 } 46 47 $wp_list_table->prepare_items(); 48 49 // Used in the HTML title tag. 50 $title = __( 'Links' ); 51 $this_file = 'link-manager.php'; 52 $parent_file = $this_file; 53 54 get_current_screen()->add_help_tab( 55 array( 56 'id' => 'overview', 57 'title' => __( 'Overview' ), 58 'content' => 59 '<p>' . sprintf( 60 /* translators: %s: URL to Widgets screen. */ 61 __( 'You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.' ), 62 'widgets.php' 63 ) . '</p>' . 64 '<p>' . __( 'Links may be separated into Link Categories; these are different than the categories used on your posts.' ) . '</p>' . 65 '<p>' . __( 'You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.' ) . '</p>', 66 ) 67 ); 68 get_current_screen()->add_help_tab( 69 array( 70 'id' => 'deleting-links', 71 'title' => __( 'Deleting Links' ), 72 'content' => 73 '<p>' . __( 'If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.' ) . '</p>', 74 ) 75 ); 76 77 get_current_screen()->set_help_sidebar( 78 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 79 '<p>' . __( '<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>' ) . '</p>' . 80 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 81 ); 82 83 get_current_screen()->set_screen_reader_content( 84 array( 85 'heading_list' => __( 'Links list' ), 86 ) 87 ); 88 89 require_once ABSPATH . 'wp-admin/admin-header.php'; 90 91 if ( ! current_user_can( 'manage_links' ) ) { 92 wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); 93 } 94 95 ?> 96 97 <div class="wrap nosubsub"> 98 <h1 class="wp-heading-inline"> 99 <?php 100 echo esc_html( $title ); 101 ?> 102 </h1> 103 104 <a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a> 105 106 <?php 107 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { 108 echo '<span class="subtitle">'; 109 printf( 110 /* translators: %s: Search query. */ 111 __( 'Search results for: %s' ), 112 '<strong>' . esc_html( wp_unslash( $_REQUEST['s'] ) ) . '</strong>' 113 ); 114 echo '</span>'; 115 } 116 ?> 117 118 <hr class="wp-header-end"> 119 120 <?php 121 if ( isset( $_REQUEST['deleted'] ) ) { 122 echo '<div id="message" class="updated notice is-dismissible"><p>'; 123 $deleted = (int) $_REQUEST['deleted']; 124 /* translators: %s: Number of links. */ 125 printf( _n( '%s link deleted.', '%s links deleted.', $deleted ), $deleted ); 126 echo '</p></div>'; 127 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); 128 } 129 ?> 130 131 <form id="posts-filter" method="get"> 132 133 <?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?> 134 135 <?php $wp_list_table->display(); ?> 136 137 <div id="ajax-response"></div> 138 </form> 139 140 </div> 141 142 <?php 143 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Dec 3 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |