當前位置: 首頁>>代碼示例>>PHP>>正文


PHP update_recently_edited函數代碼示例

本文整理匯總了PHP中update_recently_edited函數的典型用法代碼示例。如果您正苦於以下問題:PHP update_recently_edited函數的具體用法?PHP update_recently_edited怎麽用?PHP update_recently_edited使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了update_recently_edited函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fopen

        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}");
        }
        exit;
        break;
    default:
        require_once 'admin-header.php';
        if (!current_user_can('edit_plugins')) {
            die('<p>' . __('You have do not have sufficient permissions to edit plugins for this blog.') . '</p>');
        }
        update_recently_edited("wp-content/plugins/{$file}");
        if (!is_file($real_file)) {
            $error = 1;
        }
        if (!$error) {
            $f = fopen($real_file, 'r');
            $content = fread($f, filesize($real_file));
            $content = htmlspecialchars($content);
        }
        if (isset($_GET['a'])) {
            ?>
 <div id="message" class="updated fade"><p><?php 
            _e('File edited successfully.');
            ?>
</p></div>
<?php 
開發者ID:staylor,項目名稱:develop.svn.wordpress.org,代碼行數:31,代碼來源:plugin-editor.php

示例2: wp_kses_no_null

             $location = "theme-editor.php?file={$file}&theme={$theme}&a=te&scrollto={$scrollto}";
         } else {
             $location = "theme-editor.php?file={$file}&theme={$theme}&scrollto={$scrollto}";
         }
     } else {
         $location = "theme-editor.php?file={$file}&theme={$theme}&scrollto={$scrollto}";
     }
     $location = wp_kses_no_null($location);
     $strip = array('%0d', '%0a', '%0D', '%0A');
     $location = _deep_replace($strip, $location);
     header("Location: {$location}");
     exit;
     break;
 default:
     require_once 'admin-header.php';
     update_recently_edited($file);
     if (!is_file($file)) {
         $error = 1;
     }
     if (!$error && filesize($file) > 0) {
         $f = fopen($file, 'r');
         $content = fread($f, filesize($file));
         if ('.php' == substr($file, strrpos($file, '.'))) {
             $functions = wp_doc_link_parse($content);
             $docs_select = '<select name="docs-list" id="docs-list">';
             $docs_select .= '<option value="">' . esc_attr__('Function Name...') . '</option>';
             foreach ($functions as $function) {
                 $docs_select .= '<option value="' . esc_attr(urlencode($function)) . '">' . htmlspecialchars($function) . '()</option>';
             }
             $docs_select .= '</select>';
         }
開發者ID:nagyist,項目名稱:laura-wordpress,代碼行數:31,代碼來源:theme-editor.php

示例3: apply_filters

 $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);
 if (!is_file($real_file)) {
     wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
 } else {
     // Get the extension of the file
     if (preg_match('/\\.([^.]+)$/', $real_file, $matches)) {
         $ext = strtolower($matches[1]);
         // If extension is not in the acceptable list, skip it
         if (!in_array($ext, $editable_extensions)) {
             wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.')));
         }
     }
 }
 add_contextual_help($current_screen, '<p>' . __('You can use the editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' . '<p>' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' . '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function.') . '</p>' . '<p>' . __('If you want to make changes but don&#8217;t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' . (is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '') . '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' . '<p>' . __('<a href="http://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
 require_once ABSPATH . 'wp-admin/admin-header.php';
 update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
 $content = file_get_contents($real_file);
 if ('.php' == substr($real_file, strrpos($real_file, '.'))) {
     $functions = wp_doc_link_parse($content);
     if (!empty($functions)) {
         $docs_select = '<select name="docs-list" id="docs-list">';
         $docs_select .= '<option value="">' . __('Function Name&hellip;') . '</option>';
         foreach ($functions as $function) {
             $docs_select .= '<option value="' . esc_attr($function) . '">' . esc_html($function) . '()</option>';
         }
         $docs_select .= '</select>';
     }
 }
 $content = esc_textarea($content);
 if (isset($_GET['a'])) {
     ?>
開發者ID:vpatrinica,項目名稱:jfdesign,代碼行數:31,代碼來源:plugin-editor.php

示例4: check_admin_referer

        }
        if (isset($_GET['liveupdate'])) {
            check_admin_referer('edit-plugin-test_' . $file);
            $error = validate_plugin($file);
            if (is_wp_error($error)) {
                wp_die($error);
            }
            if (!is_plugin_active($file)) {
                activate_plugin($file, "plugin-editor.php?file={$file}&phperror=1");
            }
            // we'll override this later if the plugin can be included without fatal error
            wp_redirect("plugin-editor.php?file={$file}&a=te");
            exit;
        }
        require_once 'admin-header.php';
        update_recently_edited(PLUGINDIR . "/{$file}");
        if (!is_file($real_file)) {
            $error = 1;
        }
        if (!$error) {
            $content = htmlspecialchars(file_get_contents($real_file));
        }
        if (isset($_GET['a'])) {
            ?>
 <div id="message" class="updated fade"><p><?php 
            _e('File edited successfully.');
            ?>
</p></div>
<?php 
        } elseif (isset($_GET['phperror'])) {
            ?>
開發者ID:staylor,項目名稱:develop.svn.wordpress.org,代碼行數:31,代碼來源:plugin-editor.php

示例5: fopen

	} else {
		wp_redirect("plugin-editor.php?file=$file");
	}

	exit();

break;

default:

	if ( !current_user_can('edit_plugins') )
		wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');

	require_once('admin-header.php');

	update_recently_edited(PLUGINDIR . "/$file");

	if (!is_file($real_file))
		$error = 1;

	if (!$error) {
		$f = fopen($real_file, 'r');
		$content = fread($f, filesize($real_file));
		$content = htmlspecialchars($content);
	}

	?>
<?php if (isset($_GET['a'])) : ?>
 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?>
 <div class="wrap">
開發者ID:staylor,項目名稱:develop.svn.wordpress.org,代碼行數:31,代碼來源:plugin-editor.php

示例6: bws_custom_code_tab

    function bws_custom_code_tab()
    {
        if (!current_user_can('edit_plugins')) {
            wp_die(__('You do not have sufficient permissions to edit plugins for this site.', 'bestwebsoft'));
        }
        global $bstwbsftwppdtplgns_options;
        $message = $content = '';
        $is_css_active = $is_php_active = false;
        $upload_dir = wp_upload_dir();
        $folder = $upload_dir['basedir'] . '/bws-custom-code';
        if (!$upload_dir["error"]) {
            if (!is_dir($folder)) {
                wp_mkdir_p($folder, 0755);
            }
            $index_file = $upload_dir['basedir'] . '/bws-custom-code/index.php';
            if (!file_exists($index_file)) {
                if ($f = fopen($index_file, 'w+')) {
                    fclose($f);
                }
            }
        }
        $css_file = 'bws-custom-code.css';
        $real_css_file = $folder . '/' . $css_file;
        $php_file = 'bws-custom-code.php';
        $real_php_file = $folder . '/' . $php_file;
        $is_multisite = is_multisite();
        if ($is_multisite) {
            $blog_id = get_current_blog_id();
        }
        if (isset($_REQUEST['bws_update_custom_code']) && check_admin_referer('bws_update_' . $css_file)) {
            /* CSS */
            $newcontent_css = wp_unslash($_POST['bws_newcontent_css']);
            if (!empty($newcontent_css) && isset($_REQUEST['bws_custom_css_active'])) {
                if ($is_multisite) {
                    $bstwbsftwppdtplgns_options['custom_code'][$blog_id][$css_file] = $upload_dir['baseurl'] . '/bws-custom-code/' . $css_file;
                } else {
                    $bstwbsftwppdtplgns_options['custom_code'][$css_file] = $upload_dir['baseurl'] . '/bws-custom-code/' . $css_file;
                }
            } else {
                if ($is_multisite) {
                    if (isset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$css_file])) {
                        unset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$css_file]);
                    }
                } else {
                    if (isset($bstwbsftwppdtplgns_options['custom_code'][$css_file])) {
                        unset($bstwbsftwppdtplgns_options['custom_code'][$css_file]);
                    }
                }
            }
            if ($f = fopen($real_css_file, 'w+')) {
                fwrite($f, $newcontent_css);
                fclose($f);
                $message .= sprintf(__('File %s edited successfully.', 'bestwebsoft'), '<i>' . $css_file . '</i>') . ' ';
            } else {
                $error .= __('Not enough permissions to create or update the file', 'bestwebsoft') . ' ' . $real_css_file . '. ';
            }
            /* PHP */
            $newcontent_php = wp_unslash(trim($_POST['bws_newcontent_php']));
            if (file_exists($index_file)) {
                if (!empty($newcontent_php) && isset($_REQUEST['bws_custom_php_active'])) {
                    if ($is_multisite) {
                        $bstwbsftwppdtplgns_options['custom_code'][$blog_id][$php_file] = $real_php_file;
                    } else {
                        $bstwbsftwppdtplgns_options['custom_code'][$php_file] = $real_php_file;
                    }
                } else {
                    if ($is_multisite) {
                        if (isset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$php_file])) {
                            unset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$php_file]);
                        }
                    } else {
                        if (isset($bstwbsftwppdtplgns_options['custom_code'][$php_file])) {
                            unset($bstwbsftwppdtplgns_options['custom_code'][$php_file]);
                        }
                    }
                }
                if ($f = fopen($real_php_file, 'w+')) {
                    $newcontent_php = $newcontent_php;
                    fwrite($f, $newcontent_php);
                    fclose($f);
                    $message .= sprintf(__('File %s edited successfully.', 'bestwebsoft'), '<i>' . $php_file . '</i>');
                } else {
                    $error .= __('Not enough permissions to create or update the file', 'bestwebsoft') . ' ' . $real_php_file . '. ';
                }
            } else {
                $error .= __('Not enough permissions to create the file', 'bestwebsoft') . ' ' . $index_file . '. ';
            }
            if (!empty($error)) {
                $error .= ' <a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">' . __('Learn more', 'bestwebsoft') . '</a>';
            }
            if ($is_multisite) {
                update_site_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options);
            } else {
                update_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options);
            }
        }
        if (file_exists($real_css_file)) {
            update_recently_edited($real_css_file);
            $content_css = esc_textarea(file_get_contents($real_css_file));
            if ($is_multisite && isset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$css_file]) || !$is_multisite && isset($bstwbsftwppdtplgns_options['custom_code'][$css_file])) {
//.........這裏部分代碼省略.........
開發者ID:bestwebsoft,項目名稱:error-log-viewer-wordpress-plugin,代碼行數:101,代碼來源:bws_functions.php

示例7: bws_custom_code_tab

    function bws_custom_code_tab()
    {
        if (!current_user_can('edit_plugins')) {
            wp_die(__('You do not have sufficient permissions to edit plugins for this site.', 'bestwebsoft'));
        }
        global $bstwbsftwppdtplgns_options;
        $message = $content = '';
        $is_active = false;
        $upload_dir = wp_upload_dir();
        $folder = $upload_dir['basedir'] . '/bws-custom-code';
        if (!$upload_dir["error"]) {
            if (!is_dir($folder)) {
                wp_mkdir_p($folder, 0755);
            }
        }
        $file = 'bws-custom-code.css';
        $real_file = $folder . '/' . $file;
        $is_multisite = is_multisite();
        if ($is_multisite) {
            $blog_id = get_current_blog_id();
        }
        if (isset($_REQUEST['bws_update_custom_code']) && check_admin_referer('bws_update_' . $file)) {
            $newcontent = wp_unslash($_POST['bws_newcontent_css']);
            if (!empty($newcontent) && isset($_REQUEST['bws_custom_css_active'])) {
                if ($is_multisite) {
                    $bstwbsftwppdtplgns_options['custom_code'][$blog_id][$file] = $upload_dir['baseurl'] . '/bws-custom-code/' . $file;
                } else {
                    $bstwbsftwppdtplgns_options['custom_code'][$file] = $upload_dir['baseurl'] . '/bws-custom-code/' . $file;
                }
            } else {
                if ($is_multisite) {
                    if (isset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$file])) {
                        unset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$file]);
                    }
                } else {
                    if (isset($bstwbsftwppdtplgns_options['custom_code'][$file])) {
                        unset($bstwbsftwppdtplgns_options['custom_code'][$file]);
                    }
                }
            }
            if ($f = fopen($real_file, 'w+')) {
                fwrite($f, $newcontent);
                fclose($f);
                $message = __('File edited successfully.', 'bestwebsoft');
            } else {
                $error = __('Not enough permissions to create or update the file', 'bestwebsoft') . ' ' . $real_file . '. <a href="https://codex.wordpress.org/Changing_File_Permissions">' . __('Learn more', 'bestwebsoft') . '</a>';
            }
            if ($is_multisite) {
                update_site_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options);
            } else {
                update_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options);
            }
        }
        if (file_exists($real_file)) {
            update_recently_edited($real_file);
            $content = file_get_contents($real_file);
            $content = esc_textarea($content);
            if ($is_multisite && isset($bstwbsftwppdtplgns_options['custom_code'][$blog_id][$file]) || !$is_multisite && isset($bstwbsftwppdtplgns_options['custom_code'][$file])) {
                $is_active = true;
            }
        }
        if (!empty($message)) {
            ?>
			<div id="message" class="below-h2 updated notice is-dismissible"><p><?php 
            echo $message;
            ?>
</p></div>
		<?php 
        }
        ?>
		<p><?php 
        _e('These styles will be added to the header on all pages of your site.', 'bestwebsoft');
        ?>
</p>
		<p><big>
			<?php 
        if (!file_exists($real_file) || is_writeable($real_file)) {
            echo __('Editing', 'bestwebsoft') . ' <strong>' . $file . '</strong>';
        } else {
            echo __('Browsing', 'bestwebsoft') . ' <strong>' . $file . '</strong>';
        }
        ?>
		</big></p>
		<form action="" method="post">
			<?php 
        wp_nonce_field('bws_update_' . $file);
        ?>
			<p><label><input type="checkbox" name="bws_custom_css_active" value="1" <?php 
        if ($is_active) {
            echo "checked";
        }
        ?>
 />	<?php 
        _e('Activate', 'bestwebsoft');
        ?>
</label></p>
			<textarea cols="70" rows="25" name="bws_newcontent_css" id="bws_newcontent_css"><?php 
        echo $content;
        ?>
</textarea>
//.........這裏部分代碼省略.........
開發者ID:jenia-buianov,項目名稱:all_my_sites,代碼行數:101,代碼來源:bws_functions.php


注:本文中的update_recently_edited函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。