wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
- wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
$themes = get_themes();
$newcontent = stripslashes($_POST['newcontent']);
$theme = urlencode($theme);
if (is_writeable($real_file)) {
+ //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
$f = fopen($real_file, 'w+');
- fwrite($f, $newcontent);
- fclose($f);
- $location = "theme-editor.php?file=$file&theme=$theme&a=te";
+ if ($f !== FALSE) {
+ fwrite($f, $newcontent);
+ fclose($f);
+ $location = "theme-editor.php?file=$file&theme=$theme&a=te";
+ } else {
+ $location = "theme-editor.php?file=$file&theme=$theme";
+ }
} else {
$location = "theme-editor.php?file=$file&theme=$theme";
}
<div class="bordertitle">
<h2><?php _e('Theme Editor'); ?></h2>
<form id="themeselector" name="theme" action="theme-editor.php" method="post">
- <strong><?php _e('Select theme to edit:'); ?> </strong>
+ <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
<select name="theme" id="theme">
<?php
foreach ($themes as $a_theme) {