View difference between Paste ID: KpfD0uYE and u711ee75
SHOW: | | - or go back to the newest paste.
1
add_filter('wcfma_country_state_list', function($wcfma_country_state_list) {
2-
    if(!isset($wcfma_country_state_list['MX'])) {
2+
    if(!isset($wcfma_country_state_list['MY'])) {
3-
        $mx_state_list = array(
3+
        $my_state_list = array(
4-
            'MX' => array(
4+
            'MY' => array(
5-
                'label' => 'Mexico',
5+
                'label' => 'Malaysia',
6
                'state' => array(
7-
                    'MX-AGU' => 'Aguascalientes',
7+
                    "MY-01" => "Johor",
8-
                    'MX-BCN' => 'Baja California',
8+
                    "MY-02" => "Kedah",
9-
                    'MX-BCS' => 'Baja California Sur',
9+
                    "MY-03" => "Kelantan",
10-
                    'MX-CAM' => 'Campeche',
10+
                    "MY-04" => "Melaka",
11-
                    'MX-CHP' => 'Chiapas',
11+
                    "MY-05" => "Negeri Sembilan",
12-
                    'MX-CHH' => 'Chihuahua',
12+
                    "MY-06" => "Pahang",
13-
                    'MX-COA' => 'Coahuila',
13+
                    "MY-07" => "Pulau Pinang",
14-
                    'MX-COL' => 'Colima',
14+
                    "MY-08" => "Perak",
15-
                    'MX-CMX' => 'Mexico City',
15+
                    "MY-09" => "Perlis",
16-
                    'MX-DUR' => 'Durango',
16+
                    "MY-10" => "Selangor",
17-
                    'MX-GUA' => 'Guanajuato',
17+
                    "MY-11" => "Terengganu",
18-
                    'MX-GRO' => 'Guerrero',
18+
                    "MY-12" => "Sabah",
19-
                    'MX-HID' => 'Hidalgo',
19+
                    "MY-13" => "Sarawak",
20-
                    'MX-JAL' => 'Jalisco',
20+
                    "MY-14" => "Kuala Lumpur",
21-
                    'MX-MEX' => 'México',
21+
                    "MY-15" => "Labuan",
22-
                    'MX-MIC' => 'Michoacán',
22+
                    "MY-16" => "Putrajaya",
23-
                    'MX-MOR' => 'Morelos',
23+
24-
                    'MX-NAY' => 'Nayarit',
24+
25-
                    'MX-NLE' => 'Nuevo León',
25+
26-
                    'MX-OAX' => 'Oaxaca',
26+
        return array_slice( $wcfma_country_state_list, 0, 1, true ) + $my_state_list + array_slice( $wcfma_country_state_list, 1, count( $wcfma_country_state_list ) - 1, true );
27-
                    'MX-PUE' => 'Puebla',
27+
28-
                    'MX-QUE' => 'Querétaro',
28+
29-
                    'MX-ROO' => 'Quintana Roo',
29+
30-
                    'MX-SLP' => 'San Luis Potosí',
30+
31-
                    'MX-SIN' => 'Sinaloa',
31+
32-
                    'MX-SON' => 'Sonora',
32+
33-
                    'MX-TAB' => 'Tabasco',
33+
34-
                    'MX-TAM' => 'Tamaulipas',
34+
35-
                    'MX-TLA' => 'Tlaxcala',
35+
36-
                    'MX-VER' => 'Veracruz',
36+
37-
                    'MX-YUC' => 'Yucatán',
37+
38-
                    'MX-ZAC' => 'Zacatecas',
38+
39
	    	if ( $is_wcfm_analytics_enable = is_wcfm_analytics() ) {
40
	    		if ( $wcfm_is_allow_analytics = apply_filters( 'wcfm_is_allow_analytics', true ) ) {
41
						load_jvectormap_lib();
42-
        return array_slice( $wcfma_country_state_list, 0, 1, true ) + $mx_state_list + array_slice( $wcfma_country_state_list, 1, count( $wcfma_country_state_list ) - 1, true );
42+
43
					}
44
				}
45
	  	break;
46
	  	case 'wcfm-analytics':
47
	  		load_jvectormap_lib();
48
            $WCFM->library->load_select2_lib();
49
            $WCFM->library->load_chartjs_lib();
50
            $WCFM->library->load_daterangepicker_lib();
51
	    	wp_enqueue_script( 'wcfma_analytics_js', $WCFMa->library->js_lib_url . 'wcfma-script-analytics.js', array('jquery'), $WCFMa->version, true );
52
	    	wp_enqueue_script( 'wcfma_analytics_dashboard_js', $WCFMa->library->js_lib_url . 'wcfma-script-analytics-dashboard.js', array('jquery'), $WCFMa->version, true );
53
      break;
54
      
55-
	    	if ( is_wcfm_analytics() ) {
55+
56-
	    		if ( apply_filters( 'wcfm_is_allow_analytics', true ) ) {
56+
57
58
function load_jvectormap_lib(){
59
    global $WCFMa;
60
    wp_enqueue_script( 'jquery-jvectormap_js', $WCFMa->plugin_url . 'includes/jvectormap/jquery-jvectormap-2.0.3.min.js', array('jquery'), $WCFMa->version, true );
61
    $user_id = apply_filters( 'wcfm_current_vendor_id', get_current_user_id() );
62
    $wcfm_analytics_region = get_user_meta( $user_id, 'wcfm_analytics_region', true );
63
    if( !$wcfm_analytics_region ) $wcfm_analytics_region = 'world';
64
    $wcfm_analytics_region = strtolower( $wcfm_analytics_region );
65
    $path = $WCFMa->plugin_url . 'includes/jvectormap/';
66
    if($wcfm_analytics_region=='my') {
67
        $path = get_stylesheet_directory_uri() . '/js/';
68
    }
69
    wp_enqueue_script( 'jquery-jvectormap-world_js', $path.$wcfm_analytics_region.'-mill.js', array('jquery', 'jquery-jvectormap_js'), $WCFMa->version, true );
70
    wp_enqueue_style( 'wcfm_timepicker_css',  $WCFMa->plugin_url . 'includes/jvectormap/jquery-jvectormap-2.0.3.css', array(), $WCFMa->version );
71
}
72
73
add_filter('get_wcfma_map_name_list', function($list) {
74
    $list['my'] = 'my_regions';
75
    return $list;
76
});