Skip to content

Commit 68be07b

Browse files
[fix] direct access of main plugin file should not throw 500
1 parent fe6f426 commit 68be07b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

koko-analytics.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@
3636

3737
use WP_CLI;
3838

39+
// don't run if PHP version is lower than 7.4
40+
// prevent direct file access
41+
if (PHP_VERSION_ID < 70400 || ! \defined('ABSPATH')) {
42+
return;
43+
}
44+
3945
define('KOKO_ANALYTICS_VERSION', '2.2.1');
4046
define('KOKO_ANALYTICS_PLUGIN_FILE', __FILE__);
4147
define('KOKO_ANALYTICS_PLUGIN_DIR', __DIR__);
4248

4349
// Load the Koko Analytics autoloader
4450
require __DIR__ . '/autoload.php';
4551

46-
// don't run if PHP version is lower than 7.4
47-
// prevent direct file access
48-
if (PHP_VERSION_ID < 70400 || ! \defined('ABSPATH')) {
49-
return;
50-
}
51-
5252
// Main hooks (global)
5353
require __DIR__ . '/src/Controller.php';
5454
(new Controller())->hook();

0 commit comments

Comments
 (0)