Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wcfma_country_state_list', function($wcfma_country_state_list) {
- if(!isset($wcfma_country_state_list['BG'])) {
- $bulgaria_state_list = array(
- 'BG' => array(
- 'label' => 'Bulgaria',
- 'state' => array(
- 'BG342' => "Sliven",
- 'BG422' => "Haskovo",
- 'BG222' => "Stara Zagora",
- 'BG224' => "Pazardzhik",
- 'BG421' => "Plovdiv",
- 'BG225' => "Smolyan",
- 'BG425' => "Kardzhali",
- 'BG411' => "Sofia City",
- 'BG412' => "Sofia",
- 'BG414' => "Pernik",
- 'BG124' => "Gabrovo",
- 'BG122' => "Lovech",
- 'BG314' => "Pleven",
- 'BG321' => "Veliko Tarnovo",
- 'BG112' => "Montana",
- 'BG113' => "Vratsa",
- 'BG215' => "Kyustendil",
- 'BG311' => "Vidin",
- 'BG231' => "Burgas",
- 'BG233' => "Yambol",
- 'BG324' => "Razgrad",
- 'BG334' => "Targovishte",
- 'BG133' => "Shumen",
- 'BG332' => "Dobrich",
- 'BG131' => "Varna",
- 'BG136' => "Silistra",
- 'BG323' => "Ruse",
- 'BG413' => "Blagoevgrad",
- ),
- ),
- );
- return array_slice( $wcfma_country_state_list, 0, 1, true ) + $bulgaria_state_list + array_slice( $wcfma_country_state_list, 1, count( $wcfma_country_state_list ) - 1, true );
- }
- return $wcfma_country_state_list;
- });
- add_action( 'wcfm_load_scripts', 'load_script_enhanced_region', 9 );
- add_action( 'after_wcfm_load_scripts', 'load_script_enhanced_region', 9 );
- function load_script_enhanced_region($end_point) {
- global $WCFM, $WCFMa;
- remove_action( current_filter(), array($WCFMa->library, 'load_scripts') );
- switch( $end_point ) {
- case 'wcfm-dashboard':
- if ( $is_wcfm_analytics_enable = is_wcfm_analytics() ) {
- if ( $wcfm_is_allow_analytics = apply_filters( 'wcfm_is_allow_analytics', true ) ) {
- load_jvectormap_lib();
- wp_enqueue_script( 'wcfma_analytics_js', $WCFMa->library->js_lib_url . 'wcfma-script-analytics-dashboard.js', array('jquery'), $WCFMa->version, true );
- }
- }
- break;
- case 'wcfm-analytics':
- load_jvectormap_lib();
- $WCFM->library->load_select2_lib();
- $WCFM->library->load_chartjs_lib();
- $WCFM->library->load_daterangepicker_lib();
- wp_enqueue_script( 'wcfma_analytics_js', $WCFMa->library->js_lib_url . 'wcfma-script-analytics.js', array('jquery'), $WCFMa->version, true );
- wp_enqueue_script( 'wcfma_analytics_dashboard_js', $WCFMa->library->js_lib_url . 'wcfma-script-analytics-dashboard.js', array('jquery'), $WCFMa->version, true );
- break;
- }
- }
- function load_jvectormap_lib(){
- global $WCFMa;
- wp_enqueue_script( 'jquery-jvectormap_js', $WCFMa->plugin_url . 'includes/jvectormap/jquery-jvectormap-2.0.3.min.js', array('jquery'), $WCFMa->version, true );
- $user_id = apply_filters( 'wcfm_current_vendor_id', get_current_user_id() );
- $wcfm_analytics_region = get_user_meta( $user_id, 'wcfm_analytics_region', true );
- if( !$wcfm_analytics_region ) $wcfm_analytics_region = 'world';
- $wcfm_analytics_region = strtolower( $wcfm_analytics_region );
- $path = $WCFMa->plugin_url . 'includes/jvectormap/';
- if($wcfm_analytics_region=='bg') {
- $path = get_stylesheet_directory_uri() . '/js/';
- }
- wp_enqueue_script( 'jquery-jvectormap-world_js', $path.$wcfm_analytics_region.'-mill.js', array('jquery', 'jquery-jvectormap_js'), $WCFMa->version, true );
- wp_enqueue_style( 'wcfm_timepicker_css', $WCFMa->plugin_url . 'includes/jvectormap/jquery-jvectormap-2.0.3.css', array(), $WCFMa->version );
- }
- add_filter('get_wcfma_map_name_list', function($list) {
- $list['bg'] = 'bg_regions';
- return $list;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement