Changeset 42343 for trunk/src/wp-admin/includes/bookmark.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/bookmark.php
r42228 r42343 35 35 } 36 36 37 $_POST['link_url'] = esc_html( $_POST['link_url'] );38 $_POST['link_url'] = esc_url($_POST['link_url']);39 $_POST['link_name'] = esc_html( $_POST['link_name'] );37 $_POST['link_url'] = esc_html( $_POST['link_url'] ); 38 $_POST['link_url'] = esc_url( $_POST['link_url'] ); 39 $_POST['link_name'] = esc_html( $_POST['link_name'] ); 40 40 $_POST['link_image'] = esc_html( $_POST['link_image'] ); 41 $_POST['link_rss'] = esc_url($_POST['link_rss']);42 if ( ! isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )41 $_POST['link_rss'] = esc_url( $_POST['link_rss'] ); 42 if ( ! isset( $_POST['link_visible'] ) || 'N' != $_POST['link_visible'] ) { 43 43 $_POST['link_visible'] = 'Y'; 44 45 if ( !empty( $link_id ) ) { 44 } 45 46 if ( ! empty( $link_id ) ) { 46 47 $_POST['link_id'] = $link_id; 47 48 return wp_update_link( $_POST ); … … 60 61 function get_default_link_to_edit() { 61 62 $link = new stdClass; 62 if ( isset( $_GET['linkurl'] ) ) 63 if ( isset( $_GET['linkurl'] ) ) { 63 64 $link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) ); 64 else65 } else { 65 66 $link->link_url = ''; 66 67 if ( isset( $_GET['name'] ) ) 67 } 68 69 if ( isset( $_GET['name'] ) ) { 68 70 $link->link_name = esc_attr( wp_unslash( $_GET['name'] ) ); 69 else71 } else { 70 72 $link->link_name = ''; 73 } 71 74 72 75 $link->link_visible = 'Y'; … … 123 126 */ 124 127 function wp_get_link_cats( $link_id = 0 ) { 125 $cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids') );128 $cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) ); 126 129 return array_unique( $cats ); 127 130 } … … 153 156 global $wpdb; 154 157 155 $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 ); 158 $defaults = array( 159 'link_id' => 0, 160 'link_name' => '', 161 'link_url' => '', 162 'link_rating' => 0, 163 ); 156 164 157 165 $args = wp_parse_args( $linkdata, $defaults ); 158 $r = wp_unslash( sanitize_bookmark( $args, 'db' ) );166 $r = wp_unslash( sanitize_bookmark( $args, 'db' ) ); 159 167 160 168 $link_id = $r['link_id']; … … 250 258 function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { 251 259 // If $link_categories isn't already an array, make it one: 252 if ( ! is_array( $link_categories ) || 0 == count( $link_categories ) )260 if ( ! is_array( $link_categories ) || 0 == count( $link_categories ) ) { 253 261 $link_categories = array( get_option( 'default_link_category' ) ); 262 } 254 263 255 264 $link_categories = array_map( 'intval', $link_categories ); … … 278 287 279 288 // Passed link category list overwrites existing category list if not empty. 280 if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) && 0 != count( $linkdata['link_category'] ) ) 289 if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) && 0 != count( $linkdata['link_category'] ) ) { 281 290 $link_cats = $linkdata['link_category']; 282 else291 } else { 283 292 $link_cats = $link['link_category']; 293 } 284 294 285 295 // Merge old and new fields with new fields overwriting old ones. 286 $linkdata = array_merge( $link, $linkdata );296 $linkdata = array_merge( $link, $linkdata ); 287 297 $linkdata['link_category'] = $link_cats; 288 298 … … 300 310 function wp_link_manager_disabled_message() { 301 311 global $pagenow; 302 if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow ) 312 if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow ) { 303 313 return; 314 } 304 315 305 316 add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
Note: See TracChangeset
for help on using the changeset viewer.