author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Link Management Administration Screen. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** Load WordPress Administration Bootstrap */ |
|
16 | 10 |
require_once __DIR__ . '/admin.php'; |
9 | 11 |
if ( ! current_user_can( 'manage_links' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
12 |
wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); |
9 | 13 |
} |
0 | 14 |
|
9 | 15 |
$wp_list_table = _get_list_table( 'WP_Links_List_Table' ); |
0 | 16 |
|
16 | 17 |
// Handle bulk deletes. |
0 | 18 |
$doaction = $wp_list_table->current_action(); |
19 |
||
20 |
if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { |
|
21 |
check_admin_referer( 'bulk-bookmarks' ); |
|
22 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
$redirect_to = admin_url( 'link-manager.php' ); |
9 | 24 |
$bulklinks = (array) $_REQUEST['linkcheck']; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
|
16 | 26 |
if ( 'delete' === $doaction ) { |
0 | 27 |
foreach ( $bulklinks as $link_id ) { |
28 |
$link_id = (int) $link_id; |
|
29 |
||
30 |
wp_delete_link( $link_id ); |
|
31 |
} |
|
32 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
33 |
$redirect_to = add_query_arg( 'deleted', count( $bulklinks ), $redirect_to ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
34 |
} else { |
16 | 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 |
|
0 | 39 |
} |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
40 |
wp_redirect( $redirect_to ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
41 |
exit; |
0 | 42 |
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
9 | 43 |
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
44 |
exit; |
|
0 | 45 |
} |
46 |
||
47 |
$wp_list_table->prepare_items(); |
|
48 |
||
19 | 49 |
// Used in the HTML title tag. |
16 | 50 |
$title = __( 'Links' ); |
51 |
$this_file = 'link-manager.php'; |
|
52 |
$parent_file = $this_file; |
|
0 | 53 |
|
9 | 54 |
get_current_screen()->add_help_tab( |
55 |
array( |
|
56 |
'id' => 'overview', |
|
57 |
'title' => __( 'Overview' ), |
|
58 |
'content' => |
|
16 | 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>', |
|
9 | 66 |
) |
67 |
); |
|
68 |
get_current_screen()->add_help_tab( |
|
69 |
array( |
|
70 |
'id' => 'deleting-links', |
|
71 |
'title' => __( 'Deleting Links' ), |
|
72 |
'content' => |
|
16 | 73 |
'<p>' . __( 'If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.' ) . '</p>', |
9 | 74 |
) |
75 |
); |
|
0 | 76 |
|
77 |
get_current_screen()->set_help_sidebar( |
|
9 | 78 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
79 |
'<p>' . __( '<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>' ) . '</p>' . |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
80 |
'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' |
0 | 81 |
); |
82 |
||
9 | 83 |
get_current_screen()->set_screen_reader_content( |
84 |
array( |
|
85 |
'heading_list' => __( 'Links list' ), |
|
86 |
) |
|
87 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
|
16 | 89 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 90 |
|
9 | 91 |
if ( ! current_user_can( 'manage_links' ) ) { |
92 |
wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); |
|
93 |
} |
|
0 | 94 |
|
95 |
?> |
|
96 |
||
97 |
<div class="wrap nosubsub"> |
|
9 | 98 |
<h1 class="wp-heading-inline"> |
99 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
echo esc_html( $title ); |
9 | 101 |
?> |
102 |
</h1> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
104 |
<a href="link-add.php" class="page-title-action"><?php echo esc_html__( 'Add Link' ); ?></a> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
18 | 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>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
115 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
116 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
117 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
118 |
<hr class="wp-header-end"> |
0 | 119 |
|
120 |
<?php |
|
9 | 121 |
if ( isset( $_REQUEST['deleted'] ) ) { |
0 | 122 |
$deleted = (int) $_REQUEST['deleted']; |
16 | 123 |
/* translators: %s: Number of links. */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
124 |
$deleted_message = sprintf( _n( '%s link deleted.', '%s links deleted.', $deleted ), $deleted ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
125 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
126 |
$deleted_message, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
127 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
128 |
'id' => 'message', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
129 |
'additional_classes' => array( 'updated' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
130 |
'dismissible' => true, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
131 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
132 |
); |
9 | 133 |
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] ); |
0 | 134 |
} |
135 |
?> |
|
136 |
||
5 | 137 |
<form id="posts-filter" method="get"> |
0 | 138 |
|
139 |
<?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?> |
|
140 |
||
141 |
<?php $wp_list_table->display(); ?> |
|
142 |
||
143 |
<div id="ajax-response"></div> |
|
144 |
</form> |
|
145 |
||
146 |
</div> |
|
147 |
||
148 |
<?php |
|
16 | 149 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |