From: Chuck Scott Date: Fri, 11 Aug 2017 20:50:58 +0000 (-0400) Subject: Updated check for all common plugin PHP files being called directly and now sending... X-Git-Tag: v1.0.2^2~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=7c674366cde0669d8ef6a01029239848061ce89f;p=WP-Plugins%2Fglm-member-db-sample.git Updated check for all common plugin PHP files being called directly and now sending user to /assets/404.html --- diff --git a/SAMPLE_index.php b/SAMPLE_index.php index 4655105..54c7d58 100644 --- a/SAMPLE_index.php +++ b/SAMPLE_index.php @@ -22,6 +22,12 @@ * @version 0.0.1 */ +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + /* * Plugin and Database Versions * @@ -65,12 +71,6 @@ if ({definedPrefix}_PLUGIN_VERSION != get_option('{camelcasePrefix}PluginVersion * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -// Check that we're being called by WordPress. -if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); -} - /* * Some initial setup and tests */ diff --git a/activate.php b/activate.php index d6e076c..3fbb7a8 100644 --- a/activate.php +++ b/activate.php @@ -16,7 +16,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } /* diff --git a/deactivate.php b/deactivate.php index c2a46b8..1e749fc 100644 --- a/deactivate.php +++ b/deactivate.php @@ -15,7 +15,8 @@ // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } /* diff --git a/defines.php b/defines.php index 79ebe50..2295c20 100644 --- a/defines.php +++ b/defines.php @@ -5,6 +5,12 @@ * Set standard defined parameters */ +// Check that we're being called by WordPress. +if (!defined('ABSPATH')) { + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); +} + // NOTE: Plugin & Database versions are defined in "/glm-member-db.php". define('{definedPrefix}_PLUGIN_NAME', '{descrName}'); diff --git a/uninstall.php b/uninstall.php index 02de592..8173e59 100644 --- a/uninstall.php +++ b/uninstall.php @@ -18,7 +18,8 @@ die('uninstall not configured - See plugin uninstall.php script!'); // Check that we're being called by WordPress. if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); + header("Location: http://".$_SERVER['SERVER_NAME']."/error/404.html"); + die(); } //if uninstall not called from WordPress exit