Changeset 12063
- Timestamp:
- 10/19/2009 09:39:04 PM (15 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/theme.php
r12033 r12063 147 147 } 148 148 149 /** 150 * Tidies a filename for url display by the theme editor. 151 * 152 * @since 2.9.0 153 * @private 154 * 155 * @param string $fullpath Full path to the theme file 156 * @param string $containingfolder Path of the theme parent folder 157 * @return string 158 */ 159 function _get_template_edit_filename($fullpath, $containingfolder) { 160 return str_replace(dirname(dirname( $containingfolder )) , '', $fullpath); 161 } 162 149 163 ?> -
trunk/wp-admin/theme-editor.php
r12005 r12063 16 16 $parent_file = 'themes.php'; 17 17 18 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme' ));18 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme', 'dir')); 19 19 20 20 wp_admin_css( 'theme-editor' ); … … 35 35 if (empty($file)) { 36 36 $file = $allowed_files[0]; 37 } 38 39 $file = validate_file_to_edit($file, $allowed_files); 40 $real_file = get_real_file_to_edit($file); 37 } else { 38 if ( 'theme' == $dir ) { 39 $file = dirname(dirname($themes[$theme]['Template Dir'])) . $file ; 40 } else if ( 'style' == $dir) { 41 $file = dirname(dirname($themes[$theme]['Stylesheer Dir'])) . $file ; 42 } 43 } 44 45 $real_file = validate_file_to_edit($file, $allowed_files); 41 46 $scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; 42 47 … … 158 163 if( array_key_exists($description, $template_mapping ) ) { 159 164 if ( false !== strpos( $template_file, $template_dir ) ) { 160 $template_mapping[ $description ] = array( $template_file, $filedesc );165 $template_mapping[ $description ] = array( _get_template_edit_filename($template_file, $template_dir), $filedesc ); 161 166 } 162 167 } else { 163 $template_mapping[ $description ] = array( $template_file, $filedesc );168 $template_mapping[ $description ] = array( _get_template_edit_filename($template_file, $template_dir), $filedesc ); 164 169 } 165 170 } … … 167 172 while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) : 168 173 ?> 169 <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&theme=<?php echo urlencode($theme) ?> "><?php echo $filedesc ?></a></li>174 <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&theme=<?php echo urlencode($theme) ?>&dir=theme"><?php echo $filedesc ?></a></li> 170 175 <?php endwhile; ?> 171 176 </ul> … … 174 179 <?php 175 180 $template_mapping = array(); 181 $stylesheet_dir = $themes[$theme]['Stylesheet Dir']; 176 182 foreach ( $themes[$theme]['Stylesheet Files'] as $style_file ) { 177 183 $description = trim( get_file_description($style_file) ); … … 179 185 $filedesc = ( $description != $style_file ) ? "$description <span class='nonessential'>($style_show)</span>" : "$description"; 180 186 $filedesc = ( $style_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($style_show)</span></span>" : $filedesc; 181 $template_mapping[ $description ] = array( $style_file, $filedesc );187 $template_mapping[ $description ] = array( _get_template_edit_filename($style_file, $style_file), $filedesc ); 182 188 } 183 189 ksort( $template_mapping ); 184 190 while ( list( $template_sorted_key, list( $style_file, $filedesc ) ) = each( $template_mapping ) ) : 185 191 ?> 186 <li><a href="theme-editor.php?file=<?php echo "$style_file"; ?>&theme=<?php echo urlencode($theme) ?> "><?php echo $filedesc ?></a></li>192 <li><a href="theme-editor.php?file=<?php echo "$style_file"; ?>&theme=<?php echo urlencode($theme) ?>&dir=style"><?php echo $filedesc ?></a></li> 187 193 <?php endwhile; ?> 188 194 </ul>
Note: See TracChangeset
for help on using the changeset viewer.