| @@ -1,12 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Classes; | |
| 3 | +namespace WPAdminify\Inc\Classes; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Utils; | |
| 6 | -use PXLBSAdminify\Inc\Admin\AdminSettings; | |
| 7 | -use PXLBSAdminify\Inc\Admin\AdminSettingsModel; | |
| 8 | -use PXLBSAdminify\Inc\Classes\Addons_Plugins; | |
| 5 | +use WPAdminify\Inc\Utils; | |
| 6 | +use WPAdminify\Inc\Admin\AdminSettings; | |
| 7 | +use WPAdminify\Inc\Admin\AdminSettingsModel; | |
| 9 | 8 | |
| 10 | 9 | |
| 11 | 10 | |
| 12 | 11 | // no direct access allowed |
| @@ -25,11 +24,10 @@ | ||
| 25 | 24 | { |
| 26 | 25 | $this->options = (array) AdminSettings::get_instance()->get(); |
| 27 | 26 | $global_dark_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light'; |
| 28 | 27 | $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 | - add_action('admin_enqueue_scripts', array($this, 'pxlbsadminify_admin_scripts'), 100); | |
| 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' ) ); | |
| 28 | + add_action('admin_enqueue_scripts', array($this, 'jltwp_adminify_admin_scripts'), 100); | |
| 29 | + add_action('wp_ajax_jltwp_adminify_addons_install_active', 'jltwp_adminify_addons_install_active'); | |
| 32 | 30 | |
| 33 | 31 | if ($this->is_dark_mode() || $this->classic_editor || $this->block_editor) { |
| 34 | 32 | add_action('admin_head', array($this, 'header_scripts')); |
| 35 | 33 | } |
| @@ -38,9 +36,9 @@ | ||
| 38 | 36 | |
| 39 | 37 | /** |
| 40 | 38 | * Function: Ajax Call for Install and Activate WP Adminify Plugin |
| 41 | 39 | */ |
| 42 | - function pxlbsadminify_addons_install_active() | |
| 40 | + function jltwp_adminify_addons_install_active() | |
| 43 | 41 | { |
| 44 | 42 | |
| 45 | 43 | // Include necessary WordPress files |
| 46 | 44 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
| @@ -51,9 +49,9 @@ | ||
| 51 | 49 | if (isset($_POST['plugin'])) { |
| 52 | 50 | |
| 53 | 51 | $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : ''; |
| 54 | 52 | |
| 55 | - if (!wp_verify_nonce($nonce, 'pxlbsadminify_addons_nonce')) { | |
| 53 | + if (!wp_verify_nonce($nonce, 'jltwp_adminify_addons_nonce')) { | |
| 56 | 54 | wp_send_json_error(array('mess' => esc_html__('Nonce is invalid', 'adminify'))); |
| 57 | 55 | } |
| 58 | 56 | |
| 59 | 57 | if ((is_multisite() && is_network_admin()) || !current_user_can('install_plugins')) { |
| @@ -65,37 +63,14 @@ | ||
| 65 | 63 | if (empty($plugin)) { |
| 66 | 64 | wp_send_json_error(array('mess' => esc_html__('Invalid plugin', 'adminify'))); |
| 67 | 65 | } |
| 68 | 66 | |
| 69 | - // Validate the requested plugin against the trusted addons list | |
| 70 | - // and replace the user-supplied value with the canonical | |
| 71 | - // download URL from that list before passing it to the upgrader. | |
| 72 | - $addons = new Addons_Plugins(); | |
| 73 | - $plugins_list = (array) $addons->get_adminify_plugins_lists(); | |
| 74 | - $requested_slug = ''; | |
| 75 | - $trusted_source = ''; | |
| 76 | - foreach ( $plugins_list as $slug => $entry ) { | |
| 77 | - if ( ! empty( $entry['download_link'] ) && $entry['download_link'] === $plugin ) { | |
| 78 | - $requested_slug = $slug; | |
| 79 | - $trusted_source = $entry['download_link']; | |
| 80 | - break; | |
| 81 | - } | |
| 82 | - if ( $slug === $plugin ) { | |
| 83 | - $requested_slug = $slug; | |
| 84 | - $trusted_source = ! empty( $entry['download_link'] ) ? $entry['download_link'] : ''; | |
| 85 | - break; | |
| 86 | - } | |
| 87 | - } | |
| 88 | - if ( empty( $requested_slug ) || empty( $trusted_source ) ) { | |
| 89 | - wp_send_json_error( array( 'mess' => esc_html__( 'Invalid plugin', 'adminify' ) ) ); | |
| 90 | - } | |
| 91 | - | |
| 92 | 67 | $type = isset($_POST['type']) ? sanitize_text_field(wp_unslash($_POST['type'])) : 'install'; |
| 93 | 68 | $skin = new \WP_Ajax_Upgrader_Skin(); |
| 94 | 69 | $upgrader = new \Plugin_Upgrader($skin); |
| 95 | 70 | |
| 96 | 71 | if ('install' === $type) { |
| 97 | - $result = $upgrader->install( $trusted_source ); | |
| 72 | + $result = $upgrader->install($plugin); | |
| 98 | 73 | if (is_wp_error($result)) { |
| 99 | 74 | wp_send_json_error( |
| 100 | 75 | array( |
| 101 | 76 | 'mess' => $result->get_error_message(), |
| @@ -200,8 +175,30 @@ | ||
| 200 | 175 | } |
| 201 | 176 | |
| 202 | 177 | |
| 203 | 178 | |
| 179 | + // Google Fonts | |
| 180 | + function jltwp_adminify_google_fonts_url() | |
| 181 | + { | |
| 182 | + $font_family = !empty($this->options['admin_general_google_font']['font-family']) ? ($this->options['admin_general_google_font']['font-family']) : ''; | |
| 183 | + | |
| 184 | + if (empty($font_family)) { | |
| 185 | + return ''; | |
| 186 | + } | |
| 187 | + | |
| 188 | + // Get local font instance | |
| 189 | + $local_fonts = GoogleFontsLocal::get_instance(); | |
| 190 | + | |
| 191 | + // Check if local font exists, if not download it | |
| 192 | + if (!$local_fonts->is_font_local($font_family)) { | |
| 193 | + $font_weights = !empty($this->options['admin_general_google_font']['font-weight']) ? $this->options['admin_general_google_font']['font-weight'] : '400'; | |
| 194 | + $local_fonts->download_font($font_family, $font_weights); | |
| 195 | + } | |
| 196 | + | |
| 197 | + // Return local font URL | |
| 198 | + return $local_fonts->get_local_font_url($font_family); | |
| 199 | + } | |
| 200 | + | |
| 204 | 201 | /** |
| 205 | 202 | * Check if current page should skip Adminify scripts |
| 206 | 203 | * Handles root, subdirectory, subdomain, and multisite installations |
| 207 | 204 | * |
| @@ -223,9 +220,9 @@ | ||
| 223 | 220 | } |
| 224 | 221 | |
| 225 | 222 | // Fallback: Check PHP_SELF for subdirectory WordPress installs |
| 226 | 223 | // Normalize path by extracting just the filename |
| 227 | - $php_self = isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : ''; | |
| 224 | + $php_self = $_SERVER['PHP_SELF'] ?? ''; | |
| 228 | 225 | $current_file = basename( $php_self ); |
| 229 | 226 | |
| 230 | 227 | if ( in_array( $current_file, $excluded_pages, true ) ) { |
| 231 | 228 | return true; |
| @@ -231,9 +228,9 @@ | ||
| 231 | 228 | return true; |
| 232 | 229 | } |
| 233 | 230 | |
| 234 | 231 | // Additional check using REQUEST_URI for edge cases |
| 235 | - $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; | |
| 232 | + $request_uri = $_SERVER['REQUEST_URI'] ?? ''; | |
| 236 | 233 | foreach ( $excluded_pages as $page ) { |
| 237 | 234 | if ( strpos( $request_uri, '/' . $page ) !== false ) { |
| 238 | 235 | return true; |
| 239 | 236 | } |
| @@ -242,9 +239,9 @@ | ||
| 242 | 239 | return false; |
| 243 | 240 | } |
| 244 | 241 | |
| 245 | 242 | |
| 246 | - public function pxlbsadminify_admin_scripts() | |
| 243 | + public function jltwp_adminify_admin_scripts() | |
| 247 | 244 | { |
| 248 | 245 | // Skip loading scripts on excluded pages (customize.php, login, etc.) |
| 249 | 246 | if ( $this->should_skip_adminify_scripts() ) { |
| 250 | 247 | return; |
| @@ -253,59 +250,63 @@ | ||
| 253 | 250 | $screen = get_current_screen(); |
| 254 | 251 | |
| 255 | 252 | |
| 256 | 253 | // Register Styles |
| 257 | - wp_register_style('adminify-admin', PXLBSADMINIFY_ASSETS . 'css/wp-adminify' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 258 | - wp_register_style('adminify-default-ui', PXLBSADMINIFY_ASSETS . 'css/wp-adminify-default-ui' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 259 | - // wp_register_style('wp-adminify-admin-bar', PXLBSADMINIFY_ASSETS . 'css/admin-bar' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 260 | - wp_register_style('adminify-menu-editor', PXLBSADMINIFY_ASSETS . 'css/adminify-menu-editor' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 261 | - // wp_register_style('wp-adminify-dark-mode', PXLBSADMINIFY_ASSETS . 'css/dark-mode' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 262 | - // wp_register_style('wp-adminify-rtl', PXLBSADMINIFY_ASSETS . 'css/adminify-rtl' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 263 | - // wp_register_style('wp-adminify-responsive', PXLBSADMINIFY_ASSETS . 'css/adminify-responsive' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 264 | - // wp_register_style('wp-adminify-animate', PXLBSADMINIFY_ASSETS . 'vendors/animatecss/animate' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 265 | - wp_register_style('adminify-tokenize2', PXLBSADMINIFY_ASSETS . 'vendors/tokenize/tokenize2' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 266 | - wp_register_style('adminify-select2', PXLBSADMINIFY_ASSETS . 'vendors/select2/select2' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 254 | + wp_register_style('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'css/wp-adminify' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 255 | + wp_register_style('wp-adminify-default-ui', WP_ADMINIFY_ASSETS . 'css/wp-adminify-default-ui' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 256 | + // wp_register_style('wp-adminify-admin-bar', WP_ADMINIFY_ASSETS . 'css/admin-bar' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 257 | + wp_register_style('wp-adminify-menu-editor', WP_ADMINIFY_ASSETS . 'css/adminify-menu-editor' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 258 | + // wp_register_style('wp-adminify-dark-mode', WP_ADMINIFY_ASSETS . 'css/dark-mode' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 259 | + // wp_register_style('wp-adminify-rtl', WP_ADMINIFY_ASSETS . 'css/adminify-rtl' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 260 | + // wp_register_style('wp-adminify-responsive', WP_ADMINIFY_ASSETS . 'css/adminify-responsive' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 261 | + // wp_register_style('wp-adminify-animate', WP_ADMINIFY_ASSETS . 'vendors/animatecss/animate' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 262 | + wp_register_style('wp-adminify-tokenize2', WP_ADMINIFY_ASSETS . 'vendors/tokenize/tokenize2' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 263 | + wp_register_style('wp-adminify-select2', WP_ADMINIFY_ASSETS . 'vendors/select2/select2' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 267 | 264 | |
| 268 | 265 | |
| 269 | 266 | // Register Scripts |
| 270 | - wp_register_script('adminify-tokenize2', PXLBSADMINIFY_ASSETS . 'vendors/tokenize/tokenize2.min.js', array('jquery'), PXLBSADMINIFY_VER, false); | |
| 271 | - wp_register_script('adminify-select2', PXLBSADMINIFY_ASSETS . 'vendors/select2/select2.min.js', array('jquery'), PXLBSADMINIFY_VER, true); | |
| 272 | - wp_register_script('adminify-admin', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true); | |
| 267 | + wp_register_script('wp-adminify-tokenize2', WP_ADMINIFY_ASSETS . 'vendors/tokenize/tokenize2.min.js', array('jquery'), WP_ADMINIFY_VER, false); | |
| 268 | + wp_register_script('wp-adminify-select2', WP_ADMINIFY_ASSETS . 'vendors/select2/select2.min.js', array('jquery'), WP_ADMINIFY_VER, true); | |
| 269 | + wp_register_script('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify' . Utils::assets_ext('.js'), array('jquery'), WP_ADMINIFY_VER, true); | |
| 273 | 270 | |
| 274 | - // wp_register_script('wp-adminify-realtime-server', PXLBSADMINIFY_ASSETS . 'js/adminify-realtime-server.js', array('jquery'), PXLBSADMINIFY_VER, true); | |
| 271 | + // wp_register_script('wp-adminify-realtime-server', WP_ADMINIFY_ASSETS . 'js/adminify-realtime-server.js', array('jquery'), WP_ADMINIFY_VER, true); | |
| 275 | 272 | |
| 276 | 273 | // Adminify Icon Picker |
| 277 | - wp_register_style('adminify-simple-line-icons', PXLBSADMINIFY_ASSETS . 'vendors/font-icons/simple-line-icons/css/simple-line-icons' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 278 | - wp_register_style('adminify-icon-picker', PXLBSADMINIFY_ASSETS . 'vendors/adminify-icon-picker/css/style' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER); | |
| 279 | - wp_register_script('adminify-icon-picker', PXLBSADMINIFY_ASSETS . 'vendors/adminify-icon-picker/js/adminify-icon-picker' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true); | |
| 274 | + wp_register_style('wp-adminify-simple-line-icons', WP_ADMINIFY_ASSETS . 'vendors/font-icons/simple-line-icons/css/simple-line-icons' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 275 | + wp_register_style('wp-adminify-icon-picker', WP_ADMINIFY_ASSETS . 'vendors/adminify-icon-picker/css/style' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER); | |
| 276 | + wp_register_script('wp-adminify-icon-picker', WP_ADMINIFY_ASSETS . 'vendors/adminify-icon-picker/js/adminify-icon-picker' . Utils::assets_ext('.js'), array('jquery'), WP_ADMINIFY_VER, true); | |
| 280 | 277 | |
| 281 | 278 | // Dark Mode |
| 282 | - wp_register_script('adminify--dark-mode', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-dark-mode' . Utils::assets_ext('.js'), array(), PXLBSADMINIFY_VER, false); | |
| 279 | + wp_register_script('wp-adminify--dark-mode', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify-dark-mode' . Utils::assets_ext('.js'), array(), WP_ADMINIFY_VER, false); | |
| 283 | 280 | |
| 284 | 281 | // Menu Editor |
| 285 | - wp_register_script('adminify-menu-editor', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-menu-editor' . Utils::assets_ext('.js'), array('jquery', 'jquery-ui-sortable', 'adminify-icon-picker'), PXLBSADMINIFY_VER, true); | |
| 282 | + wp_register_script('wp-adminify-menu-editor', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify-menu-editor' . Utils::assets_ext('.js'), array('jquery', 'jquery-ui-sortable', 'wp-adminify-icon-picker'), WP_ADMINIFY_VER, true); | |
| 286 | 283 | |
| 287 | 284 | // Styles Enqueue |
| 285 | + if ( !empty($this->options['admin_general_google_font']['font-family'])) { | |
| 286 | + wp_enqueue_style('wp-adminify-google-fonts', $this->jltwp_adminify_google_fonts_url()); | |
| 287 | + } | |
| 288 | + | |
| 288 | 289 | if (!empty($this->options['admin_ui'])) { |
| 289 | 290 | // wp_enqueue_style('wp-adminify-animate'); |
| 290 | - wp_enqueue_style('adminify-admin'); | |
| 291 | + wp_enqueue_style('wp-adminify-admin'); | |
| 291 | 292 | // Commented on: 9-6-24 |
| 292 | 293 | // wp_enqueue_style('wp-adminify-admin-bar'); |
| 293 | 294 | // wp_enqueue_style('wp-adminify-responsive'); |
| 294 | 295 | } else { |
| 295 | - wp_enqueue_style('adminify-default-ui'); | |
| 296 | + wp_enqueue_style('wp-adminify-default-ui'); | |
| 296 | 297 | } |
| 297 | 298 | |
| 298 | 299 | |
| 299 | 300 | // RTL CSS |
| 300 | 301 | if ( is_rtl() ) { |
| 301 | - wp_enqueue_style( 'adminify-rtl', PXLBSADMINIFY_URL . 'Libs/adminify-framework/assets/css/style-rtl'. Utils::assets_ext('.css'), array(), PXLBSADMINIFY_VER, 'all' ); | |
| 302 | + wp_enqueue_style( 'adminify-rtl', WP_ADMINIFY_URL . 'Libs/adminify-framework/assets/css/style-rtl'. Utils::assets_ext('.css'), array(), WP_ADMINIFY_VER, 'all' ); | |
| 302 | 303 | } |
| 303 | 304 | |
| 304 | 305 | |
| 305 | 306 | // Dark Mode Style |
| 306 | - // wp_enqueue_style('adminify-dark-mode'); | |
| 307 | - wp_enqueue_script('adminify--dark-mode'); | |
| 307 | + // wp_enqueue_style('wp-adminify-dark-mode'); | |
| 308 | + wp_enqueue_script('wp-adminify--dark-mode'); | |
| 308 | 309 | |
| 309 | 310 | |
| 310 | 311 | // Get local fonts data for frontend - download if not exists |
| 311 | 312 | $local_fonts = GoogleFontsLocal::get_instance(); |
| @@ -310,8 +311,24 @@ | ||
| 310 | 311 | // Get local fonts data for frontend - download if not exists |
| 311 | 312 | $local_fonts = GoogleFontsLocal::get_instance(); |
| 312 | 313 | $local_fonts_urls = []; |
| 313 | 314 | |
| 315 | + // Process body font | |
| 316 | + if (!empty($this->options['admin_general_google_font']['font-family'])) { | |
| 317 | + $font_family = $this->options['admin_general_google_font']['font-family']; | |
| 318 | + $font_weight = !empty($this->options['admin_general_google_font']['font-weight']) ? $this->options['admin_general_google_font']['font-weight'] : '400'; | |
| 319 | + | |
| 320 | + // Check if local font exists, if not download it | |
| 321 | + if (!$local_fonts->is_font_local($font_family)) { | |
| 322 | + $local_fonts->download_font($font_family, $font_weight); | |
| 323 | + } | |
| 324 | + | |
| 325 | + $local_url = $local_fonts->get_local_font_url($font_family); | |
| 326 | + if ($local_url) { | |
| 327 | + $local_fonts_urls['body'] = $local_url; | |
| 328 | + } | |
| 329 | + } | |
| 330 | + | |
| 314 | 331 | // Process light mode logo font |
| 315 | 332 | if (!empty($this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-family'])) { |
| 316 | 333 | $font_family = $this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-family']; |
| 317 | 334 | $font_weight = !empty($this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-weight']) ? $this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-weight'] : '400'; |
| @@ -348,106 +365,46 @@ | ||
| 348 | 365 | |
| 349 | 366 | $localize_array_data = [ |
| 350 | 367 | 'admin_ajax' => admin_url('admin-ajax.php'), |
| 351 | 368 | 'settings' => [ |
| 352 | - 'adminify_ui' => !empty($this->options['admin_ui']) ? true : false, | |
| 369 | + 'adminify_ui' => !empty($this->options['admin_ui']) ? true : false | |
| 353 | 370 | ], |
| 354 | 371 | 'admin_nonce' => wp_create_nonce('adminify_nonce'), |
| 355 | - 'is_pro' => (class_exists('\\PXLBSAdminify\\Pro\\Adminify_Pro') && !empty(\PXLBSAdminify\Pro\Adminify_Pro::is_premium())) ? true : false, | |
| 372 | + 'is_pro' => (class_exists('\\WPAdminify\\Pro\\Adminify_Pro') && !empty(\WPAdminify\Pro\Adminify_Pro::is_premium())) ? true : false, | |
| 356 | 373 | 'local_fonts' => $local_fonts_data |
| 357 | 374 | ]; |
| 358 | 375 | |
| 359 | - // Pro-only settings flags (e.g. menu_search) attach via this | |
| 360 | - // filter from Pro/Classes/Assets_Pro.php. Free leaves the | |
| 361 | - // localize array untouched. | |
| 362 | - $localize_array_data = (array) apply_filters( 'pxlbsadminify_admin_localize_data', $localize_array_data, $this->options ); | |
| 363 | - | |
| 364 | 376 | // Scripts Enqueue |
| 365 | - wp_enqueue_script('adminify-admin'); | |
| 366 | - wp_localize_script( 'adminify-admin', 'PXLBSADMINIFY_ADMIN', $localize_array_data ); | |
| 377 | + wp_enqueue_script('wp-adminify-admin'); | |
| 378 | + wp_localize_script( 'wp-adminify-admin', 'WP_ADMINIFY_ADMIN', $localize_array_data ); | |
| 367 | 379 | |
| 368 | 380 | if (!wp_script_is('adminify-fa', 'enqueued') || !wp_script_is('adminify-fa5', 'enqueued')) { |
| 369 | 381 | if (apply_filters('adminify_fa4', false)) { |
| 370 | - wp_enqueue_style('adminify-fa', PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/fa4/css/font-awesome.min.css', array(), '4.7.0', 'all'); | |
| 382 | + wp_enqueue_style('adminify-fa', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome' . Utils::assets_ext('.css'), array(), '4.7.0', 'all'); | |
| 371 | 383 | } else { |
| 372 | - wp_enqueue_style('adminify-fa5', PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/fa5/css/all.min.css', array(), '5.15.4', 'all'); | |
| 373 | - wp_enqueue_style('adminify-fa5-v4-shims', PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/fa5/css/v4-shims.min.css', array(), '5.15.4', 'all'); | |
| 384 | + wp_enqueue_style('adminify-fa5', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all' . Utils::assets_ext('.css'), array(), '5.15.5', 'all'); | |
| 385 | + wp_enqueue_style('adminify-fa5-v4-shims', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/v4-shims' . Utils::assets_ext('.css'), array(), '5.15.5', 'all'); | |
| 374 | 386 | } |
| 375 | 387 | } |
| 376 | - wp_enqueue_style('adminify-simple-line-icons'); | |
| 388 | + wp_enqueue_style('wp-adminify-simple-line-icons'); | |
| 377 | 389 | |
| 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('adminify_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 | - if ($screen->id === 'adminify_page_wp-adminify-addons-plugins' || $screen->id === 'adminify-pro_page_wp-adminify-addons-plugins') { | |
| 390 | + if ($screen->id === 'wp-adminify_page_wp-adminify-addons-plugins' || $screen->id === 'wp-adminify-pro_page_wp-adminify-addons-plugins') { | |
| 397 | 391 | // JS Files . |
| 398 | - wp_enqueue_script('adminify-addons', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-addons' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true); | |
| 392 | + wp_enqueue_script('wp-adminify-addons', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify-addons' . Utils::assets_ext('.js'), array('jquery'), WP_ADMINIFY_VER, true); | |
| 399 | 393 | wp_localize_script( |
| 400 | - 'adminify-addons', | |
| 401 | - 'PXLBSADMINIFY_CORE', | |
| 394 | + 'wp-adminify-addons', | |
| 395 | + 'WP_ADMINIFYCORE', | |
| 402 | 396 | array( |
| 403 | 397 | 'admin_ajax' => admin_url('admin-ajax.php'), |
| 404 | - 'addons_nonce' => wp_create_nonce('pxlbsadminify_addons_nonce'), | |
| 405 | - 'plugin_key' => 'pxlbsadminify' | |
| 398 | + 'addons_nonce' => wp_create_nonce('jltwp_adminify_addons_nonce'), | |
| 399 | + 'plugin_key' => 'jltwp_adminify' | |
| 406 | 400 | ) |
| 407 | 401 | ); |
| 408 | 402 | } |
| 409 | 403 | } |
| 410 | 404 | |
| 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, 'adminify_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 | - } | |
| 447 | - | |
| 448 | 405 | // WP Adminify Options Page Style |
| 449 | - public function pxlbsadminify_admin_script() | |
| 406 | + public function jltwp_adminify_admin_script() | |
| 450 | 407 | { |
| 451 | 408 | echo '<style>.wp-adminify-two-columns{ display: flex; flex-wrap: wrap; padding: 15px; } .wp-adminify .adminify-hightlight-field{ border: 2px solid #0347FF !important; font-weight: 600 !important;} .wp-adminify-two-columns .adminify-full-width-field{ width: 100% !important; flex-basis: 100% !important; } .wp-adminify-two-columns > .adminify-field{ width: 49%; flex-basis: 49%; margin-right: 1%; margin-top: -1px; border: 1px solid #eee; box-sizing: border-box; } .wp-adminify-two-columns.aminify-title-width-40 .adminify-title, .aminify-title-width-40 .adminify-title{ width: 40% !important;} .wp-adminify-two-columns.aminify-title-width-40 .adminify-fieldset, .aminify-title-width-40 .adminify-fieldset{ width: calc(60% - 20px) !important;} .wp-adminify-two-columns.aminify-title-width-65 .adminify-title{ width: 65%;} .wp-adminify-two-columns.aminify-title-width-65 .adminify-fieldset{ width: calc(35% - 20px);} .wp-adminify-two-columns .adminify-field-subheading{height:25px;box-sizing: content-box; width: 100%; flex-basis: 100%;} .wp-adminify-white-label-notice-content { background-color: #fff; box-shadow: 0px 0px 50px rgb(0 0 0 / 13%); position: absolute; top: 150px; left: 400px; width: 530px; padding: 32px; padding-bottom: 50px; -webkit-border-radius: 20px; border-radius: 20px; text-align: center; z-index: 2; } .wp-adminify-white-label-notice-logo img { height: 100px; width: 250px; padding: 10px; padding-top: 10px; } .wp-adminify-white-label-notice-content h2 span{ color: #6814cd; text-transform: uppercase; } .wp-adminify-white-label-notice-content em{ font-size: 13px; color: red; } .wp-adminify-white-label-notice .wp-adminify-get-pro{ background-image: -moz-linear-gradient( 0deg, rgb(223,29,198) 0%, rgb(106,20,209) 100%); background-image: -webkit-linear-gradient( 0deg , rgb(223,29,198) 0%, rgb(106,20,209) 100%); background-image: -ms-linear-gradient( 0deg, rgb(223,29,198) 0%, rgb(106,20,209) 100%); border: none; box-shadow: none; color: #fff; cursor: pointer; font-weight: 700; line-height: 35px; padding: 0 15px; text-transform: uppercase; text-decoration: none; display: inline-block; width: 180px; padding: 5px 15px !important; border-radius: 10px; font-size: 15px; font-weight: 800; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } .wp-adminify-white-label-notice{ position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100%; background: rgba(200, 200, 200, 0.5); -js-display: flex; display: -webkit-box; display: -webkit-flex; display: -moz-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -webkit-justify-content: center; -moz-box-pack: center; -ms-flex-pack: center; justify-content: center;z-index: 1; } .wp-adminify-white-label-notice .wp-adminify-get-pro:hover { color:#fff; background-image: -moz-linear-gradient(0deg, rgb(106, 20, 209) 0%, rgb(223, 29, 198) 100%); background-image: -webkit-linear-gradient( 0deg, rgb(106, 20, 209) 0%, rgb(223, 29, 198) 100%); background-image: -ms-linear-gradient(0deg, rgb(106, 20, 209) 0%, rgb(223, 29, 198) 100%);} .adminify-field-callback a.wp-adminify-rollback-button{font-family:inherit !important;} .wp-adminify-rollback-button.dashicons, .wp-adminify-rollback-button.dashicons-before:before{ width: inherit !important;}</style>'; |
| 452 | 409 | } |
| 453 | 410 | |