id ) { return; } // Validate the submitted auth code against the stored one before // doing anything with the ticket. Never redirect to (and thereby // disclose) the real ticket URL/auth code for an invalid guess. $submitted_auth_code = sanitize_text_field( wp_unslash( $_REQUEST['auth_code'] ) ); // phpcs:ignore if ( ! $ticket->auth_code || ! $submitted_auth_code || ! hash_equals( (string) $ticket->auth_code, $submitted_auth_code ) ) { return; } wp_safe_redirect( $ticket->get_url() ); exit; } } /** * Load JS and CSS scripts * * @return void */ public static function load_scripts() { // Check load scripts setting to load script on perticular page. if ( ! WPSC_Functions::is_load_scripts_page() ) { return; } // jquery. wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-ui-core' ); // TinyMCE. wp_enqueue_editor(); // jQuery UI Effects. wp_enqueue_script( 'jquery-effects-core' ); wp_enqueue_script( 'jquery-effects-slide' ); // Sortable. wp_enqueue_script( 'jquery-ui-sortable' ); // WPSC Framework. wp_enqueue_script( 'wpsc-framework', WPSC_PLUGIN_URL . 'framework/scripts.js', array( 'jquery' ), WPSC_VERSION, true ); if ( is_rtl() ) { wp_enqueue_style( 'wpsc-framework', WPSC_PLUGIN_URL . 'framework/style-rtl.css', array(), WPSC_VERSION ); } else { wp_enqueue_style( 'wpsc-framework', WPSC_PLUGIN_URL . 'framework/style.css', array(), WPSC_VERSION ); } wp_localize_script( 'wpsc-framework', 'supportcandy', self::get_localization_data() ); // selectWoo. wp_enqueue_script( 'wpsc-selectWoo', WPSC_PLUGIN_URL . 'asset/js/selectWoo/selectWoo.full.min.js', array( 'jquery' ), WPSC_VERSION, true ); if ( file_exists( WPSC_ABSPATH . 'asset/js/selectWoo/i18n/' . get_locale() . '.js' ) ) { wp_enqueue_script( 'selectWoo-lang', WPSC_PLUGIN_URL . 'asset/js/selectWoo/i18n/' . get_locale() . '.js', array( 'jquery' ), WPSC_VERSION, true ); } wp_enqueue_style( 'wpsc-select2', WPSC_PLUGIN_URL . 'asset/css/select2.css', array(), WPSC_VERSION ); // gpopover. wp_enqueue_script( 'gpopover', WPSC_PLUGIN_URL . 'asset/libs/gpopover/jquery.gpopover.js', array( 'jquery' ), WPSC_VERSION, true ); wp_enqueue_style( 'gpopover', WPSC_PLUGIN_URL . 'asset/libs/gpopover/jquery.gpopover.css', array(), WPSC_VERSION ); // jquery circle progress. wp_enqueue_script( 'jquery-circle-progress', WPSC_PLUGIN_URL . 'asset/libs/jquery-circle-progress/circle-progress.min.js', array( 'jquery' ), WPSC_VERSION, true ); // flatpickr. wp_enqueue_script( 'flatpickr-js', WPSC_PLUGIN_URL . 'asset/libs/flatpickr/flatpickr.js', array( 'jquery' ), WPSC_VERSION, true ); wp_enqueue_style( 'flatpickr-css', WPSC_PLUGIN_URL . 'asset/libs/flatpickr/flatpickr.min.css', array(), WPSC_VERSION ); if ( file_exists( WPSC_ABSPATH . 'asset/libs/flatpickr/l10n/' . WPSC_Functions::get_locale_iso() . '.js' ) ) { wp_enqueue_script( 'flatpickr-lang', WPSC_PLUGIN_URL . 'asset/libs/flatpickr/l10n/' . WPSC_Functions::get_locale_iso() . '.js', array( 'jquery' ), WPSC_VERSION, true ); } // fullcalendar. wp_enqueue_script( 'fullcalendar', WPSC_PLUGIN_URL . 'asset/libs/fullcalendar/lib/main.min.js', array( 'jquery' ), WPSC_VERSION, true ); wp_enqueue_script( 'fullcalendar-locales', WPSC_PLUGIN_URL . 'asset/libs/fullcalendar/lib/locales-all.min.js', array( 'jquery' ), WPSC_VERSION, true ); wp_enqueue_style( 'fullcalendar', WPSC_PLUGIN_URL . 'asset/libs/fullcalendar/lib/main.min.css', array(), WPSC_VERSION ); // DataTables. wp_enqueue_script( 'datatables', WPSC_PLUGIN_URL . 'asset/libs/DataTables/datatables.min.js', array( 'jquery' ), WPSC_VERSION, true ); wp_enqueue_style( 'datatables', WPSC_PLUGIN_URL . 'asset/libs/DataTables/datatables.min.css', array(), WPSC_VERSION ); // ChartJs. wp_enqueue_script( 'chartjs', WPSC_PLUGIN_URL . 'asset/libs/chartjs/dist/chart.min.js', array( 'jquery' ), WPSC_VERSION, true ); } /** * Get localization data for the admin scripts * * @return array */ private static function get_localization_data() { $gs = get_option( 'wpsc-gs-general' ); $page_settings = get_option( 'wpsc-gs-page-settings' ); $file_settings = get_option( 'wpsc-gs-file-attachments' ); $localizations = array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'urls' => array( 'support' => $page_settings['support-page'] ? get_permalink( $page_settings['support-page'] ) : '', 'open_ticket' => $page_settings['open-ticket-page'] ? get_permalink( $page_settings['open-ticket-page'] ) : '', ), 'plugin_url' => WPSC_PLUGIN_URL, 'version' => WPSC_VERSION, 'loader_html' => WPSC_Framework::loader_html(), 'inline_loader' => WPSC_Framework::inline_loader(), 'is_frontend' => 1, 'is_reload' => 1, 'reply_form_position' => $gs['reply-form-position'], 'allowed_file_extensions' => array_map( 'trim', array_map( 'strtolower', explode( ',', $file_settings['allowed-file-extensions'] ) ) ), 'nonce' => wp_create_nonce( 'general' ), 'translations' => array( 'req_fields_error' => esc_attr__( 'Required fields can not be empty!', 'supportcandy' ), 'datatables' => array( 'emptyTable' => esc_attr__( 'No Records', 'supportcandy' ), 'zeroRecords' => esc_attr__( 'No Records', 'supportcandy' ), 'info' => sprintf( /* translators: e.g. Showing 1 to 20 of 300 records */ esc_attr__( 'Showing %1$s to %2$s of %3$s records', 'supportcandy' ), '_START_', '_END_', '_TOTAL_' ), 'infoEmpty' => '', 'loadingRecords' => '', 'processing' => '', 'infoFiltered' => '', 'search' => esc_attr__( 'Search:', 'supportcandy' ), 'paginate' => array( 'first' => esc_attr__( 'First', 'supportcandy' ), 'previous' => esc_attr__( 'Previous', 'supportcandy' ), 'next' => esc_attr__( 'Next', 'supportcandy' ), 'last' => esc_attr__( 'Last', 'supportcandy' ), ), ), ), 'temp' => array(), 'home_url' => home_url(), ); return apply_filters( 'wpsc_frontend_localizations', $localizations ); } /** * Authentication screen * * @param boolean $otp_login - otp login option. * @param boolean $additional_links - additional links. * @return void */ public static function load_authentication_screen( $otp_login = true, $additional_links = true ) { $gs = get_option( 'wpsc-gs-general' ); $page_settings = get_option( 'wpsc-gs-page-settings' ); $recaptcha = get_option( 'wpsc-recaptcha-settings' ); $tc = get_option( 'wpsc-term-and-conditions' ); $gdpr = get_option( 'wpsc-gdpr-settings' ); ?>