function get_default_link_to_edit() {
$link = new stdClass;
if ( isset( $_GET['linkurl'] ) )
- $link->link_url = esc_url( $_GET['linkurl'] );
+ $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
else
$link->link_url = '';
if ( isset( $_GET['name'] ) )
- $link->link_name = esc_attr( $_GET['name'] );
+ $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) );
else
$link->link_name = '';
}
/**
- * Delete link specified from database
+ * Delete link specified from database.
*
* @since 2.0.0
*
*/
function wp_delete_link( $link_id ) {
global $wpdb;
-
+ /**
+ * Fires before a link is deleted.
+ *
+ * @since 2.0.0
+ *
+ * @param int $link_id ID of the link to delete.
+ */
do_action( 'delete_link', $link_id );
wp_delete_object_term_relationships( $link_id, 'link_category' );
$wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) );
-
+ /**
+ * Fires after a link has been deleted.
+ *
+ * @since 2.2.0
+ *
+ * @param int $link_id ID of the deleted link.
+ */
do_action( 'deleted_link', $link_id );
clean_bookmark_cache( $link_id );
$linkdata = wp_parse_args( $linkdata, $defaults );
$linkdata = sanitize_bookmark( $linkdata, 'db' );
- extract( stripslashes_deep( $linkdata ), EXTR_SKIP );
+ extract( wp_unslash( $linkdata ), EXTR_SKIP );
$update = false;
wp_set_link_cats( $link_id, $link_category );
- if ( $update )
+ if ( $update ) {
+ /**
+ * Fires after a link was updated in the database.
+ *
+ * @since 2.0.0
+ *
+ * @param int $link_id ID of the link that was updated.
+ */
do_action( 'edit_link', $link_id );
- else
+ } else {
+ /**
+ * Fires after a link was added to the database.
+ *
+ * @since 2.0.0
+ *
+ * @param int $link_id ID of the link that was added.
+ */
do_action( 'add_link', $link_id );
-
+ }
clean_bookmark_cache( $link_id );
return $link_id;
$link = get_bookmark( $link_id, ARRAY_A );
// Escape data pulled from DB.
- $link = add_magic_quotes( $link );
+ $link = wp_slash( $link );
// Passed link category list overwrites existing category list if not empty.
if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )