Ticket #17689: 17689.2.diff
| File 17689.2.diff, 2.0 KB (added by wonderboymusic, 4 months ago) |
|---|
-
wp-includes/taxonomy.php
2065 2065 $name = stripslashes($name); 2066 2066 $description = stripslashes($description); 2067 2067 2068 if ( empty( $slug) )2069 $ slug = sanitize_title($name);2068 if ( empty( $slug ) ) { 2069 $name = trim( $name ); 2070 2070 2071 // check for a term like "$$$" so it isn't repeatedly added 2072 if ( preg_match_all( '#[^a-zA-Z0-9]#', $name, $matches ) && count( $matches[0] ) === strlen( $name ) ) { 2073 $exists = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, slug FROM $wpdb->terms WHERE name = %s", $name ) ); 2074 if ( ! empty( $exists ) ) { 2075 if ( term_exists( $exists->term_id, $taxonomy ) ) 2076 return new WP_Error( 'term_exists', __( 'A term with the name provided already exists.' ) ); 2077 2078 // use the existing slug or the term will never match in term_exists 2079 $slug = $exists->slug; 2080 } 2081 2082 } else { 2083 $slug = sanitize_title( $name ); 2084 } 2085 } 2086 2071 2087 $term_group = 0; 2072 2088 if ( $alias_of ) { 2073 2089 $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) ); -
wp-includes/formatting.php
980 980 $title = utf8_uri_encode($title, 200); 981 981 } 982 982 983 // let's assume that "+" next to a char followed by a space is not entered as space but as "plus" 984 // and that "-" directly next to a char followed by a space is not a dash but is "minus" 985 $title = preg_replace( array( '#([^-])-\s#', '#([^-])-$#' ), array( '$1-minus ', '$1-minus' ), $title ); 986 $title = preg_replace( array( '#([^+])\+\s#', '#([^+])\+$#' ), array( '$1-plus ', '$1-plus' ), $title ); 987 983 988 $title = strtolower($title); 984 989 $title = preg_replace('/&.+?;/', '', $title); // kill entities 985 990 $title = str_replace('.', '-', $title);
