Merged in feature/165-dev-dev01 (pull request #12)
auto-patch 165-dev-dev01-2023-12-27T21_44_36 * auto-patch 165-dev-dev01-2023-12-27T21_44_36
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of FastCGI_Purger
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
* @author rtCamp
|
||||
*/
|
||||
class FastCGI_Purger extends Purger {
|
||||
|
||||
/**
|
||||
* Function to purge url.
|
||||
*
|
||||
* @param string $url URL.
|
||||
* @param bool $feed Weather it is feed or not.
|
||||
*/
|
||||
public function purge_url( $url, $feed = true ) {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
/**
|
||||
* Filters the URL to be purged.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param string $url URL to be purged.
|
||||
*/
|
||||
$url = apply_filters( 'rt_nginx_helper_purge_url', $url );
|
||||
|
||||
$this->log( '- Purging URL | ' . $url );
|
||||
|
||||
$parse = wp_parse_url( $url );
|
||||
|
||||
if ( ! isset( $parse['path'] ) ) {
|
||||
$parse['path'] = '';
|
||||
}
|
||||
|
||||
switch ( $nginx_helper_admin->options['purge_method'] ) {
|
||||
|
||||
case 'unlink_files':
|
||||
$_url_purge_base = $parse['scheme'] . '://' . $parse['host'] . $parse['path'];
|
||||
$_url_purge = $_url_purge_base;
|
||||
|
||||
if ( ! empty( $parse['query'] ) ) {
|
||||
$_url_purge .= '?' . $parse['query'];
|
||||
}
|
||||
|
||||
$this->delete_cache_file_for( $_url_purge );
|
||||
|
||||
if ( $feed ) {
|
||||
|
||||
$feed_url = rtrim( $_url_purge_base, '/' ) . '/feed/';
|
||||
$this->delete_cache_file_for( $feed_url );
|
||||
$this->delete_cache_file_for( $feed_url . 'atom/' );
|
||||
$this->delete_cache_file_for( $feed_url . 'rdf/' );
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'get_request':
|
||||
// Go to default case.
|
||||
default:
|
||||
$_url_purge_base = $this->purge_base_url() . $parse['path'];
|
||||
$_url_purge = $_url_purge_base;
|
||||
|
||||
if ( isset( $parse['query'] ) && '' !== $parse['query'] ) {
|
||||
$_url_purge .= '?' . $parse['query'];
|
||||
}
|
||||
|
||||
$this->do_remote_get( $_url_purge );
|
||||
|
||||
if ( $feed ) {
|
||||
|
||||
$feed_url = rtrim( $_url_purge_base, '/' ) . '/feed/';
|
||||
$this->do_remote_get( $feed_url );
|
||||
$this->do_remote_get( $feed_url . 'atom/' );
|
||||
$this->do_remote_get( $feed_url . 'rdf/' );
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to custom purge urls.
|
||||
*/
|
||||
public function custom_purge_urls() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$parse = wp_parse_url( home_url() );
|
||||
|
||||
$purge_urls = isset( $nginx_helper_admin->options['purge_url'] ) && ! empty( $nginx_helper_admin->options['purge_url'] ) ?
|
||||
explode( "\r\n", $nginx_helper_admin->options['purge_url'] ) : array();
|
||||
|
||||
/**
|
||||
* Allow plugins/themes to modify/extend urls.
|
||||
*
|
||||
* @param array $purge_urls URLs which needs to be purged.
|
||||
* @param bool $wildcard If wildcard in url is allowed or not. default false.
|
||||
*/
|
||||
$purge_urls = apply_filters( 'rt_nginx_helper_purge_urls', $purge_urls, false );
|
||||
|
||||
switch ( $nginx_helper_admin->options['purge_method'] ) {
|
||||
|
||||
case 'unlink_files':
|
||||
$_url_purge_base = $parse['scheme'] . '://' . $parse['host'];
|
||||
|
||||
if ( is_array( $purge_urls ) && ! empty( $purge_urls ) ) {
|
||||
|
||||
foreach ( $purge_urls as $purge_url ) {
|
||||
|
||||
$purge_url = trim( $purge_url );
|
||||
|
||||
if ( strpos( $purge_url, '*' ) === false ) {
|
||||
|
||||
$purge_url = $_url_purge_base . $purge_url;
|
||||
$this->log( '- Purging URL | ' . $purge_url );
|
||||
$this->delete_cache_file_for( $purge_url );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'get_request':
|
||||
// Go to default case.
|
||||
default:
|
||||
$_url_purge_base = $this->purge_base_url();
|
||||
|
||||
if ( is_array( $purge_urls ) && ! empty( $purge_urls ) ) {
|
||||
|
||||
foreach ( $purge_urls as $purge_url ) {
|
||||
|
||||
$purge_url = trim( $purge_url );
|
||||
|
||||
if ( strpos( $purge_url, '*' ) === false ) {
|
||||
|
||||
$purge_url = $_url_purge_base . $purge_url;
|
||||
$this->log( '- Purging URL | ' . $purge_url );
|
||||
$this->do_remote_get( $purge_url );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge everything.
|
||||
*/
|
||||
public function purge_all() {
|
||||
|
||||
$this->unlink_recursive( RT_WP_NGINX_HELPER_CACHE_PATH, false );
|
||||
$this->log( '* * * * *' );
|
||||
$this->log( '* Purged Everything!' );
|
||||
$this->log( '* * * * *' );
|
||||
|
||||
/**
|
||||
* Fire an action after the FastCGI cache has been purged.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( 'rt_nginx_helper_after_fastcgi_purge_all' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the base url to call when purging using the "get_request" method.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function purge_base_url() {
|
||||
|
||||
$parse = wp_parse_url( home_url() );
|
||||
|
||||
/**
|
||||
* Filter to change purge suffix for FastCGI cache.
|
||||
*
|
||||
* @param string $suffix Purge suffix. Default is purge.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
$path = apply_filters( 'rt_nginx_helper_fastcgi_purge_suffix', 'purge' );
|
||||
|
||||
// Prevent users from inserting a trailing '/' that could break the url purging.
|
||||
$path = trim( $path, '/' );
|
||||
|
||||
$purge_url_base = $parse['scheme'] . '://' . $parse['host'] . '/' . $path;
|
||||
|
||||
/**
|
||||
* Filter to change purge URL base for FastCGI cache.
|
||||
*
|
||||
* @param string $purge_url_base Purge URL base.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
$purge_url_base = apply_filters( 'rt_nginx_helper_fastcgi_purge_url_base', $purge_url_base );
|
||||
|
||||
// Prevent users from inserting a trailing '/' that could break the url purging.
|
||||
return untrailingslashit( $purge_url_base );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,757 @@
|
||||
<?php
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* Defines the plugin name, version, and two examples hooks for how to
|
||||
* enqueue the admin-specific stylesheet and JavaScript.
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
* @author rtCamp
|
||||
*/
|
||||
class Nginx_Helper_Admin {
|
||||
|
||||
/**
|
||||
* The ID of this plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @var string $plugin_name The ID of this plugin.
|
||||
*/
|
||||
private $plugin_name;
|
||||
|
||||
/**
|
||||
* The version of this plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @var string $version The current version of this plugin.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* Various settings tabs.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @var string $settings_tabs Various settings tabs.
|
||||
*/
|
||||
private $settings_tabs;
|
||||
|
||||
/**
|
||||
* Purge options.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @var string $options Purge options.
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* WP-CLI Command.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @var string $options WP-CLI Command.
|
||||
*/
|
||||
const WP_CLI_COMMAND = 'nginx-helper';
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @param string $plugin_name The name of this plugin.
|
||||
* @param string $version The version of this plugin.
|
||||
*/
|
||||
public function __construct( $plugin_name, $version ) {
|
||||
|
||||
$this->plugin_name = $plugin_name;
|
||||
$this->version = $version;
|
||||
|
||||
/**
|
||||
* Define settings tabs
|
||||
*/
|
||||
$this->settings_tabs = apply_filters(
|
||||
'rt_nginx_helper_settings_tabs',
|
||||
array(
|
||||
'general' => array(
|
||||
'menu_title' => __( 'General', 'nginx-helper' ),
|
||||
'menu_slug' => 'general',
|
||||
),
|
||||
'support' => array(
|
||||
'menu_title' => __( 'Support', 'nginx-helper' ),
|
||||
'menu_slug' => 'support',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$this->options = $this->nginx_helper_settings();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the stylesheets for the admin area.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $hook The current admin page.
|
||||
*/
|
||||
public function enqueue_styles( $hook ) {
|
||||
|
||||
/**
|
||||
* This function is provided for demonstration purposes only.
|
||||
*
|
||||
* An instance of this class should be passed to the run() function
|
||||
* defined in Nginx_Helper_Loader as all of the hooks are defined
|
||||
* in that particular class.
|
||||
*
|
||||
* The Nginx_Helper_Loader will then create the relationship
|
||||
* between the defined hooks and the functions defined in this
|
||||
* class.
|
||||
*/
|
||||
|
||||
if ( 'settings_page_nginx' !== $hook ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style( $this->plugin_name . '-icons', plugin_dir_url( __FILE__ ) . 'icons/css/nginx-fontello.css', array(), $this->version, 'all' );
|
||||
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/nginx-helper-admin.css', array(), $this->version, 'all' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the JavaScript for the admin area.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $hook The current admin page.
|
||||
*/
|
||||
public function enqueue_scripts( $hook ) {
|
||||
|
||||
/**
|
||||
* This function is provided for demonstration purposes only.
|
||||
*
|
||||
* An instance of this class should be passed to the run() function
|
||||
* defined in Nginx_Helper_Loader as all of the hooks are defined
|
||||
* in that particular class.
|
||||
*
|
||||
* The Nginx_Helper_Loader will then create the relationship
|
||||
* between the defined hooks and the functions defined in this
|
||||
* class.
|
||||
*/
|
||||
|
||||
if ( 'settings_page_nginx' !== $hook ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/nginx-helper-admin.js', array( 'jquery' ), $this->version, false );
|
||||
|
||||
$do_localize = array(
|
||||
'purge_confirm_string' => esc_html__( 'Purging entire cache is not recommended. Would you like to continue?', 'nginx-helper' ),
|
||||
);
|
||||
wp_localize_script( $this->plugin_name, 'nginx_helper', $do_localize );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add admin menu.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function nginx_helper_admin_menu() {
|
||||
|
||||
if ( is_multisite() ) {
|
||||
|
||||
add_submenu_page(
|
||||
'settings.php',
|
||||
__( 'Nginx Helper', 'nginx-helper' ),
|
||||
__( 'Nginx Helper', 'nginx-helper' ),
|
||||
'manage_options',
|
||||
'nginx',
|
||||
array( &$this, 'nginx_helper_setting_page' )
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
add_submenu_page(
|
||||
'options-general.php',
|
||||
__( 'Nginx Helper', 'nginx-helper' ),
|
||||
__( 'Nginx Helper', 'nginx-helper' ),
|
||||
'manage_options',
|
||||
'nginx',
|
||||
array( &$this, 'nginx_helper_setting_page' )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add toolbar purge link.
|
||||
*
|
||||
* @param object $wp_admin_bar Admin bar object.
|
||||
*/
|
||||
public function nginx_helper_toolbar_purge_link( $wp_admin_bar ) {
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_admin() ) {
|
||||
$nginx_helper_urls = 'all';
|
||||
$link_title = __( 'Purge Cache', 'nginx-helper' );
|
||||
} else {
|
||||
$nginx_helper_urls = 'current-url';
|
||||
$link_title = __( 'Purge Current Page', 'nginx-helper' );
|
||||
}
|
||||
|
||||
$purge_url = add_query_arg(
|
||||
array(
|
||||
'nginx_helper_action' => 'purge',
|
||||
'nginx_helper_urls' => $nginx_helper_urls,
|
||||
)
|
||||
);
|
||||
|
||||
$nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' );
|
||||
|
||||
$wp_admin_bar->add_menu(
|
||||
array(
|
||||
'id' => 'nginx-helper-purge-all',
|
||||
'title' => $link_title,
|
||||
'href' => $nonced_url,
|
||||
'meta' => array( 'title' => $link_title ),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display settings.
|
||||
*
|
||||
* @global $string $pagenow Contain current admin page.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function nginx_helper_setting_page() {
|
||||
include plugin_dir_path( __FILE__ ) . 'partials/nginx-helper-admin-display.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function nginx_helper_default_settings() {
|
||||
|
||||
return array(
|
||||
'enable_purge' => 0,
|
||||
'cache_method' => 'enable_fastcgi',
|
||||
'purge_method' => 'get_request',
|
||||
'enable_map' => 0,
|
||||
'enable_log' => 0,
|
||||
'log_level' => 'INFO',
|
||||
'log_filesize' => '5',
|
||||
'enable_stamp' => 0,
|
||||
'purge_homepage_on_edit' => 1,
|
||||
'purge_homepage_on_del' => 1,
|
||||
'purge_archive_on_edit' => 1,
|
||||
'purge_archive_on_del' => 1,
|
||||
'purge_archive_on_new_comment' => 0,
|
||||
'purge_archive_on_deleted_comment' => 0,
|
||||
'purge_page_on_mod' => 1,
|
||||
'purge_page_on_new_comment' => 1,
|
||||
'purge_page_on_deleted_comment' => 1,
|
||||
'redis_hostname' => '127.0.0.1',
|
||||
'redis_port' => '6379',
|
||||
'redis_prefix' => 'nginx-cache:',
|
||||
'purge_url' => '',
|
||||
'redis_enabled_by_constant' => 0,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function nginx_helper_settings() {
|
||||
|
||||
$options = get_site_option(
|
||||
'rt_wp_nginx_helper_options',
|
||||
array(
|
||||
'redis_hostname' => '127.0.0.1',
|
||||
'redis_port' => '6379',
|
||||
'redis_prefix' => 'nginx-cache:',
|
||||
)
|
||||
);
|
||||
|
||||
$data = wp_parse_args(
|
||||
$options,
|
||||
$this->nginx_helper_default_settings()
|
||||
);
|
||||
|
||||
$is_redis_enabled = (
|
||||
defined( 'RT_WP_NGINX_HELPER_REDIS_HOSTNAME' ) &&
|
||||
defined( 'RT_WP_NGINX_HELPER_REDIS_PORT' ) &&
|
||||
defined( 'RT_WP_NGINX_HELPER_REDIS_PREFIX' )
|
||||
);
|
||||
|
||||
if ( ! $is_redis_enabled ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$data['redis_enabled_by_constant'] = $is_redis_enabled;
|
||||
$data['enable_purge'] = $is_redis_enabled;
|
||||
$data['cache_method'] = 'enable_redis';
|
||||
$data['redis_hostname'] = RT_WP_NGINX_HELPER_REDIS_HOSTNAME;
|
||||
$data['redis_port'] = RT_WP_NGINX_HELPER_REDIS_PORT;
|
||||
$data['redis_prefix'] = RT_WP_NGINX_HELPER_REDIS_PREFIX;
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Nginx helper setting link function.
|
||||
*
|
||||
* @param array $links links.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function nginx_helper_settings_link( $links ) {
|
||||
|
||||
if ( is_network_admin() ) {
|
||||
$setting_page = 'settings.php';
|
||||
} else {
|
||||
$setting_page = 'options-general.php';
|
||||
}
|
||||
|
||||
$settings_link = '<a href="' . network_admin_url( $setting_page . '?page=nginx' ) . '">' . __( 'Settings', 'nginx-helper' ) . '</a>';
|
||||
array_unshift( $links, $settings_link );
|
||||
|
||||
return $links;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the asset path.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return string asset path of the plugin.
|
||||
*/
|
||||
public function functional_asset_path() {
|
||||
|
||||
$log_path = WP_CONTENT_DIR . '/uploads/nginx-helper/';
|
||||
|
||||
return apply_filters( 'nginx_asset_path', $log_path );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the asset url.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return string asset url of the plugin.
|
||||
*/
|
||||
public function functional_asset_url() {
|
||||
|
||||
$log_url = WP_CONTENT_URL . '/uploads/nginx-helper/';
|
||||
|
||||
return apply_filters( 'nginx_asset_url', $log_url );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get latest news.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function nginx_helper_get_feeds() {
|
||||
|
||||
// Get RSS Feed(s).
|
||||
require_once ABSPATH . WPINC . '/feed.php';
|
||||
|
||||
$maxitems = 0;
|
||||
$rss_items = array();
|
||||
|
||||
// Get a SimplePie feed object from the specified feed source.
|
||||
$rss = fetch_feed( 'https://rtcamp.com/blog/feed/' );
|
||||
|
||||
if ( ! is_wp_error( $rss ) ) { // Checks that the object is created correctly.
|
||||
|
||||
// Figure out how many total items there are, but limit it to 5.
|
||||
$maxitems = $rss->get_item_quantity( 5 );
|
||||
// Build an array of all the items, starting with element 0 (first element).
|
||||
$rss_items = $rss->get_items( 0, $maxitems );
|
||||
|
||||
}
|
||||
?>
|
||||
<ul role="list">
|
||||
<?php
|
||||
if ( 0 === $maxitems ) {
|
||||
echo '<li role="listitem">' . esc_html_e( 'No items', 'nginx-helper' ) . '.</li>';
|
||||
} else {
|
||||
|
||||
// Loop through each feed item and display each item as a hyperlink.
|
||||
foreach ( $rss_items as $item ) {
|
||||
?>
|
||||
<li role="listitem">
|
||||
<?php
|
||||
printf(
|
||||
'<a href="%s" title="%s">%s</a>',
|
||||
esc_url( $item->get_permalink() ),
|
||||
esc_attr__( 'Posted ', 'nginx-helper' ) . esc_attr( $item->get_date( 'j F Y | g:i a' ) ),
|
||||
esc_html( $item->get_title() )
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add time stamps in html.
|
||||
*/
|
||||
public function add_timestamps() {
|
||||
|
||||
global $pagenow;
|
||||
|
||||
if ( is_admin() || 1 !== (int) $this->options['enable_purge'] || 1 !== (int) $this->options['enable_stamp'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $pagenow ) && 'wp-login.php' === $pagenow ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( headers_list() as $header ) {
|
||||
list( $key, $value ) = explode( ':', $header, 2 );
|
||||
$key = strtolower( $key );
|
||||
if ( 'content-type' === $key && strpos( trim( $value ), 'text/html' ) !== 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( 'content-type' === $key ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't add timestamp if run from ajax, cron or wpcli.
|
||||
*/
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$timestamps = "\n<!--" .
|
||||
'Cached using Nginx-Helper on ' . current_time( 'mysql' ) . '. ' .
|
||||
'It took ' . get_num_queries() . ' queries executed in ' . timer_stop() . ' seconds.' .
|
||||
"-->\n" .
|
||||
'<!--Visit http://wordpress.org/extend/plugins/nginx-helper/faq/ for more details-->';
|
||||
|
||||
echo wp_kses( $timestamps, array() );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get map
|
||||
*
|
||||
* @global object $wpdb
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_map() {
|
||||
|
||||
if ( ! $this->options['enable_map'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_multisite() ) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$rt_all_blogs = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
'SELECT blog_id, domain, path FROM ' . $wpdb->blogs . " WHERE site_id = %d AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0'",
|
||||
$wpdb->siteid
|
||||
)
|
||||
);
|
||||
|
||||
$wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
|
||||
|
||||
$rt_domain_map_sites = '';
|
||||
|
||||
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->dmtable}'" ) === $wpdb->dmtable ) { // phpcs:ignore
|
||||
$rt_domain_map_sites = $wpdb->get_results( "SELECT blog_id, domain FROM {$wpdb->dmtable} ORDER BY id DESC" );
|
||||
}
|
||||
|
||||
$rt_nginx_map = '';
|
||||
$rt_nginx_map_array = array();
|
||||
|
||||
if ( $rt_all_blogs ) {
|
||||
|
||||
foreach ( $rt_all_blogs as $blog ) {
|
||||
|
||||
if ( true === SUBDOMAIN_INSTALL ) {
|
||||
$rt_nginx_map_array[ $blog->domain ] = $blog->blog_id;
|
||||
} else {
|
||||
|
||||
if ( 1 !== $blog->blog_id ) {
|
||||
$rt_nginx_map_array[ $blog->path ] = $blog->blog_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $rt_domain_map_sites ) {
|
||||
|
||||
foreach ( $rt_domain_map_sites as $site ) {
|
||||
$rt_nginx_map_array[ $site->domain ] = $site->blog_id;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $rt_nginx_map_array as $domain => $domain_id ) {
|
||||
$rt_nginx_map .= "\t" . $domain . "\t" . $domain_id . ";\n";
|
||||
}
|
||||
|
||||
return $rt_nginx_map;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update map
|
||||
*/
|
||||
public function update_map() {
|
||||
|
||||
if ( is_multisite() ) {
|
||||
|
||||
$rt_nginx_map = $this->get_map();
|
||||
|
||||
$fp = fopen( $this->functional_asset_path() . 'map.conf', 'w+' );
|
||||
if ( $fp ) {
|
||||
fwrite( $fp, $rt_nginx_map );
|
||||
fclose( $fp );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge url when post status is changed.
|
||||
*
|
||||
* @global string $blog_id Blog id.
|
||||
* @global object $nginx_purger Nginx purger variable.
|
||||
*
|
||||
* @param string $new_status New status.
|
||||
* @param string $old_status Old status.
|
||||
* @param object $post Post object.
|
||||
*/
|
||||
public function set_future_post_option_on_future_status( $new_status, $old_status, $post ) {
|
||||
|
||||
global $blog_id, $nginx_purger;
|
||||
|
||||
$exclude_post_types = array( 'nav_menu_item' );
|
||||
|
||||
if ( in_array( $post->post_type, $exclude_post_types, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $this->options['enable_purge'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$purge_status = array( 'publish', 'future' );
|
||||
|
||||
if ( in_array( $old_status, $purge_status, true ) || in_array( $new_status, $purge_status, true ) ) {
|
||||
|
||||
$nginx_purger->log( 'Purge post on transition post STATUS from ' . $old_status . ' to ' . $new_status );
|
||||
$nginx_purger->purge_post( $post->ID );
|
||||
|
||||
}
|
||||
|
||||
if (
|
||||
'future' === $new_status && $post && 'future' === $post->post_status &&
|
||||
(
|
||||
( 'post' === $post->post_type || 'page' === $post->post_type ) ||
|
||||
(
|
||||
isset( $this->options['custom_post_types_recognized'] ) &&
|
||||
in_array( $post->post_type, $this->options['custom_post_types_recognized'], true )
|
||||
)
|
||||
)
|
||||
) {
|
||||
|
||||
$nginx_purger->log( 'Set/update future_posts option ( post id = ' . $post->ID . ' and blog id = ' . $blog_id . ' )' );
|
||||
$this->options['future_posts'][ $blog_id ][ $post->ID ] = strtotime( $post->post_date_gmt ) + 60;
|
||||
update_site_option( 'rt_wp_nginx_helper_options', $this->options );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset future post option on delete
|
||||
*
|
||||
* @global string $blog_id Blog id.
|
||||
* @global object $nginx_purger Nginx helper object.
|
||||
*
|
||||
* @param int $post_id Post id.
|
||||
*/
|
||||
public function unset_future_post_option_on_delete( $post_id ) {
|
||||
|
||||
global $blog_id, $nginx_purger;
|
||||
|
||||
if (
|
||||
! $this->options['enable_purge'] ||
|
||||
empty( $this->options['future_posts'] ) ||
|
||||
empty( $this->options['future_posts'][ $blog_id ] ) ||
|
||||
isset( $this->options['future_posts'][ $blog_id ][ $post_id ] ) ||
|
||||
wp_is_post_revision( $post_id )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nginx_purger->log( 'Unset future_posts option ( post id = ' . $post_id . ' and blog id = ' . $blog_id . ' )' );
|
||||
|
||||
unset( $this->options['future_posts'][ $blog_id ][ $post_id ] );
|
||||
|
||||
if ( ! count( $this->options['future_posts'][ $blog_id ] ) ) {
|
||||
unset( $this->options['future_posts'][ $blog_id ] );
|
||||
}
|
||||
|
||||
update_site_option( 'rt_wp_nginx_helper_options', $this->options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update map when new blog added in multisite.
|
||||
*
|
||||
* @global object $nginx_purger Nginx purger class object.
|
||||
*
|
||||
* @param string $blog_id blog id.
|
||||
*/
|
||||
public function update_new_blog_options( $blog_id ) {
|
||||
|
||||
global $nginx_purger;
|
||||
|
||||
$nginx_purger->log( "New site added ( id $blog_id )" );
|
||||
$this->update_map();
|
||||
$nginx_purger->log( "New site added to nginx map ( id $blog_id )" );
|
||||
$helper_options = $this->nginx_helper_default_settings();
|
||||
update_blog_option( $blog_id, 'rt_wp_nginx_helper_options', $helper_options );
|
||||
$nginx_purger->log( "Default options updated for the new blog ( id $blog_id )" );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge all urls.
|
||||
* Purge current page cache when purging is requested from front
|
||||
* and all urls when requested from admin dashboard.
|
||||
*
|
||||
* @global object $nginx_purger
|
||||
*/
|
||||
public function purge_all() {
|
||||
|
||||
global $nginx_purger, $wp;
|
||||
|
||||
$method = null;
|
||||
if ( isset( $_SERVER['REQUEST_METHOD'] ) ) {
|
||||
$method = wp_strip_all_tags( $_SERVER['REQUEST_METHOD'] );
|
||||
}
|
||||
|
||||
$action = '';
|
||||
if ( 'POST' === $method ) {
|
||||
if ( isset( $_POST['nginx_helper_action'] ) ) {
|
||||
$action = wp_strip_all_tags( $_POST['nginx_helper_action'] );
|
||||
}
|
||||
} else {
|
||||
if ( isset( $_GET['nginx_helper_action'] ) ) {
|
||||
$action = wp_strip_all_tags( $_GET['nginx_helper_action'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $action ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( 'Sorry, you do not have the necessary privileges to edit these options.' );
|
||||
}
|
||||
|
||||
if ( 'done' === $action ) {
|
||||
|
||||
add_action( 'admin_notices', array( &$this, 'display_notices' ) );
|
||||
add_action( 'network_admin_notices', array( &$this, 'display_notices' ) );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
check_admin_referer( 'nginx_helper-purge_all' );
|
||||
|
||||
$current_url = user_trailingslashit( home_url( $wp->request ) );
|
||||
|
||||
if ( ! is_admin() ) {
|
||||
$action = 'purge_current_page';
|
||||
$redirect_url = $current_url;
|
||||
} else {
|
||||
$redirect_url = add_query_arg( array( 'nginx_helper_action' => 'done' ) );
|
||||
}
|
||||
|
||||
switch ( $action ) {
|
||||
case 'purge':
|
||||
$nginx_purger->purge_all();
|
||||
break;
|
||||
case 'purge_current_page':
|
||||
$nginx_purger->purge_url( $current_url );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( 'purge' === $action ) {
|
||||
|
||||
/**
|
||||
* Fire an action after the entire cache has been purged whatever caching type is used.
|
||||
*
|
||||
* @since 2.2.2
|
||||
*/
|
||||
do_action( 'rt_nginx_helper_after_purge_all' );
|
||||
|
||||
}
|
||||
|
||||
wp_redirect( esc_url_raw( $redirect_url ) );
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispay plugin notices.
|
||||
*/
|
||||
public function display_notices() {
|
||||
echo '<div class="updated"><p>' . esc_html__( 'Purge initiated', 'nginx-helper' ) . '</p></div>';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of PhpRedis_Purger
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
* @author rtCamp
|
||||
*/
|
||||
class PhpRedis_Purger extends Purger {
|
||||
|
||||
/**
|
||||
* PHP Redis api object.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @var string $redis_object PHP Redis api object.
|
||||
*/
|
||||
public $redis_object;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
try {
|
||||
|
||||
$this->redis_object = new Redis();
|
||||
$this->redis_object->connect(
|
||||
$nginx_helper_admin->options['redis_hostname'],
|
||||
$nginx_helper_admin->options['redis_port'],
|
||||
5
|
||||
);
|
||||
|
||||
} catch ( Exception $e ) {
|
||||
$this->log( $e->getMessage(), 'ERROR' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge all cache.
|
||||
*/
|
||||
public function purge_all() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$prefix = trim( $nginx_helper_admin->options['redis_prefix'] );
|
||||
|
||||
$this->log( '* * * * *' );
|
||||
|
||||
// If Purge Cache link click from network admin then purge all.
|
||||
if ( is_network_admin() ) {
|
||||
|
||||
$total_keys_purged = $this->delete_keys_by_wildcard( $prefix . '*' );
|
||||
$this->log( '* Purged Everything! * ' );
|
||||
|
||||
} else { // Else purge only site specific cache.
|
||||
|
||||
$parse = wp_parse_url( get_home_url() );
|
||||
$parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
|
||||
$total_keys_purged = $this->delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
|
||||
$this->log( '* ' . get_home_url() . ' Purged! * ' );
|
||||
|
||||
}
|
||||
|
||||
if ( $total_keys_purged ) {
|
||||
$this->log( "Total {$total_keys_purged} urls purged." );
|
||||
} else {
|
||||
$this->log( 'No Cache found.' );
|
||||
}
|
||||
|
||||
$this->log( '* * * * *' );
|
||||
|
||||
/**
|
||||
* Fire an action after the Redis cache has been purged.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( 'rt_nginx_helper_after_redis_purge_all' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge url.
|
||||
*
|
||||
* @param string $url URL to purge.
|
||||
* @param bool $feed Feed or not.
|
||||
*/
|
||||
public function purge_url( $url, $feed = true ) {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
/**
|
||||
* Filters the URL to be purged.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param string $url URL to be purged.
|
||||
*/
|
||||
$url = apply_filters( 'rt_nginx_helper_purge_url', $url );
|
||||
|
||||
$parse = wp_parse_url( $url );
|
||||
|
||||
if ( ! isset( $parse['path'] ) ) {
|
||||
$parse['path'] = '';
|
||||
}
|
||||
|
||||
$prefix = $nginx_helper_admin->options['redis_prefix'];
|
||||
$_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'];
|
||||
|
||||
/**
|
||||
* To delete device type caches such as `<URL>--mobile`, `<URL>--desktop`, `<URL>--lowend`, etc.
|
||||
* This would need $url above to be changed with this filter `rt_nginx_helper_purge_url` by cache key that Nginx sets while generating cache.
|
||||
*
|
||||
* For example: If page is accessed from desktop, then cache will be generated by appending `--desktop` to current URL.
|
||||
* Add this filter in separate plugin or simply in theme's function.php file:
|
||||
* ```
|
||||
* add_filter( 'rt_nginx_helper_purge_url', function( $url ) {
|
||||
* $url = $url . '--*';
|
||||
* return $url;
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Regardless of what key / suffix is being to store `$device_type` cache , it will be deleted.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
if ( strpos( $_url_purge_base, '*' ) === false ) {
|
||||
|
||||
$status = $this->delete_single_key( $_url_purge_base );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge URL | ' . $_url_purge_base );
|
||||
} else {
|
||||
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
|
||||
}
|
||||
} else {
|
||||
|
||||
$status = $this->delete_keys_by_wildcard( $_url_purge_base );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge Wild Card URL | ' . $_url_purge_base . ' | ' . $status . ' url purged' );
|
||||
} else {
|
||||
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
|
||||
}
|
||||
}
|
||||
|
||||
$this->log( '* * * * *' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom purge urls.
|
||||
*/
|
||||
public function custom_purge_urls() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$parse = wp_parse_url( home_url() );
|
||||
$prefix = $nginx_helper_admin->options['redis_prefix'];
|
||||
$_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'];
|
||||
|
||||
$purge_urls = isset( $nginx_helper_admin->options['purge_url'] ) && ! empty( $nginx_helper_admin->options['purge_url'] ) ?
|
||||
explode( "\r\n", $nginx_helper_admin->options['purge_url'] ) : array();
|
||||
|
||||
/**
|
||||
* Allow plugins/themes to modify/extend urls.
|
||||
*
|
||||
* @param array $purge_urls URLs which needs to be purged.
|
||||
* @param bool $wildcard If wildcard in url is allowed or not. default true.
|
||||
*/
|
||||
$purge_urls = apply_filters( 'rt_nginx_helper_purge_urls', $purge_urls, true );
|
||||
|
||||
if ( is_array( $purge_urls ) && ! empty( $purge_urls ) ) {
|
||||
|
||||
foreach ( $purge_urls as $purge_url ) {
|
||||
|
||||
$purge_url = trim( $purge_url );
|
||||
|
||||
if ( strpos( $purge_url, '*' ) === false ) {
|
||||
|
||||
$purge_url = $_url_purge_base . $purge_url;
|
||||
$status = $this->delete_single_key( $purge_url );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge URL | ' . $purge_url );
|
||||
} else {
|
||||
$this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
|
||||
}
|
||||
} else {
|
||||
|
||||
$purge_url = $_url_purge_base . $purge_url;
|
||||
$status = $this->delete_keys_by_wildcard( $purge_url );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge Wild Card URL | ' . $purge_url . ' | ' . $status . ' url purged' );
|
||||
} else {
|
||||
$this->log( '- Cache Not Found | ' . $purge_url, 'ERROR' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single Key Delete Example
|
||||
* e.g. $key can be nginx-cache:httpGETexample.com/
|
||||
*
|
||||
* @param string $key Key.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function delete_single_key( $key ) {
|
||||
|
||||
try {
|
||||
return $this->redis_object->del( $key );
|
||||
} catch ( Exception $e ) {
|
||||
$this->log( $e->getMessage(), 'ERROR' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Keys by wildcard.
|
||||
* e.g. $key can be nginx-cache:httpGETexample.com*
|
||||
*
|
||||
* Lua Script block to delete multiple keys using wildcard
|
||||
* Script will return count i.e. number of keys deleted
|
||||
* if return value is 0, that means no matches were found
|
||||
*
|
||||
* Call redis eval and return value from lua script
|
||||
*
|
||||
* @param string $pattern pattern.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete_keys_by_wildcard( $pattern ) {
|
||||
|
||||
// Lua Script.
|
||||
$lua = <<<LUA
|
||||
local k = 0
|
||||
for i, name in ipairs(redis.call('KEYS', KEYS[1]))
|
||||
do
|
||||
redis.call('DEL', name)
|
||||
k = k+1
|
||||
end
|
||||
return k
|
||||
LUA;
|
||||
|
||||
try {
|
||||
return $this->redis_object->eval( $lua, array( $pattern ), 1 );
|
||||
} catch ( Exception $e ) {
|
||||
$this->log( $e->getMessage(), 'ERROR' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
268
wp/wp-content/plugins/nginx-helper/admin/class-predis-purger.php
Normal file
268
wp/wp-content/plugins/nginx-helper/admin/class-predis-purger.php
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* The admin-specific functionality of the plugin.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of Predis_Purger
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin
|
||||
* @author rtCamp
|
||||
*/
|
||||
class Predis_Purger extends Purger {
|
||||
|
||||
/**
|
||||
* Predis api object.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @var string $redis_object Predis api object.
|
||||
*/
|
||||
public $redis_object;
|
||||
|
||||
/**
|
||||
* Initialize the class and set its properties.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
if ( ! class_exists( 'Predis\Autoloader' ) ) {
|
||||
require_once NGINX_HELPER_BASEPATH . 'admin/predis.php';
|
||||
}
|
||||
|
||||
Predis\Autoloader::register();
|
||||
|
||||
// redis server parameter.
|
||||
$this->redis_object = new Predis\Client(
|
||||
array(
|
||||
'host' => $nginx_helper_admin->options['redis_hostname'],
|
||||
'port' => $nginx_helper_admin->options['redis_port'],
|
||||
)
|
||||
);
|
||||
|
||||
try {
|
||||
$this->redis_object->connect();
|
||||
} catch ( Exception $e ) {
|
||||
$this->log( $e->getMessage(), 'ERROR' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge all.
|
||||
*/
|
||||
public function purge_all() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$prefix = trim( $nginx_helper_admin->options['redis_prefix'] );
|
||||
|
||||
$this->log( '* * * * *' );
|
||||
|
||||
// If Purge Cache link click from network admin then purge all.
|
||||
if ( is_network_admin() ) {
|
||||
|
||||
$this->delete_keys_by_wildcard( $prefix . '*' );
|
||||
$this->log( '* Purged Everything! * ' );
|
||||
|
||||
} else { // Else purge only site specific cache.
|
||||
|
||||
$parse = wp_parse_url( get_home_url() );
|
||||
$parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
|
||||
$this->delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
|
||||
$this->log( '* ' . get_home_url() . ' Purged! * ' );
|
||||
|
||||
}
|
||||
|
||||
$this->log( '* * * * *' );
|
||||
|
||||
/**
|
||||
* Fire an action after the Redis cache has been purged.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
do_action( 'rt_nginx_helper_after_redis_purge_all' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge url.
|
||||
*
|
||||
* @param string $url URL.
|
||||
* @param bool $feed Feed or not.
|
||||
*/
|
||||
public function purge_url( $url, $feed = true ) {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
/**
|
||||
* Filters the URL to be purged.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param string $url URL to be purged.
|
||||
*/
|
||||
$url = apply_filters( 'rt_nginx_helper_purge_url', $url );
|
||||
|
||||
$this->log( '- Purging URL | ' . $url );
|
||||
|
||||
$parse = wp_parse_url( $url );
|
||||
|
||||
if ( ! isset( $parse['path'] ) ) {
|
||||
$parse['path'] = '';
|
||||
}
|
||||
|
||||
$prefix = $nginx_helper_admin->options['redis_prefix'];
|
||||
$_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'];
|
||||
|
||||
/**
|
||||
* To delete device type caches such as `<URL>--mobile`, `<URL>--desktop`, `<URL>--lowend`, etc.
|
||||
* This would need $url above to be changed with this filter `rt_nginx_helper_purge_url` by cache key that Nginx sets while generating cache.
|
||||
*
|
||||
* For example: If page is accessed from desktop, then cache will be generated by appending `--desktop` to current URL.
|
||||
* Add this filter in separate plugin or simply in theme's function.php file:
|
||||
* ```
|
||||
* add_filter( 'rt_nginx_helper_purge_url', function( $url ) {
|
||||
* $url = $url . '--*';
|
||||
* return $url;
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Regardless of what key / suffix is being to store `$device_type` cache , it will be deleted.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
if ( strpos( $_url_purge_base, '*' ) === false ) {
|
||||
|
||||
$status = $this->delete_single_key( $_url_purge_base );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge URL | ' . $_url_purge_base );
|
||||
} else {
|
||||
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
|
||||
}
|
||||
} else {
|
||||
|
||||
$status = $this->delete_keys_by_wildcard( $_url_purge_base );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge Wild Card URL | ' . $_url_purge_base . ' | ' . $status . ' url purged' );
|
||||
} else {
|
||||
$this->log( '- Cache Not Found | ' . $_url_purge_base, 'ERROR' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom purge urls.
|
||||
*/
|
||||
public function custom_purge_urls() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$parse = wp_parse_url( home_url() );
|
||||
$prefix = $nginx_helper_admin->options['redis_prefix'];
|
||||
$_url_purge_base = $prefix . $parse['scheme'] . 'GET' . $parse['host'];
|
||||
|
||||
$purge_urls = isset( $nginx_helper_admin->options['purge_url'] ) && ! empty( $nginx_helper_admin->options['purge_url'] ) ?
|
||||
explode( "\r\n", $nginx_helper_admin->options['purge_url'] ) : array();
|
||||
|
||||
/**
|
||||
* Allow plugins/themes to modify/extend urls.
|
||||
*
|
||||
* @param array $purge_urls URLs which needs to be purged.
|
||||
* @param bool $wildcard If wildcard in url is allowed or not. default true.
|
||||
*/
|
||||
$purge_urls = apply_filters( 'rt_nginx_helper_purge_urls', $purge_urls, true );
|
||||
|
||||
if ( is_array( $purge_urls ) && ! empty( $purge_urls ) ) {
|
||||
|
||||
foreach ( $purge_urls as $purge_url ) {
|
||||
|
||||
$purge_url = trim( $purge_url );
|
||||
|
||||
if ( strpos( $purge_url, '*' ) === false ) {
|
||||
|
||||
$purge_url = $_url_purge_base . $purge_url;
|
||||
$status = $this->delete_single_key( $purge_url );
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge URL | ' . $purge_url );
|
||||
} else {
|
||||
$this->log( '- Not Found | ' . $purge_url, 'ERROR' );
|
||||
}
|
||||
} else {
|
||||
|
||||
$purge_url = $_url_purge_base . $purge_url;
|
||||
$status = $this->delete_keys_by_wildcard( $purge_url );
|
||||
|
||||
if ( $status ) {
|
||||
$this->log( '- Purge Wild Card URL | ' . $purge_url . ' | ' . $status . ' url purged' );
|
||||
} else {
|
||||
$this->log( '- Not Found | ' . $purge_url, 'ERROR' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Single Key Delete Example
|
||||
* e.g. $key can be nginx-cache:httpGETexample.com/
|
||||
*
|
||||
* @param string $key Key to delete cache.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete_single_key( $key ) {
|
||||
|
||||
try {
|
||||
return $this->redis_object->executeRaw( array( 'DEL', $key ) );
|
||||
} catch ( Exception $e ) {
|
||||
$this->log( $e->getMessage(), 'ERROR' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Keys by wildcard.
|
||||
* e.g. $key can be nginx-cache:httpGETexample.com*
|
||||
*
|
||||
* Lua Script block to delete multiple keys using wildcard
|
||||
* Script will return count i.e. number of keys deleted
|
||||
* if return value is 0, that means no matches were found
|
||||
*
|
||||
* Call redis eval and return value from lua script
|
||||
*
|
||||
* @param string $pattern Pattern.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete_keys_by_wildcard( $pattern ) {
|
||||
|
||||
// Lua Script.
|
||||
$lua = <<<LUA
|
||||
local k = 0
|
||||
for i, name in ipairs(redis.call('KEYS', KEYS[1]))
|
||||
do
|
||||
redis.call('DEL', name)
|
||||
k = k+1
|
||||
end
|
||||
return k
|
||||
LUA;
|
||||
|
||||
try {
|
||||
return $this->redis_object->eval( $lua, 1, $pattern );
|
||||
} catch ( Exception $e ) {
|
||||
$this->log( $e->getMessage(), 'ERROR' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1262
wp/wp-content/plugins/nginx-helper/admin/class-purger.php
Normal file
1262
wp/wp-content/plugins/nginx-helper/admin/class-purger.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* All of the CSS for your admin-specific functionality should be
|
||||
* included in this file.
|
||||
*/
|
||||
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
h4 {
|
||||
margin: 0;
|
||||
}
|
||||
.form-table th,
|
||||
.form-wrap label {
|
||||
vertical-align: middle;
|
||||
}
|
||||
table.rtnginx-table {
|
||||
border-bottom: 1px solid #EEE;
|
||||
}
|
||||
table.rtnginx-table:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.rtnginx-table p.error {
|
||||
color: red;
|
||||
}
|
||||
pre#map {
|
||||
background: #e5e5e5 none;
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
.wrap h2.rt_option_title {
|
||||
background: url(../icons/nginx-icon-32x32.png) 0 6px no-repeat rgba(0, 0, 0, 0);
|
||||
padding-left: 40px;
|
||||
}
|
||||
#poststuff h2 {
|
||||
padding: 0 0 0 10px;
|
||||
margin-top: 0;
|
||||
}
|
||||
form#purgeall .button-primary {
|
||||
margin-bottom: 20px;
|
||||
box-shadow: inset 0 -2px rgba(0, 0, 0, 0.14);
|
||||
padding: 15px 30px;
|
||||
font-size: 1rem;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
color: #FFF;
|
||||
background: #DD3D36;
|
||||
height: auto;
|
||||
}
|
||||
form#purgeall .button-primary:hover,
|
||||
form#purgeall .button-primary:focus {
|
||||
background: #d52c24;
|
||||
}
|
||||
.nh-aligncenter {
|
||||
display: block;
|
||||
text-align: center;
|
||||
line-height: 2;
|
||||
}
|
||||
#latest_news .inside ul,
|
||||
#useful-links .inside ul {
|
||||
margin: 0 0 0 12px;
|
||||
}
|
||||
#latest_news .inside ul li,
|
||||
#useful-links .inside ul li {
|
||||
list-style: square;
|
||||
padding: 0 0 7px;
|
||||
}
|
||||
#social .inside a {
|
||||
background-color: #666;
|
||||
color: #FFF;
|
||||
display: inline-block;
|
||||
height: 30px;
|
||||
font-size: 1.25rem;
|
||||
line-height: 30px;
|
||||
margin: 10px 20px 0 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
width: 30px;
|
||||
-webkit-border-radius: 1000px;
|
||||
-moz-border-radius: 1000px;
|
||||
border-radius: 1000px;
|
||||
}
|
||||
|
||||
#social .inside .nginx-helper-facebook:hover {
|
||||
background-color: #537BBD;
|
||||
}
|
||||
#social .inside .nginx-helper-twitter:hover {
|
||||
background-color: #40BFF5;
|
||||
}
|
||||
|
||||
.rt-purge_url { width: 100%; }
|
||||
34
wp/wp-content/plugins/nginx-helper/admin/icons/config.json
Normal file
34
wp/wp-content/plugins/nginx-helper/admin/icons/config.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "nginx-fontello",
|
||||
"css_prefix_text": "nginx-helper-",
|
||||
"css_use_suffix": false,
|
||||
"hinting": true,
|
||||
"units_per_em": 1000,
|
||||
"ascent": 850,
|
||||
"glyphs": [
|
||||
{
|
||||
"uid": "72b1277834cba5b7944b0a6cac7ddb0d",
|
||||
"css": "rss",
|
||||
"code": 59395,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "627abcdb627cb1789e009c08e2678ef9",
|
||||
"css": "twitter",
|
||||
"code": 59394,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "bc50457410acf467b8b5721240768742",
|
||||
"css": "facebook",
|
||||
"code": 59393,
|
||||
"src": "entypo"
|
||||
},
|
||||
{
|
||||
"uid": "b945f4ac2439565661e8e4878e35d379",
|
||||
"css": "gplus",
|
||||
"code": 59392,
|
||||
"src": "entypo"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
@font-face {
|
||||
font-family: 'nginx-fontello';
|
||||
src: url('../font/nginx-fontello.eot?7388141');
|
||||
src: url('../font/nginx-fontello.eot?7388141#iefix') format('embedded-opentype'),
|
||||
url('../font/nginx-fontello.woff?7388141') format('woff'),
|
||||
url('../font/nginx-fontello.ttf?7388141') format('truetype'),
|
||||
url('../font/nginx-fontello.svg?7388141#nginx-fontello') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
||||
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
||||
/* // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
@font-face {
|
||||
font-family: 'nginx-fontello';
|
||||
src: url('../font/nginx-fontello.svg?7388141#nginx-fontello') format('svg');
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[class^="nginx-helper-"]:before, [class*=" nginx-helper-"]:before {
|
||||
font-family: "nginx-fontello";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: none;
|
||||
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
/* opacity: .8; */
|
||||
|
||||
/* For safety - reset parent styles, that can break glyph codes*/
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* fix buttons height, for twitter bootstrap */
|
||||
line-height: 1em;
|
||||
|
||||
/* Animation center compensation - margins should be symmetric */
|
||||
/* remove if not needed */
|
||||
margin-left: .2em;
|
||||
|
||||
/* you can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
|
||||
/* Uncomment for 3D effect */
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
|
||||
.nginx-helper-twitter:before { content: '\e802'; } /* '' */
|
||||
.nginx-helper-facebook:before { content: '\e801'; } /* '' */
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2013 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="nginx-fontello" horiz-adv-x="1000" >
|
||||
<font-face font-family="nginx-fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
<missing-glyph horiz-adv-x="1000" />
|
||||
<glyph glyph-name="rss" unicode="" d="m214 100q0-45-31-76t-76-31t-76 31t-31 76t31 76t76 31t76-31t31-76z m286-69q1-15-9-26q-11-12-27-12h-75q-14 0-24 9t-11 23q-12 128-103 219t-219 103q-14 1-23 11t-9 24v75q0 16 12 26q9 10 24 10h3q89-7 170-45t145-101q63-63 101-145t45-171z m286-1q1-15-10-26q-10-11-26-11h-80q-14 0-25 10t-11 23q-6 120-56 228t-129 188t-188 129t-227 57q-14 0-24 11t-10 24v80q0 15 11 26q10 10 25 10h1q147-8 280-67t238-164q104-104 164-238t67-280z" horiz-adv-x="785.7" />
|
||||
<glyph glyph-name="twitter" unicode="" d="m904 622q-37-54-90-93q0-8 0-23q0-73-21-145t-64-139t-103-117t-144-82t-181-30q-151 0-276 81q19-3 43-3q126 0 224 77q-59 2-105 36t-64 89q19-2 34-2q24 0 48 6q-63 13-104 62t-41 115v2q38-21 82-23q-37 25-59 64t-22 86q0 49 25 91q68-83 164-133t208-55q-5 21-5 41q0 75 53 127t127 53q79 0 132-57q61 12 114 44q-20-64-79-100q52 6 104 28z" horiz-adv-x="928.6" />
|
||||
<glyph glyph-name="facebook" unicode="" d="m500 644l-142 0q-14 0-25-15t-11-37l0-102l178 0l0-148l-178 0l0-442l-170 0l0 442l-152 0l0 148l152 0l0 86q0 94 59 159t147 65l142 0l0-156z" horiz-adv-x="500" />
|
||||
<glyph glyph-name="gplus" unicode="" d="m48 572q0 58 25 102t56 65t69 34t56 15t26 2l230 0l0-4q0-22-78-36q-28 0-38-6q40-20 54-56t14-96q0-102-68-158q-38-38-38-54q0-18 50-64q104-90 104-178q0-140-116-194q-68-34-150-34l-4 0l-4 2q-2-2-4-2q-24 0-54 5t-75 21t-74 57t-29 103q0 60 32 101t83 57t88 22t71 6l2 0q-16 22-24 47t-8 39l2 14l-14 0q-64 0-110 30q-74 44-74 160z m370-452q-4 52-43 84t-103 32l-16 0q-64-2-114-46q-46-42-42-94t53-80t119-24q68 4 109 40t37 88z m-60 500q-30 108-122 108q-12 0-20-2q-40-12-58-62q-16-50-2-106q14-52 47-85t71-33q12 0 18 2q42 12 63 65t3 113z m388-174l150 0l0-94l-150 0l0-150l-94 0l0 150l-150 0l0 94l150 0l0 150l94 0l0-150z" horiz-adv-x="896" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
8
wp/wp-content/plugins/nginx-helper/admin/index.php
Normal file
8
wp/wp-content/plugins/nginx-helper/admin/index.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
// Silence.
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* File to add JavaScript for nginx-helper.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* All of the code for your admin-specific JavaScript source
|
||||
* should reside in this file.
|
||||
*
|
||||
* Note that this assume you're going to use jQuery, so it prepares
|
||||
* the $ function reference to be used within the scope of this
|
||||
* function.
|
||||
*
|
||||
* From here, you're able to define handlers for when the DOM is
|
||||
* ready:
|
||||
*
|
||||
* $(function() {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* Or when the window is loaded:
|
||||
*
|
||||
* $( window ).load(function() {
|
||||
*
|
||||
* });
|
||||
*
|
||||
* ...and so on.
|
||||
*
|
||||
* Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler
|
||||
* for any particular page. Though other scripts in WordPress core, other plugins, and other themes may
|
||||
* be doing this, we should try to minimize doing that in our own work.
|
||||
*/
|
||||
$(
|
||||
function () {
|
||||
|
||||
var news_section = jQuery( '#latest_news' );
|
||||
|
||||
if ( news_section.length > 0 ) {
|
||||
|
||||
var args = {
|
||||
'action': 'rt_get_feeds'
|
||||
};
|
||||
|
||||
jQuery.get(
|
||||
ajaxurl,
|
||||
args,
|
||||
function( data ) {
|
||||
/**
|
||||
* Received markup is safe and escaped appropriately.
|
||||
*
|
||||
* File: admin/class-nginx-helper-admin.php
|
||||
* Method: nginx_helper_get_feeds();
|
||||
*/
|
||||
|
||||
// phpcs:ignore -- WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
|
||||
news_section.find( '.inside' ).empty().append( data );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
jQuery( "form#purgeall a" ).click(
|
||||
function (e) {
|
||||
|
||||
if ( confirm( nginx_helper.purge_confirm_string ) === true ) {
|
||||
// Continue submitting form.
|
||||
} else {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Show OR Hide options on option checkbox
|
||||
*
|
||||
* @param {type} selector Selector of Checkbox and PostBox
|
||||
*/
|
||||
function nginx_show_option( selector ) {
|
||||
|
||||
jQuery( '#' + selector ).on(
|
||||
'change',
|
||||
function () {
|
||||
|
||||
if ( jQuery( this ).is( ':checked' ) ) {
|
||||
|
||||
jQuery( '.' + selector ).show();
|
||||
|
||||
if ( 'cache_method_redis' === selector ) {
|
||||
jQuery( '.cache_method_fastcgi' ).hide();
|
||||
} else if ( selector === 'cache_method_fastcgi' ) {
|
||||
jQuery( '.cache_method_redis' ).hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
jQuery( '.' + selector ).hide();
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/* Function call with parameter */
|
||||
nginx_show_option( 'cache_method_fastcgi' );
|
||||
nginx_show_option( 'cache_method_redis' );
|
||||
nginx_show_option( 'enable_map' );
|
||||
nginx_show_option( 'enable_log' );
|
||||
nginx_show_option( 'enable_purge' );
|
||||
|
||||
}
|
||||
);
|
||||
})( jQuery );
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Provide a admin area view for the plugin
|
||||
*
|
||||
* This file is used to markup the admin-facing aspects of the plugin.
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin/partials
|
||||
*/
|
||||
|
||||
global $pagenow;
|
||||
?>
|
||||
|
||||
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
||||
|
||||
<div class="wrap rt-nginx-wrapper">
|
||||
<h2 class="rt_option_title">
|
||||
<?php esc_html_e( 'Nginx Settings', 'nginx-helper' ); ?>
|
||||
</h2>
|
||||
<div id="poststuff">
|
||||
<div id="post-body" class="metabox-holder columns-2">
|
||||
<div id="post-body-content">
|
||||
<?php
|
||||
/* Show settinhs tabs */
|
||||
$current_tab = ( isset( $_GET['tab'] ) ? wp_strip_all_tags( $_GET['tab'] ) : '' );
|
||||
$current_setting_tab = ( ! empty( $current_tab ) ) ? $current_tab : 'general';
|
||||
|
||||
echo '<h2 class="nav-tab-wrapper">';
|
||||
foreach ( $this->settings_tabs as $setting_tab => $setting_name ) {
|
||||
|
||||
$class = ( $setting_tab === $current_setting_tab ) ? ' nav-tab-active' : '';
|
||||
printf(
|
||||
'<a class="%s" href="%s">%s</a>',
|
||||
esc_attr( 'nav-tab' . $class ),
|
||||
esc_url( '?page=nginx&tab=' . $setting_name['menu_slug'] ),
|
||||
esc_html( $setting_name['menu_title'] )
|
||||
);
|
||||
}
|
||||
echo '</h2>';
|
||||
|
||||
switch ( $current_setting_tab ) {
|
||||
|
||||
case 'general':
|
||||
include plugin_dir_path( __FILE__ ) . 'nginx-helper-general-options.php';
|
||||
break;
|
||||
case 'support':
|
||||
include plugin_dir_path( __FILE__ ) . 'nginx-helper-support-options.php';
|
||||
break;
|
||||
|
||||
}
|
||||
?>
|
||||
</div> <!-- End of #post-body-content -->
|
||||
<div id="postbox-container-1" class="postbox-container">
|
||||
<?php
|
||||
require plugin_dir_path( __FILE__ ) . 'nginx-helper-sidebar-display.php';
|
||||
?>
|
||||
</div> <!-- End of #postbox-container-1 -->
|
||||
</div> <!-- End of #post-body -->
|
||||
</div> <!-- End of #poststuff -->
|
||||
</div> <!-- End of .wrap .rt-nginx-wrapper -->
|
||||
@@ -0,0 +1,733 @@
|
||||
<?php
|
||||
/**
|
||||
* Display general options of the plugin.
|
||||
*
|
||||
* This file is used to markup the admin-facing aspects of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin/partials
|
||||
*/
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$error_log_filesize = false;
|
||||
|
||||
$args = array(
|
||||
'enable_purge',
|
||||
'enable_stamp',
|
||||
'purge_method',
|
||||
'is_submit',
|
||||
'redis_hostname',
|
||||
'redis_port',
|
||||
'redis_prefix',
|
||||
'purge_homepage_on_edit',
|
||||
'purge_homepage_on_del',
|
||||
'purge_url',
|
||||
'log_level',
|
||||
'log_filesize',
|
||||
'smart_http_expire_save',
|
||||
'cache_method',
|
||||
'enable_map',
|
||||
'enable_log',
|
||||
'purge_archive_on_edit',
|
||||
'purge_archive_on_del',
|
||||
'purge_archive_on_new_comment',
|
||||
'purge_archive_on_deleted_comment',
|
||||
'purge_page_on_mod',
|
||||
'purge_page_on_new_comment',
|
||||
'purge_page_on_deleted_comment',
|
||||
'smart_http_expire_form_nonce',
|
||||
);
|
||||
|
||||
$all_inputs = array();
|
||||
|
||||
foreach ( $args as $val ) {
|
||||
if ( isset( $_POST[ $val ] ) ) {
|
||||
$all_inputs[ $val ] = wp_strip_all_tags( $_POST[ $val ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $all_inputs['smart_http_expire_save'] ) && wp_verify_nonce( $all_inputs['smart_http_expire_form_nonce'], 'smart-http-expire-form-nonce' ) ) {
|
||||
unset( $all_inputs['smart_http_expire_save'] );
|
||||
unset( $all_inputs['is_submit'] );
|
||||
|
||||
$nginx_settings = wp_parse_args(
|
||||
$all_inputs,
|
||||
$nginx_helper_admin->nginx_helper_default_settings()
|
||||
);
|
||||
|
||||
if ( ( ! is_numeric( $nginx_settings['log_filesize'] ) ) || ( empty( $nginx_settings['log_filesize'] ) ) ) {
|
||||
$error_log_filesize = __( 'Log file size must be a number.', 'nginx-helper' );
|
||||
unset( $nginx_settings['log_filesize'] );
|
||||
}
|
||||
|
||||
if ( $nginx_settings['enable_map'] ) {
|
||||
$nginx_helper_admin->update_map();
|
||||
}
|
||||
|
||||
update_site_option( 'rt_wp_nginx_helper_options', $nginx_settings );
|
||||
|
||||
echo '<div class="updated"><p>' . esc_html__( 'Settings saved.', 'nginx-helper' ) . '</p></div>';
|
||||
|
||||
}
|
||||
|
||||
$nginx_helper_settings = $nginx_helper_admin->nginx_helper_settings();
|
||||
$log_path = $nginx_helper_admin->functional_asset_path();
|
||||
$log_url = $nginx_helper_admin->functional_asset_url();
|
||||
|
||||
/**
|
||||
* Get setting url for single multiple with subdomain OR multiple with subdirectory site.
|
||||
*/
|
||||
$nginx_setting_link = '#';
|
||||
if ( is_multisite() ) {
|
||||
if ( SUBDOMAIN_INSTALL === false ) {
|
||||
$nginx_setting_link = 'https://easyengine.io/wordpress-nginx/tutorials/multisite/subdirectories/fastcgi-cache-with-purging/';
|
||||
} else {
|
||||
$nginx_setting_link = 'https://easyengine.io/wordpress-nginx/tutorials/multisite/subdomains/fastcgi-cache-with-purging/';
|
||||
}
|
||||
} else {
|
||||
$nginx_setting_link = 'https://easyengine.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/';
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Forms containing nginx helper settings options. -->
|
||||
<form id="post_form" method="post" action="#" name="smart_http_expire_form" class="clearfix">
|
||||
<div class="postbox">
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Purging Options', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="enable_purge" name="enable_purge" <?php checked( $nginx_helper_settings['enable_purge'], 1 ); ?> />
|
||||
<label for="enable_purge"><?php esc_html_e( 'Enable Purge', 'nginx-helper' ); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
|
||||
<?php if ( ! ( ! is_network_admin() && is_multisite() ) ) { ?>
|
||||
<div class="postbox enable_purge"<?php echo ( empty( $nginx_helper_settings['enable_purge'] ) ) ? ' style="display: none;"' : ''; ?>>
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Caching Method', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<input type="hidden" name="is_submit" value="1" />
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="radio" value="enable_fastcgi" id="cache_method_fastcgi" name="cache_method" <?php echo checked( $nginx_helper_settings['cache_method'], 'enable_fastcgi' ); ?> />
|
||||
<label for="cache_method_fastcgi">
|
||||
<?php
|
||||
printf(
|
||||
'%s (<a target="_blank" href="%s" title="%s">%s</a>)',
|
||||
esc_html__( 'nginx Fastcgi cache', 'nginx-helper' ),
|
||||
esc_url( $nginx_setting_link ),
|
||||
esc_attr__( 'External settings for nginx', 'nginx-helper' ),
|
||||
esc_html__( 'requires external settings for nginx', 'nginx-helper' )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="radio" value="enable_redis" id="cache_method_redis" name="cache_method" <?php echo checked( $nginx_helper_settings['cache_method'], 'enable_redis' ); ?> />
|
||||
<label for="cache_method_redis">
|
||||
<?php printf( esc_html__( 'Redis cache', 'nginx-helper' ) ); ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
<div class="enable_purge">
|
||||
<div class="postbox cache_method_fastcgi" <?php echo ( ! empty( $nginx_helper_settings['enable_purge'] ) && 'enable_fastcgi' === $nginx_helper_settings['cache_method'] ) ? '' : 'style="display: none;"'; ?> >
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Purge Method', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php esc_html_e( 'when a post/page/custom post is published.', 'nginx-helper' ); ?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_method_get_request">
|
||||
<input type="radio" value="get_request" id="purge_method_get_request" name="purge_method" <?php checked( $nginx_helper_settings['purge_method'], 'get_request' ); ?>>
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
'%1$s <strong>PURGE/url</strong> %2$s',
|
||||
esc_html__( 'Using a GET request to', 'nginx-helper' ),
|
||||
esc_html__( '(Default option)', 'nginx-helper' )
|
||||
),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
<br />
|
||||
<small>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
// translators: %s Nginx cache purge module link.
|
||||
__( 'Uses the %s module.', 'nginx-helper' ),
|
||||
'<strong><a href="https://github.com/FRiCKLE/ngx_cache_purge">ngx_cache_purge</a></strong>'
|
||||
),
|
||||
array(
|
||||
'strong' => array(),
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</small>
|
||||
</label>
|
||||
<br />
|
||||
<label for="purge_method_unlink_files">
|
||||
<input type="radio" value="unlink_files" id="purge_method_unlink_files" name="purge_method" <?php checked( $nginx_helper_settings['purge_method'], 'unlink_files' ); ?>>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'Delete local server cache files', 'nginx-helper' );
|
||||
?>
|
||||
<br />
|
||||
<small>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'Checks for matching cache file in <strong>RT_WP_NGINX_HELPER_CACHE_PATH</strong>. Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key "$scheme$request_method$host$request_uri").', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</small>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
<div class="postbox cache_method_redis"<?php echo ( ! empty( $nginx_helper_settings['enable_purge'] ) && 'enable_redis' === $nginx_helper_settings['cache_method'] ) ? '' : ' style="display: none;"'; ?>>
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Redis Settings', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr>
|
||||
<th><label for="redis_hostname"><?php esc_html_e( 'Hostname', 'nginx-helper' ); ?></label></th>
|
||||
<td>
|
||||
<input id="redis_hostname" class="medium-text" type="text" name="redis_hostname" value="<?php echo esc_attr( $nginx_helper_settings['redis_hostname'] ); ?>" <?php echo ( $nginx_helper_settings['redis_enabled_by_constant'] ) ? 'readonly="readonly"' : ''; ?> />
|
||||
<?php
|
||||
if ( $nginx_helper_settings['redis_enabled_by_constant'] ) {
|
||||
|
||||
echo '<p class="description">';
|
||||
esc_html_e( 'Overridden by constant variables.', 'nginx-helper' );
|
||||
echo '</p>';
|
||||
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="redis_port"><?php esc_html_e( 'Port', 'nginx-helper' ); ?></label></th>
|
||||
<td>
|
||||
<input id="redis_port" class="medium-text" type="text" name="redis_port" value="<?php echo esc_attr( $nginx_helper_settings['redis_port'] ); ?>" <?php echo ( $nginx_helper_settings['redis_enabled_by_constant'] ) ? 'readonly="readonly"' : ''; ?> />
|
||||
<?php
|
||||
if ( $nginx_helper_settings['redis_enabled_by_constant'] ) {
|
||||
|
||||
echo '<p class="description">';
|
||||
esc_html_e( 'Overridden by constant variables.', 'nginx-helper' );
|
||||
echo '</p>';
|
||||
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="redis_prefix"><?php esc_html_e( 'Prefix', 'nginx-helper' ); ?></label></th>
|
||||
<td>
|
||||
<input id="redis_prefix" class="medium-text" type="text" name="redis_prefix" value="<?php echo esc_attr( $nginx_helper_settings['redis_prefix'] ); ?>" <?php echo ( $nginx_helper_settings['redis_enabled_by_constant'] ) ? 'readonly="readonly"' : ''; ?> />
|
||||
<?php
|
||||
if ( $nginx_helper_settings['redis_enabled_by_constant'] ) {
|
||||
|
||||
echo '<p class="description">';
|
||||
esc_html_e( 'Overridden by constant variables.', 'nginx-helper' );
|
||||
echo '</p>';
|
||||
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="postbox enable_purge"<?php echo ( empty( $nginx_helper_settings['enable_purge'] ) ) ? ' style="display: none;"' : ''; ?>>
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Purging Conditions', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr valign="top">
|
||||
<th scope="row"><h4><?php esc_html_e( 'Purge Homepage:', 'nginx-helper' ); ?></h4></th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when a post/page/custom post is modified or added.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_homepage_on_edit">
|
||||
<input type="checkbox" value="1" id="purge_homepage_on_edit" name="purge_homepage_on_edit" <?php checked( $nginx_helper_settings['purge_homepage_on_edit'], 1 ); ?> />
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when an existing post/page/custom post is modified.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_homepage_on_del">
|
||||
<input type="checkbox" value="1" id="purge_homepage_on_del" name="purge_homepage_on_del" <?php checked( $nginx_helper_settings['purge_homepage_on_del'], 1 ); ?> />
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr valign="top">
|
||||
<th scope="row">
|
||||
<h4>
|
||||
<?php esc_html_e( 'Purge Post/Page/Custom Post Type:', 'nginx-helper' ); ?>
|
||||
</h4>
|
||||
</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
<?php
|
||||
esc_html_e( 'when a post/page/custom post is published.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_page_on_mod">
|
||||
<input type="checkbox" value="1" id="purge_page_on_mod" name="purge_page_on_mod" <?php checked( $nginx_helper_settings['purge_page_on_mod'], 1 ); ?>>
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>post</strong> is <strong>published</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when a comment is approved/published.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_page_on_new_comment">
|
||||
<input type="checkbox" value="1" id="purge_page_on_new_comment" name="purge_page_on_new_comment" <?php checked( $nginx_helper_settings['purge_page_on_new_comment'], 1 ); ?>>
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>comment</strong> is <strong>approved/published</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when a comment is unapproved/deleted.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_page_on_deleted_comment">
|
||||
<input type="checkbox" value="1" id="purge_page_on_deleted_comment" name="purge_page_on_deleted_comment" <?php checked( $nginx_helper_settings['purge_page_on_deleted_comment'], 1 ); ?>>
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>comment</strong> is <strong>unapproved/deleted</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr valign="top">
|
||||
<th scope="row">
|
||||
<h4>
|
||||
<?php esc_html_e( 'Purge Archives:', 'nginx-helper' ); ?>
|
||||
</h4>
|
||||
<small><?php esc_html_e( '(date, category, tag, author, custom taxonomies)', 'nginx-helper' ); ?></small>
|
||||
</th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when an post/page/custom post is modified or added', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_archive_on_edit">
|
||||
<input type="checkbox" value="1" id="purge_archive_on_edit" name="purge_archive_on_edit" <?php checked( $nginx_helper_settings['purge_archive_on_edit'], 1 ); ?> />
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when an existing post/page/custom post is trashed.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_archive_on_del">
|
||||
<input type="checkbox" value="1" id="purge_archive_on_del" name="purge_archive_on_del"<?php checked( $nginx_helper_settings['purge_archive_on_del'], 1 ); ?> />
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
<br />
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when a comment is approved/published.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_archive_on_new_comment">
|
||||
<input type="checkbox" value="1" id="purge_archive_on_new_comment" name="purge_archive_on_new_comment" <?php checked( $nginx_helper_settings['purge_archive_on_new_comment'], 1 ); ?> />
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>comment</strong> is <strong>approved/published</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text">
|
||||
<span>
|
||||
|
||||
<?php
|
||||
esc_html_e( 'when a comment is unapproved/deleted.', 'nginx-helper' );
|
||||
?>
|
||||
</span>
|
||||
</legend>
|
||||
<label for="purge_archive_on_deleted_comment">
|
||||
<input type="checkbox" value="1" id="purge_archive_on_deleted_comment" name="purge_archive_on_deleted_comment" <?php checked( $nginx_helper_settings['purge_archive_on_deleted_comment'], 1 ); ?> />
|
||||
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__( 'when a <strong>comment</strong> is <strong>unapproved/deleted</strong>.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
<br />
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr valign="top">
|
||||
<th scope="row">
|
||||
<h4><?php esc_html_e( 'Custom Purge URL:', 'nginx-helper' ); ?></h4>
|
||||
</th>
|
||||
<td>
|
||||
<textarea rows="5"class="rt-purge_url" id="purge_url" name="purge_url"><?php echo esc_textarea( $nginx_helper_settings['purge_url'] ); ?></textarea>
|
||||
<p class="description">
|
||||
<?php
|
||||
esc_html_e( 'Add one URL per line. URL should not contain domain name.', 'nginx-helper' );
|
||||
echo '<br>';
|
||||
echo wp_kses(
|
||||
__( 'Eg: To purge http://example.com/sample-page/ add <strong>/sample-page/</strong> in above textarea.', 'nginx-helper' ),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
echo '<br>';
|
||||
esc_html_e( "'*' will only work with redis cache server.", 'nginx-helper' );
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
<div class="postbox">
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Debug Options', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<input type="hidden" name="is_submit" value="1" />
|
||||
<table class="form-table">
|
||||
<?php if ( is_network_admin() ) { ?>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="enable_map" name="enable_map" <?php checked( $nginx_helper_settings['enable_map'], 1 ); ?> />
|
||||
<label for="enable_map">
|
||||
<?php esc_html_e( 'Enable Nginx Map.', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $nginx_helper_settings['enable_log'], 1 ); ?> />
|
||||
<label for="enable_log">
|
||||
<?php esc_html_e( 'Enable Logging', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="enable_stamp" name="enable_stamp" <?php checked( $nginx_helper_settings['enable_stamp'], 1 ); ?> />
|
||||
<label for="enable_stamp">
|
||||
<?php esc_html_e( 'Enable Nginx Timestamp in HTML', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
<?php
|
||||
} // End of if.
|
||||
|
||||
if ( is_network_admin() ) {
|
||||
?>
|
||||
<div class="postbox enable_map"<?php echo ( empty( $nginx_helper_settings['enable_map'] ) ) ? ' style="display: none;"' : ''; ?>>
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Nginx Map', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<?php
|
||||
if ( ! is_writable( $log_path . 'map.conf' ) ) {
|
||||
?>
|
||||
<span class="error fade" style="display: block">
|
||||
<p>
|
||||
<?php
|
||||
esc_html_e( 'Can\'t write on map file.', 'nginx-helper' );
|
||||
echo '<br /><br />';
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
// translators: %s file url.
|
||||
__( 'Check you have write permission on <strong>%s</strong>', 'nginx-helper' ),
|
||||
esc_url( $log_path . 'map.conf' )
|
||||
),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<table class="form-table rtnginx-table">
|
||||
<tr>
|
||||
<th>
|
||||
<?php
|
||||
printf(
|
||||
'%1$s<br /><small>%2$s</small>',
|
||||
esc_html__( 'Nginx Map path to include in nginx settings', 'nginx-helper' ),
|
||||
esc_html__( '(recommended)', 'nginx-helper' )
|
||||
);
|
||||
?>
|
||||
</th>
|
||||
<td>
|
||||
<pre><?php echo esc_url( $log_path . 'map.conf' ); ?></pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<?php
|
||||
printf(
|
||||
'%1$s<br />%2$s<br /><small>%3$s</small>',
|
||||
esc_html__( 'Or,', 'nginx-helper' ),
|
||||
esc_html__( 'Text to manually copy and paste in nginx settings', 'nginx-helper' ),
|
||||
esc_html__( '(if your network is small and new sites are not added frequently)', 'nginx-helper' )
|
||||
);
|
||||
?>
|
||||
</th>
|
||||
<td>
|
||||
<pre id="map">
|
||||
<?php echo esc_html( $nginx_helper_admin->get_map() ); ?>
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="postbox enable_log"<?php echo ( empty( $nginx_helper_settings['enable_log'] ) ) ? ' style="display: none;"' : ''; ?>>
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Logging Options', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<?php
|
||||
if ( ! is_dir( $log_path ) ) {
|
||||
mkdir( $log_path );
|
||||
}
|
||||
if ( is_writable( $log_path ) && ! file_exists( $log_path . 'nginx.log' ) ) {
|
||||
$log = fopen( $log_path . 'nginx.log', 'w' );
|
||||
fclose( $log );
|
||||
}
|
||||
if ( ! is_writable( $log_path . 'nginx.log' ) ) {
|
||||
?>
|
||||
<span class="error fade" style="display : block">
|
||||
<p>
|
||||
<?php
|
||||
esc_html_e( 'Can\'t write on log file.', 'nginx-helper' );
|
||||
echo '<br /><br />';
|
||||
echo wp_kses(
|
||||
sprintf(
|
||||
// translators: %s file url.
|
||||
__( 'Check you have write permission on <strong>%s</strong>', 'nginx-helper' ),
|
||||
esc_url( $log_path . 'nginx.log' )
|
||||
),
|
||||
array( 'strong' => array() )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<table class="form-table rtnginx-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="rt_wp_nginx_helper_logs_path">
|
||||
<?php esc_html_e( 'Logs path', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<code>
|
||||
<?php echo esc_url( $log_path . 'nginx.log' ); ?>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="rt_wp_nginx_helper_logs_link">
|
||||
<?php esc_html_e( 'View Log', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<a target="_blank" href="<?php echo esc_url( $log_url . 'nginx.log' ); ?>">
|
||||
<?php esc_html_e( 'Log', 'nginx-helper' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="rt_wp_nginx_helper_log_level">
|
||||
<?php esc_html_e( 'Log level', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<select name="log_level">
|
||||
<option value="NONE" <?php selected( $nginx_helper_settings['log_level'], 'NONE' ); ?>> <?php esc_html_e( 'None', 'nginx-helper' ); ?> </option>
|
||||
<option value="INFO" <?php selected( $nginx_helper_settings['log_level'], 'INFO' ); ?>> <?php esc_html_e( 'Info', 'nginx-helper' ); ?> </option>
|
||||
<option value="WARNING" <?php selected( $nginx_helper_settings['log_level'], 'WARNING' ); ?>> <?php esc_html_e( 'Warning', 'nginx-helper' ); ?> </option>
|
||||
<option value="ERROR" <?php selected( $nginx_helper_settings['log_level'], 'ERROR' ); ?>> <?php esc_html_e( 'Error', 'nginx-helper' ); ?> </option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="log_filesize">
|
||||
<?php esc_html_e( 'Max log file size', 'nginx-helper' ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input id="log_filesize" class="small-text" type="text" name="log_filesize" value="<?php echo esc_attr( $nginx_helper_settings['log_filesize'] ); ?>" />
|
||||
<?php
|
||||
esc_html_e( 'Mb', 'nginx-helper' );
|
||||
if ( $error_log_filesize ) {
|
||||
?>
|
||||
<p class="error fade" style="display: block;">
|
||||
<?php echo esc_html( $error_log_filesize ); ?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- End of .inside -->
|
||||
</div>
|
||||
<input type="hidden" name="smart_http_expire_form_nonce" value="<?php echo esc_attr( wp_create_nonce( 'smart-http-expire-form-nonce' ) ); ?>" />
|
||||
<?php
|
||||
submit_button( __( 'Save All Changes', 'nginx-helper' ), 'primary large', 'smart_http_expire_save', true );
|
||||
?>
|
||||
</form><!-- End of #post_form -->
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Display sidebar.
|
||||
*
|
||||
* This file is used to markup the admin-facing aspects of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin/partials
|
||||
*/
|
||||
|
||||
$purge_url = add_query_arg(
|
||||
array(
|
||||
'nginx_helper_action' => 'purge',
|
||||
'nginx_helper_urls' => 'all',
|
||||
)
|
||||
);
|
||||
$nonced_url = wp_nonce_url( $purge_url, 'nginx_helper-purge_all' );
|
||||
?>
|
||||
|
||||
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
||||
|
||||
<form id="purgeall" action="" method="post" class="clearfix">
|
||||
<a href="<?php echo esc_url( $nonced_url ); ?>" class="button-primary">
|
||||
<?php esc_html_e( 'Purge Entire Cache', 'nginx-helper' ); ?>
|
||||
</a>
|
||||
</form>
|
||||
<div class="postbox" id="support">
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Need Help?', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
'%s <a href=\'%s\'>%s</a>.',
|
||||
esc_html__( 'Please use our', 'nginx-helper' ),
|
||||
esc_url( 'http://rtcamp.com/support/forum/wordpress-nginx/' ),
|
||||
esc_html__( 'free support forum', 'nginx-helper' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox" id="social">
|
||||
<h3 class="hndle">
|
||||
<span>
|
||||
<?php esc_html_e( 'Getting Social is Good', 'nginx-helper' ); ?>
|
||||
</span>
|
||||
</h3>
|
||||
<div style="text-align:center;" class="inside">
|
||||
<a class="nginx-helper-facebook" title="<?php esc_attr_e( 'Become a fan on Facebook', 'nginx-helper' ); ?>" target="_blank" href="http://www.facebook.com/rtCamp.solutions/"></a>
|
||||
<a class="nginx-helper-twitter" title="<?php esc_attr_e( 'Follow us on Twitter', 'nginx-helper' ); ?>" target="_blank" href="https://twitter.com/rtcamp/"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox" id="useful-links">
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Useful Links', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<ul role="list">
|
||||
<li role="listitem">
|
||||
<a href="https://rtcamp.com/wordpress-nginx/" title="<?php esc_attr_e( 'WordPress-Nginx Solutions', 'nginx-helper' ); ?>"><?php esc_html_e( 'WordPress-Nginx Solutions', 'nginx-helper' ); ?></a>
|
||||
</li>
|
||||
<li role="listitem">
|
||||
<a href="https://rtcamp.com/services/wordPress-themes-design-development/" title="<?php esc_attr_e( 'WordPress Theme Devleopment', 'nginx-helper' ); ?>"><?php esc_html_e( 'WordPress Theme Devleopment', 'nginx-helper' ); ?></a>
|
||||
</li>
|
||||
<li role="listitem">
|
||||
<a href="http://rtcamp.com/services/wordpress-plugins/" title="<?php esc_attr_e( 'WordPress Plugin Development', 'nginx-helper' ); ?>"><?php esc_html_e( 'WordPress Plugin Development', 'nginx-helper' ); ?></a>
|
||||
</li>
|
||||
<li role="listitem">
|
||||
<a href="http://rtcamp.com/services/custom-wordpress-solutions/" title="<?php esc_attr_e( 'WordPress Consultancy', 'nginx-helper' ); ?>"><?php esc_html_e( 'WordPress Consultancy', 'nginx-helper' ); ?></a>
|
||||
</li>
|
||||
<li role="listitem">
|
||||
<a href="https://rtcamp.com/easyengine/" title="<?php esc_attr_e( 'easyengine (ee)', 'nginx-helper' ); ?>"><?php esc_html_e( 'easyengine (ee)', 'nginx-helper' ); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox" id="latest_news">
|
||||
<div title="<?php esc_attr_e( 'Click to toggle', 'nginx-helper' ); ?>" class="handlediv"><br /></div>
|
||||
<h3 class="hndle"><span><?php esc_html_e( 'Latest News', 'nginx-helper' ); ?></span></h3>
|
||||
<div class="inside"><img src ="<?php echo esc_url( admin_url() ); ?>/images/wpspin_light.gif" /><?php esc_html_e( 'Loading...', 'nginx-helper' ); ?></div>
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Display support options of the plugin.
|
||||
*
|
||||
* This file is used to markup the admin-facing aspects of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/admin/partials
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
|
||||
<div class="postbox">
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Support Forums', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
<div class="inside">
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<th>
|
||||
<?php esc_html_e( 'Free Support', 'nginx-helper' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<a href="https://community.easyengine.io/c/wordpress-nginx/" title="<?php esc_attr_e( 'Free Support Forum', 'nginx-helper' ); ?>" target="_blank">
|
||||
<?php esc_html_e( 'Link to forum', 'nginx-helper' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th>
|
||||
<?php esc_html_e( 'Premium Support', 'nginx-helper' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<a href="https://easyengine.io/contact/" title="<?php esc_attr_e( 'Premium Support Forum', 'nginx-helper' ); ?>" target="_blank">
|
||||
<?php esc_html_e( 'Link to forum', 'nginx-helper' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
15203
wp/wp-content/plugins/nginx-helper/admin/predis.php
Normal file
15203
wp/wp-content/plugins/nginx-helper/admin/predis.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Contains class for WP-CLI command.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
/**
|
||||
* Don't load this file directly!
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Nginx_Helper_WP_CLI_Command' ) ) {
|
||||
|
||||
/**
|
||||
* Purge site cache from Nginx.
|
||||
*/
|
||||
class Nginx_Helper_WP_CLI_Command extends WP_CLI_Command {
|
||||
|
||||
/**
|
||||
* Subcommand to purge all cache from Nginx
|
||||
*
|
||||
* Examples:
|
||||
* wp nginx-helper purge-all
|
||||
*
|
||||
* @subcommand purge-all
|
||||
*
|
||||
* @param array $args Arguments.
|
||||
* @param array $assoc_args Arguments in associative array.
|
||||
*/
|
||||
public function purge_all( $args, $assoc_args ) {
|
||||
|
||||
global $nginx_purger;
|
||||
|
||||
$nginx_purger->purge_all();
|
||||
|
||||
$message = __( 'Purged Everything!', 'nginx-helper' );
|
||||
WP_CLI::success( $message );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
28
wp/wp-content/plugins/nginx-helper/composer.json
Normal file
28
wp/wp-content/plugins/nginx-helper/composer.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "rtcamp/nginx-helper",
|
||||
"description": "Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.",
|
||||
"keywords": ["wordpress", "plugin", "nginx", "nginx-helper", "fastcgi", "redis-cache", "redis", "cache"],
|
||||
"homepage": "https://rtcamp.com/nginx-helper/",
|
||||
"license": "GPL-2.0+",
|
||||
"authors": [{
|
||||
"name": "rtCamp",
|
||||
"email": "support@rtcamp.com",
|
||||
"homepage": "https://rtcamp.com"
|
||||
}],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"type": "wordpress-plugin",
|
||||
"support": {
|
||||
"issues": "https://github.com/rtCamp/nginx-helper/issues",
|
||||
"forum": "https://wordpress.org/support/plugin/nginx-helper",
|
||||
"wiki": "https://github.com/rtCamp/nginx-helper/wiki",
|
||||
"source": "https://github.com/rtCamp/nginx-helper/"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"composer/installers": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"wpreadme2markdown/wpreadme2markdown": "*"
|
||||
}
|
||||
}
|
||||
200
wp/wp-content/plugins/nginx-helper/composer.lock
generated
Normal file
200
wp/wp-content/plugins/nginx-helper/composer.lock
generated
Normal file
@@ -0,0 +1,200 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "f8ee8d46fadaee8c9cc194ef126e7404",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
"version": "v1.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/installers.git",
|
||||
"reference": "b3bd071ea114a57212c75aa6a2eef5cfe0cc798f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/b3bd071ea114a57212c75aa6a2eef5cfe0cc798f",
|
||||
"reference": "b3bd071ea114a57212c75aa6a2eef5cfe0cc798f",
|
||||
"shasum": ""
|
||||
},
|
||||
"replace": {
|
||||
"shama/baton": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "1.0.*@dev",
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"type": "composer-installer",
|
||||
"extra": {
|
||||
"class": "Composer\\Installers\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Composer\\Installers\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kyle Robinson Young",
|
||||
"email": "kyle@dontkry.com",
|
||||
"homepage": "https://github.com/shama",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A multi-framework Composer library installer",
|
||||
"homepage": "http://composer.github.com/installers/",
|
||||
"keywords": [
|
||||
"TYPO3 CMS",
|
||||
"TYPO3 Flow",
|
||||
"TYPO3 Neos",
|
||||
"agl",
|
||||
"cakephp",
|
||||
"codeigniter",
|
||||
"drupal",
|
||||
"fuelphp",
|
||||
"installer",
|
||||
"joomla",
|
||||
"kohana",
|
||||
"laravel",
|
||||
"li3",
|
||||
"lithium",
|
||||
"mako",
|
||||
"modulework",
|
||||
"phpbb",
|
||||
"ppi",
|
||||
"silverstripe",
|
||||
"symfony",
|
||||
"wordpress",
|
||||
"zend"
|
||||
],
|
||||
"time": "2013-08-20 04:37:09"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Console.git",
|
||||
"reference": "564398bc1f33faf92fc2ec86859983d30eb81806"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Console/zipball/564398bc1f33faf92fc2ec86859983d30eb81806",
|
||||
"reference": "564398bc1f33faf92fc2ec86859983d30eb81806",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/event-dispatcher": "~2.1",
|
||||
"symfony/phpunit-bridge": "~2.7",
|
||||
"symfony/process": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
"symfony/event-dispatcher": "",
|
||||
"symfony/process": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.7-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Console\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-06-10 15:30:22"
|
||||
},
|
||||
{
|
||||
"name": "wpreadme2markdown/wpreadme2markdown",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/benbalter/WP-Readme-to-Github-Markdown.git",
|
||||
"reference": "dceae108111232949affc9107c98276c6fa6c98f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/benbalter/WP-Readme-to-Github-Markdown/zipball/dceae108111232949affc9107c98276c6fa6c98f",
|
||||
"reference": "dceae108111232949affc9107c98276c6fa6c98f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">= 5.3.3",
|
||||
"symfony/console": "~2.4"
|
||||
},
|
||||
"bin": [
|
||||
"bin/wp2md"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WPReadme2Markdown\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Archer",
|
||||
"email": "chrstnarchr@aol.com"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin J. Balter"
|
||||
}
|
||||
],
|
||||
"description": "Convert WordPress Plugin readme.txt to Markdown",
|
||||
"keywords": [
|
||||
"converter",
|
||||
"markdown",
|
||||
"readme",
|
||||
"wordpress"
|
||||
],
|
||||
"time": "2014-05-28 21:28:31"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Fired during plugin activation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's activation.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
*
|
||||
* @author rtCamp
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Nginx_Helper_Activator
|
||||
*/
|
||||
class Nginx_Helper_Activator {
|
||||
|
||||
/**
|
||||
* Create log directory. Add capability of nginx helper.
|
||||
* Schedule event to check log file size daily.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @global Nginx_Helper_Admin $nginx_helper_admin
|
||||
*/
|
||||
public static function activate() {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
$path = $nginx_helper_admin->functional_asset_path();
|
||||
|
||||
if ( ! is_dir( $path ) ) {
|
||||
mkdir( $path );
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'activate_plugins' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$role = get_role( 'administrator' );
|
||||
|
||||
if ( empty( $role ) ) {
|
||||
|
||||
update_site_option(
|
||||
'rt_wp_nginx_helper_init_check',
|
||||
__( 'Sorry, you need to be an administrator to use Nginx Helper', 'nginx-helper' )
|
||||
);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$role->add_cap( 'Nginx Helper | Config' );
|
||||
$role->add_cap( 'Nginx Helper | Purge cache' );
|
||||
|
||||
wp_schedule_event( time(), 'daily', 'rt_wp_nginx_helper_check_log_file_size_daily' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Contains Nginx_Helper_Deactivator class.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired during plugin deactivation.
|
||||
*
|
||||
* This class defines all code necessary to run during the plugin's deactivation.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
*
|
||||
* @author rtCamp
|
||||
*/
|
||||
class Nginx_Helper_Deactivator {
|
||||
|
||||
/**
|
||||
* Schedule event to check log file size daily. Remove nginx helper capability.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public static function deactivate() {
|
||||
|
||||
wp_clear_scheduled_hook( 'rt_wp_nginx_helper_check_log_file_size_daily' );
|
||||
|
||||
$role = get_role( 'administrator' );
|
||||
$role->remove_cap( 'Nginx Helper | Config' );
|
||||
$role->remove_cap( 'Nginx Helper | Purge cache' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Define the internationalization functionality
|
||||
*
|
||||
* Loads and defines the internationalization files for this plugin
|
||||
* so that it is ready for translation.
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define the internationalization functionality.
|
||||
*
|
||||
* Loads and defines the internationalization files for this plugin
|
||||
* so that it is ready for translation.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
* @author rtCamp
|
||||
*/
|
||||
class Nginx_Helper_i18n {
|
||||
|
||||
/**
|
||||
* The domain specified for this plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @var string $domain The domain identifier for this plugin.
|
||||
*/
|
||||
private $domain;
|
||||
|
||||
/**
|
||||
* Load the plugin text domain for translation.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function load_plugin_textdomain() {
|
||||
|
||||
load_plugin_textdomain(
|
||||
$this->domain,
|
||||
false,
|
||||
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the domain equal to that of the specified domain.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $domain The domain that represents the locale of this plugin.
|
||||
*/
|
||||
public function set_domain( $domain ) {
|
||||
$this->domain = $domain;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
/**
|
||||
* Register all actions and filters for the plugin
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register all actions and filters for the plugin.
|
||||
*
|
||||
* Maintain a list of all hooks that are registered throughout
|
||||
* the plugin, and register them with the WordPress API. Call the
|
||||
* run function to execute the list of actions and filters.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*
|
||||
* @subpackage nginx-helper/includes
|
||||
*
|
||||
* @author rtCamp
|
||||
*/
|
||||
class Nginx_Helper_Loader {
|
||||
|
||||
/**
|
||||
* The array of actions registered with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $actions;
|
||||
|
||||
/**
|
||||
* The array of filters registered with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
||||
*/
|
||||
protected $filters;
|
||||
|
||||
/**
|
||||
* Initialize the collections used to maintain the actions and filters.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->actions = array();
|
||||
$this->filters = array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new action to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $hook The name of the WordPress action that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the action is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
||||
*/
|
||||
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new filter to the collection to be registered with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
||||
*/
|
||||
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
||||
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility function that is used to register the actions and hooks into a single
|
||||
* collection.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
||||
* @param string $hook The name of the WordPress filter that is being registered.
|
||||
* @param object $component A reference to the instance of the object on which the filter is defined.
|
||||
* @param string $callback The name of the function definition on the $component.
|
||||
* @param int $priority The priority at which the function should be fired.
|
||||
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
||||
*
|
||||
* @return array The collection of actions and filters registered with WordPress.
|
||||
*/
|
||||
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
||||
|
||||
$hooks[] = array(
|
||||
'hook' => $hook,
|
||||
'component' => $component,
|
||||
'callback' => $callback,
|
||||
'priority' => $priority,
|
||||
'accepted_args' => $accepted_args,
|
||||
);
|
||||
|
||||
return $hooks;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the filters and actions with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function run() {
|
||||
|
||||
foreach ( $this->filters as $hook ) {
|
||||
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
foreach ( $this->actions as $hook ) {
|
||||
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
<?php
|
||||
/**
|
||||
* The file that defines the core plugin class
|
||||
*
|
||||
* A class definition that includes attributes and functions used across both the
|
||||
* public-facing side of the site and the admin area.
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
*/
|
||||
|
||||
/**
|
||||
* The core plugin class.
|
||||
*
|
||||
* This is used to define internationalization, admin-specific hooks, and
|
||||
* public-facing site hooks.
|
||||
*
|
||||
* Also maintains the unique identifier of this plugin as well as the current
|
||||
* version of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @package nginx-helper
|
||||
* @subpackage nginx-helper/includes
|
||||
* @author rtCamp
|
||||
*/
|
||||
class Nginx_Helper {
|
||||
|
||||
/**
|
||||
* The loader that's responsible for maintaining and registering all hooks that power
|
||||
* the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access protected
|
||||
* @var Nginx_Helper_Loader $loader Maintains and registers all hooks for the plugin.
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* The unique identifier of this plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access protected
|
||||
* @var string $plugin_name The string used to uniquely identify this plugin.
|
||||
*/
|
||||
protected $plugin_name;
|
||||
|
||||
/**
|
||||
* The current version of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access protected
|
||||
* @var string $version The current version of the plugin.
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* Minimum WordPress Version Required.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @var string $minium_wp
|
||||
*/
|
||||
protected $minimum_wp;
|
||||
|
||||
/**
|
||||
* Define the core functionality of the plugin.
|
||||
*
|
||||
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
||||
* Load the dependencies, define the locale, and set the hooks for the admin area and
|
||||
* the public-facing side of the site.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->plugin_name = 'nginx-helper';
|
||||
$this->version = '2.2.3';
|
||||
$this->minimum_wp = '3.0';
|
||||
|
||||
if ( ! $this->required_wp_version() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! defined( 'RT_WP_NGINX_HELPER_CACHE_PATH' ) ) {
|
||||
define( 'RT_WP_NGINX_HELPER_CACHE_PATH', '/var/run/nginx-cache' );
|
||||
}
|
||||
|
||||
$this->load_dependencies();
|
||||
$this->set_locale();
|
||||
$this->define_admin_hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the required dependencies for this plugin.
|
||||
*
|
||||
* Include the following files that make up the plugin:
|
||||
*
|
||||
* - Nginx_Helper_Loader. Orchestrates the hooks of the plugin.
|
||||
* - Nginx_Helper_i18n. Defines internationalization functionality.
|
||||
* - Nginx_Helper_Admin. Defines all hooks for the admin area.
|
||||
*
|
||||
* Create an instance of the loader which will be used to register the hooks
|
||||
* with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function load_dependencies() {
|
||||
|
||||
/**
|
||||
* The class responsible for orchestrating the actions and filters of the
|
||||
* core plugin.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-nginx-helper-loader.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining internationalization functionality
|
||||
* of the plugin.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-nginx-helper-i18n.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that required for purging urls.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-purger.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur in the admin area.
|
||||
*/
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-nginx-helper-admin.php';
|
||||
|
||||
/**
|
||||
* The class responsible for defining all actions that occur in the public-facing
|
||||
* side of the site.
|
||||
*/
|
||||
$this->loader = new Nginx_Helper_Loader();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the locale for this plugin for internationalization.
|
||||
*
|
||||
* Uses the Nginx_Helper_i18n class in order to set the domain and to register the hook
|
||||
* with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function set_locale() {
|
||||
|
||||
$plugin_i18n = new Nginx_Helper_i18n();
|
||||
$plugin_i18n->set_domain( $this->get_plugin_name() );
|
||||
|
||||
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all of the hooks related to the admin area functionality of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function define_admin_hooks() {
|
||||
|
||||
global $nginx_helper_admin, $nginx_purger;
|
||||
|
||||
$nginx_helper_admin = new Nginx_Helper_Admin( $this->get_plugin_name(), $this->get_version() );
|
||||
|
||||
// Defines global variables.
|
||||
if ( ! empty( $nginx_helper_admin->options['cache_method'] ) && 'enable_redis' === $nginx_helper_admin->options['cache_method'] ) {
|
||||
|
||||
if ( class_exists( 'Redis' ) ) { // Use PHP5-Redis extension if installed.
|
||||
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-phpredis-purger.php';
|
||||
$nginx_purger = new PhpRedis_Purger();
|
||||
|
||||
} else {
|
||||
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-predis-purger.php';
|
||||
$nginx_purger = new Predis_Purger();
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-fastcgi-purger.php';
|
||||
$nginx_purger = new FastCGI_Purger();
|
||||
|
||||
}
|
||||
|
||||
$this->loader->add_action( 'admin_enqueue_scripts', $nginx_helper_admin, 'enqueue_styles' );
|
||||
$this->loader->add_action( 'admin_enqueue_scripts', $nginx_helper_admin, 'enqueue_scripts' );
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$this->loader->add_action( 'network_admin_menu', $nginx_helper_admin, 'nginx_helper_admin_menu' );
|
||||
$this->loader->add_filter( 'network_admin_plugin_action_links_' . NGINX_HELPER_BASENAME, $nginx_helper_admin, 'nginx_helper_settings_link' );
|
||||
} else {
|
||||
$this->loader->add_action( 'admin_menu', $nginx_helper_admin, 'nginx_helper_admin_menu' );
|
||||
$this->loader->add_filter( 'plugin_action_links_' . NGINX_HELPER_BASENAME, $nginx_helper_admin, 'nginx_helper_settings_link' );
|
||||
}
|
||||
|
||||
if ( ! empty( $nginx_helper_admin->options['enable_purge'] ) ) {
|
||||
$this->loader->add_action( 'admin_bar_menu', $nginx_helper_admin, 'nginx_helper_toolbar_purge_link', 100 );
|
||||
}
|
||||
|
||||
$this->loader->add_action( 'wp_ajax_rt_get_feeds', $nginx_helper_admin, 'nginx_helper_get_feeds' );
|
||||
|
||||
$this->loader->add_action( 'shutdown', $nginx_helper_admin, 'add_timestamps', 99999 );
|
||||
$this->loader->add_action( 'add_init', $nginx_helper_admin, 'update_map' );
|
||||
|
||||
// Add actions to purge.
|
||||
$this->loader->add_action( 'wp_insert_comment', $nginx_purger, 'purge_post_on_comment', 200, 2 );
|
||||
$this->loader->add_action( 'transition_comment_status', $nginx_purger, 'purge_post_on_comment_change', 200, 3 );
|
||||
$this->loader->add_action( 'transition_post_status', $nginx_helper_admin, 'set_future_post_option_on_future_status', 20, 3 );
|
||||
$this->loader->add_action( 'delete_post', $nginx_helper_admin, 'unset_future_post_option_on_delete', 20, 1 );
|
||||
$this->loader->add_action( 'rt_wp_nginx_helper_check_log_file_size_daily', $nginx_purger, 'check_and_truncate_log_file', 100, 1 );
|
||||
$this->loader->add_action( 'edit_attachment', $nginx_purger, 'purge_image_on_edit', 100, 1 );
|
||||
$this->loader->add_action( 'wpmu_new_blog', $nginx_helper_admin, 'update_new_blog_options', 10, 1 );
|
||||
$this->loader->add_action( 'transition_post_status', $nginx_purger, 'purge_on_post_moved_to_trash', 20, 3 );
|
||||
$this->loader->add_action( 'edit_term', $nginx_purger, 'purge_on_term_taxonomy_edited', 20, 3 );
|
||||
$this->loader->add_action( 'delete_term', $nginx_purger, 'purge_on_term_taxonomy_edited', 20, 3 );
|
||||
$this->loader->add_action( 'check_ajax_referer', $nginx_purger, 'purge_on_check_ajax_referer', 20 );
|
||||
$this->loader->add_action( 'admin_bar_init', $nginx_helper_admin, 'purge_all' );
|
||||
|
||||
// expose action to allow other plugins to purge the cache.
|
||||
$this->loader->add_action( 'rt_nginx_helper_purge_all', $nginx_purger, 'purge_all' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the loader to execute all of the hooks with WordPress.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function run() {
|
||||
$this->loader->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the plugin used to uniquely identify it within the context of
|
||||
* WordPress and to define internationalization functionality.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return string The name of the plugin.
|
||||
*/
|
||||
public function get_plugin_name() {
|
||||
return $this->plugin_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reference to the class that orchestrates the hooks with the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @return Nginx_Helper_Loader Orchestrates the hooks of the plugin.
|
||||
*/
|
||||
public function get_loader() {
|
||||
return $this->loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the version number of the plugin.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @return string The version number of the plugin.
|
||||
*/
|
||||
public function get_version() {
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wp version.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @global string $wp_version
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function required_wp_version() {
|
||||
|
||||
global $wp_version;
|
||||
|
||||
$wp_ok = version_compare( $wp_version, $this->minimum_wp, '>=' );
|
||||
|
||||
if ( false === $wp_ok ) {
|
||||
|
||||
add_action( 'admin_notices', array( &$this, 'display_notices' ) );
|
||||
add_action( 'network_admin_notices', array( &$this, 'display_notices' ) );
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispay plugin notices.
|
||||
*/
|
||||
public function display_notices() {
|
||||
?>
|
||||
<div id="message" class="error">
|
||||
<p>
|
||||
<strong>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s is Minimum WP version. */
|
||||
esc_html__( 'Sorry, Nginx Helper requires WordPress %s or higher', 'nginx-helper' ),
|
||||
esc_html( $this->minimum_wp )
|
||||
);
|
||||
?>
|
||||
</strong>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
8
wp/wp-content/plugins/nginx-helper/includes/index.php
Normal file
8
wp/wp-content/plugins/nginx-helper/includes/index.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
// Silence.
|
||||
8
wp/wp-content/plugins/nginx-helper/index.php
Normal file
8
wp/wp-content/plugins/nginx-helper/index.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Silence is golden.
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
// Silence.
|
||||
BIN
wp/wp-content/plugins/nginx-helper/languages/nginx-helper.mo
Normal file
BIN
wp/wp-content/plugins/nginx-helper/languages/nginx-helper.mo
Normal file
Binary file not shown.
618
wp/wp-content/plugins/nginx-helper/languages/nginx-helper.po
Normal file
618
wp/wp-content/plugins/nginx-helper/languages/nginx-helper.po
Normal file
@@ -0,0 +1,618 @@
|
||||
# Copyright (C) 2023 rtCamp
|
||||
# This file is distributed under the same license as the Nginx Helper plugin.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Nginx Helper 2.2.3\n"
|
||||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nginx-helper\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2023-05-10T09:58:20+00:00\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"X-Generator: WP-CLI 2.7.1\n"
|
||||
"X-Domain: nginx-helper\n"
|
||||
|
||||
#. Plugin Name of the plugin
|
||||
#: admin/class-nginx-helper-admin.php:177
|
||||
#: admin/class-nginx-helper-admin.php:178
|
||||
#: admin/class-nginx-helper-admin.php:188
|
||||
#: admin/class-nginx-helper-admin.php:189
|
||||
msgid "Nginx Helper"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin
|
||||
msgid "https://rtcamp.com/nginx-helper/"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin
|
||||
msgid "Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin
|
||||
msgid "rtCamp"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "https://rtcamp.com"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:88
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:92
|
||||
msgid "Support"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:160
|
||||
msgid "Purging entire cache is not recommended. Would you like to continue?"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:212
|
||||
msgid "Purge Cache"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:215
|
||||
msgid "Purge Current Page"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:341
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:404
|
||||
msgid "No items"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:415
|
||||
msgid "Posted "
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-nginx-helper-admin.php:746
|
||||
msgid "Purge initiated"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:691
|
||||
msgid "Purging homepage (WPML) "
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:696
|
||||
msgid "Purging homepage "
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:715
|
||||
msgid "Purging personal urls"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:723
|
||||
msgid "No personal urls available"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:739
|
||||
msgid "Purging category archives"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %d: Category ID.
|
||||
#: admin/class-purger.php:748
|
||||
msgid "Purging category '%d'"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:766
|
||||
msgid "Purging tags archives"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:774
|
||||
#: admin/class-purger.php:874
|
||||
msgid "Purging tag '%1$s' ( id %2$d )"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:793
|
||||
msgid "Purging post custom taxonomies related"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Post taxonomy name.
|
||||
#. translators: %s: Taxonomy name.
|
||||
#: admin/class-purger.php:807
|
||||
#: admin/class-purger.php:907
|
||||
msgid "Purging custom taxonomy '%s'"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Post taxonomy name.
|
||||
#. translators: %s: Taxonomy name.
|
||||
#: admin/class-purger.php:821
|
||||
#: admin/class-purger.php:923
|
||||
msgid "Your built-in taxonomy '%s' has param '_builtin' set to false."
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:825
|
||||
#: admin/class-purger.php:927
|
||||
msgid "No custom taxonomies"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:838
|
||||
msgid "Purging all categories"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:846
|
||||
msgid "Purging category '%1$s' ( id %2$d )"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:852
|
||||
msgid "No categories archives"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:866
|
||||
msgid "Purging all tags"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:879
|
||||
msgid "No tags archives"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:893
|
||||
msgid "Purging all custom taxonomies"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:954
|
||||
msgid "Purging all posts, pages and custom post types."
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:969
|
||||
msgid "Purging post id '%1$d' ( post type '%2$s' )"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:974
|
||||
msgid "No posts"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:988
|
||||
msgid "Purging all date-based archives."
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1005
|
||||
msgid "Purging all daily archives."
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1028
|
||||
msgid "Purging daily archive '%1$s/%2$s/%3$s'"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1039
|
||||
msgid "No daily archives"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1051
|
||||
msgid "Purging all monthly archives."
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1079
|
||||
msgid "Purging monthly archive '%1$s/%2$s'"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1084
|
||||
msgid "No monthly archives"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1096
|
||||
msgid "Purging all yearly archives."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s: Year to purge cache.
|
||||
#: admin/class-purger.php:1124
|
||||
msgid "Purging yearly archive '%s'"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1129
|
||||
msgid "No yearly archives"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1141
|
||||
msgid "Let's purge everything!"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1147
|
||||
msgid "Everything purged!"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1170
|
||||
msgid "Term taxonomy edited or deleted"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1177
|
||||
msgid "Term taxonomy '%1$s' edited, (tt_id '%2$d', term_id '%3$d', taxonomy '%4$s')"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1181
|
||||
msgid "A term taxonomy has been deleted from taxonomy '%1$s', (tt_id '%2$d', term_id '%3$d')"
|
||||
msgstr ""
|
||||
|
||||
#: admin/class-purger.php:1209
|
||||
msgid "Widget saved, moved or removed in a sidebar"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-admin-display.php:21
|
||||
msgid "Nginx Settings"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:56
|
||||
msgid "Log file size must be a number."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:66
|
||||
msgid "Settings saved."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:93
|
||||
msgid "Purging Options"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:100
|
||||
msgid "Enable Purge"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:110
|
||||
msgid "Caching Method"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:122
|
||||
msgid "nginx Fastcgi cache"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:124
|
||||
msgid "External settings for nginx"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:125
|
||||
msgid "requires external settings for nginx"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:135
|
||||
msgid "Redis cache"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:145
|
||||
msgid "Purge Method"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:155
|
||||
#: admin/partials/nginx-helper-general-options.php:335
|
||||
msgid "when a post/page/custom post is published."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:165
|
||||
msgid "Using a GET request to"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:166
|
||||
msgid "(Default option)"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s Nginx cache purge module link.
|
||||
#: admin/partials/nginx-helper-general-options.php:177
|
||||
msgid "Uses the %s module."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:195
|
||||
msgid "Delete local server cache files"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:201
|
||||
msgid "Checks for matching cache file in <strong>RT_WP_NGINX_HELPER_CACHE_PATH</strong>. Does not require any other modules. Requires that the cache be stored on the same server as WordPress. You must also be using the default nginx cache options (levels=1:2) and (fastcgi_cache_key \"$scheme$request_method$host$request_uri\")."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:216
|
||||
msgid "Redis Settings"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:221
|
||||
msgid "Hostname"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:228
|
||||
#: admin/partials/nginx-helper-general-options.php:243
|
||||
#: admin/partials/nginx-helper-general-options.php:258
|
||||
msgid "Overridden by constant variables."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:236
|
||||
msgid "Port"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:251
|
||||
msgid "Prefix"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:271
|
||||
msgid "Purging Conditions"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:276
|
||||
msgid "Purge Homepage:"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:283
|
||||
msgid "when a post/page/custom post is modified or added."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:292
|
||||
#: admin/partials/nginx-helper-general-options.php:419
|
||||
msgid "when a <strong>post</strong> (or page/custom post) is <strong>modified</strong> or <strong>added</strong>."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:304
|
||||
msgid "when an existing post/page/custom post is modified."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:313
|
||||
msgid "when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:327
|
||||
msgid "Purge Post/Page/Custom Post Type:"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:344
|
||||
msgid "when a <strong>post</strong> is <strong>published</strong>."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:356
|
||||
#: admin/partials/nginx-helper-general-options.php:453
|
||||
msgid "when a comment is approved/published."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:365
|
||||
#: admin/partials/nginx-helper-general-options.php:462
|
||||
msgid "when a <strong>comment</strong> is <strong>approved/published</strong>."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:377
|
||||
#: admin/partials/nginx-helper-general-options.php:474
|
||||
msgid "when a comment is unapproved/deleted."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:386
|
||||
#: admin/partials/nginx-helper-general-options.php:483
|
||||
msgid "when a <strong>comment</strong> is <strong>unapproved/deleted</strong>."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:400
|
||||
msgid "Purge Archives:"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:402
|
||||
msgid "(date, category, tag, author, custom taxonomies)"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:410
|
||||
msgid "when an post/page/custom post is modified or added"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:431
|
||||
msgid "when an existing post/page/custom post is trashed."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:440
|
||||
msgid "when a <strong>published post</strong> (or page/custom post) is <strong>trashed</strong>."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:496
|
||||
msgid "Custom Purge URL:"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:502
|
||||
msgid "Add one URL per line. URL should not contain domain name."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:505
|
||||
msgid "Eg: To purge http://example.com/sample-page/ add <strong>/sample-page/</strong> in above textarea."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:509
|
||||
msgid "'*' will only work with redis cache server."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:519
|
||||
msgid "Debug Options"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:529
|
||||
msgid "Enable Nginx Map."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:538
|
||||
msgid "Enable Logging"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:546
|
||||
msgid "Enable Nginx Timestamp in HTML"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:560
|
||||
msgid "Nginx Map"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:569
|
||||
msgid "Can't write on map file."
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s file url.
|
||||
#: admin/partials/nginx-helper-general-options.php:574
|
||||
#: admin/partials/nginx-helper-general-options.php:646
|
||||
msgid "Check you have write permission on <strong>%s</strong>"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:591
|
||||
msgid "Nginx Map path to include in nginx settings"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:592
|
||||
msgid "(recommended)"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:605
|
||||
msgid "Or,"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:606
|
||||
msgid "Text to manually copy and paste in nginx settings"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:607
|
||||
msgid "(if your network is small and new sites are not added frequently)"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:625
|
||||
msgid "Logging Options"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:641
|
||||
msgid "Can't write on log file."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:663
|
||||
msgid "Logs path"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:675
|
||||
msgid "View Log"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:680
|
||||
msgid "Log"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:687
|
||||
msgid "Log level"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:692
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:693
|
||||
msgid "Info"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:694
|
||||
msgid "Warning"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:695
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:702
|
||||
msgid "Max log file size"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:708
|
||||
msgid "Mb"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-general-options.php:725
|
||||
msgid "Save All Changes"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:26
|
||||
msgid "Purge Entire Cache"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:31
|
||||
msgid "Need Help?"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:38
|
||||
msgid "Please use our"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:40
|
||||
msgid "free support forum"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:50
|
||||
msgid "Getting Social is Good"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:54
|
||||
msgid "Become a fan on Facebook"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:55
|
||||
msgid "Follow us on Twitter"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:61
|
||||
msgid "Useful Links"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:66
|
||||
msgid "WordPress-Nginx Solutions"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:69
|
||||
msgid "WordPress Theme Devleopment"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:72
|
||||
msgid "WordPress Plugin Development"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:75
|
||||
msgid "WordPress Consultancy"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:78
|
||||
msgid "easyengine (ee)"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:85
|
||||
msgid "Click to toggle"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:86
|
||||
msgid "Latest News"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-sidebar-display.php:87
|
||||
msgid "Loading..."
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-support-options.php:18
|
||||
msgid "Support Forums"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-support-options.php:24
|
||||
msgid "Free Support"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-support-options.php:27
|
||||
msgid "Free Support Forum"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-support-options.php:28
|
||||
#: admin/partials/nginx-helper-support-options.php:38
|
||||
msgid "Link to forum"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-support-options.php:34
|
||||
msgid "Premium Support"
|
||||
msgstr ""
|
||||
|
||||
#: admin/partials/nginx-helper-support-options.php:37
|
||||
msgid "Premium Support Forum"
|
||||
msgstr ""
|
||||
|
||||
#: class-nginx-helper-wp-cli-command.php:40
|
||||
msgid "Purged Everything!"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class-nginx-helper-activator.php:49
|
||||
msgid "Sorry, you need to be an administrator to use Nginx Helper"
|
||||
msgstr ""
|
||||
|
||||
#. translators: %s is Minimum WP version.
|
||||
#: includes/class-nginx-helper.php:311
|
||||
msgid "Sorry, Nginx Helper requires WordPress %s or higher"
|
||||
msgstr ""
|
||||
97
wp/wp-content/plugins/nginx-helper/nginx-helper.php
Normal file
97
wp/wp-content/plugins/nginx-helper/nginx-helper.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Nginx Helper
|
||||
* Plugin URI: https://rtcamp.com/nginx-helper/
|
||||
* Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things.
|
||||
* Version: 2.2.3
|
||||
* Author: rtCamp
|
||||
* Author URI: https://rtcamp.com
|
||||
* Text Domain: nginx-helper
|
||||
* Domain Path: /languages
|
||||
* Requires at least: 3.0
|
||||
* Tested up to: 5.4
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base URL of plugin
|
||||
*/
|
||||
if ( ! defined( 'NGINX_HELPER_BASEURL' ) ) {
|
||||
define( 'NGINX_HELPER_BASEURL', plugin_dir_url( __FILE__ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Base Name of plugin
|
||||
*/
|
||||
if ( ! defined( 'NGINX_HELPER_BASENAME' ) ) {
|
||||
define( 'NGINX_HELPER_BASENAME', plugin_basename( __FILE__ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Base PATH of plugin
|
||||
*/
|
||||
if ( ! defined( 'NGINX_HELPER_BASEPATH' ) ) {
|
||||
define( 'NGINX_HELPER_BASEPATH', plugin_dir_path( __FILE__ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* The code that runs during plugin activation.
|
||||
* This action is documented in includes/class-nginx-helper-activator.php
|
||||
*/
|
||||
function activate_nginx_helper() {
|
||||
require_once NGINX_HELPER_BASEPATH . 'includes/class-nginx-helper-activator.php';
|
||||
Nginx_Helper_Activator::activate();
|
||||
}
|
||||
|
||||
/**
|
||||
* The code that runs during plugin deactivation.
|
||||
* This action is documented in includes/class-nginx-helper-deactivator.php
|
||||
*/
|
||||
function deactivate_nginx_helper() {
|
||||
require_once NGINX_HELPER_BASEPATH . 'includes/class-nginx-helper-deactivator.php';
|
||||
Nginx_Helper_Deactivator::deactivate();
|
||||
}
|
||||
|
||||
register_activation_hook( __FILE__, 'activate_nginx_helper' );
|
||||
register_deactivation_hook( __FILE__, 'deactivate_nginx_helper' );
|
||||
|
||||
/**
|
||||
* The core plugin class that is used to define internationalization,
|
||||
* admin-specific hooks, and public-facing site hooks.
|
||||
*/
|
||||
require NGINX_HELPER_BASEPATH . 'includes/class-nginx-helper.php';
|
||||
|
||||
/**
|
||||
* Begins execution of the plugin.
|
||||
*
|
||||
* Since everything within the plugin is registered via hooks,
|
||||
* then kicking off the plugin from this point in the file does
|
||||
* not affect the page life cycle.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function run_nginx_helper() {
|
||||
|
||||
global $nginx_helper;
|
||||
|
||||
$nginx_helper = new Nginx_Helper();
|
||||
$nginx_helper->run();
|
||||
|
||||
// Load WP-CLI command.
|
||||
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
||||
|
||||
require_once NGINX_HELPER_BASEPATH . 'class-nginx-helper-wp-cli-command.php';
|
||||
\WP_CLI::add_command( 'nginx-helper', 'Nginx_Helper_WP_CLI_Command' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
run_nginx_helper();
|
||||
66
wp/wp-content/plugins/nginx-helper/phpcs.xml
Normal file
66
wp/wp-content/plugins/nginx-helper/phpcs.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="WordPress Coding Standards">
|
||||
|
||||
<!-- Set a description for this ruleset. -->
|
||||
<description>A custom set of code standard rules to check for Nginx helper plugin.</description>
|
||||
|
||||
<!-- Pass some flags to PHPCS:
|
||||
p flag: Show progress of the run.
|
||||
s flag: Show sniff codes in all reports.
|
||||
-->
|
||||
<arg value="psvn"/>
|
||||
|
||||
<!-- Check up to 8 files simultanously. -->
|
||||
<arg name="parallel" value="8"/>
|
||||
|
||||
<!-- Check PHP and JS files. -->
|
||||
<arg name="extensions" value="php,js"/>
|
||||
|
||||
<!-- Check all files in this directory and the directories below it. -->
|
||||
<file>.</file>
|
||||
|
||||
<!-- Exclude folders. -->
|
||||
<exclude-pattern>*/languages/*</exclude-pattern>
|
||||
<exclude-pattern>*/admin/predis.php</exclude-pattern> <!-- Predis library file -->
|
||||
<exclude-pattern>*/vendor/*</exclude-pattern> <!-- Composer vendor directory -->
|
||||
|
||||
<!-- Include the WordPress standard. -->
|
||||
<rule ref="WordPress">
|
||||
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid" />
|
||||
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
|
||||
</rule>
|
||||
<rule ref="WordPress-VIP-Go">
|
||||
<exclude name="WordPress.VIP.FileSystemWritesDisallow.directory_mkdir" />
|
||||
<exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fopen" />
|
||||
<exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable" />
|
||||
<exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fclose" />
|
||||
<exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_fwrite" />
|
||||
<exclude name="WordPress.VIP.FileSystemWritesDisallow.directory_rmdir" />
|
||||
<exclude name="WordPress.WP.AlternativeFunctions.file_system_read_fwrite" />
|
||||
<exclude name="WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink" />
|
||||
<exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.directory_mkdir" />
|
||||
<exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions.directory_rmdir" />
|
||||
</rule>
|
||||
|
||||
<!-- Verify that the text_domain is set to the desired text-domain.
|
||||
Multiple valid text domains can be provided as a comma-delimited list. -->
|
||||
<rule ref="WordPress.WP.I18n">
|
||||
<properties>
|
||||
<property name="text_domain" type="array" value="nginx-helper" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Verify that no WP functions are used which are deprecated or have been removed.
|
||||
The minimum version set here should be in line with the minimum WP version
|
||||
as set in the "Requires at least" tag in the readme.txt file. -->
|
||||
<rule ref="WordPress.WP.DeprecatedFunctions">
|
||||
<properties>
|
||||
<property name="minimum_supported_version" value="3.0" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Include sniffs for PHP cross-version compatibility. -->
|
||||
<rule ref="PHPCompatibility"/>
|
||||
<config name="testVersion" value="5.3-99.0"/>
|
||||
|
||||
</ruleset>
|
||||
425
wp/wp-content/plugins/nginx-helper/readme.txt
Normal file
425
wp/wp-content/plugins/nginx-helper/readme.txt
Normal file
@@ -0,0 +1,425 @@
|
||||
=== Nginx Helper ===
|
||||
Contributors: rtcamp, rahul286, saurabhshukla, manishsongirkar36, faishal, desaiuditd, darren-slatten, jk3us, daankortenbach, telofy, pjv, llonchj, jinnko, weskoop, bcole808, gungeekatx, rohanveer, chandrapatel, gagan0123, ravanh, michaelbeil, samedwards, niwreg, entr, nuvoPoint, iam404, rittesh.patel, vishalkakadiya, BhargavBhandari90, vincent-lu, murrayjbrown, bryant1410, 1gor, matt-h, pySilver, johan-chassaing, dotsam, sanketio, petenelson, nathanielks, rigagoogoo, dslatten, jinschoi, kelin1003, vaishuagola27, rahulsprajapati, Joel-James, utkarshpatel, gsayed786, shashwatmittal, sudhiryadav, thrijith, stayallive, jaredwsmith, abhijitrakas, umeshnevase, sid177, souptik, arafatkn, subscriptiongroup
|
||||
Donate Link: http://rt.cx/eedonate/
|
||||
Tags: nginx, cache, purge, nginx map, nginx cache, maps, fastcgi, proxy, redis, redis-cache, rewrite, permalinks
|
||||
License: GPLv2 or later (of-course)
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Requires at least: 3.0
|
||||
Tested up to: 6.4
|
||||
Stable tag: 2.2.3
|
||||
|
||||
Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.
|
||||
|
||||
== Description ==
|
||||
|
||||
1. Removes `index.php` from permalinks when using WordPress with nginx.
|
||||
1. Adds support for purging redis-cache when used as full-page cache created using [nginx-srcache-module](https://github.com/openresty/srcache-nginx-module#caching-with-redis)
|
||||
1. Adds support for nginx fastcgi_cache_purge & proxy_cache_purge directive from [module](https://github.com/FRiCKLE/ngx_cache_purge "ngx_cache_purge module"). Provides settings so you can customize purging rules.
|
||||
1. Adds support for nginx `map{..}` on a WordPress-multisite network installation. Using it, Nginx can serve PHP file uploads even if PHP/MySQL crashes. Please check the tutorial list below for related Nginx configurations.
|
||||
|
||||
= Tutorials =
|
||||
|
||||
You will need to follow one or more tutorials below to get desired functionality:
|
||||
|
||||
* [Nginx Map + WordPress-Multisite + Static Files Handling](https://easyengine.io/wordpress-nginx/tutorials/multisite/static-files-handling/)
|
||||
* [Nginx + WordPress + fastcgi_purge_cache](https://easyengine.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/)
|
||||
* [Nginx + WordPress-Multisite (Subdirectories) + fastcgi_purge_cache](https://easyengine.io/wordpress-nginx/tutorials/multisite/subdirectories/fastcgi-cache-with-purging/)
|
||||
* [Nginx + WordPress-Multisite (Subdomains/domain-mapping) + fastcgi_purge_cache](https://easyengine.io/wordpress-nginx/tutorials/multisite/subdomains/fastcgi-cache-with-purging/)
|
||||
* [Other WordPress-Nginx Tutorials](https://easyengine.io/wordpress-nginx/tutorials/)
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
Automatic Installation
|
||||
|
||||
1. Log in to your WordPress admin panel, navigate to the Plugins menu and click Add New.
|
||||
1. In the search field type “Nginx Helper” and click Search Plugins. From the search results, pick Nginx Helper and click Install Now. Wordpress will ask you to confirm to complete the installation.
|
||||
|
||||
Manual Installation
|
||||
|
||||
1. Extract the zip file.
|
||||
1. Upload them to `/wp-content/plugins/` directory on your WordPress installation.
|
||||
1. Then activate the Plugin from Plugins page.
|
||||
|
||||
For proper configuration, check out our **tutorial list** in the [Description tab](http://wordpress.org/extend/plugins/nginx-helper).
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
**Important** - Please refer to [https://github.com/rtcamp/nginx-helper#frequently-asked-questions](https://github.com/rtcamp/nginx-helper#frequently-asked-questions) for up-to-date FAQs.
|
||||
|
||||
= FAQ - Installation/Comptability =
|
||||
|
||||
**Q. Will this work out of the box?**
|
||||
|
||||
No. You need to make some changes at the Nginx end. Please check our [tutorial list](https://easyengine.io/wordpress-nginx/tutorials/).
|
||||
|
||||
= FAQ - Nginx Fastcgi Cache Purge =
|
||||
|
||||
**Q. There's a 'purge all' button? Does it purge the whole site?**
|
||||
|
||||
Yes, it does. It physically empties the cache directory. It is set by default to `/var/run/nginx-cache/`.
|
||||
|
||||
If your cache directory is different, you can override this in your wp-config.php by adding
|
||||
`define('RT_WP_NGINX_HELPER_CACHE_PATH','/var/run/nginx-cache/');`
|
||||
|
||||
Replace the path with your own.
|
||||
|
||||
**Q. Does it work for custom posts and taxonomies?**
|
||||
|
||||
Yes. It handles all post-types the same way.
|
||||
|
||||
**Q. How do I know my Nginx config is correct for fastcgi purging?**
|
||||
|
||||
Manually purging any page from the cache, by following instructions in the previous answer.
|
||||
|
||||
Version 1.3.4 onwards, Nginx Helper adds a comment at the end of the HTML source ('view source' in your favourite browser):
|
||||
`<!--Cached using Nginx-Helper on 2012-10-08 07:01:45. It took 42 queries executed in 0.280 seconds.-->`. This shows the time when the page was last cached. This date/time will be reset whenever this page is purged and refreshed in the cache. Just check this comment before and after a manual purge.
|
||||
|
||||
As long as you don't purge the page (or make changes that purge it from the cache), the timestamp will remain as is, even if you keep refreshing the page. This means the page was served from the cache and it's working!
|
||||
|
||||
The rest shows you the database queries and time saved on loading this page. (This would have been the additional resource load, if you weren't using fast-cgi-cache.)
|
||||
|
||||
|
||||
**Q. I need to flush a cached page immediately! How do I do that?**
|
||||
|
||||
Nginx helper plugin handles usual scenarios, when a page in the cache will need purging. For example, when a post is edited or a comment is approved on a post.
|
||||
|
||||
To purge a page immediately, follow these instructions:
|
||||
|
||||
* Let's say we have a page at the following domain: http://yoursite.com/about.
|
||||
* Between the domain name and the rest of the URL, insert '/purge/'.
|
||||
* So, in the above example, the purge URL will be http://yoursite.com/purge/about.
|
||||
* Just open this in a browser and the page will be purged instantly.
|
||||
* Needless to say, this won't work, if you have a page or taxonomy called 'purge'.
|
||||
|
||||
= FAQ - Nginx Redis Cache =
|
||||
|
||||
**Q. Can I override the redis hostname, port and prefix?**
|
||||
|
||||
Yes, you can force override the redis hostname, port or prefix by defining constant in wp-config.php. For example:
|
||||
|
||||
```
|
||||
define('RT_WP_NGINX_HELPER_REDIS_HOSTNAME', '10.0.0.1');
|
||||
|
||||
define('RT_WP_NGINX_HELPER_REDIS_PORT', '6000');
|
||||
|
||||
define('RT_WP_NGINX_HELPER_REDIS_PREFIX', 'page-cache:');
|
||||
```
|
||||
|
||||
= FAQ - Nginx Map =
|
||||
|
||||
**Q. My multisite already uses `WPMU_ACCEL_REDIRECT`. Do I still need Nginx Map?**
|
||||
|
||||
Definitely. `WPMU_ACCEL_REDIRECT` reduces the load on PHP, but it still ask WordPress i.e. PHP/MySQL to do some work for static files e.g. images in your post. Nginx map lets nginx handle files on its own bypassing wordpress which gives you much better performance without using a CDN.
|
||||
|
||||
**Q. I am using X plugin. Will it work on Nginx?**
|
||||
|
||||
Most likely yes. A wordpress plugin, if not using explicitly any Apache-only mod, should work on Nginx. Some plugin may need some extra work.
|
||||
|
||||
|
||||
= Still need help! =
|
||||
|
||||
Please post your problem in [our free support forum](https://github.com/rtCamp/nginx-helper/issues).
|
||||
|
||||
== Screenshots ==
|
||||
1. Nginx plugin settings
|
||||
2. Remaining settings
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.2.3 =
|
||||
* Add the URL being purged as parameter in `rt_nginx_helper_purge_cached_file` hook. [#271](https://github.com/rtCamp/nginx-helper/pull/271) - by [Arafat Islam](https://github.com/arafatkn)
|
||||
* Fix performance issue when saving nav menus. [#112](https://github.com/rtCamp/nginx-helper/issues/112), [#272](https://github.com/rtCamp/nginx-helper/pull/272/) - by [Arafat Islam](https://github.com/arafatkn)
|
||||
* Fix purging date archives for custom post types. [#40](https://github.com/rtCamp/nginx-helper/issues/40), [#268](https://github.com/rtCamp/nginx-helper/pull/268) - by [Arafat Islam](https://github.com/arafatkn)
|
||||
* Fix pages and CPT URLs not being purged on moving to trash. [#191](https://github.com/rtCamp/nginx-helper/issues/191), [#267](https://github.com/rtCamp/nginx-helper/pull/267) - by [Arafat Islam](https://github.com/arafatkn)
|
||||
* Fix notice - Undefined index: path [#190](https://github.com/rtCamp/nginx-helper/issues/190), [#251](https://github.com/rtCamp/nginx-helper/issues/251), [#262](https://github.com/rtCamp/nginx-helper/pull/262) - by [George Lagonikas](https://github.com/glagonikas)
|
||||
* PHP 8.1 compatibility [#291](https://github.com/rtCamp/nginx-helper/issues/291), [#302](https://github.com/rtCamp/nginx-helper/pull/302) - by [Siddharth Tikekar](https://github.com/SID177)
|
||||
* Tested with WordPress 6.1 [#285](https://github.com/rtCamp/nginx-helper/pull/285)
|
||||
|
||||
= 2.2.2 =
|
||||
* Add action `rt_nginx_helper_after_purge_all` to fire after the entire cache has been purged whatever caching type is used. [#232](https://github.com/rtCamp/nginx-helper/pull/232) - by [Julien-prrs](https://github.com/Julien-prrs)
|
||||
* Fix issue where settings not saved because the button's value localized (for any language). [#236](https://github.com/rtCamp/nginx-helper/pull/236) - by [umeshnevase](https://github.com/umeshnevase)
|
||||
* Fix issue where "Custom Purge URL" option displays previous value. [#240](https://github.com/rtCamp/nginx-helper/issues/240), [#241](https://github.com/rtCamp/nginx-helper/pull/241) - by [KirillGritcenko](https://github.com/KirillGritcenko)
|
||||
* Tested with WordPress 5.4
|
||||
|
||||
= 2.2.1 =
|
||||
* Fix timeout issue on FastCGI cache purge. [#229](https://github.com/rtCamp/nginx-helper/pull/229) - by [chandrapatel](https://github.com/chandrapatel), [thrijith](https://github.com/thrijith)
|
||||
|
||||
= 2.2.0 =
|
||||
* Add filter `rt_nginx_helper_fastcgi_purge_suffix` to change purge suffix for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive)
|
||||
* Add filter `rt_nginx_helper_fastcgi_purge_url_base` to change purge URL base for FastCGI cache. [#141](https://github.com/rtCamp/nginx-helper/pull/141) - by [stayallive](https://github.com/stayallive)
|
||||
* Update our code to be in line with WordPress Coding standards in various places. [#209](https://github.com/rtCamp/nginx-helper/pull/209), [#225](https://github.com/rtCamp/nginx-helper/pull/225) - by [abhijitrakas](https://github.com/abhijitrakas), [chandrapatel](https://github.com/chandrapatel)
|
||||
* Check and verify purging is enabled before purging cache. [#168](https://github.com/rtCamp/nginx-helper/pull/168) - by [jaredwsmith](https://github.com/jaredwsmith)
|
||||
* Hide Purge Cache button in admin bar when purge is disabled. [#218](https://github.com/rtCamp/nginx-helper/issues/218), [#219](https://github.com/rtCamp/nginx-helper/pull/219) - by [mbautista](https://github.com/mbautista), [chandrapatel](https://github.com/chandrapatel)
|
||||
* Don't add Nginx Timestamp on WordPress login page. [#204](https://github.com/rtCamp/nginx-helper/issues/204), [#220](https://github.com/rtCamp/nginx-helper/pull/220) - by [peixotorms](https://github.com/peixotorms), [chandrapatel](https://github.com/chandrapatel)
|
||||
|
||||
= 2.1.0 =
|
||||
* Add wildcard cache key deletion for device type cache purge. [#203](https://github.com/rtCamp/nginx-helper/pull/203) - by [pradeep910](https://github.com/pradeep910)
|
||||
* Add filter `rt_nginx_helper_purge_url` to filter the URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add filter `rt_nginx_helper_purge_cached_file` to filter the cached file name. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add filter `rt_nginx_helper_remote_purge_url` to filter remote URL to be purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add action `rt_nginx_helper_after_fastcgi_purge_all` to fire after the FastCGI cache has been purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add action `rt_nginx_helper_after_redis_purge_all` to fire after the Redis cache has been purged. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add action `rt_nginx_helper_purged_file` to fire an action after deleting file from cache. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add action `rt_nginx_helper_before_remote_purge_url` to fire an action before purging remote URL. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Add action `rt_nginx_helper_after_remote_purge_url` to fire an action after remote purge request. [#182](https://github.com/rtCamp/nginx-helper/pull/182) - by [todeveni](https://github.com/todeveni)
|
||||
* Fix issue with post purge on new comments. [#175](https://github.com/rtCamp/nginx-helper/pull/175) - by [jinschoi](https://github.com/jinschoi)
|
||||
* Fix Nginx Timestamp being added to invalid content type. [#200](https://github.com/rtCamp/nginx-helper/pull/200) - by [thrijith](https://github.com/thrijith)
|
||||
* Handle filesize exception while truncating nginx.log file. [#206](https://github.com/rtCamp/nginx-helper/pull/206) - by [peterjanes](https://github.com/peterjanes)
|
||||
|
||||
= 2.0.3 =
|
||||
* Update article link for fastcgi cache purge. [#187](https://github.com/rtCamp/nginx-helper/pull/187) - by [gagan0123](https://github.com/gagan0123)
|
||||
* Fix map generation issue on `SUBDOMAIN_INSTALL`. [#189](https://github.com/rtCamp/nginx-helper/pull/189) - by [ChrisHardie](https://github.com/ChrisHardie)
|
||||
|
||||
= 2.0.2 =
|
||||
* Fix undefined error when we install the plugin for the first time and if Redis is not available. [#162](https://github.com/rtCamp/nginx-helper/pull/162) - by [Joel-James](https://github.com/Joel-James)
|
||||
* Remove extra spacing for nginx map section. [#169](https://github.com/rtCamp/nginx-helper/pull/169) - by [ShashwatMittal](https://github.com/ShashwatMittal)
|
||||
* Purge Cache menu in front-end admibar now purge current page. [#173](https://github.com/rtCamp/nginx-helper/pull/173) - by [imranhsayed](https://github.com/imranhsayed)
|
||||
* Fix issue where cache is not cleared when page is swiched from publish to draft. [#174](https://github.com/rtCamp/nginx-helper/pull/174) - by [imranhsayed](https://github.com/imranhsayed)
|
||||
* Fix an issue where custom purge url option does not show newlines when using multiple urls. [#184](https://github.com/rtCamp/nginx-helper/issues/184) - by [mist-webit](https://github.com/mist-webit)
|
||||
|
||||
= 2.0.1 =
|
||||
* Fix settings url for multisite: use network_admin_url to get network correct settings url. [#163](https://github.com/rtCamp/nginx-helper/pull/163) - by [Joel-James](https://github.com/Joel-James)
|
||||
* Fix php error with arbitrary statement in empty - Prior to PHP 5.5. [#165](https://github.com/rtCamp/nginx-helper/pull/165) - by [PatelUtkarsh](https://github.com/PatelUtkarsh)
|
||||
|
||||
= 2.0.0 =
|
||||
* Fix typo causing failure to purge on trashed comment. [#159](https://github.com/rtCamp/nginx-helper/pull/159) - by [jinschoi](https://github.com/jinschoi)
|
||||
* Refactor Plugin structure and remove unused code. Initial code by [chandrapatel](https://github.com/chandrapatel), [#153](https://github.com/rtCamp/nginx-helper/pull/153) - by [jinschoi](https://github.com/kelin1003),
|
||||
* Run phpcs and fix warning. [#158](https://github.com/rtCamp/nginx-helper/pull/158)
|
||||
* Make compatible with EasyEngine v4.
|
||||
|
||||
= 1.9.12 =
|
||||
* Allow override Redis host/port/prefix by defining constant in wp-config.php [#152](https://github.com/rtCamp/nginx-helper/pull/152) - by [vincent-lu](https://github.com/vincent-lu)
|
||||
|
||||
= 1.9.11 =
|
||||
* Fixed issue where permalinks without trailing slash does not purging [#124](https://github.com/rtCamp/nginx-helper/issues/124) - by Patrick
|
||||
* Check whether role exist or not before removing capability. [#134](https://github.com/rtCamp/nginx-helper/pull/134) - by [1gor](https://github.com/1gor)
|
||||
|
||||
= 1.9.10 =
|
||||
* Fixed issue where Nginx cache folders deleted on purge. [#123](https://github.com/rtCamp/nginx-helper/pull/123) - by [johan-chassaing](https://github.com/johan-chassaing)
|
||||
* Fixed Redis purge all feature for installation where WordPress lives in a separate folder. [#130](https://github.com/rtCamp/nginx-helper/pull/130) - by [pySilver](https://github.com/pySilver)
|
||||
|
||||
= 1.9.9 =
|
||||
* Fix wp_redirect issue. [#131](https://github.com/rtCamp/nginx-helper/pull/131) - by [matt-h](https://github.com/matt-h)
|
||||
|
||||
= 1.9.8 =
|
||||
* Fixed homepage cache cleared when WPML plugin used [#116](https://github.com/rtCamp/nginx-helper/pull/116) - by [Niwreg](https://profiles.wordpress.org/niwreg/)
|
||||
* Fixed Purge Cache clears the whole Redis cache [#113](https://github.com/rtCamp/nginx-helper/issues/113) - by HansVanEijsden
|
||||
* One log file for all site in WPMU.
|
||||
* Single site Redis cache purge when click on Purge Cache button in WPMU [#122](https://github.com/rtCamp/nginx-helper/pull/122) - by Lars Støttrup Nielsen
|
||||
* Fixed notices and warnings.
|
||||
|
||||
= 1.9.7 =
|
||||
* Remove timestamp if cron or wp-cli [#114](https://github.com/rtCamp/nginx-helper/pull/114) - by [samedwards](https://profiles.wordpress.org/samedwards/)
|
||||
* Fixed notices and warnings.
|
||||
|
||||
= 1.9.6 =
|
||||
* Fixed cache purging on post publish.
|
||||
* Error fixed when redis server not installed.
|
||||
|
||||
= 1.9.5 =
|
||||
Added custom purge URL option.
|
||||
|
||||
= 1.9.4 =
|
||||
* Added redis server connection timeout.
|
||||
* Added RedisException handling.
|
||||
|
||||
= 1.9.3 =
|
||||
* Added PhpRedis API support.
|
||||
* Added redis-lua script support to purge complete cache very fast.
|
||||
* Added composer.json support
|
||||
* Fixed cache purging link in admin bar.
|
||||
* Updated the initial settings to include the 'purge_method' [#99](https://github.com/rtCamp/nginx-helper/pull/99) - by
|
||||
[gagan0123](https://github.com/gagan0123)
|
||||
|
||||
= 1.9.2 =
|
||||
Fix purging for Redis cache and FastCGI cache
|
||||
|
||||
= 1.9.1 =
|
||||
Fix purging for custom post types
|
||||
|
||||
= 1.9 =
|
||||
Added Redis cache purge support.
|
||||
|
||||
= 1.8.13 =
|
||||
Fixed PHP notice for an undefined index when "Enable Logging" is not set.
|
||||
|
||||
= 1.8.12 =
|
||||
Updated readme and changelog
|
||||
|
||||
= 1.8.11 =
|
||||
Fix url escaping [#82](https://github.com/rtCamp/nginx-helper/pull/82) - by
|
||||
[javisperez](https://github.com/javisperez)
|
||||
|
||||
= 1.8.10 =
|
||||
* Security bug fix
|
||||
|
||||
= 1.8.9 =
|
||||
* Default setting fix and wp-cli example correction - by [bcole808](https://profiles.wordpress.org/bcole808/)
|
||||
|
||||
= 1.8.8 =
|
||||
* Added option to purge cache without nginx purge module - by [bcole808](https://profiles.wordpress.org/bcole808/)
|
||||
|
||||
= 1.8.7 =
|
||||
* Added action `rt_nginx_helper_purge_all` to purge cache from other plugins - by [gungeekatx](https://profiles.wordpress.org/gungeekatx/)
|
||||
|
||||
= 1.8.6 =
|
||||
* Removed wercker.yml from plugin zip/svn.
|
||||
* Updated readme
|
||||
|
||||
= 1.8.5 =
|
||||
* Added WP_CLI support - by [Udit Desai](https://profiles.wordpress.org/desaiuditd/)
|
||||
|
||||
= 1.8.4 =
|
||||
* Fix undefined index issue and correct "purge_archive_on_del" key
|
||||
|
||||
= 1.8.3 =
|
||||
* Tested with WordPress 4.0
|
||||
* Fix issue #69
|
||||
|
||||
= 1.8.1 =
|
||||
* Tested with wordpress 3.9.1
|
||||
* Fix confilct with Mailchimp's Social plugin
|
||||
|
||||
= 1.8 =
|
||||
* New admin UI
|
||||
* Fix missing wp_sanitize_redirect function call
|
||||
|
||||
= 1.7.6 =
|
||||
* Update Backend UI
|
||||
* Added Language Support
|
||||
|
||||
= 1.7.5 =
|
||||
* Fixed option name mismatch issue to purge homepage on delete.
|
||||
|
||||
= 1.7.4 =
|
||||
* Disable purge and stamp by default.
|
||||
|
||||
= 1.7.3 =
|
||||
* Suppressed `unlink` related error-messages which can be safely ignored.
|
||||
* Fixed a bug in purge-all option.
|
||||
|
||||
= 1.7.2 =
|
||||
* [pjv](http://profiles.wordpress.org/pjv/) fixed bug in logging file.
|
||||
|
||||
= 1.7.1 =
|
||||
* Fixes bug in true purge and admin screen.
|
||||
|
||||
= 1.7 =
|
||||
* True full cache purge added.
|
||||
* Map file location changed to uploads' directory to fix http://rtcamp.com/support/topic/plugin-update-removes-map-file/
|
||||
* Log file location also changed to uploads' directory.
|
||||
|
||||
= 1.6.13 =
|
||||
* [pjv](http://profiles.wordpress.org/pjv/) changed the way home URL is accessed. Instead of site option, the plugin now uses home_URL() function.
|
||||
|
||||
= 1.6.12 =
|
||||
* [telofy](http://wordpress.org/support/profile/telofy) added purging of atom and RDF feeds.
|
||||
|
||||
= 1.6.11 =
|
||||
* Removed comments from Admin screens since, it was interfering with media uploads in 3.5 up.
|
||||
|
||||
= 1.6.10 =
|
||||
* Cleaned up code.
|
||||
* Added credits for code.
|
||||
* Improved attachment purging.
|
||||
|
||||
= 1.6.9 =
|
||||
* Added Faux to Purge all buttons, to avoid misleading users.
|
||||
|
||||
= 1.6.8 =
|
||||
* [daankortenbach](http://profiles.wordpress.org/daankortenbach) added Purge Cache link to wp-admin bar
|
||||
|
||||
= 1.6.7 =
|
||||
* [jk3us](http://profiles.wordpress.org/jk3us) added better content-type detection for cache verification comments
|
||||
|
||||
= 1.6.6 =
|
||||
* [darren-slatten](http://profiles.wordpress.org/darren-slatten/) added Manual 'Purge all URLs' functionality
|
||||
|
||||
= 1.6.5 =
|
||||
* Fixed typo that interfered with archive purge settings. Thanks to [Daan Kortenbach](http://profiles.wordpress.org/daankortenbach/) for pointing this out.
|
||||
|
||||
= 1.6.4 =
|
||||
* Improved code for map generation to better conventions since the nesting confused some servers.
|
||||
* Added map update process to admin_init for frequent refreshes.
|
||||
|
||||
= 1.6.3 =
|
||||
* Fixed duplicate entries.
|
||||
|
||||
= 1.6.2 =
|
||||
* Another bug fix in the revised code for improved multisite and multidomain mapping.
|
||||
|
||||
= 1.6.1 =
|
||||
* Fixed bug in the revised code for improved multisite and multidomain mapping.
|
||||
|
||||
= 1.6 =
|
||||
* Revised code for improved multisite and multidomain mapping.
|
||||
|
||||
= 1.5 =
|
||||
* Timestamp now only gets added to content-type text/html
|
||||
* Added option to toggle timestamp creation
|
||||
|
||||
= 1.4 =
|
||||
* Fixed bug related to nomenclature of comment status that caused purge to fail.
|
||||
|
||||
= 1.3.9 =
|
||||
* Removed extraneous headers.
|
||||
|
||||
= 1.3.8 =
|
||||
|
||||
* Fixed bug in single post/page/post-type purging code. Thanks to Greg for pointing this out here: http://rtcamp.com/support/topic/updating-post-nginx-helper-purge-cache-post/.
|
||||
|
||||
= 1.3.7 =
|
||||
|
||||
* Changed the action hook, back to 'shutdown' from 'wp_footer' to add verification comments.
|
||||
* Added a check to prevent adding comments to ajax requests,
|
||||
|
||||
= 1.3.6 =
|
||||
|
||||
* Changed the action hook, from 'shutdown' to 'wp_footer' to add verification comments. This was interfering with other plugins.
|
||||
|
||||
= 1.3.5 =
|
||||
|
||||
* Improved Readme.
|
||||
* Improved cache verification comments.
|
||||
|
||||
= 1.3.4 =
|
||||
|
||||
* Fixed duplicate entries generated for maps (Harmless, but doesn't look good!)
|
||||
* Added timestamp html comments for cache verification, as described here: http://rtcamp.com/wordpress-nginx/tutorials/checklist/
|
||||
|
||||
= 1.3.3 =
|
||||
|
||||
* Fixed map generation for multi domain installs using domain mapping plugin, where blog ids were not displayed.
|
||||
|
||||
= 1.3.2 =
|
||||
|
||||
* Fixed map generation for multi domain installs with domain mapping plugin.
|
||||
|
||||
= 1.3.1 =
|
||||
|
||||
* Minor fixes for directory structure and file names.
|
||||
|
||||
= 1.3 =
|
||||
|
||||
* Improved Readme.
|
||||
|
||||
= 1.2 =
|
||||
|
||||
* Fixed map generation error.
|
||||
* Fixed purging logic.
|
||||
* Fixed UI where purge settings were lost on disabling and re-enabling purge.
|
||||
* Minor Ui rearrangement.
|
||||
|
||||
= 1.1 =
|
||||
|
||||
* Improved readme.txt. Added Screenshots.
|
||||
|
||||
= 1.0 =
|
||||
|
||||
* First release
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.2.3 =
|
||||
Nginx Helper 2.2.3, Fix performance issue when saving nav menus, purging date archives for CPTs, purge page and post URLs when the post is trashed and passes the URL being purged in "rt_nginx_helper_purge_cached_file" hook as parameter.
|
||||
30
wp/wp-content/plugins/nginx-helper/uninstall.php
Normal file
30
wp/wp-content/plugins/nginx-helper/uninstall.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Fired when the plugin is uninstalled.
|
||||
*
|
||||
* When populating this file, consider the following flow
|
||||
* of control:
|
||||
*
|
||||
* - This method should be static
|
||||
* - Check if the $_REQUEST content actually is the plugin name
|
||||
* - Run an admin referrer check to make sure it goes through authentication
|
||||
* - Verify the output of $_GET makes sense
|
||||
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
||||
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
||||
*
|
||||
* This file may be updated more in future version of the Boilerplate; however, this is the
|
||||
* general skeleton and outline for how the file should work.
|
||||
*
|
||||
* For more information, see the following discussion:
|
||||
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
||||
*
|
||||
* @link https://rtcamp.com/nginx-helper/
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @package nginx-helper
|
||||
*/
|
||||
|
||||
// If uninstall not called from WordPress, then exit.
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
22
wp/wp-content/plugins/nginx-helper/wercker.yml
Normal file
22
wp/wp-content/plugins/nginx-helper/wercker.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
box: ubuntu
|
||||
|
||||
build:
|
||||
steps:
|
||||
|
||||
- script:
|
||||
name: placehoder
|
||||
code: echo "nothing to build"
|
||||
|
||||
deploy:
|
||||
steps:
|
||||
# - install-packages:
|
||||
# packages: subversion git wget
|
||||
|
||||
- rtcamp/wordpress-svn:
|
||||
pluginslug: nginx-helper
|
||||
mainfile: nginx-helper.php
|
||||
svnuser: $SVNUSER
|
||||
svnpass: $SVNPASS #wordpress.org password
|
||||
gituser: $GITUSER
|
||||
gitpass: $GITPASS #github.com password
|
||||
gitemail: git@example.com #github.com password
|
||||
Reference in New Issue
Block a user