Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
79 changes: 37 additions & 42 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 47 additions & 51 deletions uninstall.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Runs on Uninstall of Pressable Cache Management
*
Expand All @@ -9,57 +8,54 @@
* @link http://pressable.com
*/

//include file containing function to remove batcache on wp-config.php
// include file containing function to remove batcache on wp-config.php
// include_once ('remove_mu_plugins_batcache_on_uninstall.php');
include_once( plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php' );

// exit if uninstall constant is not defined
if (!defined('WP_UNINSTALL_PLUGIN'))
{

exit;
require_once plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php';

// Exit if uninstall constant is not defined.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
Comment on lines +11 to 18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Move uninstall guard before helper include and drop commented‑out include

Two things here:

  1. For hardening, it’s better to bail out before loading any helpers so uninstall.php does nothing when hit directly.
  2. The commented‑out include_once is the PHPCS “commented‑out code” violation you mentioned and is redundant now that require_once is in place.

You can address both with something like:

-// include file containing function to remove batcache on wp-config.php
-// include_once ('remove_mu_plugins_batcache_on_uninstall.php');
-require_once plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php';
-
-// Exit if uninstall constant is not defined.
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
-	exit;
-}
+// Exit if uninstall constant is not defined.
+if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
+	exit;
+}
+
+// Include file containing function to remove batcache on wp-config.php.
+require_once plugin_dir_path( __FILE__ ) . 'remove_mu_plugins_batcache_on_uninstall.php';

This should both satisfy PHPCS and follow the usual WordPress uninstall pattern.

🤖 Prompt for AI Agents
In uninstall.php around lines 11 to 18, move the uninstall guard check (if ( !
defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit; }) to the top of this block so it
executes before any helper files are loaded, and remove the commented-out
include_once line (the commented-out code) since require_once already loads the
helper; ensure the file now first checks WP_UNINSTALL_PLUGIN and returns
immediately if not defined, then includes/remove the helper via require_once.


// Delete the plugin options from the site database
delete_option('pressable_cache_management_options');
delete_option('cdn_settings_tab_options');
delete_option('pressable_api_authentication_tab_options');
delete_option('cdn-cache-purge-time-stamp');
delete_option('edge-cache-purge-time-stamp');
delete_option('flush-obj-cache-time-stamp');
delete_option('flush-cache-on-page-post-delete-time-stamp');
delete_option('flush-cache-on-comment-delete-time-stamp');
delete_option('pressable_api_admin_notice__status');
delete_option('pressable_cdn_connection_decactivated_notice');
delete_option('pressable_api_enable_cdn_connection_admin_notice');
delete_option('extend_batcache_activate_notice');
delete_option('extend_cdn_activate_notice');
delete_option('exclude_images_from_cdn_activate_notice');
delete_option('exclude_json_js_from_cdn_notice');
delete_option('flush-cache-page-edit-time-stamp');
delete_option('flush-cache-theme-plugin-time-stamp');
delete_option('flush-object-cache-for-single-page-notice');
delete_option('exempt_batcache_activate_notice');
delete_option('flush-object-cache-for-single-page-time-stamp');
delete_option('exclude_json_js_from_cdn_activate_notice');
delete_option('exempt_from_batcache');
delete_option('exclude_css_from_cdn_activate_notice');
delete_option('remove_pressable_branding_tab_options');
delete_option('cache_wpp_cookies_pages_activate_notice');
delete_option('exclude_fonts_from_cdn_activate_notice');
delete_option('single-page-edge-cache-purge-time-stamp');
delete_option('edge-cache-single-page-url-purged');
delete_option('single-page-url-flushed');
delete_option('pcm_site_id_added_activate_notice');
delete_option('pcm_site_id_con_res');
delete_option('cdnenabled');
delete_option('cdn-api-state');
delete_option('edge-cache-enabled');
delete_option('edge-cache-status');
delete_option('pressable_site_id');
delete_option('pcm_client_id');
delete_option('pcm_client_secret');
delete_option('single-page-path-url');
delete_option('page-title');
delete_option('page-url');
// Delete the plugin options from the site database.
delete_option( 'pressable_cache_management_options' );
delete_option( 'cdn_settings_tab_options' );
delete_option( 'pressable_api_authentication_tab_options' );
delete_option( 'cdn-cache-purge-time-stamp' );
delete_option( 'edge-cache-purge-time-stamp' );
delete_option( 'flush-obj-cache-time-stamp' );
delete_option( 'flush-cache-on-page-post-delete-time-stamp' );
delete_option( 'flush-cache-on-comment-delete-time-stamp' );
delete_option( 'pressable_api_admin_notice__status' );
delete_option( 'pressable_cdn_connection_decactivated_notice' );
delete_option( 'pressable_api_enable_cdn_connection_admin_notice' );
delete_option( 'extend_batcache_activate_notice' );
delete_option( 'extend_cdn_activate_notice' );
delete_option( 'exclude_images_from_cdn_activate_notice' );
delete_option( 'exclude_json_js_from_cdn_notice' );
delete_option( 'flush-cache-page-edit-time-stamp' );
delete_option( 'flush-cache-theme-plugin-time-stamp' );
delete_option( 'flush-object-cache-for-single-page-notice' );
delete_option( 'exempt_batcache_activate_notice' );
delete_option( 'flush-object-cache-for-single-page-time-stamp' );
delete_option( 'exclude_json_js_from_cdn_activate_notice' );
delete_option( 'exempt_from_batcache' );
delete_option( 'exclude_css_from_cdn_activate_notice' );
delete_option( 'remove_pressable_branding_tab_options' );
delete_option( 'cache_wpp_cookies_pages_activate_notice' );
delete_option( 'exclude_fonts_from_cdn_activate_notice' );
delete_option( 'single-page-edge-cache-purge-time-stamp' );
delete_option( 'edge-cache-single-page-url-purged' );
delete_option( 'single-page-url-flushed' );
delete_option( 'pcm_site_id_added_activate_notice' );
delete_option( 'pcm_site_id_con_res' );
delete_option( 'cdnenabled' );
delete_option( 'cdn-api-state' );
delete_option( 'edge-cache-enabled' );
delete_option( 'edge-cache-status' );
delete_option( 'pressable_site_id' );
delete_option( 'pcm_client_id' );
delete_option( 'pcm_client_secret' );
delete_option( 'single-page-path-url' );
delete_option( 'page-title' );
delete_option( 'page-url' );