| @@ -824,11 +824,10 @@ | ||
| 824 | 824 | if (array_key_exists($theme, $presets)) { |
| 825 | 825 | return $presets[$theme]; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | - // specific preset not found (Pro-only/custom theme saved while Pro add-on inactive). | |
| 829 | - // Fall back to base preset so core CSS vars (--adminify-menu-width) always emit. | |
| 830 | - return isset($presets['preset1']) ? $presets['preset1'] : $common_var; | |
| 828 | + // specific preset not found | |
| 829 | + return []; | |
| 831 | 830 | } |
| 832 | 831 | |
| 833 | 832 | public static function get_page_templates($type = '') |
| 834 | 833 | { |
| @@ -871,41 +870,8 @@ | ||
| 871 | 870 | { |
| 872 | 871 | return array_fill_keys(array_values($attrs), true); |
| 873 | 872 | } |
| 874 | 873 | |
| 875 | - /** | |
| 876 | - * Whether the site is served over HTTPS well enough to run the Adminify UI. | |
| 877 | - * | |
| 878 | - * Mirrors the exact condition that gates the dashboard frame in | |
| 879 | - * Inc/Admin/Admin.php ( is_ssl() + an https:// site URL ), so the AJAX | |
| 880 | - * gate behaviour stays consistent with where the UI actually loads. | |
| 881 | - * | |
| 882 | - * @return array{ready:bool,message:string} | |
| 883 | - */ | |
| 884 | - public static function adminify_ui_https_status() | |
| 885 | - { | |
| 886 | - $is_ssl = is_ssl(); | |
| 887 | - $site_https = ( 0 === stripos( (string) site_url(), 'https://' ) ); | |
| 888 | - | |
| 889 | - if ( $is_ssl && $site_https ) { | |
| 890 | - return [ | |
| 891 | - 'ready' => true, | |
| 892 | - 'message' => '', | |
| 893 | - ]; | |
| 894 | - } | |
| 895 | - | |
| 896 | - if ( ! $site_https ) { | |
| 897 | - $message = esc_html__( 'Site URL is not HTTPS. Switch to HTTPS first.', 'adminify' ); | |
| 898 | - } else { | |
| 899 | - $message = esc_html__( 'Open the dashboard over HTTPS first.', 'adminify' ); | |
| 900 | - } | |
| 901 | - | |
| 902 | - return [ | |
| 903 | - 'ready' => false, | |
| 904 | - 'message' => $message, | |
| 905 | - ]; | |
| 906 | - } | |
| 907 | - | |
| 908 | 874 | public static function kses_allowed_html() |
| 909 | 875 | { |
| 910 | 876 | /** |
| 911 | 877 | * 'post' returns the tags allowed in post content (a, p, strong, em, etc.), |
| @@ -1241,16 +1207,8 @@ | ||
| 1241 | 1207 | } |
| 1242 | 1208 | return ''; |
| 1243 | 1209 | } |
| 1244 | 1210 | |
| 1245 | - public static function new_badge($badge_text = 'New') { | |
| 1246 | - if( empty( $badge_text ) ) { | |
| 1247 | - return ''; | |
| 1248 | - } | |
| 1249 | - | |
| 1250 | - return '<span class="adminify-new-badge">' . esc_html($badge_text) . '</span>'; | |
| 1251 | - } | |
| 1252 | - | |
| 1253 | 1211 | /* |
| 1254 | 1212 | * Compares the version of WordPress running to the $version specified. |
| 1255 | 1213 | * Usage: Utils::check_wp_version('>=', '4.0') |
| 1256 | 1214 | version_compare( $wp_version, '4.3', '>=' ) |
| @@ -1312,79 +1270,8 @@ | ||
| 1312 | 1270 | // $isIframe = isset($_SERVER["HTTP_SEC_FETCH_DEST"]) && strtolower($_SERVER["HTTP_SEC_FETCH_DEST"]) === "iframe"; |
| 1313 | 1271 | // if ( $isIframe ) return true; |
| 1314 | 1272 | // if ( isset($_GET['adminify-iframe']) ) return true; |
| 1315 | 1273 | // return false; |
| 1316 | - } | |
| 1317 | - | |
| 1318 | - /** | |
| 1319 | - * Whether the request carries Fetch Metadata headers at all. | |
| 1320 | - * | |
| 1321 | - * `Sec-Fetch-*` is attached by the browser below the Service Worker layer, so | |
| 1322 | - * installs served through a Service Worker - WordPress Playground, offline | |
| 1323 | - * setups - never pass it to PHP. Older browsers do not send it either. When it | |
| 1324 | - * is missing, is_iframe() cannot tell an iframe request from a top-level one | |
| 1325 | - * and the client has to settle it instead. | |
| 1326 | - * | |
| 1327 | - * @return bool | |
| 1328 | - */ | |
| 1329 | - public static function has_fetch_metadata() | |
| 1330 | - { | |
| 1331 | - return isset( $_SERVER['HTTP_SEC_FETCH_DEST'] ) | |
| 1332 | - || isset( $_SERVER['HTTP_SEC_FETCH_MODE'] ) | |
| 1333 | - || isset( $_SERVER['HTTP_SEC_FETCH_SITE'] ); | |
| 1334 | - } | |
| 1335 | - | |
| 1336 | - /** | |
| 1337 | - * Whether this is a plain GET request. | |
| 1338 | - * | |
| 1339 | - * @return bool | |
| 1340 | - */ | |
| 1341 | - public static function is_get_request() | |
| 1342 | - { | |
| 1343 | - $method = isset( $_SERVER['REQUEST_METHOD'] ) ? strtoupper( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) ) : 'GET'; | |
| 1344 | - | |
| 1345 | - return 'GET' === $method || 'HEAD' === $method; | |
| 1346 | - } | |
| 1347 | - | |
| 1348 | - /** | |
| 1349 | - * Whether the current request renders a full admin page. | |
| 1350 | - * | |
| 1351 | - * Endpoints like async-upload.php run through wp-admin/admin.php (so `admin_init` | |
| 1352 | - * fires) but answer with a raw payload - an attachment ID, JSON, an HTML fragment. | |
| 1353 | - * Printing the Admin UI frame into those responses corrupts them: the media uploader | |
| 1354 | - * on media-new.php reads the response as an attachment ID and gives up when it is not | |
| 1355 | - * numeric. `wp_doing_ajax()` does not catch these: async-upload.php only defines | |
| 1356 | - * DOING_AJAX for the `upload-attachment` action, which media-new.php does not send. | |
| 1357 | - * | |
| 1358 | - * @return bool | |
| 1359 | - */ | |
| 1360 | - public static function is_admin_page_request() | |
| 1361 | - { | |
| 1362 | - if ( wp_doing_ajax() || wp_doing_cron() || wp_is_json_request() ) { | |
| 1363 | - return false; | |
| 1364 | - } | |
| 1365 | - | |
| 1366 | - if ( ( defined('REST_REQUEST') && REST_REQUEST ) || ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) || ( defined('WP_CLI') && WP_CLI ) ) { | |
| 1367 | - return false; | |
| 1368 | - } | |
| 1369 | - | |
| 1370 | - $pagenow = isset($GLOBALS['pagenow']) ? $GLOBALS['pagenow'] : ''; | |
| 1371 | - | |
| 1372 | - if ( empty($pagenow) && isset($_SERVER['PHP_SELF']) ) { | |
| 1373 | - $pagenow = basename( sanitize_text_field( wp_unslash($_SERVER['PHP_SELF']) ) ); | |
| 1374 | - } | |
| 1375 | - | |
| 1376 | - $raw_response_endpoints = [ | |
| 1377 | - 'admin-ajax.php', | |
| 1378 | - 'admin-post.php', | |
| 1379 | - 'async-upload.php', | |
| 1380 | - 'load-scripts.php', | |
| 1381 | - 'load-styles.php', | |
| 1382 | - 'ms-files.php', | |
| 1383 | - 'wp-cron.php', | |
| 1384 | - ]; | |
| 1385 | - | |
| 1386 | - return ! in_array( $pagenow, $raw_response_endpoints, true ); | |
| 1387 | 1274 | } |
| 1388 | 1275 | |
| 1389 | 1276 | /** |
| 1390 | 1277 | * Load a template file. |