| @@ -13,8 +13,13 @@ | ||
| 13 | 13 | declare(strict_types=1); |
| 14 | 14 | |
| 15 | 15 | namespace ThinkRank\Core; |
| 16 | 16 | |
| 17 | +// Prevent direct access. | |
| 18 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 19 | + exit; | |
| 20 | +} | |
| 21 | + | |
| 17 | 22 | /** |
| 18 | 23 | * Asset Optimizer Class |
| 19 | 24 | * |
| 20 | 25 | * @since 1.0.0 |
| @@ -59,11 +64,12 @@ | ||
| 59 | 64 | return false; |
| 60 | 65 | } |
| 61 | 66 | |
| 62 | 67 | // Check for ThinkRank admin pages |
| 68 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading page parameter for screen detection, not processing form data. | |
| 63 | 69 | return strpos($screen->id, 'thinkrank') !== false || |
| 64 | - strpos($screen->base, 'thinkrank') !== false || | |
| 65 | - (isset($_GET['page']) && strpos($_GET['page'], 'thinkrank') !== false); | |
| 70 | + strpos($screen->base, 'thinkrank') !== false || | |
| 71 | + (isset($_GET['page']) && strpos(sanitize_text_field(wp_unslash($_GET['page'])), 'thinkrank') !== false); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 66 | 72 | } |
| 67 | 73 | |
| 68 | 74 | /** |
| 69 | 75 | * Add asset preloading headers |