settings_api = new PrimeSlider_Settings_API; if (!defined('BDTPS_CORE_HIDE')) { add_action('admin_init', [$this, 'admin_init']); add_action('admin_menu', [$this, 'admin_menu'], 201); } /** * Mini-Cart issue fixed * Check if MiniCart activate in EP and Elementor * If both is activated then Show Notice */ $ps_3rdPartyOption = get_option('prime_slider_third_party_widget'); $el_use_mini_cart = get_option('elementor_use_mini_cart_template'); if ($el_use_mini_cart !== false && $ps_3rdPartyOption !== false) { if ($ps_3rdPartyOption) { if ('yes' == $el_use_mini_cart && isset($ps_3rdPartyOption['wc-mini-cart']) && 'off' !== trim($ps_3rdPartyOption['wc-mini-cart'])) { add_action('admin_notices', [$this, 'el_use_mini_cart'], 10, 3); } } } // Process license title for white label functionality $this->license_wl_process(); // Handle white label access link $this->handle_white_label_access(); // Add custom CSS/JS functionality $this->init_custom_code_functionality(); // White label settings (admin only) add_action( 'wp_ajax_ps_save_white_label', [ $this, 'save_white_label_ajax' ] ); add_action( 'wp_ajax_ps_revoke_white_label_token', [ $this, 'revoke_white_label_token_ajax' ] ); add_action( 'admin_head', [ $this, 'inject_white_label_icon_css' ] ); // Plugin installation (admin only) add_action('wp_ajax_ps_install_plugin', [$this, 'install_plugin_ajax']); // Initialize rollback version functionality $this->rollback_version = new PrimeSlider\Admin\PrimeSlider_Rollback_Version(); } /** * Initialize Custom Code Functionality * * @access public * @return void */ public function init_custom_code_functionality() { // AJAX handler for saving custom code (admin only) add_action( 'wp_ajax_ps_save_custom_code', [ $this, 'save_custom_code_ajax' ] ); // Admin scripts (admin only) add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_custom_code_scripts' ] ); // Frontend injection is now handled by global functions in the main plugin file self::init_frontend_injection(); } /** * Initialize frontend injection hooks (works on both admin and frontend) * * @access public static * @return void */ public static function init_frontend_injection() { // Frontend hooks are now registered in the main plugin file // This method is kept for backwards compatibility but does nothing } /** * Enqueue scripts for custom code editor * * @access public * @return void */ public function enqueue_custom_code_scripts( $hook ) { if ( $hook !== 'toplevel_page_prime_slider_options' ) { return; } // Enqueue WordPress built-in CodeMirror wp_enqueue_code_editor( array( 'type' => 'text/css' ) ); wp_enqueue_code_editor( array( 'type' => 'application/javascript' ) ); // Enqueue WordPress media library scripts wp_enqueue_media(); // Enqueue the admin script if it exists $admin_script_path = BDTPS_CORE_ASSETS_PATH . 'js/ps-admin.js'; if ( file_exists( $admin_script_path ) ) { wp_enqueue_script( 'ps-admin-script', BDTPS_CORE_ASSETS_URL . 'js/ps-admin.js', [ 'jquery', 'media-upload', 'media-views', 'code-editor' ], BDTPS_CORE_VER, true ); // Localize script with AJAX data wp_localize_script( 'ps-admin-script', 'ps_admin_ajax', [ 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'ps_custom_code_nonce' ), 'white_label_nonce' => wp_create_nonce( 'ps_white_label_nonce' ) ] ); } else { // Fallback: localize to jquery if the admin script doesn't exist wp_localize_script( 'jquery', 'ps_admin_ajax', [ 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'ps_custom_code_nonce' ), 'white_label_nonce' => wp_create_nonce( 'ps_white_label_nonce' ) ] ); } } /** * AJAX handler for saving white label settings * * @access public * @return void */ public function save_white_label_ajax() { // Check nonce and permissions if (!wp_verify_nonce($_POST['nonce'], 'ps_white_label_nonce')) { wp_send_json_error(['message' => __('Security check failed', 'bdthemes-prime-slider')]); } if (!current_user_can('manage_options')) { wp_send_json_error(['message' => __('You do not have permission to manage white label settings', 'bdthemes-prime-slider')]); } // Check license eligibility if (!self::is_white_label_license()) { wp_send_json_error(['message' => __('Your license does not support white label features', 'bdthemes-prime-slider')]); } // Get white label settings $white_label_enabled = isset($_POST['ps_white_label_enabled']) ? (bool) $_POST['ps_white_label_enabled'] : false; $hide_license = isset($_POST['ps_white_label_hide_license']) ? (bool) $_POST['ps_white_label_hide_license'] : false; $bdtps_hide = isset($_POST['ps_white_label_bdtps_hide']) ? (bool) $_POST['ps_white_label_bdtps_hide'] : false; $white_label_title = isset($_POST['ps_white_label_title']) ? sanitize_text_field($_POST['ps_white_label_title']) : ''; $white_label_icon = isset($_POST['ps_white_label_icon']) ? esc_url_raw($_POST['ps_white_label_icon']) : ''; $white_label_icon_id = isset($_POST['ps_white_label_icon_id']) ? absint($_POST['ps_white_label_icon_id']) : 0; $white_label_logo = isset($_POST['ps_white_label_logo']) ? esc_url_raw($_POST['ps_white_label_logo']) : ''; $white_label_logo_id = isset($_POST['ps_white_label_logo_id']) ? absint($_POST['ps_white_label_logo_id']) : 0; // Save settings update_option('ps_white_label_enabled', $white_label_enabled); update_option('ps_white_label_hide_license', $hide_license); update_option('ps_white_label_bdtps_hide', $bdtps_hide); update_option('ps_white_label_title', $white_label_title); update_option('ps_white_label_icon', $white_label_icon); update_option('ps_white_label_icon_id', $white_label_icon_id); update_option('ps_white_label_logo', $white_label_logo); update_option('ps_white_label_logo_id', $white_label_logo_id); // Set license title status if ($white_label_enabled) { update_option('prime_slider_license_title_status', true); } else { delete_option('prime_slider_license_title_status'); } // Only send access email if both white label mode AND BDTPS_CORE_HIDE are enabled if ($white_label_enabled && $bdtps_hide) { $email_sent = $this->send_white_label_access_email(); } wp_send_json_success([ 'message' => __('White label settings saved successfully', 'bdthemes-prime-slider'), 'bdtps_hide' => $bdtps_hide, 'email_sent' => isset($email_sent) ? $email_sent : false ]); } /** * Send white label access email with special link * * @access private * @return bool */ private function send_white_label_access_email() { $license_email = self::get_license_email(); $admin_email = get_bloginfo( 'admin_email' ); $license_key = self::get_license_key(); $site_name = get_bloginfo( 'name' ); $site_url = get_bloginfo( 'url' ); // Generate secure access token with additional entropy $access_token = wp_hash( $license_key . time() . wp_salt() . wp_generate_password( 32, false ) ); // Store access token in database with no expiration $token_data = [ 'token' => $access_token, 'license_key' => $license_key, 'created_at' => current_time( 'timestamp' ), 'user_id' => get_current_user_id() ]; update_option( 'ps_white_label_access_token', $token_data ); // Generate access URL using token instead of license key for security // Add white_label_tab=1 parameter to automatically switch to White Label tab $access_url = admin_url( 'admin.php?page=prime_slider_options&ps_wl=1&token=' . $access_token . '&white_label_tab=1#prime_slider_extra_options' ); // Email subject $subject = sprintf( '[%s] Prime Slider White Label Access Instructions', $site_name ); // Email message $message = $this->get_white_label_email_template( $site_name, $site_url, $access_url, $license_key ); // Email headers $headers = [ 'Content-Type: text/html; charset=UTF-8', 'From: ' . $site_name . ' <' . $admin_email . '>' ]; $email_sent = false; // Send to license email if ( ! empty( $license_email ) && is_email( $license_email ) ) { $email_sent = wp_mail( $license_email, $subject, $message, $headers ); // If on localhost or email failed, save email content for manual access if ( ! $email_sent || $this->is_localhost() ) { $this->save_email_content_for_localhost( $access_url, $message, $license_email ); } } return $email_sent; } /** * Check if running on localhost * * @access private * @return bool */ private function is_localhost() { $server_name = $_SERVER['SERVER_NAME'] ?? ''; $server_addr = $_SERVER['SERVER_ADDR'] ?? ''; $localhost_indicators = [ 'localhost', '127.0.0.1', '::1', '.local', '.test', '.dev' ]; foreach ( $localhost_indicators as $indicator ) { if ( strpos( $server_name, $indicator ) !== false || strpos( $server_addr, $indicator ) !== false ) { return true; } } return false; } /** * Save email content for localhost testing * * @access private * @param string $access_url * @param string $email_content * @param string $recipient_email * @return void */ private function save_email_content_for_localhost( $access_url, $email_content, $recipient_email ) { $email_data = [ 'access_url' => $access_url, 'email_content' => $email_content, 'recipient_email' => $recipient_email, 'message' => 'Email functionality not available on localhost. Use the access URL below:' ]; // Save for admin notice display update_option( 'ps_localhost_email_data', $email_data ); } /** * Get white label email template * * @access private * @param string $site_name * @param string $site_url * @param string $access_url * @param string $license_key * @return string */ private function get_white_label_email_template( $site_name, $site_url, $access_url, $license_key ) { $masked_license = substr( $license_key, 0, 8 ) . '****-****-****-' . substr( $license_key, -4 ); ob_start(); ?> Prime Slider White Label Access

🔒 Prime Slider White Label Access

Important: Save This Email!

Hello,

You have successfully enabled BDTPS_CORE_HIDE mode for Prime Slider Pro on .

⚠️ IMPORTANT

The plugin interface is hidden from your WordPress admin. Use below link to modify white label settings.

Access White Label Settings

Direct Link:

🔧 What You Can Do

Using the access link above, you can:

Need help? Contact support with your license key.

show_access_error( 'Invalid access parameter. Please use the correct link from your email.' ); return; } // Validate the access token if ( ! $this->validate_white_label_access_token( $access_token ) ) { $this->show_access_error( 'Invalid or expired access token. Please use the correct access link from your email.' ); return; } // Valid access - temporarily allow access by setting a flag add_action('admin_init', [$this, 'admin_init']); add_action('admin_menu', [$this, 'admin_menu'], 201); // Add success notice add_action( 'admin_notices', function() { echo '
'; echo '

✅ White Label Access Granted! You can now modify white label settings.

'; echo '
'; } ); } /** * Show access error page * * @access private * @param string $message * @return void */ private function show_access_error( $message ) { wp_die( '

🔒 Prime Slider White Label Access

' . '

Access Denied: ' . esc_html( $message ) . '

' . '

If you need assistance, please contact support with your license information.

' . '

← Return to Dashboard

', 'Access Denied', [ 'response' => 403 ] ); } /** * Inject white label icon CSS * * @access public * @return void */ public function inject_white_label_icon_css() { $white_label_enabled = get_option('ps_white_label_enabled', false); $white_label_icon = get_option('ps_white_label_icon', ''); // Only inject CSS when white label is enabled AND a custom icon is set if ( $white_label_enabled && ! empty( $white_label_icon ) ) { echo ''; } // When white label is disabled or no icon is set, don't inject any CSS // This allows WordPress's original icon to display naturally } /** * Get used widgets. * * @access public * @return array * @since 6.0.0 * */ public static function get_used_widgets() { $used_widgets = array(); if (class_exists('Elementor\Modules\Usage\Module')) { $module = Module::instance(); $old_error_level = error_reporting(); error_reporting(E_ALL & ~E_WARNING); // Suppress warnings $elements = $module->get_formatted_usage('raw'); error_reporting($old_error_level); // Restore $ps_widgets = self::get_ps_widgets_names(); if (is_array($elements) || is_object($elements)) { foreach ($elements as $post_type => $data) { foreach ($data['elements'] as $element => $count) { if (in_array($element, $ps_widgets, true)) { if (isset($used_widgets[$element])) { $used_widgets[$element] += $count; } else { $used_widgets[$element] = $count; } } } } } } return $used_widgets; } /** * Get used separate widgets. * * @access public * @return array * @since 6.0.0 * */ public static function get_used_only_widgets() { $used_widgets = array(); if (class_exists('Elementor\Modules\Usage\Module')) { $module = Module::instance(); $old_error_level = error_reporting(); error_reporting(E_ALL & ~E_WARNING); // Suppress warnings $elements = $module->get_formatted_usage('raw'); error_reporting($old_error_level); // Restore $ps_widgets = self::get_ps_only_widgets(); if (is_array($elements) || is_object($elements)) { foreach ($elements as $post_type => $data) { foreach ($data['elements'] as $element => $count) { if (in_array($element, $ps_widgets, true)) { if (isset($used_widgets[$element])) { $used_widgets[$element] += $count; } else { $used_widgets[$element] = $count; } } } } } } return $used_widgets; } /** * Get used only separate 3rdParty widgets. * * @access public * @return array * @since 6.0.0 * */ public static function get_used_only_3rdparty() { $used_widgets = array(); if (class_exists('Elementor\Modules\Usage\Module')) { $module = Module::instance(); $old_error_level = error_reporting(); error_reporting(E_ALL & ~E_WARNING); // Suppress warnings $elements = $module->get_formatted_usage('raw'); error_reporting($old_error_level); // Restore $ps_widgets = self::get_ps_only_3rdparty_names(); if (is_array($elements) || is_object($elements)) { foreach ($elements as $post_type => $data) { foreach ($data['elements'] as $element => $count) { if (in_array($element, $ps_widgets, true)) { if (isset($used_widgets[$element])) { $used_widgets[$element] += $count; } else { $used_widgets[$element] = $count; } } } } } } return $used_widgets; } /** * Get unused widgets. * * @access public * @return array * @since 6.0.0 * */ public static function get_unused_widgets() { if (!current_user_can('install_plugins')) { die(); } $ps_widgets = self::get_ps_widgets_names(); $used_widgets = self::get_used_widgets(); $unused_widgets = array_diff($ps_widgets, array_keys($used_widgets)); return $unused_widgets; } /** * Get unused separate widgets. * * @access public * @return array * @since 6.0.0 * */ public static function get_unused_only_widgets() { if (!current_user_can('install_plugins')) { die(); } $ps_widgets = self::get_ps_only_widgets(); $used_widgets = self::get_used_only_widgets(); $unused_widgets = array_diff($ps_widgets, array_keys($used_widgets)); return $unused_widgets; } /** * Get unused separate 3rdparty widgets. * * @access public * @return array * @since 6.0.0 * */ public static function get_unused_only_3rdparty() { if (!current_user_can('install_plugins')) { die(); } $ps_widgets = self::get_ps_only_3rdparty_names(); $used_widgets = self::get_used_only_3rdparty(); $unused_widgets = array_diff($ps_widgets, array_keys($used_widgets)); return $unused_widgets; } /** * Get widgets name * * @access public * @return array * @since 6.0.0 * */ public static function get_ps_widgets_names() { $names = self::$modules_names; if (null === $names) { $names = array_map( function ($item) { return isset($item['name']) ? 'prime-slider-' . str_replace('_', '-', $item['name']) : 'none'; }, self::$modules_list ); } return $names; } /** * Get separate widgets name * * @access public * @return array * @since 6.0.0 * */ public static function get_ps_only_widgets() { $names = self::$modules_names_only_widgets; if (null === $names) { $names = array_map( function ($item) { return isset($item['name']) ? 'prime-slider-' . str_replace('_', '-', $item['name']) : 'none'; }, self::$modules_list_only_widgets ); } return $names; } /** * Get separate 3rdParty widgets name * * @access public * @return array * @since 6.0.0 * */ public static function get_ps_only_3rdparty_names() { $names = self::$modules_names_only_3rdparty; if (null === $names) { $names = array_map( function ($item) { return isset($item['name']) ? 'prime-slider-' . str_replace('_', '-', $item['name']) : 'none'; }, self::$modules_list_only_3rdparty ); } return $names; } /** * Get URL with page id * * @access public * */ public static function get_url() { return admin_url('admin.php?page=' . self::PAGE_ID); } /** * Init settings API * * @access public * */ public function admin_init() { //set the settings $this->settings_api->set_sections($this->get_settings_sections()); $this->settings_api->set_fields($this->prime_slider_admin_settings()); //initialize settings $this->settings_api->admin_init(); $this->ps_redirect_to_get_pro(); if (true === _is_ps_pro_activated()) { $this->bdt_redirect_to_renew_link(); } } /** * Add Plugin Menus * * @access public * */ // Redirect to Prime Slider Pro pricing page public function ps_redirect_to_get_pro() { if (isset($_GET['page']) && $_GET['page'] === self::PAGE_ID . '_get_pro') { wp_redirect('https://primeslider.pro/pricing/'); exit; } } // Redirect to renew link public function bdt_redirect_to_renew_link() { if (isset($_GET['page']) && $_GET['page'] === self::PAGE_ID . '_license_renew') { wp_redirect('https://account.bdthemes.com/'); exit; } } public function admin_menu() { add_menu_page( BDTPS_CORE_TITLE . ' ' . esc_html__('Dashboard', 'bdthemes-prime-slider'), BDTPS_CORE_TITLE, 'manage_options', self::PAGE_ID, [$this, 'plugin_page'], $this->prime_slider_icon(), 58 ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('Core Widgets', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_active_modules', [$this, 'display_page'] ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('3rd Party Widgets', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_third_party_widget', [$this, 'display_page'] ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('Extensions', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_elementor_extend', [$this, 'display_page'] ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('Special Features', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_other_settings', [$this, 'display_page'] ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('Extra Options', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_extra_options', [$this, 'plugin_page'] ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('System Status', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_analytics_system_req', [$this, 'plugin_page'] ); add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('Other Plugins', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_other_plugins', [$this, 'plugin_page'] ); // add_submenu_page( // self::PAGE_ID, // BDTPS_CORE_TITLE, // esc_html__('Get Up to 60%', 'bdthemes-prime-slider'), // 'manage_options', // self::PAGE_ID . '#prime_slider_affiliate', // [$this, 'plugin_page'] // ); if (true == _is_ps_pro_activated()) { add_submenu_page( self::PAGE_ID, BDTPS_CORE_TITLE, esc_html__('Rollback Version', 'bdthemes-prime-slider'), 'manage_options', self::PAGE_ID . '#prime_slider_rollback_version', [$this, 'plugin_page'] ); } } /** * Get SVG Ic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iBzdHlsZT0ic3RvcC1jb2xvcjojRkU1MTZCIi8+DQoJPC9saW5lYXJHcmFkaWVudD4NCgk8cGF0aCBjbGFzcz0ic3Q0IiBkPSJNMjA3LjcsMTExLjF2MTEyLjZjMCwzLTIuNSw1LjUtNS41LDUuNWgtMzIuNmMtMywwLTUuNS0yLjUtNS41LTUuNVYxMTEuMWMwLTMsMi41LTUuNSw1LjUtNS41aDMyLjYNCgkJQzIwNS4yLDEwNS42LDIwNy43LDEwOCwyMDcuNywxMTEuMXoiLz4NCjwvZz4NCjwvc3ZnPg0K'; } /** * Get SVG Icons of Prime Slider * * @access public * @return array */ public function get_settings_sections() { $sections = [ [ 'id' => 'prime_slider_active_modules', 'title' => esc_html__('Core Widgets', 'bdthemes-prime-slider') ], [ 'id' => 'prime_slider_third_party_widget', 'title' => esc_html__('3rd Party Widgets', 'bdthemes-prime-slider') ], [ 'id' => 'prime_slider_elementor_extend', 'title' => esc_html__('Extensions', 'bdthemes-prime-slider') ], [ 'id' => 'prime_slider_other_settings', 'title' => esc_html__('Special Features', 'bdthemes-prime-slider'), ], ]; return $sections; } /** * Merge Admin Settings * * @access protected * @return array */ protected function prime_slider_admin_settings() { return ModuleService::get_widget_settings(function ($settings) { $settings_fields = $settings['settings_fields']; self::$modules_list = array_merge($settings_fields['prime_slider_active_modules'], $settings_fields['prime_slider_third_party_widget']); self::$modules_list_only_widgets = $settings_fields['prime_slider_active_modules']; self::$modules_list_only_3rdparty = $settings_fields['prime_slider_third_party_widget']; return $settings_fields; }); } /** * Get Welcome Panel * * @access public * @return void */ public function prime_slider_welcome() { ?>

', ''); ?>

Prime Slider Dashboard Template

Prime Slider Dashboard Template

Prime Slider

  • Rooten

settings_api->show_navigation(); ?>
prime_slider_welcome(); ?>
settings_api->show_forms(); ?>
prime_slider_extra_options(); ?>
prime_slider_analytics_system_req_content(); ?>
prime_slider_others_plugin(); ?>
prime_slider_rollback_version_content(); ?>
prime_slider_get_pro(); ?>
footer_info(); } ?>
script(); } /** * Tabbable JavaScript codes & Initiate Color Picker * * This code uses localstorage for displaying active tabs */ function script() { ?> ID] = $page->post_title; } } return $pages_options; } /** * Check if current license supports white label features * Now includes other_param checking for AppSumo WL flag * * @access public static * @return bool */ public static function is_white_label_license() { // Check if pro version is activated first if (!function_exists('_is_ps_pro_activated') || !_is_ps_pro_activated()) { return false; } // Since PrimeSliderPro\Base doesn't exist, return false for now // This should be replaced with actual pro license checking logic when available $license_info = PrimeSliderPro\Base\Prime_Slider_Base::GetRegisterInfo(); // Security: Validate license info structure if (empty($license_info) || !is_object($license_info) || empty($license_info->license_title) || empty($license_info->is_valid)) { return false; } // Sanitize license title to prevent any potential issues $license_title = sanitize_text_field(strtolower($license_info->license_title)); // Check for other_param WL flag FIRST (for AppSumo and other special licenses) if (!empty($license_info->other_param)) { // Check if other_param contains WL flag if (is_array($license_info->other_param)) { if (in_array('WL', $license_info->other_param, true)) { return true; } } elseif (is_string($license_info->other_param)) { if (strpos($license_info->other_param, 'WL') !== false) { return true; } } } // Check standard license types (but NOT AppSumo - AppSumo requires WL flag) $allowed_types = self::get_white_label_allowed_license_types(); $allowed_hashes = array_values($allowed_types); // Split license title into words and check each word $words = preg_split('/\s+/', $license_title, -1, PREG_SPLIT_NO_EMPTY); foreach ($words as $word) { $word = trim($word); if (empty($word) || strlen($word) > 50) { // Prevent extremely long strings continue; } // Use SHA-256 for enhanced security $hash = hash('sha256', $word); if (in_array($hash, $allowed_hashes, true)) { // Strict comparison return true; } } return false; } /** * Render White Label Section * * @access public * @return void */ public function render_white_label_section() { //// Safely check if helper functions exist $is_pro_installed = function_exists('_is_pro_pro_installed') ? _is_pro_pro_installed() : false; $is_pro_activated = function_exists('_is_ps_pro_activated') ? _is_ps_pro_activated() : false; // Define plugin slug (adjust if needed) $plugin_slug = 'bdthemes-prime-slider/bdthemes-prime-slider.php'; // Case 1: Pro not installed if ( ! $is_pro_installed ) : ?>

'activate', 'plugin' => $plugin_slug, ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_slug ); ?>

>

Icon Preview

Logo Preview

⚠️ BDTPS_CORE_HIDE Currently Active

Advanced white label mode is currently enabled. Prime Slider menus are hidden from the admin interface.

When you enable BDTPS_CORE_HIDE, an email will be automatically sent to:

  • License Email:

This email will contain a special access link that allows you to return to these settings even when BDTPS_CORE_HIDE is active.

license_title)) { update_option( 'prime_slider_license_title_status', false ); return false; } $license_title = strtolower($license_info->license_title); $allowed_types = self::get_white_label_allowed_license_types(); $allowed_hashes = array_values($allowed_types); // Split license title into words and check each word $words = preg_split('/\s+/', $license_title); foreach ($words as $word) { $word = trim($word); if (empty($word)) continue; // Use SHA-256 instead of MD5 for better security $hash = hash('sha256', $word); if (in_array($hash, $allowed_hashes)) { update_option( 'prime_slider_license_title_status', true ); return true; } } update_option( 'prime_slider_license_title_status', false ); return false; } public static function license_wl_status() { $status = get_option('prime_slider_license_title_status'); if ($status) { return true; } return false; } /** * Display Analytics and System Requirements * * @access public * @return void */ public function prime_slider_analytics_system_req_content() { ?>
prime_slider_widgets_status(); ?>

prime_slider_system_requirement(); ?>
>

>

>

>

', '' ); echo ' ' . esc_html__('from here.', 'bdthemes-prime-slider') . ''; ?>
'; $no_icon = ''; $environment = Utils::get_environment_info(); ?>
Prime Slider' ); ?>
'Invalid security token.' ] ); } // Check user capability if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ 'message' => 'Insufficient permissions.' ] ); } // Sanitize and save the custom code $custom_css = isset( $_POST['custom_css'] ) ? wp_unslash( $_POST['custom_css'] ) : ''; $custom_js = isset( $_POST['custom_js'] ) ? wp_unslash( $_POST['custom_js'] ) : ''; $custom_css_2 = isset( $_POST['custom_css_2'] ) ? wp_unslash( $_POST['custom_css_2'] ) : ''; $custom_js_2 = isset( $_POST['custom_js_2'] ) ? wp_unslash( $_POST['custom_js_2'] ) : ''; // Handle excluded pages - ensure we get proper array format $excluded_pages = array(); if ( isset( $_POST['excluded_pages'] ) ) { if ( is_array( $_POST['excluded_pages'] ) ) { $excluded_pages = $_POST['excluded_pages']; } elseif ( is_string( $_POST['excluded_pages'] ) && ! empty( $_POST['excluded_pages'] ) ) { // Handle case where it might be a single value $excluded_pages = [ $_POST['excluded_pages'] ]; } } // Sanitize excluded pages - convert to integers and remove empty values $excluded_pages = array_map( 'intval', $excluded_pages ); $excluded_pages = array_filter( $excluded_pages, function( $page_id ) { return $page_id > 0; } ); // Save to database update_option( 'ps_custom_css', $custom_css ); update_option( 'ps_custom_js', $custom_js ); update_option( 'ps_custom_css_2', $custom_css_2 ); update_option( 'ps_custom_js_2', $custom_js_2 ); update_option( 'ps_excluded_pages', $excluded_pages ); wp_send_json_success( [ 'message' => 'Custom code saved successfully!', 'excluded_count' => count( $excluded_pages ) ] ); } /** * Handle AJAX plugin installation * * @access public * @return void */ public function install_plugin_ajax() { // Check nonce if (!wp_verify_nonce($_POST['nonce'], 'ps_install_plugin_nonce')) { wp_send_json_error(['message' => __('Security check failed', 'bdthemes-prime-slider')]); } // Check user capability if (!current_user_can('install_plugins')) { wp_send_json_error(['message' => __('You do not have permission to install plugins', 'bdthemes-prime-slider')]); } $plugin_slug = sanitize_text_field($_POST['plugin_slug']); if (empty($plugin_slug)) { wp_send_json_error(['message' => __('Plugin slug is required', 'bdthemes-prime-slider')]); } // Include necessary WordPress files require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php'; // Get plugin information $api = plugins_api('plugin_information', [ 'slug' => $plugin_slug, 'fields' => [ 'sections' => false, ], ]); if (is_wp_error($api)) { wp_send_json_error(['message' => __('Plugin not found: ', 'bdthemes-prime-slider') . $api->get_error_message()]); } // Install the plugin $skin = new \WP_Ajax_Upgrader_Skin(); $upgrader = new \Plugin_Upgrader($skin); $result = $upgrader->install($api->download_link); if (is_wp_error($result)) { wp_send_json_error(['message' => __('Installation failed: ', 'bdthemes-prime-slider') . $result->get_error_message()]); } elseif ($skin->get_errors()->has_errors()) { wp_send_json_error(['message' => __('Installation failed: ', 'bdthemes-prime-slider') . $skin->get_error_messages()]); } elseif (is_null($result)) { wp_send_json_error(['message' => __('Installation failed: Unable to connect to filesystem', 'bdthemes-prime-slider')]); } // Get installation status $install_status = install_plugin_install_status($api); wp_send_json_success([ 'message' => __('Plugin installed successfully!', 'bdthemes-prime-slider'), 'plugin_file' => $install_status['file'], 'plugin_name' => $api->name ]); } /** * Extract plugin slug from plugin path * * @param string $plugin_path Plugin file path * @return string Plugin slug */ private function extract_plugin_slug_from_path($plugin_path) { $parts = explode('/', $plugin_path); return isset($parts[0]) ? $parts[0] : ''; } /** * Get plugin action button HTML based on plugin status * * @param string $plugin_path Plugin file path * @param string $install_url Plugin installation URL * @param string $plugin_slug Plugin slug for activation * @return string Button HTML */ private function get_plugin_action_button($plugin_path, $install_url, $plugin_slug = '') { $status = $this->get_plugin_status($plugin_path); switch ($status) { case 'active': return ''; case 'installed': $activate_url = wp_nonce_url( add_query_arg([ 'action' => 'activate', 'plugin' => $plugin_path ], admin_url('plugins.php')), 'activate-plugin_' . $plugin_path ); return '' . __('Activate', 'bdthemes-prime-slider') . ''; case 'not_installed': default: $plugin_slug = $this->extract_plugin_slug_from_path($plugin_path); $nonce = wp_create_nonce('ps_install_plugin_nonce'); return '' . __('Install', 'bdthemes-prime-slider') . ''; } } /** * Extra Options Start Here */ /** * Render Custom CSS & JS Section * * @access public * @return void */ public function render_custom_css_js_section() { ?>

render_custom_css_js_section(); ?>
render_white_label_section(); ?>
rollback_version->prime_slider_rollback_version_content(); } /** * Get allowed white label license types (SHA-256 hashes) * This centralized method makes it easy to add new license types in the future * Note: AppSumo and Lifetime licenses require WL flag in other_param instead of automatic access * * @access public static * @return array Array of SHA-256 hashes for allowed license types */ public static function get_white_label_allowed_license_types() { $allowed_types = [ 'agency' => 'c4b2af4722ee54e317672875b2d8cf49aa884bf5820ec6091114fea5ec6560e4', 'extended' => '4d7120eb6c796b04273577476eb2e20c34c51d7fa1025ec19c3414448abc241e', 'developer' => '88fa0d759f845b47c044c2cd44e29082cf6fea665c30c146374ec7c8f3d699e3', // Note: AppSumo and Lifetime licenses removed from automatic access // They require WL flag in other_param for white label functionality ]; return $allowed_types; } /** * Revoke white label access token * * @access public * @return bool */ public function revoke_white_label_access_token() { $token_data = get_option( 'ps_white_label_access_token', [] ); if ( ! empty( $token_data ) ) { delete_option( 'ps_white_label_access_token' ); return true; } return false; } /** * Validate white label access token * * @access public * @param string $token * @return bool */ public function validate_white_label_access_token( $token ) { $stored_token_data = get_option( 'ps_white_label_access_token', [] ); if ( empty( $stored_token_data ) || ! isset( $stored_token_data['token'] ) ) { return false; } // Check token match if ( $stored_token_data['token'] !== $token ) { return false; } // Check if token was generated for current license $current_license_key = self::get_license_key(); if ( $stored_token_data['license_key'] !== $current_license_key ) { return false; } return true; } /** * AJAX handler for revoking white label access token * * @access public * @return void */ public function revoke_white_label_token_ajax() { // Check nonce and permissions if (!wp_verify_nonce($_POST['nonce'], 'ps_white_label_nonce')) { wp_send_json_error(['message' => __('Security check failed', 'bdthemes-prime-slider')]); } if (!current_user_can('manage_options')) { wp_send_json_error(['message' => __('You do not have permission to manage white label settings', 'bdthemes-prime-slider')]); } // Check license eligibility if (!self::is_white_label_license()) { wp_send_json_error(['message' => __('Your license does not support white label features', 'bdthemes-prime-slider')]); } // Revoke the token $revoked = $this->revoke_white_label_access_token(); if ($revoked) { wp_send_json_success([ 'message' => __('White label access token has been revoked successfully', 'bdthemes-prime-slider') ]); } else { wp_send_json_error([ 'message' => __('No active access token found to revoke', 'bdthemes-prime-slider') ]); } } /** * Get License Key * * @access public * @return string */ public static function get_license_key() { $license_key = get_option('prime_slider_license_key'); return trim($license_key); } /** * Get License Email * * @access public * @return string */ public static function get_license_email() { return trim(get_option('prime_slider_license_email', get_bloginfo('admin_email'))); } } new PrimeSlider_Admin_Settings();