Changeset 11168
- Timestamp:
- 05/04/2009 09:12:12 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r11109 r11168 53 53 $template_data = implode( '', file( WP_CONTENT_DIR . $file ) ); 54 54 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name )) 55 return $name[1]. ' Page Template';55 return _cleanup_header_comment($name[1]) . ' Page Template'; 56 56 } 57 57 -
trunk/wp-admin/includes/misc.php
r11135 r11168 371 371 } 372 372 } 373 374 375 /** 376 * Strip close comment and close php tags from file headers used by WP 377 * See http://core.trac.wordpress.org/ticket/8497 378 * 379 * @since 2.8 380 **/ 381 function _cleanup_header_comment($str) { 382 return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str)); 383 } 384 -
trunk/wp-admin/includes/plugin.php
r11021 r11168 87 87 foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) { 88 88 if ( !empty( ${$field} ) ) 89 ${$field} = trim(${$field}[1]);89 ${$field} = _cleanup_header_comment(${$field}[1]); 90 90 else 91 91 ${$field} = ''; -
trunk/wp-admin/includes/theme.php
r11005 r11168 134 134 $name = ''; 135 135 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) 136 $name = $name[1];136 $name = _cleanup_header_comment($name[1]); 137 137 138 138 if ( !empty( $name ) ) { -
trunk/wp-includes/theme.php
r11109 r11168 181 181 $theme_data = str_replace ( '\r', '\n', $theme_data ); 182 182 if ( preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name ) ) 183 $name = $theme = wp_kses( trim( $theme_name[1]), $themes_allowed_tags );183 $name = $theme = wp_kses( _cleanup_header_comment($theme_name[1]), $themes_allowed_tags ); 184 184 else 185 185 $name = $theme = ''; 186 186 187 187 if ( preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ) ) 188 $theme_uri = clean_url( trim( $theme_uri[1]) );188 $theme_uri = clean_url( _cleanup_header_comment($theme_uri[1]) ); 189 189 else 190 190 $theme_uri = ''; 191 191 192 192 if ( preg_match( '|Description:(.*)$|mi', $theme_data, $description ) ) 193 $description = wptexturize( wp_kses( trim( $description[1]), $themes_allowed_tags ) );193 $description = wptexturize( wp_kses( _cleanup_header_comment($description[1]), $themes_allowed_tags ) ); 194 194 else 195 195 $description = ''; 196 196 197 197 if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) ) 198 $author_uri = clean_url( trim($author_uri[1]) );198 $author_uri = clean_url( _cleanup_header_comment($author_uri[1]) ); 199 199 else 200 200 $author_uri = ''; 201 201 202 202 if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) ) 203 $template = wp_kses( trim( $template[1]), $themes_allowed_tags );203 $template = wp_kses( _cleanup_header_comment($template[1]), $themes_allowed_tags ); 204 204 else 205 205 $template = ''; 206 206 207 207 if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) ) 208 $version = wp_kses( trim( $version[1]), $themes_allowed_tags );208 $version = wp_kses( _cleanup_header_comment($version[1]), $themes_allowed_tags ); 209 209 else 210 210 $version = ''; 211 211 212 212 if ( preg_match('|Status:(.*)|i', $theme_data, $status) ) 213 $status = wp_kses( trim( $status[1]), $themes_allowed_tags );213 $status = wp_kses( _cleanup_header_comment($status[1]), $themes_allowed_tags ); 214 214 else 215 215 $status = 'publish'; 216 216 217 217 if ( preg_match('|Tags:(.*)|i', $theme_data, $tags) ) 218 $tags = array_map( 'trim', explode( ',', wp_kses( trim( $tags[1]), array() ) ) );218 $tags = array_map( 'trim', explode( ',', wp_kses( _cleanup_header_comment($tags[1]), array() ) ) ); 219 219 else 220 220 $tags = array(); … … 222 222 if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) { 223 223 if ( empty( $author_uri ) ) { 224 $author = wp_kses( trim( $author_name[1]), $themes_allowed_tags );224 $author = wp_kses( _cleanup_header_comment($author_name[1]), $themes_allowed_tags ); 225 225 } else { 226 $author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1]), $themes_allowed_tags ) );226 $author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( _cleanup_header_comment($author_name[1]), $themes_allowed_tags ) ); 227 227 } 228 228 } else {
Note: See TracChangeset
for help on using the changeset viewer.