PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.7.6
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.7.6
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
← All changes | Inc/Admin/Frames/Init.php +11 -27 4.2.144.0.7.6 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Admin\Frames;
3 +namespace WPAdminify\Inc\Admin\Frames;
4 4
5 -use PXLBSAdminify\Inc\Utils;
6 -
7 5 // no direct access allowed
8 6 if (!defined('ABSPATH')) {
9 7 exit;
10 8 }
@@ -33,19 +31,16 @@
33 31 public function __construct()
34 32 {
35 33
36 34 if ( ! $this->is_allowed() ) {
37 - if ( Utils::is_iframe() ) {
38 - $http_host = isset($_SERVER['HTTP_HOST']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : '';
39 - $request_uri = isset($_SERVER['REQUEST_URI']) ? esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])) : '';
40 - $scheme = empty($_SERVER['HTTPS']) ? 'http' : 'https';
41 - $actual_link = $scheme . '://' . $http_host . $request_uri;
35 + if ( is_iframe() ) {
36 + $actual_link = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
42 37 Frames::custom_plugin_change_reload($actual_link);
43 38 }
44 39 return;
45 40 }
46 41
47 - if ( Utils::is_iframe() ) {
42 + if ( is_iframe() ) {
48 43 $this->frame = new Frames();
49 44 } else {
50 45 $this->admin = new Admin();
51 46 }
@@ -58,9 +53,9 @@
58 53 *
59 54 * @return string Normalized path (e.g., /wp-admin/edit.php)
60 55 */
61 56 private function get_normalized_admin_path() {
62 - $php_self = isset($_SERVER['PHP_SELF']) ? sanitize_text_field(wp_unslash($_SERVER['PHP_SELF'])) : '';
57 + $php_self = $_SERVER['PHP_SELF'] ?? '';
63 58
64 59 // Method 1: Use WordPress native function to get subdirectory path
65 60 // site_url() returns full URL including subdirectory
66 61 // e.g., https://example.com/blog or https://example.com
@@ -98,10 +93,9 @@
98 93 }
99 94
100 95 // Fallback: ends-with check for edge cases
101 96 // e.g., /wp-admin/customize.php should match even if normalization fails
102 - $php_self = isset($_SERVER['PHP_SELF']) ? sanitize_text_field(wp_unslash($_SERVER['PHP_SELF'])) : '';
103 - if ( $this->url_ends_with( $php_self, $blocked_url ) ) {
97 + if ( $this->url_ends_with( $_SERVER['PHP_SELF'] ?? '', $blocked_url ) ) {
104 98 return true;
105 99 }
106 100
107 101 return false;
@@ -135,9 +129,9 @@
135 129 'site_url' => site_url(),
136 130 'home_url' => home_url(),
137 131 'admin_url' => admin_url(),
138 132 'subdirectory' => wp_parse_url( site_url(), PHP_URL_PATH ) ?: '/',
139 - 'php_self' => isset($_SERVER['PHP_SELF']) ? sanitize_text_field(wp_unslash($_SERVER['PHP_SELF'])) : '',
133 + 'php_self' => $_SERVER['PHP_SELF'] ?? '',
140 134 'normalized_path' => $this->get_normalized_admin_path(),
141 135 ];
142 136 }
143 137
@@ -190,10 +184,9 @@
190 184 function check_query_params($query_params) {
191 185 // Pattern 1: Both keys and their values should check in $_GET
192 186 if (array_keys($query_params) === $query_params) {
193 187 foreach ($query_params as $key => $value) {
194 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
195 - if (!isset($_GET[$key]) || sanitize_text_field(wp_unslash($_GET[$key])) != $value) {
188 + if (!isset($_GET[$key]) || $_GET[$key] != $value) {
196 189 return false; // Key doesn't exist or the value doesn't match
197 190 }
198 191 }
199 192 return true; // All keys and values match
@@ -203,12 +196,10 @@
203 196 if (array_values($query_params) === $query_params) {
204 197 foreach ($query_params as $param) {
205 198 if ( substr($param, -1) === '!' ) {
206 199 $param = substr($param, 0, -1);
207 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
208 200 if ( isset($_GET[$param]) ) return false; // The key exists in $_GET
209 201 } else {
210 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
211 202 if ( ! isset($_GET[$param]) ) return false; // The key doesn't exist in $_GET
212 203 }
213 204
214 205 }
@@ -220,18 +211,15 @@
220 211 if (is_numeric($key)) {
221 212 // For numeric keys, we're checking only existence (Pattern 1 behavior)
222 213 if ( substr($value, -1) === '!' ) {
223 214 $value = substr($value, 0, -1);
224 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
225 215 if ( isset($_GET[$value]) ) return false; // The key exists in $_GET
226 216 } else {
227 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
228 217 if ( ! isset($_GET[$value]) ) return false; // The key doesn't exist in $_GET
229 218 }
230 219 } else {
231 220 // For associative keys, we check for both key and value (Pattern 2 behavior)
232 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
233 - if (!isset($_GET[$key]) || sanitize_text_field(wp_unslash($_GET[$key])) != $value) {
221 + if (!isset($_GET[$key]) || $_GET[$key] != $value) {
234 222 return false; // Key doesn't exist or value doesn't match
235 223 }
236 224 }
237 225 }
@@ -239,16 +227,12 @@
239 227 return true; // All conditions are met
240 228 }
241 229
242 230 function check_post_type($post_types) {
243 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
244 231 if ( isset( $_GET['post_type'] ) ) {
245 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
246 - return in_array( sanitize_text_field( wp_unslash( $_GET['post_type'] ) ), $post_types );
247 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
232 + return in_array( $_GET['post_type'], $post_types );
248 233 } else if ( isset( $_GET['post'] ) ) {
249 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
250 - return in_array( get_post_type( absint( wp_unslash( $_GET['post'] ) ) ), $post_types );
234 + return in_array( get_post_type( $_GET['post'] ), $post_types );
251 235 }
252 236 return in_array( 'post', $post_types );
253 237 }
254 238