' . "\n\t" . '
' . __('Attention! In order to take advantage of all the controls that Thesis offers, you need to change the name of your custom-sample folder to custom.', 'thesis') . "
' . __('Attention!', 'thesis') . ' ' . __('Your ' . $location . ' file is not writable by the server, and in order to work the full extent of its magic, Thesis needs to be able to write to this file. All you have to do is set your layout.css file permissions to 666, and you\'ll be good to go. After setting your file permissions, you should head to the Design Options page and hit the save button.', 'thesis') . '
' . __('Attention!', 'thesis') . ' ' . __('For security reasons, the file you are attempting to edit cannot be modified via this screen.', 'thesis') . '
' . "\n"; elseif (!file_exists(THESIS_CUSTOM)) // The custom/ directory does not exist $error = '' . __('Attention!', 'thesis') . ' ' . __('Your custom/ directory does not appear to exist. Have you remembered to rename /custom-sample?', 'thesis') . '
' . __('Attention!', 'thesis') . ' ' . __('The file you are attempting does not appear to exist.', 'thesis') . '
' . "\n"; elseif (!is_writable(THESIS_CUSTOM . '/custom.css')) // The selected file is not writable $error = '' . __('Attention!', 'thesis') . ' ' . sprintf(__('Your /custom/%s file is not writable by the server, and in order to modify the file via the admin panel, Thesis needs to be able to write to this file. All you have to do is set this file’s permissions to 666, and you’ll be good to go.', 'thesis'), $file) . '
/custom folder may be modified via this interface. Thank you.', 'thesis'));
$file_open = fopen(THESIS_CUSTOM . '/' . $file, 'w+'); // Open the file
if ($file_open !== false) // If possible, write new custom file
fwrite($file_open, $contents);
fclose($file_open); // Close the file
$updated = '&updated=true'; // Display updated message
}
if (isset($_POST['custom_file_jump'])) {
$file = $_POST['custom_files'];
$updated = '';
}
wp_redirect(admin_url('admin.php?page=thesis-file-editor' . $updated . '&file=' . $file));
}
/**
* function thesis_get_custom_files()
*
* Returns an array of available files from within custom/.
*
* @since 1.6
*/
function thesis_get_custom_files() {
$files = array();
$directory = opendir(THESIS_CUSTOM); // Open the directory
$exts = array('.php', '.css', '.js', '.txt', '.inc', '.htaccess', '.html', '.htm'); // What type of files do we want?
while ($file = readdir($directory)) { // Read the files
if ($file != '.' && $file != '..') { // Only list files within the _current_ directory
$extension = substr($file, strrpos($file, '.')); // Get the extension of the file
if ($extension && in_array($extension, $exts)) // Verify extension of the file; we can't edit images!
$files[] = $file; // Add the file to the array
}
}
closedir($directory); // Close the directory
return $files; // Return the array of editable files
}