| @@ -27,9 +27,8 @@ | ||
| 27 | 27 | $global_dark_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light'; |
| 28 | 28 | $this->dark_mode = empty(get_user_meta(get_current_user_id(), 'color_mode', true)) ? $global_dark_mode : get_user_meta(get_current_user_id(), 'color_mode', true); |
| 29 | 29 | add_action('admin_enqueue_scripts', array($this, 'pxlbsadminify_admin_scripts'), 100); |
| 30 | 30 | add_action('wp_ajax_pxlbsadminify_addons_install_active', array( $this, 'pxlbsadminify_addons_install_active' ) ); |
| 31 | - add_action('wp_ajax_pxlbsadminify_ssl_check', array( $this, 'pxlbsadminify_ssl_check' ) ); | |
| 32 | 31 | |
| 33 | 32 | if ($this->is_dark_mode() || $this->classic_editor || $this->block_editor) { |
| 34 | 33 | add_action('admin_head', array($this, 'header_scripts')); |
| 35 | 34 | } |
| @@ -350,9 +349,9 @@ | ||
| 350 | 349 | 'admin_ajax' => admin_url('admin-ajax.php'), |
| 351 | 350 | 'settings' => [ |
| 352 | 351 | 'adminify_ui' => !empty($this->options['admin_ui']) ? true : false, |
| 353 | 352 | ], |
| 354 | - 'admin_nonce' => wp_create_nonce('pxlbsadminify_frame_nonce'), | |
| 353 | + 'admin_nonce' => wp_create_nonce('adminify_nonce'), | |
| 355 | 354 | 'is_pro' => (class_exists('\\PXLBSAdminify\\Pro\\Adminify_Pro') && !empty(\PXLBSAdminify\Pro\Adminify_Pro::is_premium())) ? true : false, |
| 356 | 355 | 'local_fonts' => $local_fonts_data |
| 357 | 356 | ]; |
| 358 | 357 | |
| @@ -374,26 +373,8 @@ | ||
| 374 | 373 | } |
| 375 | 374 | } |
| 376 | 375 | wp_enqueue_style('adminify-simple-line-icons'); |
| 377 | 376 | |
| 378 | - // Adminify UI HTTPS gate — only on the main settings screen where the switcher lives. | |
| 379 | - if (isset($screen->id) && false !== strpos($screen->id, 'wp-adminify-settings')) { | |
| 380 | - wp_enqueue_script('adminify-ui-ssl-check', PXLBSADMINIFY_ASSETS . 'admin/js/adminify-ui-ssl-check.js', array('jquery'), PXLBSADMINIFY_VER, true); | |
| 381 | - wp_localize_script( | |
| 382 | - 'adminify-ui-ssl-check', | |
| 383 | - 'PXLBSADMINIFY_SSL', | |
| 384 | - array( | |
| 385 | - 'ajax_url' => admin_url('admin-ajax.php'), | |
| 386 | - 'nonce' => wp_create_nonce('pxlbsadminify_frame_nonce'), | |
| 387 | - 'field_id' => 'admin_ui', | |
| 388 | - 'i18n' => array( | |
| 389 | - 'label' => esc_html__('Adminify UI needs HTTPS:', 'adminify'), | |
| 390 | - 'generic_error' => esc_html__('Could not verify HTTPS right now. Please try again.', 'adminify'), | |
| 391 | - ), | |
| 392 | - ) | |
| 393 | - ); | |
| 394 | - } | |
| 395 | - | |
| 396 | 377 | if ($screen->id === 'adminify_page_wp-adminify-addons-plugins' || $screen->id === 'adminify-pro_page_wp-adminify-addons-plugins') { |
| 397 | 378 | // JS Files . |
| 398 | 379 | wp_enqueue_script('adminify-addons', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-addons' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true); |
| 399 | 380 | wp_localize_script( |
| @@ -405,45 +386,8 @@ | ||
| 405 | 386 | 'plugin_key' => 'pxlbsadminify' |
| 406 | 387 | ) |
| 407 | 388 | ); |
| 408 | 389 | } |
| 409 | - } | |
| 410 | - | |
| 411 | - /** | |
| 412 | - * AJAX: verify the site is HTTPS-ready before enabling the Adminify UI. | |
| 413 | - * | |
| 414 | - * Called from assets/admin/js/adminify-ui-ssl-check.js when the user flips | |
| 415 | - * the "Adminify UI" switcher on. Returns success only when the dashboard | |
| 416 | - * frame would actually load (see Utils::adminify_ui_https_status()). | |
| 417 | - */ | |
| 418 | - public function pxlbsadminify_ssl_check() | |
| 419 | - { | |
| 420 | - $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : ''; | |
| 421 | - | |
| 422 | - if (!wp_verify_nonce($nonce, 'pxlbsadminify_frame_nonce')) { | |
| 423 | - wp_send_json_error(array( | |
| 424 | - 'https_ready' => false, | |
| 425 | - 'message' => esc_html__('Security check failed. Please reload the page and try again.', 'adminify'), | |
| 426 | - )); | |
| 427 | - } | |
| 428 | - | |
| 429 | - if (!current_user_can('manage_options')) { | |
| 430 | - wp_send_json_error(array( | |
| 431 | - 'https_ready' => false, | |
| 432 | - 'message' => esc_html__('You do not have permission to change this setting.', 'adminify'), | |
| 433 | - )); | |
| 434 | - } | |
| 435 | - | |
| 436 | - $status = Utils::adminify_ui_https_status(); | |
| 437 | - | |
| 438 | - if (!empty($status['ready'])) { | |
| 439 | - wp_send_json_success(array('https_ready' => true)); | |
| 440 | - } | |
| 441 | - | |
| 442 | - wp_send_json_error(array( | |
| 443 | - 'https_ready' => false, | |
| 444 | - 'message' => $status['message'], | |
| 445 | - )); | |
| 446 | 390 | } |
| 447 | 391 | |
| 448 | 392 | // WP Adminify Options Page Style |
| 449 | 393 | public function pxlbsadminify_admin_script() |