-
Notifications
You must be signed in to change notification settings - Fork 130
Rebrand the plugin to EasyEngine Cache Helper #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c15c5c3
7d872d5
69669eb
36a109c
6fe05aa
6fb31de
61dfdae
c00fad9
457a39e
541ae1f
d8106ad
25e5b98
9c91b6e
1b50696
a2977c8
df0aa30
d564001
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| * @subpackage nginx-helper/admin | ||
| */ | ||
|
|
||
| use EasyCache\Cloudflare_Client; | ||
| use EECacheHelper\Cloudflare_Client; | ||
|
|
||
| /** | ||
| * The admin-specific functionality of the plugin. | ||
|
|
@@ -106,13 +106,9 @@ public function initialize_setting_tab() { | |
| 'rt_nginx_helper_settings_tabs', | ||
| array( | ||
| 'general' => array( | ||
| 'menu_title' => __( 'General', 'nginx-helper' ), | ||
| 'menu_title' => __( 'Nginx', 'nginx-helper' ), | ||
| 'menu_slug' => 'general', | ||
| ), | ||
| 'support' => array( | ||
| 'menu_title' => __( 'Support', 'nginx-helper' ), | ||
| 'menu_slug' => 'support', | ||
| ), | ||
| 'cloudflare' => array( | ||
| 'menu_title' => __( 'Cloudflare', 'nginx-helper' ), | ||
| 'menu_slug' => 'cloudflare', | ||
|
|
@@ -196,8 +192,8 @@ public function nginx_helper_admin_menu() { | |
|
|
||
| add_submenu_page( | ||
| 'settings.php', | ||
| __( 'Nginx Helper', 'nginx-helper' ), | ||
| __( 'Nginx Helper', 'nginx-helper' ), | ||
| __( 'EasyEngine Cache Helper for Nginx & Cloudflare', 'nginx-helper' ), | ||
| __( 'EasyEngine Cache Helper for Nginx & Cloudflare', 'nginx-helper' ), | ||
| 'manage_options', | ||
| 'nginx', | ||
| array( &$this, 'nginx_helper_setting_page' ) | ||
|
|
@@ -207,8 +203,8 @@ public function nginx_helper_admin_menu() { | |
|
|
||
| add_submenu_page( | ||
| 'options-general.php', | ||
| __( 'Nginx Helper', 'nginx-helper' ), | ||
| __( 'Nginx Helper', 'nginx-helper' ), | ||
| __( 'EasyEngine Cache Helper for Nginx & Cloudflare', 'nginx-helper' ), | ||
| __( 'EasyEngine Cache Helper for Nginx & Cloudflare', 'nginx-helper' ), | ||
| 'manage_options', | ||
| 'nginx', | ||
| array( &$this, 'nginx_helper_setting_page' ) | ||
|
|
@@ -362,10 +358,10 @@ public function get_cloudflare_default_settings() { | |
| public function get_cloudflare_settings() { | ||
| $default_settings = $this->get_cloudflare_default_settings(); | ||
|
|
||
| $stored_options = get_site_option( 'easycache_cf_settings', array() ); | ||
| $stored_options = get_site_option( 'easyengine_cache_manager_cf_settings', array() ); | ||
|
||
|
|
||
| if ( defined( 'EASYCACHE_CLOUDFLARE_API_TOKEN' ) && !empty( EASYCACHE_CLOUDFLARE_API_TOKEN ) ) { | ||
| $stored_options['api_token'] = EASYCACHE_CLOUDFLARE_API_TOKEN; | ||
| if ( defined( 'EASYENGINE_CACHE_MANAGER_CLOUDFLARE_API_TOKEN' ) && !empty( EASYENGINE_CACHE_MANAGER_CLOUDFLARE_API_TOKEN ) ) { | ||
|
||
| $stored_options['api_token'] = EASYENGINE_CACHE_MANAGER_CLOUDFLARE_API_TOKEN; | ||
|
Comment on lines
+363
to
+364
|
||
| $stored_options['api_token_enabled_by_constant'] = true; | ||
| } | ||
|
|
||
|
|
@@ -384,11 +380,11 @@ public function get_cloudflare_settings() { | |
| public function store_cloudflare_settings() { | ||
| $default_settings = $this->get_cloudflare_default_settings(); | ||
|
|
||
| $stored_options = get_site_option( 'easycache_cf_settings', array() ); | ||
| $stored_options = get_site_option( 'easyengine_cache_manager_cf_settings', array() ); | ||
|
|
||
| $diff_options = wp_parse_args( $stored_options, $default_settings ); | ||
|
|
||
| add_site_option( 'easycache_cf_settings', $diff_options ); | ||
| add_site_option( 'easyengine_cache_manager_cf_settings', $diff_options ); | ||
|
Comment on lines
+383
to
+387
|
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -526,7 +522,7 @@ public function nginx_helper_get_feeds() { | |
| $rss_items = array(); | ||
|
|
||
| // Get a SimplePie feed object from the specified feed source. | ||
| $rss = fetch_feed( 'https://rtcamp.com/blog/feed/' ); | ||
| $rss = fetch_feed( 'https://easyengine.io/blog/feed/' ); | ||
|
|
||
| if ( ! is_wp_error( $rss ) ) { // Checks that the object is created correctly. | ||
|
|
||
|
|
@@ -614,7 +610,7 @@ public function add_timestamps() { | |
| } | ||
|
|
||
| $timestamps = "\n<!--" . | ||
| 'Cached using Nginx-Helper on ' . current_time( 'mysql' ) . '. ' . | ||
| 'Cached using EasyEngine Cache Helper for Nginx & Cloudflare 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-->'; | ||
|
||
|
|
@@ -1208,15 +1204,15 @@ public function purge_product_cache_on_update( $product_id ) { | |
| * @return void | ||
| */ | ||
| public function handle_cf_cache_rule_update() { | ||
| $nonce = isset( $_POST['easycache_add_cache_rule_nonce'] ) ? wp_unslash( $_POST['easycache_add_cache_rule_nonce'] ) : ''; | ||
| $nonce = isset( $_POST['easyengine_cache_manager_add_cache_rule_nonce'] ) ? wp_unslash( $_POST['easyengine_cache_manager_add_cache_rule_nonce'] ) : ''; | ||
|
|
||
| if ( wp_verify_nonce( $nonce, 'easycache_add_cache_rule_nonce' ) ) { | ||
| if ( wp_verify_nonce( $nonce, 'easyengine_cache_manager_add_cache_rule_nonce' ) ) { | ||
|
|
||
| if ( ! current_user_can( 'manage_options' ) ) { | ||
| return; | ||
| } | ||
|
|
||
| $result = EasyCache\Cloudflare_Client::setupCacheRule(); | ||
| $result = EECacheHelper\Cloudflare_Client::setupCacheRule(); | ||
|
|
||
| set_transient( 'ec_page_rule_save_state_admin_notice', $result, 60 ); | ||
| } | ||
|
|
@@ -1261,9 +1257,9 @@ public static function add_cloudflare_admin_bar_purge( $wp_admin_bar ) { | |
| } | ||
|
|
||
| if ( ! empty( $_GET['message'] ) && 'ec-cleared-url-cache' === $_GET['message'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
| $title = esc_html__( 'URL Cache Cleared', 'easycache' ); | ||
| $title = esc_html__( 'URL Cache Cleared', 'nginx-helper' ); | ||
| } else { | ||
| $title = esc_html__( 'Clear URL Cache', 'easycache' ); | ||
| $title = esc_html__( 'Clear Cloudflare Edge Cache', 'nginx-helper' ); | ||
| } | ||
|
|
||
| $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( $_SERVER['REQUEST_URI'] ) : ''; | ||
|
|
@@ -1272,7 +1268,7 @@ public static function add_cloudflare_admin_bar_purge( $wp_admin_bar ) { | |
| 'id' => 'clear-page-cache', | ||
| 'title' => $title, | ||
| 'meta' => [ | ||
| 'title' => __( 'Purge the current URL from Cloudflare cache.', 'easycache' ), | ||
| 'title' => __( 'Purge the current URL from Cloudflare cache.', 'nginx-helper' ), | ||
| ], | ||
| 'href' => wp_nonce_url( admin_url( 'admin-ajax.php?action=ec_clear_url_cache&path=' . rawurlencode( home_url( $request_uri ) ) ), 'ec-clear-url-cache' ), | ||
| ] ); | ||
|
|
@@ -1288,17 +1284,17 @@ public static function handle_cloudflare_clear_cache_ajax() { | |
| if ( empty( $nonce ) | ||
| || ! wp_verify_nonce( $nonce, 'ec-clear-url-cache' ) | ||
| || ! current_user_can( 'manage_options' ) ) { | ||
| wp_die( esc_html__( "You shouldn't be doing this.", 'easycache' ) ); | ||
| wp_die( esc_html__( "You shouldn't be doing this.", 'nginx-helper' ) ); | ||
| } | ||
|
|
||
| $path = isset( $_GET['path'] ) ? esc_url_raw( $_GET['path'] ) : ''; | ||
| if ( empty( $path ) ) { | ||
| wp_die( esc_html__( 'No path provided.', 'easycache' ) ); | ||
| wp_die( esc_html__( 'No path provided.', 'nginx-helper' ) ); | ||
| } | ||
|
|
||
| $ret = Cloudflare_Client::purgeByUrls( [ $path ] ); | ||
| if ( ! $ret ) { | ||
| wp_die( esc_html__( 'Failed to clear URL cache.', 'easycache' ) ); | ||
| wp_die( esc_html__( 'Failed to clear URL cache.', 'nginx-helper' ) ); | ||
| } | ||
|
|
||
| wp_safe_redirect( add_query_arg( 'message', 'ec-cleared-url-cache', $path ) ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,8 +36,9 @@ pre#map { | |
| padding: 10px; | ||
| } | ||
| .wrap h2.rt_option_title { | ||
| background: url(../icons/nginx-icon-32x32.png) 0 6px no-repeat rgba(0, 0, 0, 0); | ||
| background: url(../icons/icon-64x64.png) 0 6px no-repeat rgba(0, 0, 0, 0); | ||
| padding-left: 40px; | ||
| background-size: 36px 36px; | ||
|
||
| } | ||
| #poststuff h2 { | ||
| padding: 0 0 0 10px; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
|
|
||
| <div class="wrap rt-nginx-wrapper"> | ||
| <h2 class="rt_option_title"> | ||
| <?php esc_html_e( 'Nginx Settings', 'nginx-helper' ); ?> | ||
| <?php esc_html_e( 'EasyEngine Cache Helper for Nginx & Cloudflare Settings', 'nginx-helper' ); ?> | ||
|
||
| </h2> | ||
| <div id="poststuff"> | ||
| <div id="post-body" class="metabox-holder columns-2"> | ||
|
|
@@ -46,11 +46,8 @@ | |
| 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; | ||
| case 'cloudflare': | ||
| include plugin_dir_path( __FILE__ ) . 'easycache-cloudflare-options.php'; | ||
| include plugin_dir_path( __FILE__ ) . 'easyengine-cache-manager-cloudflare-options.php'; | ||
| break; | ||
|
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tab menu title was changed from "General" to "Nginx". While this is more specific, consider that the tab contains general Nginx cache settings, not just Nginx-specific features. The name "General" might be clearer if the plugin handles both Nginx and Cloudflare settings, as "Nginx" might be confused with the separate Cloudflare tab.