wp/wp-admin/includes/bookmark.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 /**
     9 /**
    10  * Add a link to using values provided in $_POST.
    10  * Adds a link using values provided in $_POST.
    11  *
    11  *
    12  * @since 2.0.0
    12  * @since 2.0.0
    13  *
    13  *
    14  * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
    14  * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
    15  */
    15  */
    32 			'<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
    32 			'<p>' . __( 'Sorry, you are not allowed to edit the links for this site.' ) . '</p>',
    33 			403
    33 			403
    34 		);
    34 		);
    35 	}
    35 	}
    36 
    36 
    37 	$_POST['link_url']   = esc_html( $_POST['link_url'] );
       
    38 	$_POST['link_url']   = esc_url( $_POST['link_url'] );
    37 	$_POST['link_url']   = esc_url( $_POST['link_url'] );
    39 	$_POST['link_name']  = esc_html( $_POST['link_name'] );
    38 	$_POST['link_name']  = esc_html( $_POST['link_name'] );
    40 	$_POST['link_image'] = esc_html( $_POST['link_image'] );
    39 	$_POST['link_image'] = esc_html( $_POST['link_image'] );
    41 	$_POST['link_rss']   = esc_url( $_POST['link_rss'] );
    40 	$_POST['link_rss']   = esc_url( $_POST['link_rss'] );
    42 	if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) {
    41 	if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) {
    57  * @since 2.0.0
    56  * @since 2.0.0
    58  *
    57  *
    59  * @return stdClass Default link object.
    58  * @return stdClass Default link object.
    60  */
    59  */
    61 function get_default_link_to_edit() {
    60 function get_default_link_to_edit() {
    62 	$link = new stdClass;
    61 	$link = new stdClass();
    63 	if ( isset( $_GET['linkurl'] ) ) {
    62 	if ( isset( $_GET['linkurl'] ) ) {
    64 		$link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
    63 		$link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
    65 	} else {
    64 	} else {
    66 		$link->link_url = '';
    65 		$link->link_url = '';
    67 	}
    66 	}
    82  *
    81  *
    83  * @since 2.0.0
    82  * @since 2.0.0
    84  *
    83  *
    85  * @global wpdb $wpdb WordPress database abstraction object.
    84  * @global wpdb $wpdb WordPress database abstraction object.
    86  *
    85  *
    87  * @param int $link_id ID of the link to delete
    86  * @param int $link_id ID of the link to delete.
    88  * @return true Always true.
    87  * @return true Always true.
    89  */
    88  */
    90 function wp_delete_link( $link_id ) {
    89 function wp_delete_link( $link_id ) {
    91 	global $wpdb;
    90 	global $wpdb;
    92 	/**
    91 	/**
   266 
   265 
   267 	return $link_id;
   266 	return $link_id;
   268 }
   267 }
   269 
   268 
   270 /**
   269 /**
   271  * Update link with the specified link categories.
   270  * Updates link with the specified link categories.
   272  *
   271  *
   273  * @since 2.1.0
   272  * @since 2.1.0
   274  *
   273  *
   275  * @param int   $link_id         ID of the link to update.
   274  * @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.
   275  * @param int[] $link_categories Array of link category IDs to add the link to.