@@ -36,177 +36,177 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function geodir_templates_scripts() |
38 | 38 | { |
39 | - $is_detail_page = false; |
|
40 | - $geodir_map_name = geodir_map_name(); |
|
39 | + $is_detail_page = false; |
|
40 | + $geodir_map_name = geodir_map_name(); |
|
41 | 41 | |
42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | - $is_detail_page = true; |
|
44 | - } |
|
42 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | + $is_detail_page = true; |
|
44 | + } |
|
45 | 45 | |
46 | - wp_enqueue_script('jquery'); |
|
46 | + wp_enqueue_script('jquery'); |
|
47 | 47 | |
48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | - wp_enqueue_script('geodirectory-script'); |
|
48 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | + wp_enqueue_script('geodirectory-script'); |
|
50 | 50 | |
51 | - $geodir_vars_data = array( |
|
52 | - 'siteurl' => get_option('siteurl'), |
|
53 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
55 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
57 | - 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
|
51 | + $geodir_vars_data = array( |
|
52 | + 'siteurl' => get_option('siteurl'), |
|
53 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
55 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
56 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
57 | + 'is_rtl' => is_rtl() ? 1 : 0, // fix rtl issue |
|
58 | 58 | 'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')), |
59 | 59 | 'lightBox_txtOf' => addslashes(__('of', 'geodirectory')), |
60 | - ); |
|
61 | - |
|
62 | - /** |
|
63 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
64 | - * |
|
65 | - * This is used by addons to add JS translatable variables. |
|
66 | - * |
|
67 | - * @since 1.4.4 |
|
68 | - * @param array $geodir_vars_data { |
|
69 | - * geodir var data used by addons to add JS translatable variables. |
|
70 | - * |
|
71 | - * @type string $siteurl Site url. |
|
72 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
73 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
74 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
75 | - * @type int $is_rtl Checks if current locale is RTL. |
|
76 | - * |
|
77 | - * } |
|
78 | - */ |
|
79 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
80 | - |
|
81 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
82 | - |
|
83 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
85 | - |
|
86 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
88 | - |
|
89 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
90 | - if ($is_detail_page) { |
|
91 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
92 | - } |
|
60 | + ); |
|
61 | + |
|
62 | + /** |
|
63 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
64 | + * |
|
65 | + * This is used by addons to add JS translatable variables. |
|
66 | + * |
|
67 | + * @since 1.4.4 |
|
68 | + * @param array $geodir_vars_data { |
|
69 | + * geodir var data used by addons to add JS translatable variables. |
|
70 | + * |
|
71 | + * @type string $siteurl Site url. |
|
72 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
73 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
74 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
75 | + * @type int $is_rtl Checks if current locale is RTL. |
|
76 | + * |
|
77 | + * } |
|
78 | + */ |
|
79 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
80 | + |
|
81 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
82 | + |
|
83 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
85 | + |
|
86 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
88 | + |
|
89 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
90 | + if ($is_detail_page) { |
|
91 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
92 | + } |
|
93 | 93 | |
94 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
95 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
96 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
97 | - /** |
|
98 | - * Filter the variables that are added to the end of the google maps script call. |
|
99 | - * |
|
100 | - * This i used to change things like google maps language etc. |
|
101 | - * |
|
102 | - * @since 1.0.0 |
|
103 | - * @param string $var The string to filter, default is empty string. |
|
104 | - */ |
|
105 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
106 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
94 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
95 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
96 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
97 | + /** |
|
98 | + * Filter the variables that are added to the end of the google maps script call. |
|
99 | + * |
|
100 | + * This i used to change things like google maps language etc. |
|
101 | + * |
|
102 | + * @since 1.0.0 |
|
103 | + * @param string $var The string to filter, default is empty string. |
|
104 | + */ |
|
105 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
106 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
107 | 107 | |
108 | - // Overlapping Marker Spiderfier |
|
109 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
110 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
111 | - } |
|
108 | + // Overlapping Marker Spiderfier |
|
109 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
110 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
111 | + } |
|
112 | 112 | |
113 | - if ($geodir_map_name == 'osm') { |
|
114 | - // Leaflet OpenStreetMap |
|
115 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
116 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
113 | + if ($geodir_map_name == 'osm') { |
|
114 | + // Leaflet OpenStreetMap |
|
115 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
116 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
117 | 117 | |
118 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
118 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
120 | 120 | |
121 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
122 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
121 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
122 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
123 | 123 | |
124 | - if ($is_detail_page) { |
|
125 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
126 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
124 | + if ($is_detail_page) { |
|
125 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
126 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
127 | 127 | |
128 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
129 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
130 | - } |
|
128 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
129 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
130 | + } |
|
131 | 131 | |
132 | - // Overlapping Marker Spiderfier Leaflet |
|
133 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
135 | - } |
|
136 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
132 | + // Overlapping Marker Spiderfier Leaflet |
|
133 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
134 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
135 | + } |
|
136 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
137 | 137 | |
138 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
139 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
140 | - |
|
141 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | - wp_enqueue_script('chosen'); |
|
143 | - |
|
144 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
145 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
146 | - |
|
147 | - 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); |
|
148 | - |
|
149 | - if (is_page() && geodir_is_page('add-listing')) { |
|
150 | - // SCRIPT FOR UPLOAD |
|
151 | - wp_enqueue_script('plupload-all'); |
|
152 | - wp_enqueue_script('jquery-ui-sortable'); |
|
153 | - |
|
154 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
155 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
156 | - // SCRIPT FOR UPLOAD END |
|
157 | - |
|
158 | - // 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 |
|
159 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
160 | - $ajax_url = admin_url('admin-ajax.php'); |
|
161 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
162 | - $ajax_url = admin_url('admin-ajax.php'); |
|
163 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
164 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
165 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
166 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
167 | - } else { |
|
168 | - $ajax_url = admin_url('admin-ajax.php'); |
|
169 | - } |
|
138 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
139 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
140 | + |
|
141 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | + wp_enqueue_script('chosen'); |
|
143 | + |
|
144 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
145 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
146 | + |
|
147 | + 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); |
|
148 | + |
|
149 | + if (is_page() && geodir_is_page('add-listing')) { |
|
150 | + // SCRIPT FOR UPLOAD |
|
151 | + wp_enqueue_script('plupload-all'); |
|
152 | + wp_enqueue_script('jquery-ui-sortable'); |
|
153 | + |
|
154 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
155 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
156 | + // SCRIPT FOR UPLOAD END |
|
157 | + |
|
158 | + // 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 |
|
159 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
160 | + $ajax_url = admin_url('admin-ajax.php'); |
|
161 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
162 | + $ajax_url = admin_url('admin-ajax.php'); |
|
163 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
164 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
165 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
166 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
167 | + } else { |
|
168 | + $ajax_url = admin_url('admin-ajax.php'); |
|
169 | + } |
|
170 | 170 | |
171 | - // place js config array for plupload |
|
172 | - $plupload_init = array( |
|
173 | - 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
174 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
175 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
176 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
177 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
178 | - 'multiple_queues' => true, |
|
179 | - 'max_file_size' => geodir_max_upload_size(), |
|
180 | - 'url' => $ajax_url, |
|
181 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
182 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
183 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
184 | - 'multipart' => true, |
|
185 | - 'urlstream_upload' => true, |
|
186 | - 'multi_selection' => false, // will be added per uploader |
|
187 | - // additional post data to send to our ajax hook |
|
188 | - 'multipart_params' => array( |
|
189 | - '_ajax_nonce' => "", // will be added per uploader |
|
190 | - 'action' => 'plupload_action', // the ajax action name |
|
191 | - 'imgid' => 0 // will be added per uploader |
|
192 | - ) |
|
193 | - ); |
|
194 | - $base_plupload_config = json_encode($plupload_init); |
|
195 | - |
|
196 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
197 | - 'upload_img_size' => geodir_max_upload_size()); |
|
198 | - |
|
199 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
200 | - |
|
201 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
202 | - } // End if for add place page |
|
203 | - |
|
204 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
205 | - if ($is_detail_page) { |
|
171 | + // place js config array for plupload |
|
172 | + $plupload_init = array( |
|
173 | + 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
174 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
175 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
176 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
177 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
178 | + 'multiple_queues' => true, |
|
179 | + 'max_file_size' => geodir_max_upload_size(), |
|
180 | + 'url' => $ajax_url, |
|
181 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
182 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
183 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
184 | + 'multipart' => true, |
|
185 | + 'urlstream_upload' => true, |
|
186 | + 'multi_selection' => false, // will be added per uploader |
|
187 | + // additional post data to send to our ajax hook |
|
188 | + 'multipart_params' => array( |
|
189 | + '_ajax_nonce' => "", // will be added per uploader |
|
190 | + 'action' => 'plupload_action', // the ajax action name |
|
191 | + 'imgid' => 0 // will be added per uploader |
|
192 | + ) |
|
193 | + ); |
|
194 | + $base_plupload_config = json_encode($plupload_init); |
|
195 | + |
|
196 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
197 | + 'upload_img_size' => geodir_max_upload_size()); |
|
198 | + |
|
199 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
200 | + |
|
201 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
202 | + } // End if for add place page |
|
203 | + |
|
204 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
205 | + if ($is_detail_page) { |
|
206 | 206 | wp_enqueue_script('geodirectory-post-custom-js'); |
207 | 207 | } |
208 | 208 | |
209 | - // font awesome rating script |
|
209 | + // font awesome rating script |
|
210 | 210 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
211 | 211 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
212 | 212 | wp_enqueue_script('geodir-barrating-js'); |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | wp_enqueue_script('geodir-jRating-js'); |
216 | 216 | } |
217 | 217 | |
218 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | - wp_enqueue_script('geodir-on-document-load'); |
|
218 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | + wp_enqueue_script('geodir-on-document-load'); |
|
220 | 220 | |
221 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
222 | - wp_enqueue_script('google-geometa'); |
|
221 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
222 | + wp_enqueue_script('google-geometa'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function geodir_header_scripts() |
235 | 235 | { |
236 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
237 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
236 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
237 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | function geodir_google_analytics_tracking_code() |
249 | 249 | { |
250 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
250 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
251 | 251 | |
252 | 252 | <script> |
253 | 253 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | </script> |
263 | 263 | |
264 | 264 | <?php |
265 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
266 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
267 | - } |
|
265 | + }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
266 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
267 | + } |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -278,16 +278,16 @@ discard block |
||
278 | 278 | function geodir_footer_scripts() |
279 | 279 | { |
280 | 280 | |
281 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
281 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
282 | 282 | |
283 | - /* |
|
283 | + /* |
|
284 | 284 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
285 | 285 | * |
286 | 286 | * Flexbox wont wrap on ios for search form items |
287 | 287 | */ |
288 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
289 | - 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>"; |
|
290 | - } |
|
288 | + if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
289 | + 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>"; |
|
290 | + } |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function geodir_add_async_forscript($url) |
303 | 303 | { |
304 | - if (strpos($url, '#asyncload')===false) |
|
305 | - return $url; |
|
306 | - else if (is_admin()) |
|
307 | - return str_replace('#asyncload', '', $url); |
|
308 | - else |
|
309 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
304 | + if (strpos($url, '#asyncload')===false) |
|
305 | + return $url; |
|
306 | + else if (is_admin()) |
|
307 | + return str_replace('#asyncload', '', $url); |
|
308 | + else |
|
309 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
310 | 310 | } |
311 | 311 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
312 | 312 | |
@@ -319,18 +319,18 @@ discard block |
||
319 | 319 | function geodir_templates_styles() |
320 | 320 | { |
321 | 321 | |
322 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
323 | - wp_enqueue_style('geodir-core-scss'); |
|
324 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
322 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
323 | + wp_enqueue_style('geodir-core-scss'); |
|
324 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
325 | 325 | |
326 | - if(is_rtl()){ |
|
327 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
328 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
329 | - } |
|
326 | + if(is_rtl()){ |
|
327 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
328 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
329 | + } |
|
330 | 330 | |
331 | - wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js#faload', array('font-awesome-shim'), GEODIRECTORY_VERSION); |
|
332 | - wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION); |
|
333 | - wp_enqueue_script( 'font-awesome' ); |
|
331 | + wp_register_script('font-awesome', 'https://use.fontawesome.com/releases/v5.5.0/js/all.js#faload', array('font-awesome-shim'), GEODIRECTORY_VERSION); |
|
332 | + wp_register_script('font-awesome-shim', 'https://use.fontawesome.com/releases/v5.5.0/js/v4-shims.js', array(), GEODIRECTORY_VERSION); |
|
333 | + wp_enqueue_script( 'font-awesome' ); |
|
334 | 334 | |
335 | 335 | |
336 | 336 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function geodir_get_sidebar() |
346 | 346 | { |
347 | - get_sidebar('geodirectory'); |
|
347 | + get_sidebar('geodirectory'); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -363,122 +363,122 @@ discard block |
||
363 | 363 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
364 | 364 | */ |
365 | 365 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
366 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
366 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
367 | 367 | |
368 | - if (empty($prelabel)) { |
|
369 | - $prelabel = '<strong><</strong>'; |
|
370 | - } |
|
368 | + if (empty($prelabel)) { |
|
369 | + $prelabel = '<strong><</strong>'; |
|
370 | + } |
|
371 | 371 | |
372 | - if (empty($nxtlabel)) { |
|
373 | - $nxtlabel = '<strong>></strong>'; |
|
374 | - } |
|
372 | + if (empty($nxtlabel)) { |
|
373 | + $nxtlabel = '<strong>></strong>'; |
|
374 | + } |
|
375 | 375 | |
376 | - $half_pages_to_show = round($pages_to_show / 2); |
|
376 | + $half_pages_to_show = round($pages_to_show / 2); |
|
377 | 377 | |
378 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
379 | - return; |
|
378 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
379 | + return; |
|
380 | 380 | |
381 | - if (!is_single()) { |
|
382 | - if (function_exists('geodir_location_geo_home_link')) { |
|
383 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
384 | - } |
|
385 | - $numposts = $wp_query->found_posts; |
|
381 | + if (!is_single()) { |
|
382 | + if (function_exists('geodir_location_geo_home_link')) { |
|
383 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
384 | + } |
|
385 | + $numposts = $wp_query->found_posts; |
|
386 | 386 | |
387 | - $max_page = ceil($numposts / $posts_per_page); |
|
387 | + $max_page = ceil($numposts / $posts_per_page); |
|
388 | 388 | |
389 | - if (empty($paged)) { |
|
390 | - $paged = 1; |
|
391 | - } |
|
389 | + if (empty($paged)) { |
|
390 | + $paged = 1; |
|
391 | + } |
|
392 | 392 | |
393 | - $post_type = geodir_get_current_posttype(); |
|
394 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
395 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
396 | - $term = array(); |
|
393 | + $post_type = geodir_get_current_posttype(); |
|
394 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
395 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
396 | + $term = array(); |
|
397 | 397 | |
398 | - if (is_tax()) { |
|
399 | - $term_id = get_queried_object_id(); |
|
400 | - $taxonomy = get_query_var('taxonomy'); |
|
398 | + if (is_tax()) { |
|
399 | + $term_id = get_queried_object_id(); |
|
400 | + $taxonomy = get_query_var('taxonomy'); |
|
401 | 401 | |
402 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
403 | - $term = get_term($term_id, $post_type . 'category'); |
|
404 | - } |
|
405 | - } |
|
402 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
403 | + $term = get_term($term_id, $post_type . 'category'); |
|
404 | + } |
|
405 | + } |
|
406 | 406 | |
407 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
408 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
407 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
408 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
409 | 409 | |
410 | - if (!is_array($taxonomy_search)) { |
|
411 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
412 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
413 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
414 | - } |
|
415 | - } |
|
410 | + if (!is_array($taxonomy_search)) { |
|
411 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
412 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
413 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
414 | + } |
|
415 | + } |
|
416 | 416 | |
417 | - if (!empty($term) && !is_wp_error($term)) { |
|
418 | - $listing_type_name = $term->name; |
|
419 | - } |
|
420 | - } |
|
417 | + if (!empty($term) && !is_wp_error($term)) { |
|
418 | + $listing_type_name = $term->name; |
|
419 | + } |
|
420 | + } |
|
421 | 421 | |
422 | - if ($max_page > 1 || $always_show) { |
|
423 | - // Extra pagination info |
|
424 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
425 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
426 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
422 | + if ($max_page > 1 || $always_show) { |
|
423 | + // Extra pagination info |
|
424 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
425 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
426 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
427 | 427 | |
428 | - if ($geodir_pagination_more_info != '') { |
|
429 | - if ($listing_type_name) { |
|
430 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
431 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
432 | - } else { |
|
433 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
434 | - } |
|
435 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
436 | - /** |
|
437 | - * Adds an extra pagination info above/under pagination. |
|
438 | - * |
|
439 | - * @since 1.5.9 |
|
440 | - * |
|
441 | - * @param string $pagination_info Extra pagination info content. |
|
442 | - * @param string $listing_type_name Listing results type. |
|
443 | - * @param string $start_no First result number. |
|
444 | - * @param string $end_no Last result number. |
|
445 | - * @param string $numposts Total number of listings. |
|
446 | - * @param string $post_type The post type. |
|
447 | - */ |
|
448 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
428 | + if ($geodir_pagination_more_info != '') { |
|
429 | + if ($listing_type_name) { |
|
430 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
431 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
432 | + } else { |
|
433 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
434 | + } |
|
435 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
436 | + /** |
|
437 | + * Adds an extra pagination info above/under pagination. |
|
438 | + * |
|
439 | + * @since 1.5.9 |
|
440 | + * |
|
441 | + * @param string $pagination_info Extra pagination info content. |
|
442 | + * @param string $listing_type_name Listing results type. |
|
443 | + * @param string $start_no First result number. |
|
444 | + * @param string $end_no Last result number. |
|
445 | + * @param string $numposts Total number of listings. |
|
446 | + * @param string $post_type The post type. |
|
447 | + */ |
|
448 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
449 | 449 | |
450 | - if ($geodir_pagination_more_info == 'before') { |
|
451 | - $before = $before . $pagination_info; |
|
452 | - } else if ($geodir_pagination_more_info == 'after') { |
|
453 | - $after = $pagination_info . $after; |
|
454 | - } |
|
455 | - } |
|
450 | + if ($geodir_pagination_more_info == 'before') { |
|
451 | + $before = $before . $pagination_info; |
|
452 | + } else if ($geodir_pagination_more_info == 'after') { |
|
453 | + $after = $pagination_info . $after; |
|
454 | + } |
|
455 | + } |
|
456 | 456 | |
457 | - echo "$before <div class='Navi gd-navi'>"; |
|
458 | - if ($paged >= ($pages_to_show - 1)) { |
|
459 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
460 | - } |
|
461 | - previous_posts_link($prelabel); |
|
462 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
463 | - if ($i >= 1 && $i <= $max_page) { |
|
464 | - if ($i == $paged) { |
|
465 | - echo "<strong class='on'>$i</strong>"; |
|
466 | - } else { |
|
467 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
468 | - } |
|
469 | - } |
|
470 | - } |
|
471 | - next_posts_link($nxtlabel, $max_page); |
|
472 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
473 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
474 | - } |
|
475 | - echo "</div> $after"; |
|
476 | - } |
|
457 | + echo "$before <div class='Navi gd-navi'>"; |
|
458 | + if ($paged >= ($pages_to_show - 1)) { |
|
459 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
460 | + } |
|
461 | + previous_posts_link($prelabel); |
|
462 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
463 | + if ($i >= 1 && $i <= $max_page) { |
|
464 | + if ($i == $paged) { |
|
465 | + echo "<strong class='on'>$i</strong>"; |
|
466 | + } else { |
|
467 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
468 | + } |
|
469 | + } |
|
470 | + } |
|
471 | + next_posts_link($nxtlabel, $max_page); |
|
472 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
473 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
474 | + } |
|
475 | + echo "</div> $after"; |
|
476 | + } |
|
477 | 477 | |
478 | - if (function_exists('geodir_location_geo_home_link')) { |
|
479 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
480 | - } |
|
481 | - } |
|
478 | + if (function_exists('geodir_location_geo_home_link')) { |
|
479 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
480 | + } |
|
481 | + } |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
@@ -489,20 +489,20 @@ discard block |
||
489 | 489 | */ |
490 | 490 | function geodir_listingsearch_scripts() |
491 | 491 | { |
492 | - if (get_option('gd_search_dist') != '') { |
|
493 | - $dist = get_option('gd_search_dist'); |
|
494 | - } else { |
|
495 | - $dist = 500; |
|
496 | - } |
|
497 | - $dist_dif = 1000; |
|
498 | - |
|
499 | - if ($dist <= 5000) $dist_dif = 500; |
|
500 | - if ($dist <= 1000) $dist_dif = 100; |
|
501 | - if ($dist <= 500) $dist_dif = 50; |
|
502 | - if ($dist <= 100) $dist_dif = 10; |
|
503 | - if ($dist <= 50) $dist_dif = 5; |
|
504 | - |
|
505 | - ?> |
|
492 | + if (get_option('gd_search_dist') != '') { |
|
493 | + $dist = get_option('gd_search_dist'); |
|
494 | + } else { |
|
495 | + $dist = 500; |
|
496 | + } |
|
497 | + $dist_dif = 1000; |
|
498 | + |
|
499 | + if ($dist <= 5000) $dist_dif = 500; |
|
500 | + if ($dist <= 1000) $dist_dif = 100; |
|
501 | + if ($dist <= 500) $dist_dif = 50; |
|
502 | + if ($dist <= 100) $dist_dif = 10; |
|
503 | + if ($dist <= 50) $dist_dif = 5; |
|
504 | + |
|
505 | + ?> |
|
506 | 506 | <script type="text/javascript"> |
507 | 507 | |
508 | 508 | jQuery(function ($) { |
@@ -560,20 +560,20 @@ discard block |
||
560 | 560 | * @package GeoDirectory |
561 | 561 | */ |
562 | 562 | function geodir_add_sharelocation_scripts() { |
563 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
564 | - if (get_option('geodir_search_field_default_text')) |
|
565 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
563 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
564 | + if (get_option('geodir_search_field_default_text')) |
|
565 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
566 | 566 | |
567 | - $default_near_text = NEAR_TEXT; |
|
568 | - if (get_option('geodir_near_field_default_text')) |
|
569 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
567 | + $default_near_text = NEAR_TEXT; |
|
568 | + if (get_option('geodir_near_field_default_text')) |
|
569 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
570 | 570 | |
571 | - $search_location = geodir_get_default_location(); |
|
571 | + $search_location = geodir_get_default_location(); |
|
572 | 572 | |
573 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
574 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
575 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
576 | - ?> |
|
573 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
574 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
575 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
576 | + ?> |
|
577 | 577 | <script type="text/javascript"> |
578 | 578 | var default_location = '<?php echo $city ;?>'; |
579 | 579 | var latlng; |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | initialise2(); |
666 | 666 | } else { |
667 | 667 | <?php |
668 | - $near_add = get_option('geodir_search_near_addition'); |
|
669 | - /** |
|
670 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
671 | - * |
|
672 | - * @since 1.0.0 |
|
673 | - */ |
|
674 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
675 | - ?> |
|
668 | + $near_add = get_option('geodir_search_near_addition'); |
|
669 | + /** |
|
670 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
671 | + * |
|
672 | + * @since 1.0.0 |
|
673 | + */ |
|
674 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
675 | + ?> |
|
676 | 676 | if (window.gdMaps === 'google') { |
677 | 677 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
678 | 678 | function (results, status) { |
@@ -786,32 +786,32 @@ discard block |
||
786 | 786 | */ |
787 | 787 | function geodir_show_badges_on_image($which, $post, $link) |
788 | 788 | { |
789 | - $return = ''; |
|
790 | - switch ($which) { |
|
791 | - case 'featured': |
|
792 | - /** |
|
793 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
794 | - * |
|
795 | - * @since 1.0.0 |
|
796 | - * @param object $post The post object. |
|
797 | - * @param string $link The link to the post. |
|
798 | - */ |
|
799 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
800 | - break; |
|
801 | - case 'new' : |
|
802 | - /** |
|
803 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
804 | - * |
|
805 | - * @since 1.0.0 |
|
806 | - * @param object $post The post object. |
|
807 | - * @param string $link The link to the post. |
|
808 | - */ |
|
809 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
810 | - break; |
|
811 | - |
|
812 | - } |
|
789 | + $return = ''; |
|
790 | + switch ($which) { |
|
791 | + case 'featured': |
|
792 | + /** |
|
793 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
794 | + * |
|
795 | + * @since 1.0.0 |
|
796 | + * @param object $post The post object. |
|
797 | + * @param string $link The link to the post. |
|
798 | + */ |
|
799 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
800 | + break; |
|
801 | + case 'new' : |
|
802 | + /** |
|
803 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
804 | + * |
|
805 | + * @since 1.0.0 |
|
806 | + * @param object $post The post object. |
|
807 | + * @param string $link The link to the post. |
|
808 | + */ |
|
809 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
810 | + break; |
|
811 | + |
|
812 | + } |
|
813 | 813 | |
814 | - return $return; |
|
814 | + return $return; |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
@@ -820,9 +820,9 @@ discard block |
||
820 | 820 | * @since 1.6.22 |
821 | 821 | */ |
822 | 822 | function geodir_fix_script_conflict() { |
823 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
824 | - wp_dequeue_script( 'flexslider' ); |
|
825 | - } |
|
823 | + if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
824 | + wp_dequeue_script( 'flexslider' ); |
|
825 | + } |
|
826 | 826 | } |
827 | 827 | add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
828 | 828 | |
@@ -835,12 +835,12 @@ discard block |
||
835 | 835 | */ |
836 | 836 | function geodir_fontawesome_defer($url) |
837 | 837 | { |
838 | - if (strpos($url, 'use.fontawesome.com/releases/')===false) |
|
839 | - return $url; |
|
840 | - else if (is_admin()) |
|
841 | - return str_replace('#faload', '', $url); |
|
842 | - else |
|
843 | - return $url."' data-search-pseudo-elements defer='defer"; |
|
838 | + if (strpos($url, 'use.fontawesome.com/releases/')===false) |
|
839 | + return $url; |
|
840 | + else if (is_admin()) |
|
841 | + return str_replace('#faload', '', $url); |
|
842 | + else |
|
843 | + return $url."' data-search-pseudo-elements defer='defer"; |
|
844 | 844 | } |
845 | 845 | //add_filter('clean_url', 'geodir_fontawesome_defer', 11, 1); // let users add this as a snippet if they need it |
846 | 846 | |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | * Dequeue our fontawesome if using BB page. |
849 | 849 | */ |
850 | 850 | function geodir_fix_beaver_builder(){ |
851 | - if(isset($_REQUEST['fl_builder'])){ |
|
852 | - wp_dequeue_script( 'font-awesome' ); |
|
853 | - } |
|
851 | + if(isset($_REQUEST['fl_builder'])){ |
|
852 | + wp_dequeue_script( 'font-awesome' ); |
|
853 | + } |
|
854 | 854 | } |
855 | 855 | add_filter('wp_print_scripts','geodir_fix_beaver_builder',100); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | </script> |
263 | 263 | |
264 | 264 | <?php |
265 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
265 | + } elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
266 | 266 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
267 | 267 | } |
268 | 268 | } |
@@ -301,13 +301,14 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function geodir_add_async_forscript($url) |
303 | 303 | { |
304 | - if (strpos($url, '#asyncload')===false) |
|
305 | - return $url; |
|
306 | - else if (is_admin()) |
|
307 | - return str_replace('#asyncload', '', $url); |
|
308 | - else |
|
309 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
310 | -} |
|
304 | + if (strpos($url, '#asyncload')===false) { |
|
305 | + return $url; |
|
306 | + } else if (is_admin()) { |
|
307 | + return str_replace('#asyncload', '', $url); |
|
308 | + } else { |
|
309 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
310 | + } |
|
311 | + } |
|
311 | 312 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
312 | 313 | |
313 | 314 | /** |
@@ -375,8 +376,10 @@ discard block |
||
375 | 376 | |
376 | 377 | $half_pages_to_show = round($pages_to_show / 2); |
377 | 378 | |
378 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
379 | - return; |
|
379 | + if (geodir_is_page('home')) { |
|
380 | + // dont apply default pagination for geodirectory home page. |
|
381 | + return; |
|
382 | + } |
|
380 | 383 | |
381 | 384 | if (!is_single()) { |
382 | 385 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -496,11 +499,21 @@ discard block |
||
496 | 499 | } |
497 | 500 | $dist_dif = 1000; |
498 | 501 | |
499 | - if ($dist <= 5000) $dist_dif = 500; |
|
500 | - if ($dist <= 1000) $dist_dif = 100; |
|
501 | - if ($dist <= 500) $dist_dif = 50; |
|
502 | - if ($dist <= 100) $dist_dif = 10; |
|
503 | - if ($dist <= 50) $dist_dif = 5; |
|
502 | + if ($dist <= 5000) { |
|
503 | + $dist_dif = 500; |
|
504 | + } |
|
505 | + if ($dist <= 1000) { |
|
506 | + $dist_dif = 100; |
|
507 | + } |
|
508 | + if ($dist <= 500) { |
|
509 | + $dist_dif = 50; |
|
510 | + } |
|
511 | + if ($dist <= 100) { |
|
512 | + $dist_dif = 10; |
|
513 | + } |
|
514 | + if ($dist <= 50) { |
|
515 | + $dist_dif = 5; |
|
516 | + } |
|
504 | 517 | |
505 | 518 | ?> |
506 | 519 | <script type="text/javascript"> |
@@ -561,12 +574,14 @@ discard block |
||
561 | 574 | */ |
562 | 575 | function geodir_add_sharelocation_scripts() { |
563 | 576 | $default_search_for_text = SEARCH_FOR_TEXT; |
564 | - if (get_option('geodir_search_field_default_text')) |
|
565 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
577 | + if (get_option('geodir_search_field_default_text')) { |
|
578 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
579 | + } |
|
566 | 580 | |
567 | 581 | $default_near_text = NEAR_TEXT; |
568 | - if (get_option('geodir_near_field_default_text')) |
|
569 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
582 | + if (get_option('geodir_near_field_default_text')) { |
|
583 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
584 | + } |
|
570 | 585 | |
571 | 586 | $search_location = geodir_get_default_location(); |
572 | 587 | |
@@ -835,13 +850,14 @@ discard block |
||
835 | 850 | */ |
836 | 851 | function geodir_fontawesome_defer($url) |
837 | 852 | { |
838 | - if (strpos($url, 'use.fontawesome.com/releases/')===false) |
|
839 | - return $url; |
|
840 | - else if (is_admin()) |
|
841 | - return str_replace('#faload', '', $url); |
|
842 | - else |
|
843 | - return $url."' data-search-pseudo-elements defer='defer"; |
|
844 | -} |
|
853 | + if (strpos($url, 'use.fontawesome.com/releases/')===false) { |
|
854 | + return $url; |
|
855 | + } else if (is_admin()) { |
|
856 | + return str_replace('#faload', '', $url); |
|
857 | + } else { |
|
858 | + return $url."' data-search-pseudo-elements defer='defer"; |
|
859 | + } |
|
860 | + } |
|
845 | 861 | //add_filter('clean_url', 'geodir_fontawesome_defer', 11, 1); // let users add this as a snippet if they need it |
846 | 862 | |
847 | 863 | /** |