Changeset 5906 for trunk/wp-admin/includes/bookmark.php
- Timestamp:
- 08/20/2007 10:50:04 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/bookmark.php
r5726 r5906 61 61 62 62 function get_link_to_edit( $link_id ) { 63 $link = get_link( $link_id ); 64 65 $link->link_url = clean_url($link->link_url); 66 $link->link_name = attribute_escape($link->link_name); 67 $link->link_image = attribute_escape($link->link_image); 68 $link->link_description = attribute_escape($link->link_description); 69 $link->link_rss = clean_url($link->link_rss); 70 $link->link_rel = attribute_escape($link->link_rel); 71 $link->link_notes = wp_specialchars($link->link_notes); 72 $link->post_category = $link->link_category; 73 74 return $link; 63 return get_link( $link_id, OBJECT, 'edit' ); 75 64 } 76 65 77 66 function wp_insert_link($linkdata) { 78 67 global $wpdb, $current_user; 68 69 $defaults = array('link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 ); 70 71 $linkdata = wp_parse_args($linkdata, $defaults); 72 $linkdata = sanitize_bookmark($linkdata, 'db'); 79 73 80 74 extract($linkdata, EXTR_SKIP); … … 85 79 $update = true; 86 80 87 $link_id = (int) $link_id; 81 if ( trim( $link_name ) == '' ) 82 return 0; 88 83 89 if ( trim( $link_name) == '' )84 if ( trim( $link_url ) == '' ) 90 85 return 0; 91 $link_name = apply_filters('pre_link_name', $link_name);92 93 if( trim( $link_url ) == '' )94 return 0;95 $link_url = apply_filters('pre_link_url', $link_url);96 86 97 87 if ( empty($link_rating) ) 98 88 $link_rating = 0; 99 else100 $link_rating = (int) $link_rating;101 89 102 90 if ( empty($link_image) ) 103 91 $link_image = ''; 104 $link_image = apply_filters('pre_link_image', $link_image);105 92 106 93 if ( empty($link_target) ) 107 94 $link_target = ''; 108 $link_target = apply_filters('pre_link_target', $link_target);109 95 110 96 if ( empty($link_visible) ) 111 97 $link_visible = 'Y'; 112 $link_visibile = preg_replace('/[^YNyn]/', '', $link_visible);113 98 114 99 if ( empty($link_owner) ) 115 100 $link_owner = $current_user->id; 116 else117 $link_owner = (int) $link_owner;118 101 119 102 if ( empty($link_notes) ) 120 103 $link_notes = ''; 121 $link_notes = apply_filters('pre_link_notes', $link_notes);122 104 123 105 if ( empty($link_description) ) 124 106 $link_description = ''; 125 $link_description = apply_filters('pre_link_description', $link_description);126 107 127 108 if ( empty($link_rss) ) 128 109 $link_rss = ''; 129 $link_rss = apply_filters('pre_link_rss', $link_rss);130 110 131 111 if ( empty($link_rel) ) 132 112 $link_rel = ''; 133 $link_rel = apply_filters('pre_link_rel', $link_rel);134 113 135 114 // Make sure we set a valid category
Note: See TracChangeset
for help on using the changeset viewer.