run:R W Run
7.85 KB
2026-03-11 16:18:51
R W Run
3.54 KB
2026-03-11 16:18:51
R W Run
148.33 KB
2026-03-11 16:18:51
R W Run
11.45 KB
2026-03-11 16:18:51
R W Run
3.58 KB
2026-03-11 16:18:51
R W Run
2.53 KB
2026-03-11 16:18:51
R W Run
2.6 KB
2026-03-11 16:18:51
R W Run
6.59 KB
2026-03-11 16:18:51
R W Run
14.83 KB
2026-03-11 16:18:51
R W Run
21.18 KB
2026-03-11 16:18:51
R W Run
48.13 KB
2026-03-11 16:18:51
R W Run
4.07 KB
2026-03-11 16:18:51
R W Run
5.3 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
26.73 KB
2026-03-11 16:18:51
R W Run
2.8 KB
2026-03-11 16:18:51
R W Run
15.2 KB
2026-03-11 16:18:51
R W Run
192.08 KB
2026-03-11 16:18:51
R W Run
11.77 KB
2026-03-11 16:18:51
R W Run
3.2 KB
2026-03-11 16:18:51
R W Run
22.89 KB
2026-03-11 16:18:51
R W Run
12.77 KB
2026-03-11 16:18:51
R W Run
4.08 KB
2026-03-11 16:18:51
R W Run
26.27 KB
2026-03-11 16:18:51
R W Run
4.97 KB
2026-03-11 16:18:51
R W Run
5.57 KB
2026-03-11 16:18:51
R W Run
13.93 KB
2026-03-11 16:18:51
R W Run
4.09 KB
2026-03-11 16:18:51
R W Run
6.79 KB
2026-03-11 16:18:51
R W Run
60.45 KB
2026-03-11 16:18:51
R W Run
32.4 KB
2026-03-11 16:18:51
R W Run
18.24 KB
2026-03-11 16:18:51
R W Run
66.01 KB
2026-03-11 16:18:51
R W Run
23.84 KB
2026-03-11 16:18:51
R W Run
17.72 KB
2026-03-11 16:18:51
R W Run
22.71 KB
2026-03-11 16:18:51
R W Run
18.05 KB
2026-03-11 16:18:51
R W Run
22.76 KB
2026-03-11 16:18:51
R W Run
7.34 KB
2026-03-11 16:18:51
R W Run
4.51 KB
2026-03-11 16:18:51
R W Run
9.02 KB
2026-03-11 16:18:51
R W Run
1.46 KB
2026-03-11 16:18:51
R W Run
51.76 KB
2026-03-11 16:18:51
R W Run
25.29 KB
2026-03-11 16:18:51
R W Run
21.61 KB
2026-03-11 16:18:51
R W Run
27.77 KB
2026-03-11 16:18:51
R W Run
15.35 KB
2026-03-11 16:18:51
R W Run
24.54 KB
2026-03-11 16:18:51
R W Run
56.44 KB
2026-03-11 16:18:51
R W Run
1.42 KB
2026-03-11 16:18:51
R W Run
63.66 KB
2026-03-11 16:18:51
R W Run
31.9 KB
2026-03-11 16:18:51
R W Run
14.44 KB
2026-03-11 16:18:51
R W Run
36.47 KB
2026-03-11 16:18:51
R W Run
14 KB
2026-03-11 16:18:51
R W Run
121.89 KB
2026-03-11 16:18:51
R W Run
6.26 KB
2026-03-11 16:18:51
R W Run
20.73 KB
2026-03-11 16:18:51
R W Run
15.23 KB
2026-03-11 16:18:51
R W Run
10.14 KB
2026-03-11 16:18:51
R W Run
6.94 KB
2026-03-11 16:18:51
R W Run
1.44 KB
2026-03-11 16:18:51
R W Run
46.85 KB
2026-03-11 16:18:51
R W Run
18.61 KB
2026-03-11 16:18:51
R W Run
6.08 KB
2026-03-11 16:18:51
R W Run
20.06 KB
2026-03-11 16:18:51
R W Run
5.73 KB
2026-03-11 16:18:51
R W Run
68.18 KB
2026-03-11 16:18:51
R W Run
40.8 KB
2026-03-11 16:18:51
R W Run
1.44 KB
2026-03-11 16:18:51
R W Run
25.26 KB
2026-03-11 16:18:51
R W Run
95.94 KB
2026-03-11 16:18:51
R W Run
43.12 KB
2026-03-11 16:18:51
R W Run
41.73 KB
2026-03-11 16:18:51
R W Run
6.46 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
116.31 KB
2026-03-11 16:18:51
R W Run
9.39 KB
2026-03-11 16:18:51
R W Run
64.34 KB
2026-03-11 16:18:51
R W Run
44.73 KB
2026-03-11 16:18:51
R W Run
1.27 KB
2026-03-11 16:18:51
R W Run
3.68 KB
2026-03-11 16:18:51
R W Run
33.53 KB
2026-03-11 16:18:51
R W Run
48.84 KB
2026-03-11 16:18:51
R W Run
26.35 KB
2026-03-11 16:18:51
R W Run
1.12 KB
2026-03-11 16:18:51
R W Run
4.19 KB
2026-03-11 16:18:51
R W Run
38.19 KB
2026-03-11 16:18:51
R W Run
91.33 KB
2026-03-11 16:18:51
R W Run
80.39 KB
2026-03-11 16:18:51
R W Run
32.67 KB
2026-03-11 16:18:51
R W Run
16.18 KB
2026-03-11 16:18:51
R W Run
44.46 KB
2026-03-11 16:18:51
R W Run
6.23 KB
2026-03-11 16:18:51
R W Run
8.23 KB
2026-03-11 16:18:51
R W Run
96.96 KB
2026-03-11 16:18:51
R W Run
6.83 KB
2026-03-11 16:18:51
R W Run
46.62 KB
2026-03-11 16:18:51
R W Run
10.82 KB
2026-03-11 16:18:51
R W Run
68.86 KB
2026-03-11 16:18:51
R W Run
33.63 KB
2026-03-11 16:18:51
R W Run
113.3 KB
2026-03-11 16:18:51
R W Run
22.98 KB
2026-03-11 16:18:51
R W Run
10.66 KB
2026-03-11 16:18:51
R W Run
error_log
📄bookmark.php
1<?php
2/**
3 * WordPress Bookmark Administration API
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/**
10 * Adds a link using values provided in $_POST.
11 *
12 * @since 2.0.0
13 *
14 * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
15 */
16function add_link() {
17 return edit_link();
18}
19
20/**
21 * Updates or inserts a link using values provided in $_POST.
22 *
23 * @since 2.0.0
24 *
25 * @param int $link_id Optional. ID of the link to edit. Default 0.
26 * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
27 */
28function edit_link( $link_id = 0 ) {
29 if ( ! current_user_can( 'manage_links' ) ) {
30 wp_die(
31 '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
32 '<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
33 403
34 );
35 }
36
37 $_POST['link_url'] = esc_url( $_POST['link_url'] );
38 $_POST['link_name'] = esc_html( $_POST['link_name'] );
39 $_POST['link_image'] = esc_html( $_POST['link_image'] );
40 $_POST['link_rss'] = esc_url( $_POST['link_rss'] );
41 if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) {
42 $_POST['link_visible'] = 'Y';
43 }
44
45 if ( ! empty( $link_id ) ) {
46 $_POST['link_id'] = $link_id;
47 return wp_update_link( $_POST );
48 } else {
49 return wp_insert_link( $_POST );
50 }
51}
52
53/**
54 * Retrieves the default link for editing.
55 *
56 * @since 2.0.0
57 *
58 * @return stdClass Default link object.
59 */
60function get_default_link_to_edit() {
61 $link = new stdClass();
62 if ( isset( $_GET['linkurl'] ) ) {
63 $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
64 } else {
65 $link->link_url = '';
66 }
67
68 if ( isset( $_GET['name'] ) ) {
69 $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) );
70 } else {
71 $link->link_name = '';
72 }
73
74 $link->link_visible = 'Y';
75
76 return $link;
77}
78
79/**
80 * Deletes a specified link from the database.
81 *
82 * @since 2.0.0
83 *
84 * @global wpdb $wpdb WordPress database abstraction object.
85 *
86 * @param int $link_id ID of the link to delete.
87 * @return true Always true.
88 */
89function wp_delete_link( $link_id ) {
90 global $wpdb;
91 /**
92 * Fires before a link is deleted.
93 *
94 * @since 2.0.0
95 *
96 * @param int $link_id ID of the link to delete.
97 */
98 do_action( 'delete_link', $link_id );
99
100 wp_delete_object_term_relationships( $link_id, 'link_category' );
101
102 $wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) );
103
104 /**
105 * Fires after a link has been deleted.
106 *
107 * @since 2.2.0
108 *
109 * @param int $link_id ID of the deleted link.
110 */
111 do_action( 'deleted_link', $link_id );
112
113 clean_bookmark_cache( $link_id );
114
115 return true;
116}
117
118/**
119 * Retrieves the link category IDs associated with the link specified.
120 *
121 * @since 2.1.0
122 *
123 * @param int $link_id Link ID to look up.
124 * @return int[] The IDs of the requested link's categories.
125 */
126function wp_get_link_cats( $link_id = 0 ) {
127 $cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) );
128 return array_unique( $cats );
129}
130
131/**
132 * Retrieves link data based on its ID.
133 *
134 * @since 2.0.0
135 *
136 * @param int|stdClass $link Link ID or object to retrieve.
137 * @return object Link object for editing.
138 */
139function get_link_to_edit( $link ) {
140 return get_bookmark( $link, OBJECT, 'edit' );
141}
142
143/**
144 * Inserts a link into the database, or updates an existing link.
145 *
146 * Runs all the necessary sanitizing, provides default values if arguments are missing,
147 * and finally saves the link.
148 *
149 * @since 2.0.0
150 *
151 * @global wpdb $wpdb WordPress database abstraction object.
152 *
153 * @param array $linkdata {
154 * Elements that make up the link to insert.
155 *
156 * @type int $link_id Optional. The ID of the existing link if updating.
157 * @type string $link_url The URL the link points to.
158 * @type string $link_name The title of the link.
159 * @type string $link_image Optional. A URL of an image.
160 * @type string $link_target Optional. The target element for the anchor tag.
161 * @type string $link_description Optional. A short description of the link.
162 * @type string $link_visible Optional. 'Y' means visible, anything else means not.
163 * @type int $link_owner Optional. A user ID.
164 * @type int $link_rating Optional. A rating for the link.
165 * @type string $link_rel Optional. A relationship of the link to you.
166 * @type string $link_notes Optional. An extended description of or notes on the link.
167 * @type string $link_rss Optional. A URL of an associated RSS feed.
168 * @type int $link_category Optional. The term ID of the link category.
169 * If empty, uses default link category.
170 * }
171 * @param bool $wp_error Optional. Whether to return a WP_Error object on failure. Default false.
172 * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
173 */
174function wp_insert_link( $linkdata, $wp_error = false ) {
175 global $wpdb;
176
177 $defaults = array(
178 'link_id' => 0,
179 'link_name' => '',
180 'link_url' => '',
181 'link_rating' => 0,
182 );
183
184 $parsed_args = wp_parse_args( $linkdata, $defaults );
185 $parsed_args = wp_unslash( sanitize_bookmark( $parsed_args, 'db' ) );
186
187 $link_id = $parsed_args['link_id'];
188 $link_name = $parsed_args['link_name'];
189 $link_url = $parsed_args['link_url'];
190
191 $update = false;
192 if ( ! empty( $link_id ) ) {
193 $update = true;
194 }
195
196 if ( '' === trim( $link_name ) ) {
197 if ( '' !== trim( $link_url ) ) {
198 $link_name = $link_url;
199 } else {
200 return 0;
201 }
202 }
203
204 if ( '' === trim( $link_url ) ) {
205 return 0;
206 }
207
208 $link_rating = ( ! empty( $parsed_args['link_rating'] ) ) ? $parsed_args['link_rating'] : 0;
209 $link_image = ( ! empty( $parsed_args['link_image'] ) ) ? $parsed_args['link_image'] : '';
210 $link_target = ( ! empty( $parsed_args['link_target'] ) ) ? $parsed_args['link_target'] : '';
211 $link_visible = ( ! empty( $parsed_args['link_visible'] ) ) ? $parsed_args['link_visible'] : 'Y';
212 $link_owner = ( ! empty( $parsed_args['link_owner'] ) ) ? $parsed_args['link_owner'] : get_current_user_id();
213 $link_notes = ( ! empty( $parsed_args['link_notes'] ) ) ? $parsed_args['link_notes'] : '';
214 $link_description = ( ! empty( $parsed_args['link_description'] ) ) ? $parsed_args['link_description'] : '';
215 $link_rss = ( ! empty( $parsed_args['link_rss'] ) ) ? $parsed_args['link_rss'] : '';
216 $link_rel = ( ! empty( $parsed_args['link_rel'] ) ) ? $parsed_args['link_rel'] : '';
217 $link_category = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array();
218 $link_updated = gmdate( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) );
219
220 // Make sure we set a valid category.
221 if ( ! is_array( $link_category ) || 0 === count( $link_category ) ) {
222 $link_category = array( get_option( 'default_link_category' ) );
223 }
224
225 if ( $update ) {
226 if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss', 'link_updated' ), compact( 'link_id' ) ) ) {
227 if ( $wp_error ) {
228 return new WP_Error( 'db_update_error', __( 'Could not update link in the database.' ), $wpdb->last_error );
229 } else {
230 return 0;
231 }
232 }
233 } else {
234 if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss', 'link_updated' ) ) ) {
235 if ( $wp_error ) {
236 return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database.' ), $wpdb->last_error );
237 } else {
238 return 0;
239 }
240 }
241 $link_id = (int) $wpdb->insert_id;
242 }
243
244 wp_set_link_cats( $link_id, $link_category );
245
246 if ( $update ) {
247 /**
248 * Fires after a link was updated in the database.
249 *
250 * @since 2.0.0
251 *
252 * @param int $link_id ID of the link that was updated.
253 */
254 do_action( 'edit_link', $link_id );
255 } else {
256 /**
257 * Fires after a link was added to the database.
258 *
259 * @since 2.0.0
260 *
261 * @param int $link_id ID of the link that was added.
262 */
263 do_action( 'add_link', $link_id );
264 }
265 clean_bookmark_cache( $link_id );
266
267 return $link_id;
268}
269
270/**
271 * Updates link with the specified link categories.
272 *
273 * @since 2.1.0
274 *
275 * @param int $link_id ID of the link to update.
276 * @param int[] $link_categories Array of link category IDs to add the link to.
277 */
278function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
279 // If $link_categories isn't already an array, make it one:
280 if ( ! is_array( $link_categories ) || 0 === count( $link_categories ) ) {
281 $link_categories = array( get_option( 'default_link_category' ) );
282 }
283
284 $link_categories = array_map( 'intval', $link_categories );
285 $link_categories = array_unique( $link_categories );
286
287 wp_set_object_terms( $link_id, $link_categories, 'link_category' );
288
289 clean_bookmark_cache( $link_id );
290}
291
292/**
293 * Updates a link in the database.
294 *
295 * @since 2.0.0
296 *
297 * @param array $linkdata Link data to update. See wp_insert_link() for accepted arguments.
298 * @return int|WP_Error Value 0 or WP_Error on failure. The updated link ID on success.
299 */
300function wp_update_link( $linkdata ) {
301 $link_id = (int) $linkdata['link_id'];
302
303 $link = get_bookmark( $link_id, ARRAY_A );
304
305 // Escape data pulled from DB.
306 $link = wp_slash( $link );
307
308 // Passed link category list overwrites existing category list if not empty.
309 if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
310 && count( $linkdata['link_category'] ) > 0
311 ) {
312 $link_cats = $linkdata['link_category'];
313 } else {
314 $link_cats = $link['link_category'];
315 }
316
317 // Merge old and new fields with new fields overwriting old ones.
318 $linkdata = array_merge( $link, $linkdata );
319 $linkdata['link_category'] = $link_cats;
320
321 return wp_insert_link( $linkdata );
322}
323
324/**
325 * Outputs the 'disabled' message for the WordPress Link Manager.
326 *
327 * @since 3.5.0
328 * @access private
329 *
330 * @global string $pagenow The filename of the current screen.
331 */
332function wp_link_manager_disabled_message() {
333 global $pagenow;
334
335 if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) {
336 return;
337 }
338
339 add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
340 $really_can_manage_links = current_user_can( 'manage_links' );
341 remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
342
343 if ( $really_can_manage_links ) {
344 $plugins = get_plugins();
345
346 if ( empty( $plugins['link-manager/link-manager.php'] ) ) {
347 if ( current_user_can( 'install_plugins' ) ) {
348 $install_url = wp_nonce_url(
349 self_admin_url( 'update.php?action=install-plugin&plugin=link-manager' ),
350 'install-plugin_link-manager'
351 );
352
353 wp_die(
354 sprintf(
355 /* translators: %s: A link to install the Link Manager plugin. */
356 __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager plugin</a>.' ),
357 esc_url( $install_url )
358 )
359 );
360 }
361 } elseif ( is_plugin_inactive( 'link-manager/link-manager.php' ) ) {
362 if ( current_user_can( 'activate_plugins' ) ) {
363 $activate_url = wp_nonce_url(
364 self_admin_url( 'plugins.php?action=activate&plugin=link-manager/link-manager.php' ),
365 'activate-plugin_link-manager/link-manager.php'
366 );
367
368 wp_die(
369 sprintf(
370 /* translators: %s: A link to activate the Link Manager plugin. */
371 __( 'Please activate the <a href="%s">Link Manager plugin</a> to use the link manager.' ),
372 esc_url( $activate_url )
373 )
374 );
375 }
376 }
377 }
378
379 wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) );
380}
381