MM-DD format or leave blank)', 'dokan-lite' ) ), 'i18n_edited_variations' => esc_js( __( 'Save changes before changing page?', 'dokan-lite' ) ), 'i18n_variation_count_single' => esc_js( __( '%qty% variation', 'dokan-lite' ) ), 'i18n_variation_count_plural' => esc_js( __( '%qty% variations', 'dokan-lite' ) ), 'i18n_no_result_found' => esc_js( __( 'No Result Found', 'dokan-lite' ) ), 'i18n_sales_price_error' => esc_js( __( 'Please insert value less than the regular price!', 'dokan-lite' ) ), 'variations_per_page' => absint( apply_filters( 'dokan_product_variations_per_page', 10 ) ), 'store_banner_dimension' => [ 'width' => $banner_width, 'height' => $banner_height, 'flex-width' => $has_flex_width, 'flex-height' => $has_flex_height ], 'selectAndCrop' => __( 'Select and Crop', 'dokan-lite' ), 'chooseImage' => __( 'Choose Image', 'dokan-lite' ), 'product_title_required' => __( 'Product title is required', 'dokan-lite' ), 'product_category_required' => __( 'Product category is required', 'dokan-lite' ), 'search_products_nonce' => wp_create_nonce( 'search-products' ), 'search_customer_nonce' => wp_create_nonce( 'search-customer' ), 'i18n_matches_1' => __( 'One result is available, press enter to select it.', 'dokan-lite' ), 'i18n_matches_n' => __( '%qty% results are available, use up and down arrow keys to navigate.', 'dokan-lite' ), 'i18n_no_matches' => __( 'No matches found', 'dokan-lite' ), 'i18n_ajax_error' => __( 'Loading failed', 'dokan-lite' ), 'i18n_input_too_short_1' => __( 'Please enter 1 or more characters', 'dokan-lite' ), 'i18n_input_too_short_n' => __( 'Please enter %qty% or more characters', 'dokan-lite' ), 'i18n_input_too_long_1' => __( 'Please delete 1 character', 'dokan-lite' ), 'i18n_input_too_long_n' => __( 'Please delete %qty% characters', 'dokan-lite' ), 'i18n_selection_too_long_1' => __( 'You can only select 1 item', 'dokan-lite' ), 'i18n_selection_too_long_n' => __( 'You can only select %qty% items', 'dokan-lite' ), 'i18n_load_more' => __( 'Loading more results…', 'dokan-lite' ), 'i18n_searching' => __( 'Searching…', 'dokan-lite' ), 'i18n_date_format' => get_option( 'date_format' ) ); $default_args = array_merge( $default_args, $custom_args ); } return $default_args; } /** * Get file prefix * * @return string */ public function get_prefix() { $prefix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; return $prefix; } /** * Register scripts * * @param array $scripts * * @return void */ public function register_scripts( $scripts ) { foreach ( $scripts as $handle => $script ) { $deps = isset( $script['deps'] ) ? $script['deps'] : false; $in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : true; $version = isset( $script['version'] ) ? $script['version'] : DOKAN_PLUGIN_VERSION; wp_register_script( $handle, $script['src'], $deps, $version, $in_footer ); } } /** * Register styles * * @param array $styles * * @return void */ public function register_styles( $styles ) { foreach ( $styles as $handle => $style ) { $deps = isset( $style['deps'] ) ? $style['deps'] : false; $version = isset( $style['version'] ) ? $style['version'] : DOKAN_PLUGIN_VERSION; wp_register_style( $handle, $style['src'], $deps, $version ); } } /** * Enqueue the scripts * * @param array $scripts * * @return void */ public function enqueue_scripts( $scripts ) { foreach ( $scripts as $handle => $script ) { wp_enqueue_script( $handle ); } } /** * Enqueue styles * * @param array $styles * * @return void */ public function enqueue_styles( $styles ) { foreach ( $styles as $handle => $script ) { wp_enqueue_style( $handle ); } } /** * Admin localized scripts * * @since 3.0.0 * * @return array */ public function get_admin_localized_scripts() { $general_settings = get_option( 'dokan_general', [] ); $banner_width = dokan_get_option( 'store_banner_width', 'dokan_appearance', 625 ); $banner_height = dokan_get_option( 'store_banner_height', 'dokan_appearance', 300 ); $has_flex_width = ! empty( $general_settings['store_banner_flex_width'] ) ? $general_settings['store_banner_flex_width'] : true; $has_flex_height = ! empty( $general_settings['store_banner_flex_height'] ) ? $general_settings['store_banner_flex_height'] : true; return apply_filters( 'dokan_admin_localize_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'dokan_admin' ), 'rest' => array( 'root' => esc_url_raw( get_rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'version' => 'dokan/v1', ), 'api' => null, 'libs' => array(), 'routeComponents' => array( 'default' => null ), 'routes' => $this->get_vue_admin_routes(), 'currency' => $this->get_localized_price(), 'hasPro' => dokan()->is_pro_exists(), 'proVersion' => dokan()->is_pro_exists() ? dokan_pro()->version : '', 'i18n' => array( 'dokan-lite' => dokan_get_jed_locale_data( 'dokan-lite' ) ) , 'urls' => array( 'adminRoot' => admin_url(), 'siteUrl' => home_url( '/' ), 'storePrefix' => dokan_get_option( 'custom_store_url', 'dokan_general', 'store' ), 'assetsUrl' => DOKAN_PLUGIN_ASSEST, 'buynowpro' => dokan_pro_buynow_url() ), 'states' => WC()->countries->get_allowed_country_states(), 'countries' => WC()->countries->get_allowed_countries(), 'current_time' => current_time( 'mysql' ), 'store_banner_dimension' => [ 'width' => $banner_width, 'height' => $banner_height, 'flex-width' => $has_flex_width, 'flex-height' => $has_flex_height ], 'ajax_loader' => DOKAN_PLUGIN_ASSEST . '/images/spinner-2x.gif', ) ); } }