prefix = 'nimap_'; global $nimap_settings; if ( ! $nimap_settings ) { $nimap_settings = get_option( 'nimap_multi_locator', array() ); } $this->default = array( 'general_enable' => 0, 'general_api_key' => '', // 'general_api_key' => 'AIzaSyBru7pKVEk6hZ1zUjBNNW19hg1l-xRYl1I', 'general_map_id' => '', 'general_api_server_key' => '', 'general_search_store_type' => 'google', // 'general_store_locator_type' => '2col', 'general_store_locator_type' => 'fullwidth', 'general_distance_unit' => 'km', // 'general_store_route' => 'google', // 'general_address_route' => 'address', 'general_address_route' => 'coordinate', 'general_show_search_locator' => 1, // 'general_store_title' => '', // 'general_store_description' => '', // 'general_store_address' => '', // 'general_store_phone' => '', // 'general_store_email' => '', // 'general_store_website' => '', // 'general_store_open_time' => '', // 'general_store_category' => '', // 'general_store_zip' => '', // 'general_store_detail' => '4187', // 'general_store_list' => '4172', // 'general_store_locator' => '4153', 'general_store_detail' => '', 'general_store_list' => '', 'general_store_locator' => '', 'general_store_js' => '', 'general_store_css' => '', 'map_load_location_init' => 'user', 'map_auto_load_stores' => 1, // 'user_load_location_init' => 'user', 'map_start_point' => '', 'map_start_latitude' => '', 'map_start_longitude' => '', 'map_zoom_level' => 12, 'map_auto_zoom_level' => 15, 'map_language' => '', 'map_locale' => 0, 'map_language_local' => 0, //satellite roadmap hybrid terrain 'map_type' => 'roadmap', // 'map_layout' => 5, 'map_style' => 'default', 'map_custom_style' => '', 'map_store_marker' => 'simple', 'map_store_marker_color' => '', 'map_store_marker_custom' => '', 'map_user_marker' => 'simple', 'map_user_marker_color' => '', 'map_user_marker_custom' => '', 'map_show_distance_radius' => 0, 'map_radius_color' => '#80FFFF', 'map_radius_border_color' => '#30BAFF', 'map_geolocation_text' => 'Use my location to find the closest store nearby', 'map_geolocation_button' => 'Use location', 'map_type_control' => 1, 'map_run_fit_bounds' => 0, 'map_control_position' => 'RIGHT_BOTTOM', 'map_gesture_handling' => 'cooperative', 'map_street_view' => 1, 'info_display_fields' => array( 'image', 'title', 'address', 'description', 'phone', 'email', 'website', 'open_time', 'category', 'zip', 'distance', 'custom', ), // 'info_custom_fields' => '', 'info_buttons' => '[["Go to store","store"],["Route","route"],["Website","website"]]', // 'info_buttons' => array( // array( 'Go to store', 'store' ), // array( 'Route', 'route' ) // ), 'info_width' => '', 'info_height' => '', 'info_image_width' => '', 'info_address_format' => 'city_state', 'list_enable' => 1, 'list_sort_by' => 'distance', 'list_no_result_title' => 'No result', 'list_count_title' => 'Stores: ', 'list_paging_enable' => 1, 'list_paging_number' => 2, // 'list_store_print_enable' => 0, 'list_display_fields' => array( 'image', 'title', 'address', 'description', 'phone', 'email', 'website', 'open_time', 'category', 'zip', 'distance', 'custom', ), // 'list_custom_fields' => '', 'list_buttons' => '[["Go to store","store"],["Route","route"],["Website","website"]]', // 'list_buttons' => array( // array( 'Go to store', 'store' ) // ), // 'list_collapse_enable' => 0, // 'list_collapse_fields' => array( // 'title', // ), 'search_enable' => 1, 'search_label' => 'Search for location', 'search_layout' => '2col', // 'search_placeholder_text' => 'Your location', // 'search_button_type' => 'text', // 'search_button_text' => 'Search', // 'search_button_icon' => '', 'search_store_enable' => 1, 'search_store_load' => 'all', 'search_store_label' => 'Search for store', // 'search_store_button_type' => 'text', 'search_store_layout' => '2col', 'search_store_by_field' => 'title', // 'search_store_placeholder_text' => 'Store name to search', // 'search_store_button_text' => 'Search Store', // 'search_store_button_icon' => '', // 'search_mix_enable' => 1, // 'search_mix_button_type' => 'text', // 'search_mix_layout' => 'fullwidth', // 'search_mix_placeholder_text' => 'Search for location and store', // 'search_mix_button_text' => 'Search', // 'search_mix_button_icon' => '', // 'filter_enable' => 1, // 'filter_type' => 'list', 'filter_distance_enable' => 1, 'filter_distance_label' => 'Distance', 'filter_category_enable' => 1, 'filter_category_label' => 'Category', 'filter_status_enable' => 1, 'filter_status_label' => 'Status', 'filter_sort_by' => 'distance', // 'filter_sort_title' => 'Sort', // 'filter_sort_fields' => array( // 'title', // ), //search store 'store_layout' => 'fullwidth', // 'store_collapse' => 0, // 'store_collapse_fields' => array( // 'title', // ), 'store_display_fields' => array( 'image', 'title', 'address', 'description', 'phone', 'email', 'website', 'open_time', 'category', 'zip', 'custom', ), 'store_buttons' => '[["Route","route"],["Website","website"]]', 'store_result_column' => 2, 'store_paging_enable' => 1, 'store_paging_number' => 20, //store details 'single_layout' => 'fullwidth', 'single_buttons' => '[["Route","route"],["Website","website"]]', // 'single_map_enable' => 1, // 'single_map_zoom' => '', 'single_display_fields' => array( 'map', 'image', 'title', 'address', 'description', 'phone', 'email', 'website', 'open_time', 'category', 'zip', 'custom', ), // 'shortcodes' => array( // '{product_title}', // '{product_stock}', // '{product_rating}', // '{product_review_count}', // '{product_reviews}', // '{product_description}', // '{product_short_description}', // '{product_additional_information}', // ), ); $this->params = apply_filters( 'nimap_multi_locator', wp_parse_args( $nimap_settings, $this->default ) ); } public function get_params( $name = "" ) { if ( ! $name ) { return $this->params; } elseif ( isset( $this->params[ $name ] ) ) { return apply_filters( 'nimap_multi_locator_' . $name, $this->params[ $name ] ); } else { return false; } } public function get_default( $name = "" ) { if ( ! $name ) { return $this->default; } elseif ( isset( $this->default[ $name ] ) ) { return apply_filters( 'nimap_multi_locator_default_' . $name, $this->default[ $name ] ); } else { return false; } } public static function get_instance( $new = false ) { if ( $new || null === self::$instance ) { self::$instance = new self(); } return self::$instance; } public function set( $name ) { if ( is_array( $name ) ) { return implode( ' ', array_map( array( $this, 'set' ), $name ) ); } else { return esc_attr( $this->prefix . $name ); } } public function get_field( $field ) { return self::get_params( $field ); } public function set_field( $name, $multi = false ) { return $multi ? "nimap_params[$name][]" : "nimap_params[$name]"; } public function get_page_locator( $name = "" ) { if ( ! $name ) { return $this->params; } elseif ( isset( $this->params[ $name ] ) ) { switch ( $name ) { case 'general_store_detail': $mp_page_id = empty( $this->params[ $name ] ) ? get_option( 'nimap_init_locator_detail_id' ) : $this->params[ $name ]; break; case 'general_store_list': $mp_page_id = empty( $this->params[ $name ] ) ? get_option( 'nimap_init_locator_list_id' ) : $this->params[ $name ]; break; default: $mp_page_id = empty( $this->params[ $name ] ) ? get_option( 'nimap_init_locator_page_id' ) : $this->params[ $name ]; } return apply_filters( 'nimap_multi_locator_' . $name, $mp_page_id ); } else { return false; } } public function text_option( $field_name, $label = '', $placeholder = '', $explain = '', $multi = false, $multilingual = '' ) { $set_name = $this->set_field( $field_name, $multi ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); ?>
get_default_language(); $languages = $langs = icl_get_languages( 'skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str' ); if ( count( $languages ) ) { foreach ( $languages as $key => $language ) { if ( $key == $default_lang ) { continue; } $field_name_mlg = $field_name . '_' . $key; $class_mlg = 'nimap-' . str_replace( '_', '-', $field_name_mlg ); $set_name_mlg = $this->set_field( $field_name_mlg, $multi ); ?>

set_field( $field_name_mlg, $multi ); ?>

' . wp_kses_post( $explain ) . '

' ?> set_field( $field_name, $multi ); $set_unit = $this->set_field( $field_name . '_unit', $multi ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); $col = ! empty( $units ) ? 11 : 12; ?> ' ?>
min="" max="" name="" value="" class="">
"; foreach ( $units as $unit ) { $selected = self::get_field( $field_name . '_unit' ) == $unit ? 'selected' : ''; echo ""; } echo ""; } elseif ( ! empty( $units ) ) { echo "
" . esc_html( $units ) . "
"; } ?>
set_field( $field_name, $multi ); $set_unit = $this->set_field( $field_name . '_unit', $multi ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); $col = ! empty( $units ) ? 11 : 12; ?> ' ?>
name="" value="" class="">
set_field( $field_name, $multi ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); ?>
Loading
set_field( $field_name, $multi ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); $saved_data = self::get_field( $field_name ); ?> ' ?>
set_field( $field_name ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); ?> ' ?>
value="1" name="" class="">
set_field( $field_name ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); ?> ' ?>
' . esc_html( $explain ) . '

' ?>
set_field( $field_name, false ); ?>
$o_val ) { if ( ! is_array( $o_val ) || empty( $o_val ) ) { continue; } ?>
set_field( $field_name ); // $class = 'nimap-' . str_replace( '_', '-', $field_name ); ?> ' ?>
set_field( $field_name, $multi ); $class = 'nimap-' . str_replace( '_', '-', $field_name ); ?>
get_default_language(); $languages = $langs = icl_get_languages( 'skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str' ); if ( count( $languages ) ) { foreach ( $languages as $key => $language ) { if ( $key == $default_lang ) { continue; } $field_name_mlg = $field_name . '_' . $key; $class_mlg = 'nimap-' . str_replace( '_', '-', $field_name_mlg ); $set_name_mlg = $this->set_field( $field_name_mlg, $multi ); ?>

set_field( $field_name_mlg, $multi ); ?>

' . esc_html( $explain ) . '

' ?> $handle ) { if ( ! $handle || empty( $srcs[ $i ] ) ) { continue; } $suffix_t = ! empty( $is_suffix[ $i ] ) ? '.min' : $suffix; $action( $handle, NIMAP_CSS . $srcs[ $i ] . $suffix_t . '.css', ! empty( $des[ $i ] ) ? $des[ $i ] : array(), NIMAP_VERSION ); } } public static function enqueue_script( $handles = array(), $srcs = array(), $is_suffix = array(), $des = array(), $type = 'enqueue', $in_footer = false ) { if ( empty( $handles ) || empty( $srcs ) ) { return; } $action = $type === 'register' ? 'wp_register_script' : 'wp_enqueue_script'; $suffix = WP_DEBUG ? '' : '.min'; foreach ( $handles as $i => $handle ) { if ( ! $handle || empty( $srcs[ $i ] ) ) { continue; } $suffix_t = ! empty( $is_suffix[ $i ] ) ? '.min' : $suffix; $action( $handle, NIMAP_JS . $srcs[ $i ] . $suffix_t . '.js', ! empty( $des[ $i ] ) ? $des[ $i ] : array( 'jquery' ), NIMAP_VERSION, $in_footer ); } } }