Changeset 20557
- Timestamp:
- 04/21/2012 08:57:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/theme-editor.php
r20379 r20557 55 55 wp_die( __( 'The requested theme does not exist.' ) ); 56 56 57 if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() ) 58 wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() ); 59 57 60 $allowed_files = $theme->get_files( 'php', 1 ); 58 61 $has_templates = ! empty( $allowed_files ); 59 60 62 $style_files = $theme->get_files( 'css' ); 61 if ( isset( $style_files['style.css'] ) ) { 62 $allowed_files['style.css'] = $style_files['style.css']; 63 unset( $style_files['style.css'] ); 64 } else { 65 $style_files['style.css'] = false; 66 } 63 $allowed_files['style.css'] = $style_files['style.css']; 67 64 $allowed_files += $style_files; 68 65 69 66 if ( empty( $file ) ) { 70 if ( ! empty( $allowed_files['style.css'] ) ) { 71 $relative_file = 'style.css'; 72 $file = $allowed_files['style.css']; 73 } else { 74 $relative_file = key( $allowed_files ); 75 $file = current( $allowed_files ); 76 } 67 $relative_file = 'style.css'; 68 $file = $allowed_files['style.css']; 77 69 } else { 78 70 $relative_file = urldecode( stripslashes( $file ) ); … … 154 146 <?php 155 147 foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) { 148 if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() ) 149 continue; 150 156 151 $selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : ''; 157 152 echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>'; … … 166 161 <div id="templateside"> 167 162 <?php 168 if ( array_filter( $allowed_files )) :163 if ( $allowed_files ) : 169 164 if ( $has_templates || $theme->is_child_theme() ) : 170 165 ?> 171 166 <h3><?php _e('Templates'); ?></h3> 172 167 <?php if ( $theme->is_child_theme() ) : ?> 173 <p class="howto"><?php printf( __( 'This child theme inherits templates from a parent theme, %s.' ), '<a href="' . self_admin_url('theme-editor.php?theme=' . $theme->get_template()) . '">' . $theme->parent()->display('Name') . '</a>' ); ?></p>168 <p class="howto"><?php printf( __( 'This child theme inherits templates from a parent theme, %s.' ), '<a href="' . self_admin_url('theme-editor.php?theme=' . urlencode( $theme->get_template() ) ) . '">' . $theme->parent()->display('Name') . '</a>' ); ?></p> 174 169 <?php endif; ?> 175 170 <ul> … … 178 173 179 174 foreach ( $allowed_files as $filename => $absolute_filename ) : 180 if ( 'style.css' == $filename ) {175 if ( 'style.css' == $filename ) 181 176 echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n"; 182 if ( ! $absolute_filename )183 continue;184 }185 177 186 178 $file_description = get_file_description( $filename );
Note: See TracChangeset
for help on using the changeset viewer.