[ 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 $title = __( 'Links' ); 50 $this_file = 'link-manager.php'; 51 $parent_file = $this_file; 52 53 get_current_screen()->add_help_tab( 54 array( 55 'id' => 'overview', 56 'title' => __( 'Overview' ), 57 'content' => 58 '<p>' . sprintf( 59 /* translators: %s: URL to Widgets screen. */ 60 __( '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.' ), 61 'widgets.php' 62 ) . '</p>' . 63 '<p>' . __( 'Links may be separated into Link Categories; these are different than the categories used on your posts.' ) . '</p>' . 64 '<p>' . __( 'You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.' ) . '</p>', 65 ) 66 ); 67 get_current_screen()->add_help_tab( 68 array( 69 'id' => 'deleting-links', 70 'title' => __( 'Deleting Links' ), 71 'content' => 72 '<p>' . __( 'If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.' ) . '</p>', 73 ) 74 ); 75 76 get_current_screen()->set_help_sidebar( 77 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 78 '<p>' . __( '<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>' ) . '</p>' . 79 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 80 ); 81 82 get_current_screen()->set_screen_reader_content( 83 array( 84 'heading_list' => __( 'Links list' ), 85 ) 86 ); 87 88 require_once ABSPATH . 'wp-admin/admin-header.php'; 89 90 if ( ! current_user_can( 'manage_links' ) ) { 91 wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); 92 } 93 94 ?> 95 96 <div class="wrap nosubsub"> 97 <h1 class="wp-heading-inline"> 98 <?php 99 echo esc_html( $title ); 100 ?> 101 </h1> 102 103 <a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a> 104 105 <?php 106 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { 107 echo '<span class="subtitle">'; 108 printf( 109 /* translators: %s: Search query. */ 110 __( 'Search results for: %s' ), 111 '<strong>' . esc_html( wp_unslash( $_REQUEST['s'] ) ) . '</strong>' 112 ); 113 echo '</span>'; 114 } 115 ?> 116 117 <hr class="wp-header-end"> 118 119 <?php 120 if ( isset( $_REQUEST['deleted'] ) ) { 121 echo '<div id="message" class="updated notice is-dismissible"><p>'; 122 $deleted = (int) $_REQUEST['deleted']; 123 /* translators: %s: Number of links. */ 124 printf( _n( '%s link deleted.', '%s links deleted.', $deleted ), $deleted ); 125 echo '</p></div>'; 126 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); 127 } 128 ?> 129 130 <form id="posts-filter" method="get"> 131 132 <?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?> 133 134 <?php $wp_list_table->display(); ?> 135 136 <div id="ajax-response"></div> 137 </form> 138 139 </div> 140 141 <?php 142 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Apr 19 01:00:04 2021 | Cross-referenced by PHPXref 0.7.1 |