Make WordPress Core

Ticket #2926: r3979_theme-editor.patch

File r3979_theme-editor.patch, 1.1 KB (added by Arrrr, 18 years ago)
  • wp-admin/theme-editor.php

     
    120120<?php
    121121if ($allowed_files) :
    122122?>
     123<?php
     124foreach($allowed_files as $allowed_file) :
     125        $filename_root = trim(get_file_description($allowed_file));
     126        $filename = $filename_root;
     127        $i = 2;
     128        while (array_key_exists($filename, $files_tmp))
     129        {
     130                $filename = $filename_root . " ($i)";
     131                $i++;
     132        }
     133        $files_tmp[$filename] = $allowed_file;
     134endforeach;
     135if ($files_tmp) :
     136        ksort($files_tmp);
     137        $allowed_files = $files_tmp;
     138endif;
     139?>
    123140  <ul>
    124 <?php foreach($allowed_files as $allowed_file) : ?>
    125                  <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
     141<?php foreach($allowed_files as $file_name => $allowed_file) : ?>
     142                 <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $file_name; ?></a></li>
    126143<?php endforeach; ?>
    127144  </ul>
    128145<?php endif; ?>