@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function geodir_core_dequeue_script() |
24 | 24 | { |
25 | - wp_dequeue_script('flexslider'); |
|
25 | + wp_dequeue_script('flexslider'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100); |
@@ -35,168 +35,168 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function geodir_templates_scripts() |
37 | 37 | { |
38 | - $is_detail_page = false; |
|
39 | - $geodir_map_name = geodir_map_name(); |
|
38 | + $is_detail_page = false; |
|
39 | + $geodir_map_name = geodir_map_name(); |
|
40 | 40 | |
41 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | - $is_detail_page = true; |
|
43 | - } |
|
44 | - |
|
45 | - wp_enqueue_script('jquery'); |
|
46 | - |
|
47 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | - wp_enqueue_script('geodirectory-script'); |
|
41 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | + $is_detail_page = true; |
|
43 | + } |
|
49 | 44 | |
50 | - $geodir_vars_data = array( |
|
51 | - 'siteurl' => get_option('siteurl'), |
|
52 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
53 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
55 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | - 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
57 | - ); |
|
45 | + wp_enqueue_script('jquery'); |
|
46 | + |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | + wp_enqueue_script('geodirectory-script'); |
|
49 | + |
|
50 | + $geodir_vars_data = array( |
|
51 | + 'siteurl' => get_option('siteurl'), |
|
52 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
53 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
55 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | + 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
57 | + ); |
|
58 | + |
|
59 | + /** |
|
60 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
61 | + * |
|
62 | + * This is used by addons to add JS translatable variables. |
|
63 | + * |
|
64 | + * @since 1.4.4 |
|
65 | + * @param array $geodir_vars_data { |
|
66 | + * geodir var data used by addons to add JS translatable variables. |
|
67 | + * |
|
68 | + * @type string $siteurl Site url. |
|
69 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
70 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
71 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
72 | + * @type int $is_rtl Checks if current locale is RTL. |
|
73 | + * |
|
74 | + * } |
|
75 | + */ |
|
76 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | + |
|
78 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
79 | + |
|
80 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
82 | + |
|
83 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
85 | + |
|
86 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + if ($is_detail_page) { |
|
88 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
89 | + } |
|
58 | 90 | |
59 | - /** |
|
60 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
61 | - * |
|
62 | - * This is used by addons to add JS translatable variables. |
|
63 | - * |
|
64 | - * @since 1.4.4 |
|
65 | - * @param array $geodir_vars_data { |
|
66 | - * geodir var data used by addons to add JS translatable variables. |
|
67 | - * |
|
68 | - * @type string $siteurl Site url. |
|
69 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
70 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
71 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
72 | - * @type int $is_rtl Checks if current locale is RTL. |
|
73 | - * |
|
74 | - * } |
|
75 | - */ |
|
76 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | - |
|
78 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
79 | - |
|
80 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
82 | - |
|
83 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
85 | - |
|
86 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | - if ($is_detail_page) { |
|
88 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
89 | - } |
|
90 | - |
|
91 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
92 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
94 | - /** |
|
95 | - * Filter the variables that are added to the end of the google maps script call. |
|
96 | - * |
|
97 | - * This i used to change things like google maps language etc. |
|
98 | - * |
|
99 | - * @since 1.0.0 |
|
100 | - * @param string $var The string to filter, default is empty string. |
|
101 | - */ |
|
102 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
103 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | - } |
|
91 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
92 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
94 | + /** |
|
95 | + * Filter the variables that are added to the end of the google maps script call. |
|
96 | + * |
|
97 | + * This i used to change things like google maps language etc. |
|
98 | + * |
|
99 | + * @since 1.0.0 |
|
100 | + * @param string $var The string to filter, default is empty string. |
|
101 | + */ |
|
102 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | + } |
|
105 | 105 | |
106 | - if ($geodir_map_name == 'osm') { |
|
107 | - // Leaflet OpenStreetMap |
|
108 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
106 | + if ($geodir_map_name == 'osm') { |
|
107 | + // Leaflet OpenStreetMap |
|
108 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
110 | 110 | |
111 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
111 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
113 | 113 | |
114 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
114 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
116 | 116 | |
117 | - if ($is_detail_page) { |
|
118 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
117 | + if ($is_detail_page) { |
|
118 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
123 | - } |
|
124 | - } |
|
125 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
121 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
123 | + } |
|
124 | + } |
|
125 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
126 | 126 | |
127 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
128 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
129 | - |
|
130 | - |
|
131 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | - wp_enqueue_script('chosen'); |
|
133 | - |
|
134 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
136 | - |
|
137 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | - |
|
139 | - if (is_page() && geodir_is_page('add-listing')) { |
|
140 | - // SCRIPT FOR UPLOAD |
|
141 | - wp_enqueue_script('plupload-all'); |
|
142 | - wp_enqueue_script('jquery-ui-sortable'); |
|
143 | - |
|
144 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
145 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
146 | - // SCRIPT FOR UPLOAD END |
|
147 | - |
|
148 | - // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
149 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
150 | - $ajax_url = admin_url('admin-ajax.php'); |
|
151 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
152 | - $ajax_url = admin_url('admin-ajax.php'); |
|
153 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
154 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
155 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
156 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
157 | - } else { |
|
158 | - $ajax_url = admin_url('admin-ajax.php'); |
|
159 | - } |
|
127 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
128 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
129 | + |
|
130 | + |
|
131 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | + wp_enqueue_script('chosen'); |
|
133 | + |
|
134 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
136 | + |
|
137 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | + |
|
139 | + if (is_page() && geodir_is_page('add-listing')) { |
|
140 | + // SCRIPT FOR UPLOAD |
|
141 | + wp_enqueue_script('plupload-all'); |
|
142 | + wp_enqueue_script('jquery-ui-sortable'); |
|
143 | + |
|
144 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
145 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
146 | + // SCRIPT FOR UPLOAD END |
|
147 | + |
|
148 | + // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
149 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
150 | + $ajax_url = admin_url('admin-ajax.php'); |
|
151 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
152 | + $ajax_url = admin_url('admin-ajax.php'); |
|
153 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
154 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
155 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
156 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
157 | + } else { |
|
158 | + $ajax_url = admin_url('admin-ajax.php'); |
|
159 | + } |
|
160 | 160 | |
161 | - // place js config array for plupload |
|
162 | - $plupload_init = array( |
|
163 | - 'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', |
|
164 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
165 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
166 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
167 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
168 | - 'multiple_queues' => true, |
|
169 | - 'max_file_size' => geodir_max_upload_size(), |
|
170 | - 'url' => $ajax_url, |
|
171 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
172 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
173 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
174 | - 'multipart' => true, |
|
175 | - 'urlstream_upload' => true, |
|
176 | - 'multi_selection' => false, // will be added per uploader |
|
177 | - // additional post data to send to our ajax hook |
|
178 | - 'multipart_params' => array( |
|
179 | - '_ajax_nonce' => "", // will be added per uploader |
|
180 | - 'action' => 'plupload_action', // the ajax action name |
|
181 | - 'imgid' => 0 // will be added per uploader |
|
182 | - ) |
|
183 | - ); |
|
184 | - $base_plupload_config = json_encode($plupload_init); |
|
185 | - |
|
186 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
187 | - 'upload_img_size' => geodir_max_upload_size()); |
|
188 | - |
|
189 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
190 | - |
|
191 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | - } // End if for add place page |
|
193 | - |
|
194 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | - if ($is_detail_page) { |
|
161 | + // place js config array for plupload |
|
162 | + $plupload_init = array( |
|
163 | + 'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4', |
|
164 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
165 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
166 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
167 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
168 | + 'multiple_queues' => true, |
|
169 | + 'max_file_size' => geodir_max_upload_size(), |
|
170 | + 'url' => $ajax_url, |
|
171 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
172 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
173 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
174 | + 'multipart' => true, |
|
175 | + 'urlstream_upload' => true, |
|
176 | + 'multi_selection' => false, // will be added per uploader |
|
177 | + // additional post data to send to our ajax hook |
|
178 | + 'multipart_params' => array( |
|
179 | + '_ajax_nonce' => "", // will be added per uploader |
|
180 | + 'action' => 'plupload_action', // the ajax action name |
|
181 | + 'imgid' => 0 // will be added per uploader |
|
182 | + ) |
|
183 | + ); |
|
184 | + $base_plupload_config = json_encode($plupload_init); |
|
185 | + |
|
186 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
187 | + 'upload_img_size' => geodir_max_upload_size()); |
|
188 | + |
|
189 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
190 | + |
|
191 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | + } // End if for add place page |
|
193 | + |
|
194 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | + if ($is_detail_page) { |
|
196 | 196 | wp_enqueue_script('geodirectory-post-custom-js'); |
197 | 197 | } |
198 | 198 | |
199 | - // font awesome rating script |
|
199 | + // font awesome rating script |
|
200 | 200 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
201 | 201 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
202 | 202 | wp_enqueue_script('geodir-barrating-js'); |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | wp_enqueue_script('geodir-jRating-js'); |
206 | 206 | } |
207 | 207 | |
208 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | - wp_enqueue_script('geodir-on-document-load'); |
|
208 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | + wp_enqueue_script('geodir-on-document-load'); |
|
210 | 210 | |
211 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | - wp_enqueue_script('google-geometa'); |
|
211 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | + wp_enqueue_script('google-geometa'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_header_scripts() |
225 | 225 | { |
226 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
227 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
226 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
227 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | function geodir_footer_scripts() |
241 | 241 | { |
242 | 242 | |
243 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
243 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
244 | 244 | |
245 | 245 | <script> |
246 | 246 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | </script> |
256 | 256 | |
257 | 257 | <?php |
258 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
259 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
260 | - } |
|
258 | + }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
259 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
260 | + } |
|
261 | 261 | |
262 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
262 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
263 | 263 | |
264 | - /* |
|
264 | + /* |
|
265 | 265 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
266 | 266 | * |
267 | 267 | * Flexbox wont wrap on ios for search form items |
268 | 268 | */ |
269 | - if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
270 | - echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
271 | - } |
|
269 | + if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
270 | + echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
271 | + } |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | */ |
283 | 283 | function geodir_add_async_forscript($url) |
284 | 284 | { |
285 | - if (strpos($url, '#asyncload')===false) |
|
286 | - return $url; |
|
287 | - else if (is_admin()) |
|
288 | - return str_replace('#asyncload', '', $url); |
|
289 | - else |
|
290 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
285 | + if (strpos($url, '#asyncload')===false) |
|
286 | + return $url; |
|
287 | + else if (is_admin()) |
|
288 | + return str_replace('#asyncload', '', $url); |
|
289 | + else |
|
290 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
291 | 291 | } |
292 | 292 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
293 | 293 | |
@@ -300,17 +300,17 @@ discard block |
||
300 | 300 | function geodir_templates_styles() |
301 | 301 | { |
302 | 302 | |
303 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
304 | - wp_enqueue_style('geodir-core-scss'); |
|
305 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
303 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
304 | + wp_enqueue_style('geodir-core-scss'); |
|
305 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
306 | 306 | |
307 | - if(is_rtl()){ |
|
308 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
309 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
310 | - } |
|
307 | + if(is_rtl()){ |
|
308 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
309 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
310 | + } |
|
311 | 311 | |
312 | - wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
313 | - wp_enqueue_style('font-awesome'); |
|
312 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
313 | + wp_enqueue_style('font-awesome'); |
|
314 | 314 | |
315 | 315 | |
316 | 316 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | function geodir_get_sidebar() |
326 | 326 | { |
327 | - get_sidebar('geodirectory'); |
|
327 | + get_sidebar('geodirectory'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -343,122 +343,122 @@ discard block |
||
343 | 343 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
344 | 344 | */ |
345 | 345 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
346 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
346 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
347 | 347 | |
348 | - if (empty($prelabel)) { |
|
349 | - $prelabel = '<strong>«</strong>'; |
|
350 | - } |
|
348 | + if (empty($prelabel)) { |
|
349 | + $prelabel = '<strong>«</strong>'; |
|
350 | + } |
|
351 | 351 | |
352 | - if (empty($nxtlabel)) { |
|
353 | - $nxtlabel = '<strong>»</strong>'; |
|
354 | - } |
|
352 | + if (empty($nxtlabel)) { |
|
353 | + $nxtlabel = '<strong>»</strong>'; |
|
354 | + } |
|
355 | 355 | |
356 | - $half_pages_to_show = round($pages_to_show / 2); |
|
356 | + $half_pages_to_show = round($pages_to_show / 2); |
|
357 | 357 | |
358 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
359 | - return; |
|
358 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
359 | + return; |
|
360 | 360 | |
361 | - if (!is_single()) { |
|
362 | - if (function_exists('geodir_location_geo_home_link')) { |
|
363 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
364 | - } |
|
365 | - $numposts = $wp_query->found_posts; |
|
361 | + if (!is_single()) { |
|
362 | + if (function_exists('geodir_location_geo_home_link')) { |
|
363 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
364 | + } |
|
365 | + $numposts = $wp_query->found_posts; |
|
366 | 366 | |
367 | - $max_page = ceil($numposts / $posts_per_page); |
|
367 | + $max_page = ceil($numposts / $posts_per_page); |
|
368 | 368 | |
369 | - if (empty($paged)) { |
|
370 | - $paged = 1; |
|
371 | - } |
|
369 | + if (empty($paged)) { |
|
370 | + $paged = 1; |
|
371 | + } |
|
372 | 372 | |
373 | - $post_type = geodir_get_current_posttype(); |
|
374 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
375 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
376 | - $term = array(); |
|
373 | + $post_type = geodir_get_current_posttype(); |
|
374 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
375 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
376 | + $term = array(); |
|
377 | 377 | |
378 | - if (is_tax()) { |
|
379 | - $term_id = get_queried_object_id(); |
|
380 | - $taxonomy = get_query_var('taxonomy'); |
|
378 | + if (is_tax()) { |
|
379 | + $term_id = get_queried_object_id(); |
|
380 | + $taxonomy = get_query_var('taxonomy'); |
|
381 | 381 | |
382 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
383 | - $term = get_term($term_id, $post_type . 'category'); |
|
384 | - } |
|
385 | - } |
|
382 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
383 | + $term = get_term($term_id, $post_type . 'category'); |
|
384 | + } |
|
385 | + } |
|
386 | 386 | |
387 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
388 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
387 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
388 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
389 | 389 | |
390 | - if (!is_array($taxonomy_search)) { |
|
391 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
392 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
394 | - } |
|
395 | - } |
|
390 | + if (!is_array($taxonomy_search)) { |
|
391 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
392 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
394 | + } |
|
395 | + } |
|
396 | 396 | |
397 | - if (!empty($term) && !is_wp_error($term)) { |
|
398 | - $listing_type_name = $term->name; |
|
399 | - } |
|
400 | - } |
|
397 | + if (!empty($term) && !is_wp_error($term)) { |
|
398 | + $listing_type_name = $term->name; |
|
399 | + } |
|
400 | + } |
|
401 | 401 | |
402 | - if ($max_page > 1 || $always_show) { |
|
403 | - // Extra pagination info |
|
404 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
405 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
406 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
402 | + if ($max_page > 1 || $always_show) { |
|
403 | + // Extra pagination info |
|
404 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
405 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
406 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
407 | 407 | |
408 | - if ($geodir_pagination_more_info != '') { |
|
409 | - if ($listing_type_name) { |
|
410 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
411 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
412 | - } else { |
|
413 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
414 | - } |
|
415 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
416 | - /** |
|
417 | - * Adds an extra pagination info above/under pagination. |
|
418 | - * |
|
419 | - * @since 1.5.9 |
|
420 | - * |
|
421 | - * @param string $pagination_info Extra pagination info content. |
|
422 | - * @param string $listing_type_name Listing results type. |
|
423 | - * @param string $start_no First result number. |
|
424 | - * @param string $end_no Last result number. |
|
425 | - * @param string $numposts Total number of listings. |
|
426 | - * @param string $post_type The post type. |
|
427 | - */ |
|
428 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
408 | + if ($geodir_pagination_more_info != '') { |
|
409 | + if ($listing_type_name) { |
|
410 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
411 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
412 | + } else { |
|
413 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
414 | + } |
|
415 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
416 | + /** |
|
417 | + * Adds an extra pagination info above/under pagination. |
|
418 | + * |
|
419 | + * @since 1.5.9 |
|
420 | + * |
|
421 | + * @param string $pagination_info Extra pagination info content. |
|
422 | + * @param string $listing_type_name Listing results type. |
|
423 | + * @param string $start_no First result number. |
|
424 | + * @param string $end_no Last result number. |
|
425 | + * @param string $numposts Total number of listings. |
|
426 | + * @param string $post_type The post type. |
|
427 | + */ |
|
428 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
429 | 429 | |
430 | - if ($geodir_pagination_more_info == 'before') { |
|
431 | - $before = $before . $pagination_info; |
|
432 | - } else if ($geodir_pagination_more_info == 'after') { |
|
433 | - $after = $pagination_info . $after; |
|
434 | - } |
|
435 | - } |
|
430 | + if ($geodir_pagination_more_info == 'before') { |
|
431 | + $before = $before . $pagination_info; |
|
432 | + } else if ($geodir_pagination_more_info == 'after') { |
|
433 | + $after = $pagination_info . $after; |
|
434 | + } |
|
435 | + } |
|
436 | 436 | |
437 | - echo "$before <div class='Navi gd-navi'>"; |
|
438 | - if ($paged >= ($pages_to_show - 1)) { |
|
439 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
440 | - } |
|
441 | - previous_posts_link($prelabel); |
|
442 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
443 | - if ($i >= 1 && $i <= $max_page) { |
|
444 | - if ($i == $paged) { |
|
445 | - echo "<strong class='on'>$i</strong>"; |
|
446 | - } else { |
|
447 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
448 | - } |
|
449 | - } |
|
450 | - } |
|
451 | - next_posts_link($nxtlabel, $max_page); |
|
452 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
453 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
454 | - } |
|
455 | - echo "</div> $after"; |
|
456 | - } |
|
437 | + echo "$before <div class='Navi gd-navi'>"; |
|
438 | + if ($paged >= ($pages_to_show - 1)) { |
|
439 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
440 | + } |
|
441 | + previous_posts_link($prelabel); |
|
442 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
443 | + if ($i >= 1 && $i <= $max_page) { |
|
444 | + if ($i == $paged) { |
|
445 | + echo "<strong class='on'>$i</strong>"; |
|
446 | + } else { |
|
447 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
448 | + } |
|
449 | + } |
|
450 | + } |
|
451 | + next_posts_link($nxtlabel, $max_page); |
|
452 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
453 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
454 | + } |
|
455 | + echo "</div> $after"; |
|
456 | + } |
|
457 | 457 | |
458 | - if (function_exists('geodir_location_geo_home_link')) { |
|
459 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
460 | - } |
|
461 | - } |
|
458 | + if (function_exists('geodir_location_geo_home_link')) { |
|
459 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
460 | + } |
|
461 | + } |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -469,20 +469,20 @@ discard block |
||
469 | 469 | */ |
470 | 470 | function geodir_listingsearch_scripts() |
471 | 471 | { |
472 | - if (get_option('gd_search_dist') != '') { |
|
473 | - $dist = get_option('gd_search_dist'); |
|
474 | - } else { |
|
475 | - $dist = 500; |
|
476 | - } |
|
477 | - $dist_dif = 1000; |
|
478 | - |
|
479 | - if ($dist <= 5000) $dist_dif = 500; |
|
480 | - if ($dist <= 1000) $dist_dif = 100; |
|
481 | - if ($dist <= 500) $dist_dif = 50; |
|
482 | - if ($dist <= 100) $dist_dif = 10; |
|
483 | - if ($dist <= 50) $dist_dif = 5; |
|
484 | - |
|
485 | - ?> |
|
472 | + if (get_option('gd_search_dist') != '') { |
|
473 | + $dist = get_option('gd_search_dist'); |
|
474 | + } else { |
|
475 | + $dist = 500; |
|
476 | + } |
|
477 | + $dist_dif = 1000; |
|
478 | + |
|
479 | + if ($dist <= 5000) $dist_dif = 500; |
|
480 | + if ($dist <= 1000) $dist_dif = 100; |
|
481 | + if ($dist <= 500) $dist_dif = 50; |
|
482 | + if ($dist <= 100) $dist_dif = 10; |
|
483 | + if ($dist <= 50) $dist_dif = 5; |
|
484 | + |
|
485 | + ?> |
|
486 | 486 | <script type="text/javascript"> |
487 | 487 | |
488 | 488 | jQuery(function ($) { |
@@ -540,20 +540,20 @@ discard block |
||
540 | 540 | * @package GeoDirectory |
541 | 541 | */ |
542 | 542 | function geodir_add_sharelocation_scripts() { |
543 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
544 | - if (get_option('geodir_search_field_default_text')) |
|
545 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
543 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
544 | + if (get_option('geodir_search_field_default_text')) |
|
545 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
546 | 546 | |
547 | - $default_near_text = NEAR_TEXT; |
|
548 | - if (get_option('geodir_near_field_default_text')) |
|
549 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
547 | + $default_near_text = NEAR_TEXT; |
|
548 | + if (get_option('geodir_near_field_default_text')) |
|
549 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
550 | 550 | |
551 | - $search_location = geodir_get_default_location(); |
|
551 | + $search_location = geodir_get_default_location(); |
|
552 | 552 | |
553 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
554 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
555 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
556 | - ?> |
|
553 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
554 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
555 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
556 | + ?> |
|
557 | 557 | <script type="text/javascript"> |
558 | 558 | var default_location = '<?php echo $city ;?>'; |
559 | 559 | var latlng; |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | initialise2(); |
635 | 635 | } else { |
636 | 636 | <?php |
637 | - $near_add = get_option('geodir_search_near_addition'); |
|
638 | - /** |
|
639 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
640 | - * |
|
641 | - * @since 1.0.0 |
|
642 | - */ |
|
643 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
644 | - ?> |
|
637 | + $near_add = get_option('geodir_search_near_addition'); |
|
638 | + /** |
|
639 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
640 | + * |
|
641 | + * @since 1.0.0 |
|
642 | + */ |
|
643 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
644 | + ?> |
|
645 | 645 | if (window.gdMaps === 'google') { |
646 | 646 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
647 | 647 | function (results, status) { |
@@ -744,30 +744,30 @@ discard block |
||
744 | 744 | */ |
745 | 745 | function geodir_show_badges_on_image($which, $post, $link) |
746 | 746 | { |
747 | - $return = ''; |
|
748 | - switch ($which) { |
|
749 | - case 'featured': |
|
750 | - /** |
|
751 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
752 | - * |
|
753 | - * @since 1.0.0 |
|
754 | - * @param object $post The post object. |
|
755 | - * @param string $link The link to the post. |
|
756 | - */ |
|
757 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
758 | - break; |
|
759 | - case 'new' : |
|
760 | - /** |
|
761 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
762 | - * |
|
763 | - * @since 1.0.0 |
|
764 | - * @param object $post The post object. |
|
765 | - * @param string $link The link to the post. |
|
766 | - */ |
|
767 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
768 | - break; |
|
769 | - |
|
770 | - } |
|
747 | + $return = ''; |
|
748 | + switch ($which) { |
|
749 | + case 'featured': |
|
750 | + /** |
|
751 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
752 | + * |
|
753 | + * @since 1.0.0 |
|
754 | + * @param object $post The post object. |
|
755 | + * @param string $link The link to the post. |
|
756 | + */ |
|
757 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
758 | + break; |
|
759 | + case 'new' : |
|
760 | + /** |
|
761 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
762 | + * |
|
763 | + * @since 1.0.0 |
|
764 | + * @param object $post The post object. |
|
765 | + * @param string $link The link to the post. |
|
766 | + */ |
|
767 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
768 | + break; |
|
769 | + |
|
770 | + } |
|
771 | 771 | |
772 | - return $return; |
|
772 | + return $return; |
|
773 | 773 | } |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | $is_detail_page = false; |
39 | 39 | $geodir_map_name = geodir_map_name(); |
40 | 40 | |
41 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
41 | + if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) { |
|
42 | 42 | $is_detail_page = true; |
43 | 43 | } |
44 | 44 | |
45 | 45 | wp_enqueue_script('jquery'); |
46 | 46 | |
47 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | 48 | wp_enqueue_script('geodirectory-script'); |
49 | 49 | |
50 | 50 | $geodir_vars_data = array( |
51 | 51 | 'siteurl' => get_option('siteurl'), |
52 | 52 | 'geodir_plugin_url' => geodir_plugin_url(), |
53 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
53 | + 'geodir_lazy_load' => get_option('geodir_lazy_load', 1), |
|
54 | 54 | 'geodir_ajax_url' => geodir_get_ajax_url(), |
55 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
55 | + 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'), |
|
56 | 56 | 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
57 | 57 | ); |
58 | 58 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * } |
75 | 75 | */ |
76 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
76 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); |
|
77 | 77 | |
78 | 78 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
79 | 79 | |
80 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
81 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
80 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); |
|
81 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); } |
|
82 | 82 | |
83 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
83 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); |
|
84 | 84 | wp_enqueue_script('geodirectory-lightbox-jquery'); |
85 | 85 | |
86 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
86 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); |
|
87 | 87 | if ($is_detail_page) { |
88 | 88 | wp_enqueue_script('geodirectory-jquery-simplemodal'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | if (in_array($geodir_map_name, array('auto', 'google'))) { |
92 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
93 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
92 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
93 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
94 | 94 | /** |
95 | 95 | * Filter the variables that are added to the end of the google maps script call. |
96 | 96 | * |
@@ -100,48 +100,48 @@ discard block |
||
100 | 100 | * @param string $var The string to filter, default is empty string. |
101 | 101 | */ |
102 | 102 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
103 | - wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($geodir_map_name == 'osm') { |
107 | 107 | // Leaflet OpenStreetMap |
108 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
108 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
109 | 109 | wp_enqueue_style('geodirectory-leaflet-style'); |
110 | 110 | |
111 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
111 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
112 | 112 | wp_enqueue_script('geodirectory-leaflet-script'); |
113 | 113 | |
114 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
114 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array(), GEODIRECTORY_VERSION); |
|
115 | 115 | wp_enqueue_script('geodirectory-leaflet-geo-script'); |
116 | 116 | |
117 | 117 | if ($is_detail_page) { |
118 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
118 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
119 | 119 | wp_enqueue_style('geodirectory-leaflet-routing-style'); |
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
121 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js', array(), GEODIRECTORY_VERSION); |
|
122 | 122 | wp_enqueue_script('geodirectory-leaflet-routing-script'); |
123 | 123 | } |
124 | 124 | } |
125 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
125 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
126 | 126 | |
127 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true); |
|
127 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
128 | 128 | wp_enqueue_script('geodirectory-goMap-script'); |
129 | 129 | |
130 | 130 | |
131 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | 132 | wp_enqueue_script('chosen'); |
133 | 133 | |
134 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
135 | 135 | wp_enqueue_script('geodirectory-choose-ajax'); |
136 | 136 | |
137 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
137 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
138 | 138 | |
139 | 139 | if (is_page() && geodir_is_page('add-listing')) { |
140 | 140 | // SCRIPT FOR UPLOAD |
141 | 141 | wp_enqueue_script('plupload-all'); |
142 | 142 | wp_enqueue_script('jquery-ui-sortable'); |
143 | 143 | |
144 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
144 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
145 | 145 | wp_enqueue_script('geodirectory-plupload-script'); |
146 | 146 | // SCRIPT FOR UPLOAD END |
147 | 147 | |
@@ -188,27 +188,27 @@ discard block |
||
188 | 188 | |
189 | 189 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
190 | 190 | |
191 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
191 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
192 | 192 | } // End if for add place page |
193 | 193 | |
194 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
194 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
195 | 195 | if ($is_detail_page) { |
196 | 196 | wp_enqueue_script('geodirectory-post-custom-js'); |
197 | 197 | } |
198 | 198 | |
199 | 199 | // font awesome rating script |
200 | 200 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
201 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
201 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
202 | 202 | wp_enqueue_script('geodir-barrating-js'); |
203 | 203 | } else { // default rating script |
204 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
204 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
205 | 205 | wp_enqueue_script('geodir-jRating-js'); |
206 | 206 | } |
207 | 207 | |
208 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
208 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
209 | 209 | wp_enqueue_script('geodir-on-document-load'); |
210 | 210 | |
211 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
211 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
212 | 212 | wp_enqueue_script('google-geometa'); |
213 | 213 | } |
214 | 214 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_header_scripts() |
225 | 225 | { |
226 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
226 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>'; |
|
227 | 227 | echo stripslashes(get_option('geodir_header_scripts')); |
228 | 228 | } |
229 | 229 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | function geodir_footer_scripts() |
241 | 241 | { |
242 | 242 | |
243 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
243 | + if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?> |
|
244 | 244 | |
245 | 245 | <script> |
246 | 246 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
249 | 249 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
250 | 250 | |
251 | - ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto'); |
|
252 | - <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?> |
|
251 | + ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto'); |
|
252 | + <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?> |
|
253 | 253 | ga('send', 'pageview'); |
254 | 254 | |
255 | 255 | </script> |
256 | 256 | |
257 | 257 | <?php |
258 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
258 | + }elseif (get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) { |
|
259 | 259 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
260 | 260 | } |
261 | 261 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * |
267 | 267 | * Flexbox wont wrap on ios for search form items |
268 | 268 | */ |
269 | - if (preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
269 | + if (preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) { |
|
270 | 270 | echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
271 | 271 | } |
272 | 272 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | function geodir_add_async_forscript($url) |
284 | 284 | { |
285 | - if (strpos($url, '#asyncload')===false) |
|
285 | + if (strpos($url, '#asyncload') === false) |
|
286 | 286 | return $url; |
287 | 287 | else if (is_admin()) |
288 | 288 | return str_replace('#asyncload', '', $url); |
@@ -300,12 +300,12 @@ discard block |
||
300 | 300 | function geodir_templates_styles() |
301 | 301 | { |
302 | 302 | |
303 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
303 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
304 | 304 | wp_enqueue_style('geodir-core-scss'); |
305 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
305 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
306 | 306 | |
307 | - if(is_rtl()){ |
|
308 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
307 | + if (is_rtl()) { |
|
308 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
309 | 309 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
310 | 310 | } |
311 | 311 | |
@@ -379,18 +379,18 @@ discard block |
||
379 | 379 | $term_id = get_queried_object_id(); |
380 | 380 | $taxonomy = get_query_var('taxonomy'); |
381 | 381 | |
382 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
383 | - $term = get_term($term_id, $post_type . 'category'); |
|
382 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
383 | + $term = get_term($term_id, $post_type.'category'); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
388 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
387 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
388 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
389 | 389 | |
390 | 390 | if (!is_array($taxonomy_search)) { |
391 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
392 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
391 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
392 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
393 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | if ($max_page > 1 || $always_show) { |
403 | 403 | // Extra pagination info |
404 | 404 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
405 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
405 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
406 | 406 | $end_no = min($paged * $posts_per_page, $numposts); |
407 | 407 | |
408 | 408 | if ($geodir_pagination_more_info != '') { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } else { |
413 | 413 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
414 | 414 | } |
415 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
415 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
416 | 416 | /** |
417 | 417 | * Adds an extra pagination info above/under pagination. |
418 | 418 | * |
@@ -428,15 +428,15 @@ discard block |
||
428 | 428 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
429 | 429 | |
430 | 430 | if ($geodir_pagination_more_info == 'before') { |
431 | - $before = $before . $pagination_info; |
|
431 | + $before = $before.$pagination_info; |
|
432 | 432 | } else if ($geodir_pagination_more_info == 'after') { |
433 | - $after = $pagination_info . $after; |
|
433 | + $after = $pagination_info.$after; |
|
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | 437 | echo "$before <div class='Navi gd-navi'>"; |
438 | 438 | if ($paged >= ($pages_to_show - 1)) { |
439 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
439 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
440 | 440 | } |
441 | 441 | previous_posts_link($prelabel); |
442 | 442 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | if ($i == $paged) { |
445 | 445 | echo "<strong class='on'>$i</strong>"; |
446 | 446 | } else { |
447 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
447 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
451 | 451 | next_posts_link($nxtlabel, $max_page); |
452 | 452 | if (($paged + $half_pages_to_show) < ($max_page)) { |
453 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
453 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
454 | 454 | } |
455 | 455 | echo "</div> $after"; |
456 | 456 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | jQuery(function ($) { |
489 | 489 | $("#distance_slider").slider({ |
490 | 490 | range: true, |
491 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
491 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
492 | 492 | min: 0, |
493 | 493 | max: <?php echo $dist; ?>, |
494 | 494 | step: <?php echo $dist_dif; ?>, |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
556 | 556 | ?> |
557 | 557 | <script type="text/javascript"> |
558 | - var default_location = '<?php echo $city ;?>'; |
|
558 | + var default_location = '<?php echo $city; ?>'; |
|
559 | 559 | var latlng; |
560 | 560 | var address; |
561 | 561 | var dist = 0; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | var $form = jQuery(this).closest('form'); |
572 | 572 | |
573 | 573 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
574 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
574 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
575 | 575 | |
576 | 576 | // Disable location based search for disabled location post type. |
577 | 577 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | } |
586 | 586 | } |
587 | 587 | |
588 | - if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) { |
|
588 | + if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) { |
|
589 | 589 | geodir_setsearch($form); |
590 | 590 | } else { |
591 | 591 | jQuery(".snear", $form).val(''); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | }); |
604 | 604 | |
605 | 605 | function geodir_setsearch($form) { |
606 | - if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location); |
|
606 | + if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location); |
|
607 | 607 | geocodeAddress($form); |
608 | 608 | } |
609 | 609 | |
@@ -622,15 +622,15 @@ discard block |
||
622 | 622 | // Call the geocode function |
623 | 623 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
624 | 624 | |
625 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
626 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
625 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
626 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
627 | 627 | jQuery(".snear", $form).val(''); |
628 | 628 | } |
629 | 629 | jQuery($form).submit(); |
630 | 630 | } else { |
631 | 631 | var address = jQuery(".snear", $form).val(); |
632 | 632 | |
633 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
633 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
634 | 634 | initialise2(); |
635 | 635 | } else { |
636 | 636 | <?php |
@@ -643,12 +643,12 @@ discard block |
||
643 | 643 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
644 | 644 | ?> |
645 | 645 | if (window.gdMaps === 'google') { |
646 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
646 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
647 | 647 | function (results, status) { |
648 | 648 | if (status == google.maps.GeocoderStatus.OK) { |
649 | 649 | updateSearchPosition(results[0].geometry.location, $form); |
650 | 650 | } else { |
651 | - alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status); |
|
651 | + alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status); |
|
652 | 652 | } |
653 | 653 | }); |
654 | 654 | } else if (window.gdMaps === 'osm') { |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
658 | 658 | updateSearchPosition(geo, $form); |
659 | 659 | } else { |
660 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
660 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
661 | 661 | } |
662 | 662 | }); |
663 | 663 | } else { |
@@ -703,19 +703,19 @@ discard block |
||
703 | 703 | var msg; |
704 | 704 | switch (err.code) { |
705 | 705 | case err.UNKNOWN_ERROR: |
706 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
706 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
707 | 707 | break; |
708 | 708 | case err.PERMISSION_DENINED: |
709 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
709 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
710 | 710 | break; |
711 | 711 | case err.POSITION_UNAVAILABLE: |
712 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
712 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
713 | 713 | break; |
714 | 714 | case err.BREAK: |
715 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
715 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
716 | 716 | break; |
717 | 717 | default: |
718 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
718 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
719 | 719 | } |
720 | 720 | jQuery('#info').html(msg); |
721 | 721 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * @param object $post The post object. |
755 | 755 | * @param string $link The link to the post. |
756 | 756 | */ |
757 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
757 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
758 | 758 | break; |
759 | 759 | case 'new' : |
760 | 760 | /** |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | * @param object $post The post object. |
765 | 765 | * @param string $link The link to the post. |
766 | 766 | */ |
767 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
767 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
768 | 768 | break; |
769 | 769 | |
770 | 770 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | </script> |
256 | 256 | |
257 | 257 | <?php |
258 | - }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
258 | + } elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
259 | 259 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
260 | 260 | } |
261 | 261 | |
@@ -282,13 +282,14 @@ discard block |
||
282 | 282 | */ |
283 | 283 | function geodir_add_async_forscript($url) |
284 | 284 | { |
285 | - if (strpos($url, '#asyncload')===false) |
|
286 | - return $url; |
|
287 | - else if (is_admin()) |
|
288 | - return str_replace('#asyncload', '', $url); |
|
289 | - else |
|
290 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
291 | -} |
|
285 | + if (strpos($url, '#asyncload')===false) { |
|
286 | + return $url; |
|
287 | + } else if (is_admin()) { |
|
288 | + return str_replace('#asyncload', '', $url); |
|
289 | + } else { |
|
290 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
291 | + } |
|
292 | + } |
|
292 | 293 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
293 | 294 | |
294 | 295 | /** |
@@ -355,8 +356,10 @@ discard block |
||
355 | 356 | |
356 | 357 | $half_pages_to_show = round($pages_to_show / 2); |
357 | 358 | |
358 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
359 | - return; |
|
359 | + if (geodir_is_page('home')) { |
|
360 | + // dont apply default pagination for geodirectory home page. |
|
361 | + return; |
|
362 | + } |
|
360 | 363 | |
361 | 364 | if (!is_single()) { |
362 | 365 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -476,11 +479,21 @@ discard block |
||
476 | 479 | } |
477 | 480 | $dist_dif = 1000; |
478 | 481 | |
479 | - if ($dist <= 5000) $dist_dif = 500; |
|
480 | - if ($dist <= 1000) $dist_dif = 100; |
|
481 | - if ($dist <= 500) $dist_dif = 50; |
|
482 | - if ($dist <= 100) $dist_dif = 10; |
|
483 | - if ($dist <= 50) $dist_dif = 5; |
|
482 | + if ($dist <= 5000) { |
|
483 | + $dist_dif = 500; |
|
484 | + } |
|
485 | + if ($dist <= 1000) { |
|
486 | + $dist_dif = 100; |
|
487 | + } |
|
488 | + if ($dist <= 500) { |
|
489 | + $dist_dif = 50; |
|
490 | + } |
|
491 | + if ($dist <= 100) { |
|
492 | + $dist_dif = 10; |
|
493 | + } |
|
494 | + if ($dist <= 50) { |
|
495 | + $dist_dif = 5; |
|
496 | + } |
|
484 | 497 | |
485 | 498 | ?> |
486 | 499 | <script type="text/javascript"> |
@@ -541,12 +554,14 @@ discard block |
||
541 | 554 | */ |
542 | 555 | function geodir_add_sharelocation_scripts() { |
543 | 556 | $default_search_for_text = SEARCH_FOR_TEXT; |
544 | - if (get_option('geodir_search_field_default_text')) |
|
545 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
557 | + if (get_option('geodir_search_field_default_text')) { |
|
558 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
559 | + } |
|
546 | 560 | |
547 | 561 | $default_near_text = NEAR_TEXT; |
548 | - if (get_option('geodir_near_field_default_text')) |
|
549 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
562 | + if (get_option('geodir_near_field_default_text')) { |
|
563 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
564 | + } |
|
550 | 565 | |
551 | 566 | $search_location = geodir_get_default_location(); |
552 | 567 |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | window.gdMaps = window.gdMaps || gdMaps; |
83 | 83 | |
84 | 84 | user_address = false; |
85 | - jQuery('#<?php echo $prefix.'address';?>').keypress(function () { |
|
85 | + jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () { |
|
86 | 86 | user_address = true; |
87 | 87 | }); |
88 | 88 | |
89 | 89 | baseMarker = ''; |
90 | 90 | geocoder = ''; |
91 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
92 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
93 | - <?php if($lat_lng_blank){$lat='';$lng='';}?> |
|
94 | - var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>; |
|
91 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
92 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
93 | + <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?> |
|
94 | + var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>; |
|
95 | 95 | var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>; |
96 | 96 | var oldstr_address; |
97 | 97 | var oldstr_zip; |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | do_action('geodir_add_listing_geocode_js_vars'); |
341 | 341 | ?> |
342 | 342 | <?php if ($is_map_restrict) { ?> |
343 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') { |
|
344 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>'); |
|
345 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
343 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') { |
|
344 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>'); |
|
345 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
346 | 346 | jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>')); |
347 | 347 | baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>')); |
348 | 348 | updateMarkerPosition(baseMarker.getPosition()); |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | <?php } ?> |
352 | 352 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
353 | 353 | } else { |
354 | - updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>'); |
|
354 | + updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>'); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | function centerMap(latlng) { |
358 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
358 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
359 | 359 | if (window.gdMaps == 'google') { |
360 | 360 | jQuery.goMap.map.panTo(baseMarker.getPosition()); |
361 | 361 | } else if (window.gdMaps == 'osm') { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } |
365 | 365 | } |
366 | 366 | function centerMarker() { |
367 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
367 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
368 | 368 | var center = jQuery.goMap.map.getCenter(); |
369 | 369 | if (window.gdMaps == 'google') { |
370 | 370 | baseMarker.setPosition(center); |
@@ -373,48 +373,48 @@ discard block |
||
373 | 373 | } |
374 | 374 | } |
375 | 375 | function updateMapZoom(zoom) { |
376 | - jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom); |
|
376 | + jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom); |
|
377 | 377 | } |
378 | 378 | function updateMarkerPosition(markerlatLng) { |
379 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
380 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat()); |
|
381 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng()); |
|
379 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
380 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat()); |
|
381 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng()); |
|
382 | 382 | } |
383 | 383 | function updateMarkerPositionOSM(markerlatLng) { |
384 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat); |
|
385 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng); |
|
384 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat); |
|
385 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng); |
|
386 | 386 | } |
387 | 387 | function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) { |
388 | - var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>'; |
|
389 | - <?php ob_start();?> |
|
390 | - var old_country = jQuery("#<?php echo $prefix.'country';?>").val(); |
|
391 | - var old_region = jQuery("#<?php echo $prefix.'region';?>").val(); |
|
388 | + var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>'; |
|
389 | + <?php ob_start(); ?> |
|
390 | + var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val(); |
|
391 | + var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val(); |
|
392 | 392 | |
393 | - if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') { |
|
394 | - jQuery("#<?php echo $prefix.'address';?>").val(getAddress); |
|
393 | + if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') { |
|
394 | + jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress); |
|
395 | 395 | } |
396 | 396 | if (getAddress) { |
397 | 397 | oldstr_address = getAddress; |
398 | 398 | } |
399 | 399 | |
400 | - jQuery("#<?php echo $prefix.'zip';?>").val(getZip); |
|
400 | + jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip); |
|
401 | 401 | if (getZip) { |
402 | 402 | oldstr_zip = getZip; |
403 | 403 | } |
404 | 404 | if (set_map_val_in_fields) { |
405 | 405 | if (getCountry) { |
406 | - jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false); |
|
407 | - jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true); |
|
408 | - jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated"); |
|
406 | + jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false); |
|
407 | + jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true); |
|
408 | + jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated"); |
|
409 | 409 | } |
410 | 410 | if (getState) { |
411 | - if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) { |
|
412 | - jQuery("#<?php echo $prefix.'region';?>").val(getState); |
|
411 | + if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) { |
|
412 | + jQuery("#<?php echo $prefix.'region'; ?>").val(getState); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | if (getCity) { |
416 | - if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) { |
|
417 | - jQuery("#<?php echo $prefix.'city';?>").val(getCity); |
|
416 | + if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) { |
|
417 | + jQuery("#<?php echo $prefix.'city'; ?>").val(getCity); |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 | } |
@@ -430,15 +430,15 @@ discard block |
||
430 | 430 | ?> |
431 | 431 | } |
432 | 432 | function geodir_codeAddress(set_on_map) { |
433 | - var address = jQuery('#<?php echo $prefix.'address';?>').val(); |
|
434 | - var zip = jQuery('#<?php echo $prefix.'zip';?>').val(); |
|
435 | - var city = jQuery('#<?php echo $prefix.'city';?>').val(); |
|
436 | - var region = jQuery('#<?php echo $prefix.'region';?>').val(); |
|
437 | - var country = jQuery('#<?php echo $prefix.'country';?>').val(); |
|
438 | - var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected'); |
|
433 | + var address = jQuery('#<?php echo $prefix.'address'; ?>').val(); |
|
434 | + var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val(); |
|
435 | + var city = jQuery('#<?php echo $prefix.'city'; ?>').val(); |
|
436 | + var region = jQuery('#<?php echo $prefix.'region'; ?>').val(); |
|
437 | + var country = jQuery('#<?php echo $prefix.'country'; ?>').val(); |
|
438 | + var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected'); |
|
439 | 439 | var ISO2 = country_selected.data('country_code'); |
440 | - if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) { |
|
441 | - ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code'); |
|
440 | + if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) { |
|
441 | + ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code'); |
|
442 | 442 | } |
443 | 443 | if (ISO2 == '--') { |
444 | 444 | ISO2 = ''; |
@@ -447,13 +447,13 @@ discard block |
||
447 | 447 | zip = ''; |
448 | 448 | } |
449 | 449 | if (typeof city == "undefined") { |
450 | - city = '<?php echo addslashes_gpc($city);?>'; |
|
450 | + city = '<?php echo addslashes_gpc($city); ?>'; |
|
451 | 451 | } |
452 | 452 | if (typeof region == "undefined") { |
453 | - region = '<?php echo addslashes_gpc($region);?>'; |
|
453 | + region = '<?php echo addslashes_gpc($region); ?>'; |
|
454 | 454 | } |
455 | 455 | if (typeof country == "undefined") { |
456 | - country = '<?php echo addslashes_gpc($country);?>'; |
|
456 | + country = '<?php echo addslashes_gpc($country); ?>'; |
|
457 | 457 | } |
458 | 458 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
459 | 459 | <?php ob_start(); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | if (typeof address === 'undefined') |
469 | 469 | address = ''; |
470 | 470 | <?php |
471 | - if(is_admin() && isset($_REQUEST['tab'])){?> |
|
471 | + if (is_admin() && isset($_REQUEST['tab'])) {?> |
|
472 | 472 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') { |
473 | 473 | address = ''; |
474 | 474 | } |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | geocoder.geocode({'address': address, 'country': ISO2}, |
516 | 516 | function (results, status) { |
517 | 517 | console.log(status); |
518 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
518 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
519 | 519 | if (status == google.maps.GeocoderStatus.OK) { |
520 | 520 | baseMarker.setPosition(results[0].geometry.location); |
521 | 521 | jQuery.goMap.map.setCenter(results[0].geometry.location); |
@@ -532,21 +532,21 @@ discard block |
||
532 | 532 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2}); |
533 | 533 | //} |
534 | 534 | } else { |
535 | - alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status); |
|
535 | + alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status); |
|
536 | 536 | } |
537 | 537 | }); |
538 | 538 | } |
539 | 539 | } |
540 | 540 | function gdMaxMap() { |
541 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
541 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
542 | 542 | |
543 | - jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen'); |
|
543 | + jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen'); |
|
544 | 544 | jQuery('.map_category').toggleClass('map_category_fullscreen'); |
545 | - jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen'); |
|
545 | + jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen'); |
|
546 | 546 | jQuery('body').toggleClass('body_fullscreen'); |
547 | - jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen'); |
|
548 | - jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen'); |
|
549 | - jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen'); |
|
547 | + jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen'); |
|
548 | + jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen'); |
|
549 | + jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen'); |
|
550 | 550 | jQuery('.TopLeft').toggleClass('TopLeft_fullscreen'); |
551 | 551 | window.setTimeout(function () { |
552 | 552 | if (window.gdMaps == 'google') { |
@@ -582,9 +582,9 @@ discard block |
||
582 | 582 | do_action('geodir_add_listing_geocode_js_vars'); |
583 | 583 | ?> |
584 | 584 | <?php if ($is_map_restrict) { ?> |
585 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') { |
|
586 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>'); |
|
587 | - jQuery("#<?php echo $prefix.'map';?>").goMap(); |
|
585 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') { |
|
586 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>'); |
|
587 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap(); |
|
588 | 588 | centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>')); |
589 | 589 | baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>')); |
590 | 590 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
@@ -593,39 +593,39 @@ discard block |
||
593 | 593 | <?php } ?> |
594 | 594 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
595 | 595 | } else { |
596 | - alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>'); |
|
596 | + alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>'); |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | 600 | jQuery(function ($) { |
601 | - $("#<?php echo $prefix.'map';?>").goMap({ |
|
602 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
603 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
604 | - zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT, |
|
601 | + $("#<?php echo $prefix.'map'; ?>").goMap({ |
|
602 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
603 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
604 | + zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT, |
|
605 | 605 | maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN |
606 | 606 | streetViewControl: true, |
607 | - <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?> |
|
607 | + <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?> |
|
608 | 608 | }); |
609 | 609 | |
610 | 610 | if (window.gdMaps) { |
611 | 611 | geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : []; |
612 | 612 | |
613 | 613 | baseMarker = $.goMap.createMarker({ |
614 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
615 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
614 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
615 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
616 | 616 | id: 'baseMarker', |
617 | - icon: '<?php echo $marker_icon;?>', |
|
617 | + icon: '<?php echo $marker_icon; ?>', |
|
618 | 618 | draggable: true, |
619 | 619 | addToMap: true, // For OSM |
620 | - w: parseFloat('<?php echo $icon_size['w'];?>'), |
|
621 | - h: parseFloat('<?php echo $icon_size['h'];?>'), |
|
620 | + w: parseFloat('<?php echo $icon_size['w']; ?>'), |
|
621 | + h: parseFloat('<?php echo $icon_size['h']; ?>'), |
|
622 | 622 | }); |
623 | 623 | } else { |
624 | - jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide(); |
|
625 | - jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show(); |
|
624 | + jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide(); |
|
625 | + jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show(); |
|
626 | 626 | } |
627 | 627 | |
628 | - $("#<?php echo $prefix;?>set_address_button").click(function () { |
|
628 | + $("#<?php echo $prefix; ?>set_address_button").click(function () { |
|
629 | 629 | var set_on_map = true; |
630 | 630 | geodir_codeAddress(set_on_map); |
631 | 631 | }); |
@@ -659,14 +659,14 @@ discard block |
||
659 | 659 | updateMapZoom($.goMap.map.zoom); |
660 | 660 | }); |
661 | 661 | |
662 | - var maxMap = document.getElementById('<?php echo $prefix;?>triggermap'); |
|
662 | + var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap'); |
|
663 | 663 | google.maps.event.addDomListener(maxMap, 'click', gdMaxMap); |
664 | 664 | |
665 | 665 | <?php if ($is_map_restrict) { ?> |
666 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>'; |
|
666 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>'; |
|
667 | 667 | geocoder.geocode({'address': CITY_ADDRESS}, |
668 | 668 | function (results, status) { |
669 | - $("#<?php echo $prefix.'map';?>").goMap(); |
|
669 | + $("#<?php echo $prefix.'map'; ?>").goMap(); |
|
670 | 670 | if (status == google.maps.GeocoderStatus.OK) { |
671 | 671 | // Bounds for North America |
672 | 672 | var bound_lat_lng = String(results[0].geometry.bounds); |
@@ -677,13 +677,13 @@ discard block |
||
677 | 677 | new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3]) |
678 | 678 | ); |
679 | 679 | } else { |
680 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status); |
|
680 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status); |
|
681 | 681 | } |
682 | 682 | }); |
683 | 683 | <?php } ?> |
684 | 684 | // Limit the zoom level |
685 | 685 | google.maps.event.addListener($.goMap.map, 'zoom_changed', function () { |
686 | - $("#<?php echo $prefix.'map';?>").goMap(); |
|
686 | + $("#<?php echo $prefix.'map'; ?>").goMap(); |
|
687 | 687 | if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel); |
688 | 688 | }); |
689 | 689 | } else if (window.gdMaps == 'osm') { |
@@ -709,10 +709,10 @@ discard block |
||
709 | 709 | updateMapZoom($.goMap.map.getZoom()); |
710 | 710 | }); |
711 | 711 | |
712 | - L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap); |
|
712 | + L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap); |
|
713 | 713 | |
714 | 714 | <?php if ($is_map_restrict) { ?> |
715 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>'; |
|
715 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>'; |
|
716 | 716 | geocodePositionOSM('', CITY_ADDRESS); |
717 | 717 | <?php } ?> |
718 | 718 | // Limit the zoom level |
@@ -735,14 +735,14 @@ discard block |
||
735 | 735 | <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;"> |
736 | 736 | <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div> |
737 | 737 | <div class="TopRight"></div> |
738 | - <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px"> |
|
738 | + <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px"> |
|
739 | 739 | <!-- new map start --> |
740 | 740 | <div class="iprelative"> |
741 | - <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
741 | + <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
742 | 742 | <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div> |
743 | 743 | <div id="<?php echo $prefix; ?>advmap_counter"></div> |
744 | 744 | <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
745 | - <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div> |
|
745 | + <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div> |
|
746 | 746 | </div> |
747 | 747 | <!-- new map end --> |
748 | 748 | </div> |