本文整理汇总了PHP中get_real_file_to_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP get_real_file_to_edit函数的具体用法?PHP get_real_file_to_edit怎么用?PHP get_real_file_to_edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_real_file_to_edit函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_option
}
}
}
$recents = get_option('recently_edited');
if (empty($file)) {
if ($recents) {
$file = $recents[0];
} else {
$file = 'index.php';
}
}
$file = validate_file_to_edit($file);
$real_file = get_real_file_to_edit($file);
switch($action) {
case 'update':
if ($user_level < 5) {
die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
}
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
header("Location: templates.php?file=$file&a=te");
示例2: get_plugins
${$wpvar} = '';
} else {
${$wpvar} = $_GET["{$wpvar}"];
}
} else {
${$wpvar} = $_POST["{$wpvar}"];
}
}
}
$plugins = get_plugins();
$plugin_files = array_keys($plugins);
if (empty($file)) {
$file = $plugin_files[0];
}
$file = validate_file_to_edit($file, $plugin_files);
$real_file = get_real_file_to_edit("wp-content/plugins/{$file}");
switch ($action) {
case 'update':
check_admin_referer('edit-plugin_' . $file);
if (!current_user_can('edit_plugins')) {
die('<p>' . __('You have do not have sufficient permissions to edit templates for this blog.') . '</p>');
}
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
wp_redirect("plugin-editor.php?file={$file}&a=te");
} else {
wp_redirect("plugin-editor.php?file={$file}");
}
示例3: __
require_once 'admin.php';
$title = __("Edit Plugins");
$parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
add_action('admin_head', 'theme_editor_css');
function theme_editor_css()
{
wp_admin_css('css/theme-editor');
}
$plugins = get_plugins();
$plugin_files = array_keys($plugins);
if (empty($file)) {
$file = $plugin_files[0];
}
$file = validate_file_to_edit($file, $plugin_files);
$real_file = get_real_file_to_edit(PLUGINDIR . "/{$file}");
switch ($action) {
case 'update':
check_admin_referer('edit-plugin_' . $file);
if (!current_user_can('edit_plugins')) {
wp_die('<p>' . __('You do not have sufficient permissions to edit templates for this blog.') . '</p>');
}
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
// Deactivate so we can test it.
if (is_plugin_active($file) || isset($_POST['phperror'])) {
if (is_plugin_active($file)) {
deactivate_plugins($file, true);
示例4: read_tag
function read_tag($tag, $contents)
{
$theTag = strstr($contents, 'get_' . $tag . '(');
//when the tag doesnt exist, return nothing, or it will take the standard file
if (!$theTag) {
return '';
}
$theTag = str_replace('get_' . $tag . '(', '', $theTag);
if (strpos($theTag, ')') != 0) {
$theTag = substr($theTag, 0, strpos($theTag, ')'));
} else {
$theTag = '';
}
$theTag = str_replace('\'', '', $theTag);
//remove '
$theTag = str_replace('"', '', $theTag);
//remove "
$fileToRead = get_template_directory_uri() . '/';
$fileToRead .= $tag;
if ($theTag) {
$fileToRead .= '-' . $theTag;
}
$fileToRead .= '.php';
$fileToRead = strstr($fileToRead, '/themes/');
$fileToRead = validate_file_to_edit($fileToRead, $allowed_files);
$fileToRead = get_real_file_to_edit($fileToRead);
//first try to read the child theme, otherwise use the normal theme
$themes = get_themes();
$theme = $themes[get_current_theme()];
$current_theme_url = $theme['Template'];
$child_theme_url = str_replace('themes/', '', strstr(get_stylesheet_directory_uri(), 'themes/'));
if (fopen(str_replace($current_theme_url, $child_theme_url, $fileToRead), 'r')) {
//child theme exists
$fileToRead = str_replace($current_theme_url, $child_theme_url, $fileToRead);
$f = fopen($fileToRead, 'r');
} else {
$f = fopen($fileToRead, 'r');
}
$tagContents = fread($f, filesize($fileToRead));
$tagContents = htmlspecialchars($tagContents);
return $tagContents;
}
示例5: require_once
require_once('admin.php');
$title = __("Edit Plugins");
$parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
$plugins = get_plugins();
$plugin_files = array_keys($plugins);
if (empty($file)) {
$file = $plugin_files[0];
}
$file = validate_file_to_edit($file, $plugin_files);
$real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
switch($action) {
case 'update':
check_admin_referer('edit-plugin_' . $file);
if ( !current_user_can('edit_plugins') )
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
$newcontent = stripslashes($_POST['newcontent']);
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);