'.__('Update successfully','nggallery').'';
}
} else {
// get the options
$act_cssfile = $ngg_options[CSSfile];
}
// set the path
$real_file = NGGALLERY_ABSPATH."css/".$act_cssfile;
if (isset($_POST['updatecss'])) {
if ( !current_user_can('edit_themes') )
wp_die('
'.__('You do not have sufficient permissions to edit templates for this blog.').'
');
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
$messagetext = ''.__('CSS file successfully updated','nggallery').'';
}
}
// get the content of the file
if (!is_file($real_file))
$error = 1;
if (!$error && filesize($real_file) > 0) {
$f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file));
$content = htmlspecialchars($content);
}
// message window
if(!empty($messagetext)) { echo ''; }
?>
' . sprintf(__('Editing
%s'), $file_show) . '';
} else {
echo '
' . sprintf(__('Browsing %s'), $file_show) . '
';
}
?>
' . __('Oops, no such file exists! Double check the name and try again, merci.') . '
';
}
?>
read()) !== false) {
if (preg_match('|^\.+$|', $file))
continue;
if (is_dir($plugin_root.'/'.$file)) {
$plugins_subdir = @ dir($plugin_root.'/'.$file);
if ($plugins_subdir) {
while (($subfile = $plugins_subdir->read()) !== false) {
if (preg_match('|^\.+$|', $subfile))
continue;
if (preg_match('|\.css$|', $subfile))
$plugin_files[] = "$file/$subfile";
}
}
} else {
if (preg_match('|\.css$|', $file))
$plugin_files[] = $file;
}
}
}
if ( !$plugins_dir || !$plugin_files )
return $cssfiles;
foreach ( $plugin_files as $plugin_file ) {
if ( !is_readable("$plugin_root/$plugin_file"))
continue;
$plugin_data = ngg_get_cssfiles_data("$plugin_root/$plugin_file");
if ( empty ($plugin_data['Name']) )
continue;
$cssfiles[plugin_basename($plugin_file)] = $plugin_data;
}
uasort($cssfiles, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
return $cssfiles;
}
/**********************************************************/
// parse the Header information
function ngg_get_cssfiles_data($plugin_file) {
$plugin_data = implode('', file($plugin_file));
preg_match("|CSS Name:(.*)|i", $plugin_data, $plugin_name);
preg_match("|Description:(.*)|i", $plugin_data, $description);
preg_match("|Author:(.*)|i", $plugin_data, $author_name);
if (preg_match("|Version:(.*)|i", $plugin_data, $version))
$version = trim($version[1]);
else
$version = '';
$description = wptexturize(trim($description[1]));
$name = trim($plugin_name[1]);
$author = trim($author_name[1]);
return array ('Name' => $name, 'Description' => $description, 'Author' => $author, 'Version' => $version );
}
?>