Ticket #6007: 6007.diff
File 6007.diff, 12.2 KB (added by , 13 years ago) |
---|
-
wp-includes/theme.php
187 187 'Description' => 'Description', 188 188 'Author' => 'Author', 189 189 'AuthorURI' => 'Author URI', 190 'TextDomain' => 'Text Domain', 191 'DomainPath' => 'Domain Path', 190 192 'Version' => 'Version', 191 193 'Template' => 'Template', 192 194 'Status' => 'Status', 193 195 'Tags' => 'Tags' 194 196 ); 195 197 196 $themes_allowed_tags = array(197 'a' => array(198 'href' => array(),'title' => array()199 ),200 'abbr' => array(201 'title' => array()202 ),203 'acronym' => array(204 'title' => array()205 ),206 'code' => array(),207 'em' => array(),208 'strong' => array()209 );210 211 198 $theme_data = get_file_data( $theme_file, $default_headers, 'theme' ); 212 199 213 $theme_data['Name'] = $theme_data['Title'] = wp_kses( $theme_data['Name'], $themes_allowed_tags ); 200 $allowed_tags = $allowed_tags_in_links = array( 201 'abbr' => array( 'title' => true ), 202 'acronym' => array( 'title' => true ), 203 'code' => true, 204 'em' => true, 205 'strong' => true, 206 ); 207 $allowed_tags['a'] = array( 'href' => true, 'title' => true ); 214 208 215 $theme_data['URI'] = esc_url( $theme_data['URI'] );209 // Sanitized all displayed data. 216 210 217 $theme_data['Description'] = wptexturize( wp_kses( $theme_data['Description'], $themes_allowed_tags ) ); 211 // Author and Name are marked up inside <a> tags. Don't allow these. 212 $theme_data['Author'] = wp_kses( $theme_data['Author'], $allowed_tags_in_links ); 213 $theme_data['AuthorName'] = $theme_data['Author']; 218 214 219 $theme_data['AuthorURI'] = esc_url( $theme_data['AuthorURI'] ); 215 $theme_data['Name'] = wp_kses( $theme_data['Name'], $allowed_tags_in_links ); 216 $theme_data['Title'] = $theme_data['Name']; 220 217 221 $theme_data['Template'] = wp_kses( $theme_data['Template'], $themes_allowed_tags ); 218 $theme_data['Description'] = wp_kses( $theme_data['Description'], $allowed_tags ); 219 $theme_data['Version'] = wp_kses( $theme_data['Version'], $allowed_tags ); 220 $theme_data['Template'] = wp_kses( $theme_data['Template'], $allowed_tags ); 221 $theme_data['Status'] = wp_kses( $theme_data['Status'], $allowed_tags ); 222 222 223 $theme_data['Version'] = wp_kses( $theme_data['Version'], $themes_allowed_tags ); 224 225 if ( $theme_data['Status'] == '' ) 223 if ( ! $theme_data['Status'] ) 226 224 $theme_data['Status'] = 'publish'; 227 else228 $theme_data['Status'] = wp_kses( $theme_data['Status'], $themes_allowed_tags );229 225 230 if ( $theme_data['Tags'] == '' ) 226 $theme_data['URI'] = esc_url( $theme_data['URI'] ); 227 $theme_data['AuthorURI'] = esc_url( $theme_data['AuthorURI'] ); 228 229 if ( is_string( $theme_data['Tags'] ) ) 230 $theme_data['Tags'] = array_map( 'trim', explode( ',', strip_tags( $theme_data['Tags'] ) ) ); 231 elseif ( ! $theme_data['Tags'] ) 231 232 $theme_data['Tags'] = array(); 232 else233 $theme_data['Tags'] = array_map( 'trim', explode( ',', wp_kses( $theme_data['Tags'], array() ) ) );234 233 235 if ( $theme_data['Author'] == '' ) { 236 $theme_data['Author'] = $theme_data['AuthorName'] = __('Anonymous'); 234 // Apply markup 235 $theme_data['Description'] = wptexturize( $theme_data['Description'] ); 236 237 if ( $theme_data['Author'] ) { 238 if ( $theme_data['AuthorURI'] ) 239 $theme_data['Author'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], esc_attr__( 'Visit author homepage' ), $theme_data['Author'] ); 237 240 } else { 238 $theme_data['AuthorName'] = wp_kses( $theme_data['Author'], $themes_allowed_tags ); 239 if ( empty( $theme_data['AuthorURI'] ) ) { 240 $theme_data['Author'] = $theme_data['AuthorName']; 241 } else { 242 $theme_data['Author'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], esc_attr__( 'Visit author homepage' ), $theme_data['AuthorName'] ); 243 } 241 $theme_data['Author'] = $theme_data['AuthorName'] = __( 'Anonymous' ); 244 242 } 245 243 246 244 return $theme_data; … … 287 285 288 286 $name = $theme_data['Name']; 289 287 $title = $theme_data['Title']; 290 $description = wptexturize($theme_data['Description']);288 $description = $theme_data['Description']; 291 289 $version = $theme_data['Version']; 292 290 $author = $theme_data['Author']; 293 291 $template = $theme_data['Template']; … … 437 435 'Tags' => $theme_data['Tags'], 438 436 'Theme Root' => $theme_root, 439 437 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ), 438 'TextDomain' => $theme_data['TextDomain'], 439 'DomainPath' => $theme_data['DomainPath'], 440 440 ); 441 441 } 442 442 -
wp-content/themes/twentyten/style.css
7 7 License: GNU General Public License 8 8 License URI: license.txt 9 9 Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu 10 Text Domain: twentyten 11 Domain Path: /languages 10 12 */ 11 13 12 14 -
wp-admin/includes/file.php
34 34 'video.php' => __('Video Attachment Template'), 35 35 'audio.php' => __('Audio Attachment Template'), 36 36 'application.php' => __('Application Attachment Template'), 37 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ),38 37 '.htaccess' => __( '.htaccess (for rewrite rules )' ), 39 38 // Deprecated files 39 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), 40 40 'wp-layout.css' => __( 'Stylesheet' ), 41 41 'wp-comments.php' => __( 'Comments Template' ), 42 42 'wp-comments-popup.php' => __( 'Popup Comments Template' ), … … 51 51 * @uses _cleanup_header_comment 52 52 * @uses $wp_file_descriptions 53 53 * @param string $file Filesystem path or filename 54 * @param array $theme_data Optional. Theme data 54 55 * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist 55 56 */ 56 function get_file_description( $file ) {57 function get_file_description( $file, $theme_data = null ) { 57 58 global $wp_file_descriptions; 58 59 59 if ( isset( $wp_file_descriptions[basename( $file )] ) ) { 60 return $wp_file_descriptions[basename( $file )]; 61 } 62 elseif ( file_exists( $file ) && is_file( $file ) ) { 60 if ( isset( $wp_file_descriptions[ basename( $file ) ] ) ) { 61 return $wp_file_descriptions[ basename( $file ) ]; 62 } elseif ( file_exists( $file ) && is_file( $file ) ) { 63 63 $template_data = implode( '', file( $file ) ); 64 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name )) 65 return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) ); 64 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) { 65 $page_template = _cleanup_header_comment( $name[1] ); 66 if ( ! empty( $theme_data['TextDomain'] ) ) 67 $page_template = translate( $page_template, $theme_data['TextDomain'] ); 68 return sprintf( __( '%s Page Template' ), $page_template ); 69 } 66 70 } 67 71 68 return basename( $file);72 return trim( basename( $file ) ); 69 73 } 70 74 71 75 /** -
wp-admin/includes/theme.php
177 177 $themes = get_themes(); 178 178 $theme = get_current_theme(); 179 179 $templates = $themes[$theme]['Template Files']; 180 $textdomain = $themes[$theme]['TextDomain']; 180 181 $page_templates = array(); 181 182 182 183 if ( is_array( $templates ) ) { … … 194 195 195 196 $template_data = implode( '', file( $template )); 196 197 197 $name = '';198 198 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) 199 $name = _cleanup_header_comment($name[1]); 199 $name = trim( _cleanup_header_comment( $name[1] ) ); 200 else 201 continue; 200 202 201 if ( !empty( $name ) ) { 202 $page_templates[trim( $name )] = $basename; 203 } 203 if ( $textdomain ) 204 $name = translate( $name, $textdomain ); 205 206 if ( $name ) 207 $page_templates[ $name ] = $basename; 204 208 } 205 209 } 206 210 -
wp-admin/includes/class-wp-plugins-list-table.php
345 345 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>'; 346 346 } 347 347 if ( $plugin_data['Description'] ) 348 $description .= '<p>' . $plugin_data['Description']. '</p>';348 $description .= '<p>' . wptexturize( $plugin_data['Description'] ) . '</p>'; 349 349 } else { 350 350 $is_active_for_network = is_plugin_active_for_network($plugin_file); 351 351 if ( $screen->is_network ) … … 389 389 $checkbox_id = "checkbox_" . md5($plugin_data['Name']); 390 390 $checkbox = in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $plugin_data['Name'] . "</label>"; 391 391 if ( 'dropins' != $context ) { 392 $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description']: ' ' ) . '</p>';392 $description = '<p>' . ( $plugin_data['Description'] ? wptexturize( $plugin_data['Description'] ) : ' ' ) . '</p>'; 393 393 $plugin_name = $plugin_data['Name']; 394 394 } 395 395 -
wp-admin/theme-editor.php
138 138 <div id="message" class="updated"><p><?php _e('File edited successfully.') ?></p></div> 139 139 <?php endif; 140 140 141 $description = get_file_description( $file);141 $description = get_file_description( $file, $themes[ $theme ] ); 142 142 $desc_header = ( $description != $file_show ) ? "$description <span>($file_show)</span>" : $file_show; 143 143 144 144 $is_child_theme = $themes[$theme]['Template'] != $themes[$theme]['Stylesheet']; … … 187 187 if ( $is_child_theme && strpos( $template_file, trailingslashit( $template_dir ) ) === 0 ) 188 188 continue; 189 189 190 $description = trim( get_file_description($template_file));190 $description = get_file_description( $template_file, $themes[ $theme ] ); 191 191 $template_show = basename($template_file); 192 192 $filedesc = ( $description != $template_file ) ? "$description<br /><span class='nonessential'>($template_show)</span>" : "$description"; 193 193 $filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description<br /><span class='nonessential'>($template_show)</span></span>" : $filedesc; … … 209 209 if ( $is_child_theme && strpos( $style_file, trailingslashit( $template_dir ) ) === 0 ) 210 210 continue; 211 211 212 $description = trim( get_file_description($style_file));212 $description = get_file_description( $style_file, $themes[ $theme ] ); 213 213 $style_show = basename($style_file); 214 214 $filedesc = ( $description != $style_file ) ? "$description<br /><span class='nonessential'>($style_show)</span>" : "$description"; 215 215 $filedesc = ( $style_file == $file ) ? "<span class='highlight'>$description<br /><span class='nonessential'>($style_show)</span></span>" : $filedesc; -
wp-admin/themes.php
137 137 } 138 138 echo implode ( ' | ', $options ); 139 139 140 if ( $ct->tags ) : ?> 141 <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p> 142 <?php endif; ?> 140 if ( $ct->tags ) { 141 $f = array(); 142 $feature_list = get_theme_feature_list(); 143 foreach ( $feature_list as $feature_group => $features ) { 144 foreach ( $features as $tag => $translated ) { 145 if ( in_array( $tag, $ct->tags ) ) 146 $f[] = $translated; 147 } 148 } 149 /* translators: %l is a placeholder for wp_sprintf(). (Lowercase L.) */ 150 echo '<p>' . wp_sprintf( __( 'Features: %l.' ), $f ) . '</p>'; 151 unset( $f, $feature_list, $tag, $translated, $feature_group, $features ); 152 } 153 ?> 143 154 </div> 144 155 <?php theme_update_available($ct); ?> 145 156