@@ -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(); |
|
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#asyncload', 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 | - } |
|
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', '//maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | - } |
|
38 | + $is_detail_page = false; |
|
39 | + $geodir_map_name = geodir_map_name(); |
|
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#asyncload', 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 | + } |
|
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', '//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.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.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 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
243 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
243 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | */ |
255 | 255 | function geodir_add_async_forscript($url) |
256 | 256 | { |
257 | - if (strpos($url, '#asyncload')===false) |
|
258 | - return $url; |
|
259 | - else if (is_admin()) |
|
260 | - return str_replace('#asyncload', '', $url); |
|
261 | - else |
|
262 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
257 | + if (strpos($url, '#asyncload')===false) |
|
258 | + return $url; |
|
259 | + else if (is_admin()) |
|
260 | + return str_replace('#asyncload', '', $url); |
|
261 | + else |
|
262 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
263 | 263 | } |
264 | 264 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
265 | 265 | |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | function geodir_templates_styles() |
273 | 273 | { |
274 | 274 | |
275 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
276 | - wp_enqueue_style('geodir-core-scss'); |
|
277 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
275 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
276 | + wp_enqueue_style('geodir-core-scss'); |
|
277 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
278 | 278 | |
279 | - if(is_rtl()){ |
|
280 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
281 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
282 | - } |
|
279 | + if(is_rtl()){ |
|
280 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
281 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
282 | + } |
|
283 | 283 | |
284 | - wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
285 | - wp_enqueue_style('font-awesome'); |
|
284 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
285 | + wp_enqueue_style('font-awesome'); |
|
286 | 286 | |
287 | 287 | |
288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function geodir_get_sidebar() |
298 | 298 | { |
299 | - get_sidebar('geodirectory'); |
|
299 | + get_sidebar('geodirectory'); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -315,122 +315,122 @@ discard block |
||
315 | 315 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
316 | 316 | */ |
317 | 317 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
318 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
318 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
319 | 319 | |
320 | - if (empty($prelabel)) { |
|
321 | - $prelabel = '<strong>«</strong>'; |
|
322 | - } |
|
320 | + if (empty($prelabel)) { |
|
321 | + $prelabel = '<strong>«</strong>'; |
|
322 | + } |
|
323 | 323 | |
324 | - if (empty($nxtlabel)) { |
|
325 | - $nxtlabel = '<strong>»</strong>'; |
|
326 | - } |
|
324 | + if (empty($nxtlabel)) { |
|
325 | + $nxtlabel = '<strong>»</strong>'; |
|
326 | + } |
|
327 | 327 | |
328 | - $half_pages_to_show = round($pages_to_show / 2); |
|
328 | + $half_pages_to_show = round($pages_to_show / 2); |
|
329 | 329 | |
330 | - if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default pagination for geodirectory home page. |
|
331 | - return; |
|
330 | + if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default pagination for geodirectory home page. |
|
331 | + return; |
|
332 | 332 | |
333 | - if (!is_single()) { |
|
334 | - if (function_exists('geodir_location_geo_home_link')) { |
|
335 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
336 | - } |
|
337 | - $numposts = $wp_query->found_posts; |
|
333 | + if (!is_single()) { |
|
334 | + if (function_exists('geodir_location_geo_home_link')) { |
|
335 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
336 | + } |
|
337 | + $numposts = $wp_query->found_posts; |
|
338 | 338 | |
339 | - $max_page = ceil($numposts / $posts_per_page); |
|
339 | + $max_page = ceil($numposts / $posts_per_page); |
|
340 | 340 | |
341 | - if (empty($paged)) { |
|
342 | - $paged = 1; |
|
343 | - } |
|
341 | + if (empty($paged)) { |
|
342 | + $paged = 1; |
|
343 | + } |
|
344 | 344 | |
345 | - $post_type = geodir_get_current_posttype(); |
|
346 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
347 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
348 | - $term = array(); |
|
345 | + $post_type = geodir_get_current_posttype(); |
|
346 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
347 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
348 | + $term = array(); |
|
349 | 349 | |
350 | - if (is_tax()) { |
|
351 | - $term_id = get_queried_object_id(); |
|
352 | - $taxonomy = get_query_var('taxonomy'); |
|
350 | + if (is_tax()) { |
|
351 | + $term_id = get_queried_object_id(); |
|
352 | + $taxonomy = get_query_var('taxonomy'); |
|
353 | 353 | |
354 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
355 | - $term = get_term($term_id, $post_type . 'category'); |
|
356 | - } |
|
357 | - } |
|
354 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
355 | + $term = get_term($term_id, $post_type . 'category'); |
|
356 | + } |
|
357 | + } |
|
358 | 358 | |
359 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
360 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
359 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
360 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
361 | 361 | |
362 | - if (!is_array($taxonomy_search)) { |
|
363 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
364 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
365 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
366 | - } |
|
367 | - } |
|
362 | + if (!is_array($taxonomy_search)) { |
|
363 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
364 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
365 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
366 | + } |
|
367 | + } |
|
368 | 368 | |
369 | - if (!empty($term) && !is_wp_error($term)) { |
|
370 | - $listing_type_name = $term->name; |
|
371 | - } |
|
372 | - } |
|
369 | + if (!empty($term) && !is_wp_error($term)) { |
|
370 | + $listing_type_name = $term->name; |
|
371 | + } |
|
372 | + } |
|
373 | 373 | |
374 | - if ($max_page > 1 || $always_show) { |
|
375 | - // Extra pagination info |
|
376 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
377 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
378 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
374 | + if ($max_page > 1 || $always_show) { |
|
375 | + // Extra pagination info |
|
376 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
377 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
378 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
379 | 379 | |
380 | - if ($geodir_pagination_more_info != '') { |
|
381 | - if ($listing_type_name) { |
|
382 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
383 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
384 | - } else { |
|
385 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
386 | - } |
|
387 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
388 | - /** |
|
389 | - * Adds an extra pagination info above/under pagination. |
|
390 | - * |
|
391 | - * @since 1.5.9 |
|
392 | - * |
|
393 | - * @param string $pagination_info Extra pagination info content. |
|
394 | - * @param string $listing_type_name Listing results type. |
|
395 | - * @param string $start_no First result number. |
|
396 | - * @param string $end_no Last result number. |
|
397 | - * @param string $numposts Total number of listings. |
|
398 | - * @param string $post_type The post type. |
|
399 | - */ |
|
400 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
380 | + if ($geodir_pagination_more_info != '') { |
|
381 | + if ($listing_type_name) { |
|
382 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
383 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
384 | + } else { |
|
385 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
386 | + } |
|
387 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
388 | + /** |
|
389 | + * Adds an extra pagination info above/under pagination. |
|
390 | + * |
|
391 | + * @since 1.5.9 |
|
392 | + * |
|
393 | + * @param string $pagination_info Extra pagination info content. |
|
394 | + * @param string $listing_type_name Listing results type. |
|
395 | + * @param string $start_no First result number. |
|
396 | + * @param string $end_no Last result number. |
|
397 | + * @param string $numposts Total number of listings. |
|
398 | + * @param string $post_type The post type. |
|
399 | + */ |
|
400 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
401 | 401 | |
402 | - if ($geodir_pagination_more_info == 'before') { |
|
403 | - $before = $before . $pagination_info; |
|
404 | - } else if ($geodir_pagination_more_info == 'after') { |
|
405 | - $after = $pagination_info . $after; |
|
406 | - } |
|
407 | - } |
|
402 | + if ($geodir_pagination_more_info == 'before') { |
|
403 | + $before = $before . $pagination_info; |
|
404 | + } else if ($geodir_pagination_more_info == 'after') { |
|
405 | + $after = $pagination_info . $after; |
|
406 | + } |
|
407 | + } |
|
408 | 408 | |
409 | - echo "$before <div class='Navi gd-navi'>"; |
|
410 | - if ($paged >= ($pages_to_show - 1)) { |
|
411 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
412 | - } |
|
413 | - previous_posts_link($prelabel); |
|
414 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
415 | - if ($i >= 1 && $i <= $max_page) { |
|
416 | - if ($i == $paged) { |
|
417 | - echo "<strong class='on'>$i</strong>"; |
|
418 | - } else { |
|
419 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
420 | - } |
|
421 | - } |
|
422 | - } |
|
423 | - next_posts_link($nxtlabel, $max_page); |
|
424 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
425 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
426 | - } |
|
427 | - echo "</div> $after"; |
|
428 | - } |
|
409 | + echo "$before <div class='Navi gd-navi'>"; |
|
410 | + if ($paged >= ($pages_to_show - 1)) { |
|
411 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
412 | + } |
|
413 | + previous_posts_link($prelabel); |
|
414 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
415 | + if ($i >= 1 && $i <= $max_page) { |
|
416 | + if ($i == $paged) { |
|
417 | + echo "<strong class='on'>$i</strong>"; |
|
418 | + } else { |
|
419 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
420 | + } |
|
421 | + } |
|
422 | + } |
|
423 | + next_posts_link($nxtlabel, $max_page); |
|
424 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
425 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
426 | + } |
|
427 | + echo "</div> $after"; |
|
428 | + } |
|
429 | 429 | |
430 | - if (function_exists('geodir_location_geo_home_link')) { |
|
431 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
432 | - } |
|
433 | - } |
|
430 | + if (function_exists('geodir_location_geo_home_link')) { |
|
431 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
432 | + } |
|
433 | + } |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -441,20 +441,20 @@ discard block |
||
441 | 441 | */ |
442 | 442 | function geodir_listingsearch_scripts() |
443 | 443 | { |
444 | - if (get_option('gd_search_dist') != '') { |
|
445 | - $dist = get_option('gd_search_dist'); |
|
446 | - } else { |
|
447 | - $dist = 500; |
|
448 | - } |
|
449 | - $dist_dif = 1000; |
|
450 | - |
|
451 | - if ($dist <= 5000) $dist_dif = 500; |
|
452 | - if ($dist <= 1000) $dist_dif = 100; |
|
453 | - if ($dist <= 500) $dist_dif = 50; |
|
454 | - if ($dist <= 100) $dist_dif = 10; |
|
455 | - if ($dist <= 50) $dist_dif = 5; |
|
456 | - |
|
457 | - ?> |
|
444 | + if (get_option('gd_search_dist') != '') { |
|
445 | + $dist = get_option('gd_search_dist'); |
|
446 | + } else { |
|
447 | + $dist = 500; |
|
448 | + } |
|
449 | + $dist_dif = 1000; |
|
450 | + |
|
451 | + if ($dist <= 5000) $dist_dif = 500; |
|
452 | + if ($dist <= 1000) $dist_dif = 100; |
|
453 | + if ($dist <= 500) $dist_dif = 50; |
|
454 | + if ($dist <= 100) $dist_dif = 10; |
|
455 | + if ($dist <= 50) $dist_dif = 5; |
|
456 | + |
|
457 | + ?> |
|
458 | 458 | <script type="text/javascript"> |
459 | 459 | |
460 | 460 | jQuery(function ($) { |
@@ -513,15 +513,15 @@ discard block |
||
513 | 513 | function geodir_add_sharelocation_scripts() |
514 | 514 | { |
515 | 515 | |
516 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
517 | - if (get_option('geodir_search_field_default_text')) |
|
518 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
516 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
517 | + if (get_option('geodir_search_field_default_text')) |
|
518 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
519 | 519 | |
520 | - $default_near_text = NEAR_TEXT; |
|
521 | - if (get_option('geodir_near_field_default_text')) |
|
522 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
520 | + $default_near_text = NEAR_TEXT; |
|
521 | + if (get_option('geodir_near_field_default_text')) |
|
522 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
523 | 523 | |
524 | - ?> |
|
524 | + ?> |
|
525 | 525 | |
526 | 526 | |
527 | 527 | <script type="text/javascript"> |
@@ -602,14 +602,14 @@ discard block |
||
602 | 602 | initialise2(); |
603 | 603 | } else { |
604 | 604 | <?php |
605 | - $near_add = get_option('geodir_search_near_addition'); |
|
606 | - /** |
|
607 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
608 | - * |
|
609 | - * @since 1.0.0 |
|
610 | - */ |
|
611 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
612 | - ?> |
|
605 | + $near_add = get_option('geodir_search_near_addition'); |
|
606 | + /** |
|
607 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
608 | + * |
|
609 | + * @since 1.0.0 |
|
610 | + */ |
|
611 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
612 | + ?> |
|
613 | 613 | if (window.gdMaps === 'google') { |
614 | 614 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
615 | 615 | function (results, status) { |
@@ -712,30 +712,30 @@ discard block |
||
712 | 712 | */ |
713 | 713 | function geodir_show_badges_on_image($which, $post, $link) |
714 | 714 | { |
715 | - $return = ''; |
|
716 | - switch ($which) { |
|
717 | - case 'featured': |
|
718 | - /** |
|
719 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
720 | - * |
|
721 | - * @since 1.0.0 |
|
722 | - * @param object $post The post object. |
|
723 | - * @param string $link The link to the post. |
|
724 | - */ |
|
725 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
726 | - break; |
|
727 | - case 'new' : |
|
728 | - /** |
|
729 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
730 | - * |
|
731 | - * @since 1.0.0 |
|
732 | - * @param object $post The post object. |
|
733 | - * @param string $link The link to the post. |
|
734 | - */ |
|
735 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
736 | - break; |
|
737 | - |
|
738 | - } |
|
715 | + $return = ''; |
|
716 | + switch ($which) { |
|
717 | + case 'featured': |
|
718 | + /** |
|
719 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
720 | + * |
|
721 | + * @since 1.0.0 |
|
722 | + * @param object $post The post object. |
|
723 | + * @param string $link The link to the post. |
|
724 | + */ |
|
725 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
726 | + break; |
|
727 | + case 'new' : |
|
728 | + /** |
|
729 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
730 | + * |
|
731 | + * @since 1.0.0 |
|
732 | + * @param object $post The post object. |
|
733 | + * @param string $link The link to the post. |
|
734 | + */ |
|
735 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
736 | + break; |
|
737 | + |
|
738 | + } |
|
739 | 739 | |
740 | - return $return; |
|
740 | + return $return; |
|
741 | 741 | } |
@@ -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#asyncload', array(), GEODIRECTORY_VERSION); |
|
47 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js#asyncload', 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', '//maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
103 | + wp_enqueue_script('geodirectory-googlemap-script', '//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.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
208 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.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 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | function geodir_add_async_forscript($url) |
256 | 256 | { |
257 | - if (strpos($url, '#asyncload')===false) |
|
257 | + if (strpos($url, '#asyncload') === false) |
|
258 | 258 | return $url; |
259 | 259 | else if (is_admin()) |
260 | 260 | return str_replace('#asyncload', '', $url); |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | function geodir_templates_styles() |
273 | 273 | { |
274 | 274 | |
275 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
275 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
276 | 276 | wp_enqueue_style('geodir-core-scss'); |
277 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
277 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
278 | 278 | |
279 | - if(is_rtl()){ |
|
280 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
279 | + if (is_rtl()) { |
|
280 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
281 | 281 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
282 | 282 | } |
283 | 283 | |
@@ -351,18 +351,18 @@ discard block |
||
351 | 351 | $term_id = get_queried_object_id(); |
352 | 352 | $taxonomy = get_query_var('taxonomy'); |
353 | 353 | |
354 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
355 | - $term = get_term($term_id, $post_type . 'category'); |
|
354 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
355 | + $term = get_term($term_id, $post_type.'category'); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
360 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
359 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
360 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
361 | 361 | |
362 | 362 | if (!is_array($taxonomy_search)) { |
363 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
364 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
365 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
363 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
364 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
365 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | if ($max_page > 1 || $always_show) { |
375 | 375 | // Extra pagination info |
376 | 376 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
377 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
377 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
378 | 378 | $end_no = min($paged * $posts_per_page, $numposts); |
379 | 379 | |
380 | 380 | if ($geodir_pagination_more_info != '') { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | } else { |
385 | 385 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
386 | 386 | } |
387 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
387 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
388 | 388 | /** |
389 | 389 | * Adds an extra pagination info above/under pagination. |
390 | 390 | * |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
401 | 401 | |
402 | 402 | if ($geodir_pagination_more_info == 'before') { |
403 | - $before = $before . $pagination_info; |
|
403 | + $before = $before.$pagination_info; |
|
404 | 404 | } else if ($geodir_pagination_more_info == 'after') { |
405 | - $after = $pagination_info . $after; |
|
405 | + $after = $pagination_info.$after; |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
409 | 409 | echo "$before <div class='Navi gd-navi'>"; |
410 | 410 | if ($paged >= ($pages_to_show - 1)) { |
411 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
411 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
412 | 412 | } |
413 | 413 | previous_posts_link($prelabel); |
414 | 414 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -416,13 +416,13 @@ discard block |
||
416 | 416 | if ($i == $paged) { |
417 | 417 | echo "<strong class='on'>$i</strong>"; |
418 | 418 | } else { |
419 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
419 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | } |
423 | 423 | next_posts_link($nxtlabel, $max_page); |
424 | 424 | if (($paged + $half_pages_to_show) < ($max_page)) { |
425 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
425 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
426 | 426 | } |
427 | 427 | echo "</div> $after"; |
428 | 428 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | jQuery(function ($) { |
461 | 461 | $("#distance_slider").slider({ |
462 | 462 | range: true, |
463 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
463 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
464 | 464 | min: 0, |
465 | 465 | max: <?php echo $dist; ?>, |
466 | 466 | step: <?php echo $dist_dif; ?>, |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | |
527 | 527 | <script type="text/javascript"> |
528 | - var default_location = '<?php if($search_location = geodir_get_default_location()) echo $search_location->city ;?>'; |
|
528 | + var default_location = '<?php if ($search_location = geodir_get_default_location()) echo $search_location->city; ?>'; |
|
529 | 529 | var latlng; |
530 | 530 | var address; |
531 | 531 | var dist = 0; |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | var $form = jQuery(this).closest('form'); |
539 | 539 | |
540 | 540 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
541 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
541 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
542 | 542 | |
543 | 543 | // Disable location based search for disabled location post type. |
544 | 544 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | } |
553 | 553 | } |
554 | 554 | |
555 | - 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;?>')) { |
|
555 | + 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; ?>')) { |
|
556 | 556 | geodir_setsearch($form); |
557 | 557 | } else { |
558 | 558 | jQuery(".snear", $form).val(''); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | }); |
572 | 572 | |
573 | 573 | function geodir_setsearch($form) { |
574 | - 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); |
|
574 | + 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); |
|
575 | 575 | geocodeAddress($form); |
576 | 576 | } |
577 | 577 | |
@@ -590,15 +590,15 @@ discard block |
||
590 | 590 | // Call the geocode function |
591 | 591 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
592 | 592 | |
593 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
594 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
593 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
594 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
595 | 595 | jQuery(".snear", $form).val(''); |
596 | 596 | } |
597 | 597 | jQuery($form).submit(); |
598 | 598 | } else { |
599 | 599 | var address = jQuery(".snear", $form).val(); |
600 | 600 | |
601 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
601 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
602 | 602 | initialise2(); |
603 | 603 | } else { |
604 | 604 | <?php |
@@ -611,12 +611,12 @@ discard block |
||
611 | 611 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
612 | 612 | ?> |
613 | 613 | if (window.gdMaps === 'google') { |
614 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
614 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
615 | 615 | function (results, status) { |
616 | 616 | if (status == google.maps.GeocoderStatus.OK) { |
617 | 617 | updateSearchPosition(results[0].geometry.location, $form); |
618 | 618 | } else { |
619 | - alert("<?php esc_attr_e('Search was not successful for the following reason:', 'geodirectory');?>" + status); |
|
619 | + alert("<?php esc_attr_e('Search was not successful for the following reason:', 'geodirectory'); ?>" + status); |
|
620 | 620 | } |
621 | 621 | }); |
622 | 622 | } else if (window.gdMaps === 'osm') { |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
626 | 626 | updateSearchPosition(geo, $form); |
627 | 627 | } else { |
628 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
628 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
629 | 629 | } |
630 | 630 | }); |
631 | 631 | } else { |
@@ -671,19 +671,19 @@ discard block |
||
671 | 671 | var msg; |
672 | 672 | switch (err.code) { |
673 | 673 | case err.UNKNOWN_ERROR: |
674 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
674 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
675 | 675 | break; |
676 | 676 | case err.PERMISSION_DENINED: |
677 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
677 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
678 | 678 | break; |
679 | 679 | case err.POSITION_UNAVAILABLE: |
680 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
680 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
681 | 681 | break; |
682 | 682 | case err.BREAK: |
683 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
683 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
684 | 684 | break; |
685 | 685 | default: |
686 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
686 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
687 | 687 | } |
688 | 688 | jQuery('#info').html(msg); |
689 | 689 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param object $post The post object. |
723 | 723 | * @param string $link The link to the post. |
724 | 724 | */ |
725 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
725 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
726 | 726 | break; |
727 | 727 | case 'new' : |
728 | 728 | /** |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @param object $post The post object. |
733 | 733 | * @param string $link The link to the post. |
734 | 734 | */ |
735 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
735 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
736 | 736 | break; |
737 | 737 | |
738 | 738 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $title = str_replace($srcharr, $replarr, $post_title); |
65 | 65 | |
66 | 66 | if (is_ssl()) { |
67 | - $icon = str_replace("http:","https:",$icon ); |
|
67 | + $icon = str_replace("http:", "https:", $icon); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if ($icon != '') { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $icon_size = array('w' => 36, 'h' => 45); |
81 | 81 | } |
82 | 82 | |
83 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}'; |
|
83 | + $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}'; |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Filter the json data when creating output for post json marker.. |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param string $post_json JSON representation of the post marker info. |
90 | 90 | * @param object $post The post object. |
91 | 91 | */ |
92 | - $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post); |
|
92 | + $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) { |
109 | 109 | foreach ($map_canvas_arr as $canvas => $jason) { |
110 | 110 | if (is_array($map_jason) && !empty($map_jason)) { |
111 | - $canvas_jason = $canvas . "_jason"; |
|
111 | + $canvas_jason = $canvas."_jason"; |
|
112 | 112 | $map_canvas_arr[$canvas] = array_unique($map_jason); |
113 | 113 | unset($cat_content_info); |
114 | 114 | $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | if (!empty($cat_content_info)) { |
117 | 117 | $json_content = substr(implode(',', $cat_content_info), 1); |
118 | 118 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016 |
119 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']'; |
|
119 | + $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']'; |
|
120 | 120 | } else { |
121 | 121 | $canvas_jason = '[{"totalcount":"0"}]'; |
122 | 122 | } |
123 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
123 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | * @param string $canvas Map canvas array key. |
133 | 133 | * @param array $map_canvas_jason_args Map canvas args. |
134 | 134 | */ |
135 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
135 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args); |
|
136 | 136 | |
137 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
137 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args); |
|
138 | 138 | } else { |
139 | 139 | $canvas_jason = '[{"totalcount":"0"}]'; |
140 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
140 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param string $canvas Map canvas array key. |
150 | 150 | * @param array $map_canvas_jason_args Map canvas args. |
151 | 151 | */ |
152 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args); |
|
153 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args); |
|
152 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args); |
|
153 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | |
215 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
215 | + $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
216 | 216 | |
217 | 217 | $geodir_cat_icons = geodir_get_term_icon(); |
218 | 218 | |
219 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place'; |
|
219 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place'; |
|
220 | 220 | $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt; |
221 | 221 | foreach ($cat_terms as $cat_term): |
222 | 222 | |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | |
231 | 231 | // Untick the category by default on home map |
232 | 232 | if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) { |
233 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $cat_term->term_id, $geodir_home_map_untick)) { |
|
233 | + if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$cat_term->term_id, $geodir_home_map_untick)) { |
|
234 | 234 | $checked = ''; |
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
239 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
240 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
241 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
242 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
238 | + $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"'; |
|
239 | + $term_check .= ' name="'.$map_canvas_name.'_cat[]" '; |
|
240 | + $term_check .= ' title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">'; |
|
241 | + $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>'; |
|
242 | + $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>'; |
|
243 | 243 | |
244 | 244 | endif; |
245 | 245 | |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | * @package GeoDirectory |
352 | 352 | */ |
353 | 353 | function geodir_map_load_style() { |
354 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) { |
|
354 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) { |
|
355 | 355 | ?> |
356 | 356 | <script type="text/javascript"> |
357 | 357 | if (!(window.google && typeof google.maps !== 'undefined')) { |
358 | - document.write('<' + 'link id="geodirectory-leaflet-style-css" media="all" type="text/css" href="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>" rel="stylesheet"' + '>'); |
|
359 | - document.write('<' + 'link id="geodirectory-leaflet-routing-style" media="all" type="text/css" href="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>" rel="stylesheet"' + '>'); |
|
358 | + document.write('<' + 'link id="geodirectory-leaflet-style-css" media="all" type="text/css" href="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>" rel="stylesheet"' + '>'); |
|
359 | + document.write('<' + 'link id="geodirectory-leaflet-routing-style" media="all" type="text/css" href="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>" rel="stylesheet"' + '>'); |
|
360 | 360 | } |
361 | 361 | </script> |
362 | 362 | <?php |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | * @package GeoDirectory |
373 | 373 | */ |
374 | 374 | function geodir_map_load_script() { |
375 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) { |
|
375 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) { |
|
376 | 376 | ?> |
377 | 377 | <script type="text/javascript"> |
378 | 378 | if (!(window.google && typeof google.maps !== 'undefined')) { |
379 | - document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>'); |
|
380 | - document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>'); |
|
381 | - document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo geodir_plugin_url();?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>'); |
|
379 | + document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>'); |
|
380 | + document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>'); |
|
381 | + document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo geodir_plugin_url(); ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>'); |
|
382 | 382 | } |
383 | 383 | </script> |
384 | 384 | <?php |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | |
130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
131 | 131 | } else { |
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
136 | 136 | } else { |
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | 170 | // Set default map options |
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true); |
|
173 | 173 | |
174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
175 | 175 | |
@@ -188,41 +188,41 @@ discard block |
||
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | 190 | ?> |
191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
197 | 197 | |
198 | 198 | <div class="map_background"> |
199 | 199 | <div class="top_banner_section_in clearfix"> |
200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
204 | 204 | <!-- new map start --> |
205 | 205 | <div class="iprelative"> |
206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
210 | 210 | <!--<div id="home_map_counter"></div> --> |
211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
213 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div> |
215 | 215 | </div> |
216 | 216 | <!-- new map end --> |
217 | 217 | </div> |
218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
219 | 219 | </div> |
220 | 220 | </div> |
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
223 | 223 | <?php } else { |
224 | 224 | ?> |
225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
226 | 226 | <?php } |
227 | 227 | |
228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/> |
243 | 243 | |
244 | 244 | <script> |
245 | - <?php if(geodir_is_page('detail')){?> |
|
245 | + <?php if (geodir_is_page('detail')) {?> |
|
246 | 246 | jQuery(function () { |
247 | 247 | gd_initialize_ac(); |
248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // Create the autocomplete object, restricting the search |
254 | 254 | // to geographical location types. |
255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')), |
|
256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')), |
|
257 | 257 | {types: ['geocode']}); |
258 | 258 | // When the user selects an address from the dropdown, |
259 | 259 | // populate the address fields in the form. |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | if (window.gdMaps == 'osm') { |
268 | 268 | window.setTimeout(function() { |
269 | - calcRoute('<?php echo $map_canvas_name;?>'); |
|
269 | + calcRoute('<?php echo $map_canvas_name; ?>'); |
|
270 | 270 | }, 1000); |
271 | 271 | } |
272 | 272 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
322 | 322 | ?> |
323 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
323 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
324 | 324 | <?php |
325 | 325 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
326 | 326 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | } |
331 | 331 | ?> |
332 | 332 | <div |
333 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
333 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
334 | 334 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
335 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
336 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
337 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?> |
|
338 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
335 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
336 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
337 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?> |
|
338 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
339 | 339 | <input |
340 | 340 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}" |
341 | 341 | type="text" |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
348 | 348 | <?php } else {$child_collapse = "0"; |
349 | 349 | ?> |
350 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
350 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
351 | 351 | <?php } ?> |
352 | 352 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
353 | 353 | <div class="toggle"> |
354 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
354 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
355 | 355 | <script>jQuery( document ).ready(function() { |
356 | 356 | geodir_show_sub_cat_collapse_button(); |
357 | 357 | });</script> |
@@ -379,21 +379,21 @@ discard block |
||
379 | 379 | $city = $country != 'me' ? $city : ''; |
380 | 380 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
381 | 381 | ?> |
382 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
383 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
384 | - value="<?php echo $country;?>"/> |
|
385 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
386 | - value="<?php echo $region;?>"/> |
|
387 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
388 | - value="<?php echo $city;?>"/> |
|
389 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
390 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
382 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
383 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
384 | + value="<?php echo $country; ?>"/> |
|
385 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
386 | + value="<?php echo $region; ?>"/> |
|
387 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
388 | + value="<?php echo $city; ?>"/> |
|
389 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
390 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
391 | 391 | <?php } else { //end of location filter |
392 | 392 | ?> |
393 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
393 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
394 | 394 | <?php }?> |
395 | 395 | |
396 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
396 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
397 | 397 | |
398 | 398 | <input type="hidden" name="limitstart" value=""/> |
399 | 399 | |
@@ -401,10 +401,10 @@ discard block |
||
401 | 401 | |
402 | 402 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
403 | 403 | $post_types = geodir_get_posttypes('object'); |
404 | - if (count((array)($post_types)) > 1) { |
|
404 | + if (count((array) ($post_types)) > 1) { |
|
405 | 405 | ?> |
406 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
407 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
406 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
407 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
408 | 408 | |
409 | 409 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
410 | 410 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | foreach ($post_types as $post_type => $args) { |
416 | 416 | if (!in_array($post_type, $exclude_post_types)) { |
417 | 417 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
418 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
418 | + echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__(ucfirst($args->labels->name), 'geodirectory').'</a></li>'; |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | ?> |
@@ -440,9 +440,9 @@ discard block |
||
440 | 440 | <script type="text/javascript"> |
441 | 441 | |
442 | 442 | jQuery(document).ready(function () { |
443 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice |
|
444 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false); |
|
445 | - map_sticky('<?php echo $map_canvas_name;?>'); |
|
443 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice |
|
444 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false); |
|
445 | + map_sticky('<?php echo $map_canvas_name; ?>'); |
|
446 | 446 | }); |
447 | 447 | |
448 | 448 | </script> |
@@ -453,18 +453,18 @@ discard block |
||
453 | 453 | <script> |
454 | 454 | (function () { |
455 | 455 | var screenH = jQuery(window).height(); |
456 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>"; |
|
456 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>"; |
|
457 | 457 | |
458 | 458 | var ptypeH = ''; |
459 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
460 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
459 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
460 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
461 | 461 | } |
462 | 462 | |
463 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
464 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
465 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px'); |
|
466 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
467 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
463 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
464 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
465 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px'); |
|
466 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
467 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
468 | 468 | |
469 | 469 | }()); |
470 | 470 | </script> |
@@ -476,13 +476,13 @@ discard block |
||
476 | 476 | <script> |
477 | 477 | (function () { |
478 | 478 | var screenH = jQuery(window).height(); |
479 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>"; |
|
479 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>"; |
|
480 | 480 | var ptypeH = ''; |
481 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
482 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
481 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
482 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
483 | 483 | } |
484 | 484 | |
485 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
485 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
486 | 486 | |
487 | 487 | }()); |
488 | 488 | </script> |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * @param array $geodir_map_options Array of map settings. |
498 | 498 | * @param string $map_canvas_name The canvas name and ID for the map. |
499 | 499 | */ |
500 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
500 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name); |
|
501 | 501 | |
502 | 502 | |
503 | 503 | endif; // Exclude posttypes if end |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | // If this file is called directly, abort. |
11 | 11 | if (!defined('WPINC')) { |
12 | - die; |
|
12 | + die; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function gdsc_validate_measurements($value) |
24 | 24 | { |
25 | - if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | - // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | - $value = preg_replace('/\D/', '', $value); |
|
28 | - if (100 < $value) { |
|
29 | - $value = 100; |
|
30 | - } |
|
31 | - // Re-add the percent symbol |
|
32 | - $value = $value . '%'; |
|
33 | - } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | - // Get the absint & re-add the 'px' |
|
35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | - } else { |
|
37 | - $value = preg_replace('/\D/', '', $value); |
|
38 | - } |
|
25 | + if ((strlen($value) - 1) == strpos(trim($value), '%')) { |
|
26 | + // $value is entered as a percent, so it can't be less than 0 or more than 100 |
|
27 | + $value = preg_replace('/\D/', '', $value); |
|
28 | + if (100 < $value) { |
|
29 | + $value = 100; |
|
30 | + } |
|
31 | + // Re-add the percent symbol |
|
32 | + $value = $value . '%'; |
|
33 | + } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
|
34 | + // Get the absint & re-add the 'px' |
|
35 | + $value = preg_replace('/\D/', '', $value) . 'px'; |
|
36 | + } else { |
|
37 | + $value = preg_replace('/\D/', '', $value); |
|
38 | + } |
|
39 | 39 | |
40 | - return $value; |
|
40 | + return $value; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -52,35 +52,35 @@ discard block |
||
52 | 52 | function gdsc_validate_map_args($params) |
53 | 53 | { |
54 | 54 | |
55 | - $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | - $params['height'] = gdsc_validate_measurements($params['height']); |
|
55 | + $params['width'] = gdsc_validate_measurements($params['width']); |
|
56 | + $params['height'] = gdsc_validate_measurements($params['height']); |
|
57 | 57 | |
58 | - // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | - if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | - $params['maptype'] = 'ROADMAP'; |
|
61 | - } else { |
|
62 | - $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | - } |
|
58 | + // Only accept our 4 maptypes. Otherwise, revert to the default. |
|
59 | + if (!(in_array(geodir_strtoupper($params['maptype']), array('HYBRID', 'SATELLITE', 'ROADMAP', 'TERRAIN')))) { |
|
60 | + $params['maptype'] = 'ROADMAP'; |
|
61 | + } else { |
|
62 | + $params['maptype'] = geodir_strtoupper($params['maptype']); |
|
63 | + } |
|
64 | 64 | |
65 | - // Zoom accepts a value between 1 and 19 |
|
66 | - $params['zoom'] = absint($params['zoom']); |
|
67 | - if (19 < $params['zoom']) { |
|
68 | - $params['zoom'] = '19'; |
|
69 | - } |
|
70 | - if (0 == $params['zoom']) { |
|
71 | - $params['zoom'] = '1'; |
|
72 | - } |
|
65 | + // Zoom accepts a value between 1 and 19 |
|
66 | + $params['zoom'] = absint($params['zoom']); |
|
67 | + if (19 < $params['zoom']) { |
|
68 | + $params['zoom'] = '19'; |
|
69 | + } |
|
70 | + if (0 == $params['zoom']) { |
|
71 | + $params['zoom'] = '1'; |
|
72 | + } |
|
73 | 73 | |
74 | - // Child_collapse must be boolean |
|
75 | - $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
74 | + // Child_collapse must be boolean |
|
75 | + $params['child_collapse'] = gdsc_to_bool_val($params['child_collapse']); |
|
76 | 76 | |
77 | - // Scrollwheel must be boolean |
|
78 | - $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
77 | + // Scrollwheel must be boolean |
|
78 | + $params['scrollwheel'] = gdsc_to_bool_val($params['scrollwheel']); |
|
79 | 79 | |
80 | - // Scrollwheel must be boolean |
|
81 | - $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
80 | + // Scrollwheel must be boolean |
|
81 | + $params['autozoom'] = gdsc_to_bool_val($params['autozoom']); |
|
82 | 82 | |
83 | - return $params; |
|
83 | + return $params; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -99,52 +99,52 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function gdsc_to_bool_val($in, $strict = false) |
101 | 101 | { |
102 | - $out = null; |
|
103 | - |
|
104 | - // if not strict, we only have to check if something is false |
|
105 | - if (in_array($in, array( |
|
106 | - 'false', |
|
107 | - 'False', |
|
108 | - 'FALSE', |
|
109 | - 'no', |
|
110 | - 'No', |
|
111 | - 'n', |
|
112 | - 'N', |
|
113 | - '0', |
|
114 | - 'off', |
|
115 | - 'Off', |
|
116 | - 'OFF', |
|
117 | - false, |
|
118 | - 0, |
|
119 | - null |
|
120 | - ), true)) { |
|
121 | - $out = false; |
|
122 | - } else if ($strict) { |
|
123 | - // if strict, check the equivalent true values |
|
124 | - if (in_array($in, array( |
|
125 | - 'true', |
|
126 | - 'True', |
|
127 | - 'TRUE', |
|
128 | - 'yes', |
|
129 | - 'Yes', |
|
130 | - 'y', |
|
131 | - 'Y', |
|
132 | - '1', |
|
133 | - 'on', |
|
134 | - 'On', |
|
135 | - 'ON', |
|
136 | - true, |
|
137 | - 1 |
|
138 | - ), true)) { |
|
139 | - $out = true; |
|
140 | - } |
|
141 | - } else { |
|
142 | - // not strict? let the regular php bool check figure it out (will |
|
143 | - // largely default to true) |
|
144 | - $out = ($in ? true : false); |
|
145 | - } |
|
102 | + $out = null; |
|
103 | + |
|
104 | + // if not strict, we only have to check if something is false |
|
105 | + if (in_array($in, array( |
|
106 | + 'false', |
|
107 | + 'False', |
|
108 | + 'FALSE', |
|
109 | + 'no', |
|
110 | + 'No', |
|
111 | + 'n', |
|
112 | + 'N', |
|
113 | + '0', |
|
114 | + 'off', |
|
115 | + 'Off', |
|
116 | + 'OFF', |
|
117 | + false, |
|
118 | + 0, |
|
119 | + null |
|
120 | + ), true)) { |
|
121 | + $out = false; |
|
122 | + } else if ($strict) { |
|
123 | + // if strict, check the equivalent true values |
|
124 | + if (in_array($in, array( |
|
125 | + 'true', |
|
126 | + 'True', |
|
127 | + 'TRUE', |
|
128 | + 'yes', |
|
129 | + 'Yes', |
|
130 | + 'y', |
|
131 | + 'Y', |
|
132 | + '1', |
|
133 | + 'on', |
|
134 | + 'On', |
|
135 | + 'ON', |
|
136 | + true, |
|
137 | + 1 |
|
138 | + ), true)) { |
|
139 | + $out = true; |
|
140 | + } |
|
141 | + } else { |
|
142 | + // not strict? let the regular php bool check figure it out (will |
|
143 | + // largely default to true) |
|
144 | + $out = ($in ? true : false); |
|
145 | + } |
|
146 | 146 | |
147 | - return $out; |
|
147 | + return $out; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | */ |
158 | 158 | function gdsc_is_post_type_valid($incoming_post_type) |
159 | 159 | { |
160 | - $post_types = geodir_get_posttypes(); |
|
161 | - $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | - $post_type_found = false; |
|
163 | - foreach ($post_types as $type) { |
|
164 | - if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | - $post_type_found = true; |
|
166 | - } |
|
167 | - } |
|
160 | + $post_types = geodir_get_posttypes(); |
|
161 | + $post_types = array_map('geodir_strtolower', $post_types); |
|
162 | + $post_type_found = false; |
|
163 | + foreach ($post_types as $type) { |
|
164 | + if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) { |
|
165 | + $post_type_found = true; |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - return $post_type_found; |
|
169 | + return $post_type_found; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -186,52 +186,52 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function gdsc_listing_loop_filter($query) |
188 | 188 | { |
189 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | - |
|
191 | - $geodir_post_type = geodir_get_current_posttype(); |
|
192 | - |
|
193 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | - |
|
196 | - if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | - $request_term = end($request_term); |
|
199 | - if (!term_exists($request_term)) { |
|
200 | - $args = array('number' => '1',); |
|
201 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | - foreach ($terms_arr as $location_term) { |
|
203 | - $term_arr = $location_term; |
|
204 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | - } |
|
206 | - $wp_query->queried_object_id = 1; |
|
207 | - $wp_query->queried_object = $term_arr; |
|
208 | - } |
|
209 | - } |
|
189 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $term; |
|
190 | + |
|
191 | + $geodir_post_type = geodir_get_current_posttype(); |
|
192 | + |
|
193 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) { |
|
194 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
195 | + |
|
196 | + if (isset($wp_query->query[$taxonomies[0]])) { |
|
197 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]); |
|
198 | + $request_term = end($request_term); |
|
199 | + if (!term_exists($request_term)) { |
|
200 | + $args = array('number' => '1',); |
|
201 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
202 | + foreach ($terms_arr as $location_term) { |
|
203 | + $term_arr = $location_term; |
|
204 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term)); |
|
205 | + } |
|
206 | + $wp_query->queried_object_id = 1; |
|
207 | + $wp_query->queried_object = $term_arr; |
|
208 | + } |
|
209 | + } |
|
210 | 210 | |
211 | - } |
|
212 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
211 | + } |
|
212 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
|
213 | 213 | |
214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
214 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
215 | 215 | |
216 | - add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | - add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | - geodir_post_where(); |
|
219 | - if (!is_admin()) { |
|
220 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | - } |
|
216 | + add_filter('posts_fields', 'geodir_posts_fields', 1); |
|
217 | + add_filter('posts_join', 'geodir_posts_join', 1); |
|
218 | + geodir_post_where(); |
|
219 | + if (!is_admin()) { |
|
220 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
221 | + } |
|
222 | 222 | |
223 | - // advanced filter for popular post view widget |
|
224 | - global $wp_query; |
|
225 | - if (!is_admin()) { |
|
226 | - if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | - } |
|
229 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | - } |
|
223 | + // advanced filter for popular post view widget |
|
224 | + global $wp_query; |
|
225 | + if (!is_admin()) { |
|
226 | + if (!empty($wp_query->query['with_pics_only'])) { |
|
227 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000); |
|
228 | + } |
|
229 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000); |
|
230 | + } |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - return $query; |
|
234 | + return $query; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -245,40 +245,40 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function gdsc_manage_category_choice($post_type, $category) |
247 | 247 | { |
248 | - if (0 == $category || '' == $category) { |
|
249 | - return ''; |
|
250 | - } |
|
248 | + if (0 == $category || '' == $category) { |
|
249 | + return ''; |
|
250 | + } |
|
251 | 251 | |
252 | - if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | - return ''; |
|
254 | - } |
|
252 | + if (!(gdsc_is_post_type_valid($post_type))) { |
|
253 | + return ''; |
|
254 | + } |
|
255 | 255 | |
256 | - $taxonomies = geodir_get_taxonomies($post_type); |
|
256 | + $taxonomies = geodir_get_taxonomies($post_type); |
|
257 | 257 | |
258 | - $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
258 | + $categories = get_terms(array('taxonomy' => $taxonomies[0])); |
|
259 | 259 | |
260 | - $cat_id = 0; |
|
260 | + $cat_id = 0; |
|
261 | 261 | |
262 | - foreach ($categories as $cat) { |
|
263 | - if (is_numeric($category)) { |
|
264 | - if (absint($category) == $cat->term_id) { |
|
265 | - $cat_id = $cat->term_id; |
|
266 | - break; |
|
267 | - } |
|
268 | - } else { |
|
269 | - if ($category == $cat->slug) { |
|
270 | - $cat_id = $cat->term_id; |
|
271 | - break; |
|
272 | - } |
|
262 | + foreach ($categories as $cat) { |
|
263 | + if (is_numeric($category)) { |
|
264 | + if (absint($category) == $cat->term_id) { |
|
265 | + $cat_id = $cat->term_id; |
|
266 | + break; |
|
267 | + } |
|
268 | + } else { |
|
269 | + if ($category == $cat->slug) { |
|
270 | + $cat_id = $cat->term_id; |
|
271 | + break; |
|
272 | + } |
|
273 | 273 | |
274 | - if ($category == $cat->name) { |
|
275 | - $cat_id = $cat->term_id; |
|
276 | - break; |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
274 | + if ($category == $cat->name) { |
|
275 | + $cat_id = $cat->term_id; |
|
276 | + break; |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - return $cat_id; |
|
281 | + return $cat_id; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // @todo: Extract this |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * Adds the script in the page footer for the home page google map. |
289 | 289 | * |
290 | 290 | * @since 1.0.0 |
291 | - * @return string Print the script in page footer. |
|
291 | + * @return string Print the script in page footer. |
|
292 | 292 | */ |
293 | 293 | function geodir_home_map_add_script() |
294 | - { |
|
295 | - ?> |
|
294 | + { |
|
295 | + ?> |
|
296 | 296 | <script type="text/javascript"> |
297 | 297 | jQuery(document).ready(function () { |
298 | 298 | geoDirMapSlide(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | </script> |
367 | 367 | <?php |
368 | - } |
|
368 | + } |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function geodir_popular_category_add_scripts() |
378 | 378 | { |
379 | - ?> |
|
379 | + ?> |
|
380 | 380 | <script type="text/javascript"> |
381 | 381 | jQuery(function ($) { |
382 | 382 | $('.geodir-showcat').click(function () { |
@@ -406,56 +406,56 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function gdsc_validate_layout_choice($layout_choice) |
408 | 408 | { |
409 | - switch (geodir_strtolower($layout_choice)) { |
|
410 | - case 'list'; |
|
411 | - case 'one'; |
|
412 | - case 'one_column'; |
|
413 | - case 'onecolumn'; |
|
414 | - case '1'; |
|
415 | - $layout_choice = 'list'; |
|
416 | - break; |
|
417 | - case 'gridview_onehalf'; |
|
418 | - case 'two'; |
|
419 | - case 'two_column'; |
|
420 | - case 'two_columns'; |
|
421 | - case 'twocolumn'; |
|
422 | - case 'twocolumns'; |
|
423 | - case '2'; |
|
424 | - $layout_choice = 'gridview_onehalf'; |
|
425 | - break; |
|
426 | - case 'gridview_onethird'; |
|
427 | - case 'three'; |
|
428 | - case 'three_column'; |
|
429 | - case 'three_columns'; |
|
430 | - case 'threecolumn'; |
|
431 | - case 'threecolumns'; |
|
432 | - case '3'; |
|
433 | - $layout_choice = 'gridview_onethird'; |
|
434 | - break; |
|
435 | - case 'gridview_onefourth'; |
|
436 | - case 'four'; |
|
437 | - case 'four_column'; |
|
438 | - case 'four_columns'; |
|
439 | - case 'fourcolumn'; |
|
440 | - case 'fourcolumns'; |
|
441 | - case '4'; |
|
442 | - $layout_choice = 'gridview_onefourth'; |
|
443 | - break; |
|
444 | - case 'gridview_onefifth'; |
|
445 | - case 'five'; |
|
446 | - case 'five_column'; |
|
447 | - case 'five_columns'; |
|
448 | - case 'fivecolumn'; |
|
449 | - case 'fivecolumns'; |
|
450 | - case '5'; |
|
451 | - $layout_choice = 'gridview_onefifth'; |
|
452 | - break; |
|
453 | - default: |
|
454 | - $layout_choice = 'gridview_onehalf'; |
|
455 | - break; |
|
456 | - } |
|
409 | + switch (geodir_strtolower($layout_choice)) { |
|
410 | + case 'list'; |
|
411 | + case 'one'; |
|
412 | + case 'one_column'; |
|
413 | + case 'onecolumn'; |
|
414 | + case '1'; |
|
415 | + $layout_choice = 'list'; |
|
416 | + break; |
|
417 | + case 'gridview_onehalf'; |
|
418 | + case 'two'; |
|
419 | + case 'two_column'; |
|
420 | + case 'two_columns'; |
|
421 | + case 'twocolumn'; |
|
422 | + case 'twocolumns'; |
|
423 | + case '2'; |
|
424 | + $layout_choice = 'gridview_onehalf'; |
|
425 | + break; |
|
426 | + case 'gridview_onethird'; |
|
427 | + case 'three'; |
|
428 | + case 'three_column'; |
|
429 | + case 'three_columns'; |
|
430 | + case 'threecolumn'; |
|
431 | + case 'threecolumns'; |
|
432 | + case '3'; |
|
433 | + $layout_choice = 'gridview_onethird'; |
|
434 | + break; |
|
435 | + case 'gridview_onefourth'; |
|
436 | + case 'four'; |
|
437 | + case 'four_column'; |
|
438 | + case 'four_columns'; |
|
439 | + case 'fourcolumn'; |
|
440 | + case 'fourcolumns'; |
|
441 | + case '4'; |
|
442 | + $layout_choice = 'gridview_onefourth'; |
|
443 | + break; |
|
444 | + case 'gridview_onefifth'; |
|
445 | + case 'five'; |
|
446 | + case 'five_column'; |
|
447 | + case 'five_columns'; |
|
448 | + case 'fivecolumn'; |
|
449 | + case 'fivecolumns'; |
|
450 | + case '5'; |
|
451 | + $layout_choice = 'gridview_onefifth'; |
|
452 | + break; |
|
453 | + default: |
|
454 | + $layout_choice = 'gridview_onehalf'; |
|
455 | + break; |
|
456 | + } |
|
457 | 457 | |
458 | - return $layout_choice; |
|
458 | + return $layout_choice; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function gdsc_validate_sort_choice($sort_choice) |
470 | 470 | { |
471 | - $sorts = array( |
|
472 | - 'az', |
|
473 | - 'latest', |
|
474 | - 'featured', |
|
475 | - 'high_review', |
|
476 | - 'high_rating', |
|
477 | - 'random', |
|
478 | - ); |
|
479 | - |
|
480 | - if (!(in_array($sort_choice, $sorts))) { |
|
481 | - $sort_choice = 'latest'; |
|
482 | - } |
|
471 | + $sorts = array( |
|
472 | + 'az', |
|
473 | + 'latest', |
|
474 | + 'featured', |
|
475 | + 'high_review', |
|
476 | + 'high_rating', |
|
477 | + 'random', |
|
478 | + ); |
|
479 | + |
|
480 | + if (!(in_array($sort_choice, $sorts))) { |
|
481 | + $sort_choice = 'latest'; |
|
482 | + } |
|
483 | 483 | |
484 | - return $sort_choice; |
|
484 | + return $sort_choice; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -494,22 +494,22 @@ discard block |
||
494 | 494 | */ |
495 | 495 | function gdsc_validate_listing_width($width_choice) |
496 | 496 | { |
497 | - if (!(empty($width_choice))) { |
|
498 | - $width_choice = absint($width_choice); |
|
499 | - } else { |
|
500 | - return ''; |
|
501 | - } |
|
497 | + if (!(empty($width_choice))) { |
|
498 | + $width_choice = absint($width_choice); |
|
499 | + } else { |
|
500 | + return ''; |
|
501 | + } |
|
502 | 502 | |
503 | - if (100 < $width_choice) { |
|
504 | - $width_choice = 100; |
|
505 | - } |
|
503 | + if (100 < $width_choice) { |
|
504 | + $width_choice = 100; |
|
505 | + } |
|
506 | 506 | |
507 | - // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
508 | - if (10 > $width_choice) { |
|
509 | - $width_choice = 10; |
|
510 | - } |
|
507 | + // If listing_width is too narrow, it won't work, arbitrarily set to 10% here |
|
508 | + if (10 > $width_choice) { |
|
509 | + $width_choice = 10; |
|
510 | + } |
|
511 | 511 | |
512 | - return $width_choice; |
|
512 | + return $width_choice; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -522,18 +522,18 @@ discard block |
||
522 | 522 | */ |
523 | 523 | function gdsc_validate_list_filter_choice($filter_choice) |
524 | 524 | { |
525 | - $filters = array( |
|
526 | - 'all', |
|
527 | - 'today', |
|
528 | - 'upcoming', |
|
529 | - 'past', |
|
530 | - ); |
|
531 | - |
|
532 | - if (!(in_array($filter_choice, $filters))) { |
|
533 | - $filter_choice = 'all'; |
|
534 | - } |
|
525 | + $filters = array( |
|
526 | + 'all', |
|
527 | + 'today', |
|
528 | + 'upcoming', |
|
529 | + 'past', |
|
530 | + ); |
|
531 | + |
|
532 | + if (!(in_array($filter_choice, $filters))) { |
|
533 | + $filter_choice = 'all'; |
|
534 | + } |
|
535 | 535 | |
536 | - return $filter_choice; |
|
536 | + return $filter_choice; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @return string Listings HTML content. |
555 | 555 | */ |
556 | 556 | function geodir_sc_gd_listings_output($args = array()) { |
557 | - $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
557 | + $title = !empty($args['title']) ? __($args['title'], 'geodirectory') : ''; |
|
558 | 558 | $post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place'; |
559 | 559 | $category = !empty($args['category']) ? $args['category'] : '0'; |
560 | 560 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
@@ -564,17 +564,17 @@ discard block |
||
564 | 564 | $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
565 | 565 | $with_pagination = !empty($args['with_pagination']) ? true : false; |
566 | 566 | $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
567 | - $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
568 | - $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
569 | - /** |
|
570 | - * Filter the content text displayed when no listings found. |
|
571 | - * |
|
572 | - * @since 1.6.0 |
|
573 | - * |
|
574 | - * @param string $shortcode_content The shortcode content text. |
|
575 | - * @param array $args Array of arguements to filter listings. |
|
576 | - */ |
|
577 | - $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
567 | + $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
|
568 | + $tags = !empty($args['tags']) ? $args['tags'] : array(); |
|
569 | + /** |
|
570 | + * Filter the content text displayed when no listings found. |
|
571 | + * |
|
572 | + * @since 1.6.0 |
|
573 | + * |
|
574 | + * @param string $shortcode_content The shortcode content text. |
|
575 | + * @param array $args Array of arguements to filter listings. |
|
576 | + */ |
|
577 | + $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
|
578 | 578 | |
579 | 579 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
580 | 580 | $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
@@ -586,87 +586,87 @@ discard block |
||
586 | 586 | $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
587 | 587 | |
588 | 588 | $query_args = array( |
589 | - 'posts_per_page' => $post_number, |
|
590 | - 'is_geodir_loop' => true, |
|
591 | - 'gd_location' => $add_location_filter, |
|
592 | - 'post_type' => $post_type, |
|
593 | - 'order_by' => $list_sort, |
|
589 | + 'posts_per_page' => $post_number, |
|
590 | + 'is_geodir_loop' => true, |
|
591 | + 'gd_location' => $add_location_filter, |
|
592 | + 'post_type' => $post_type, |
|
593 | + 'order_by' => $list_sort, |
|
594 | 594 | 'pageno' => $pageno |
595 | - ); |
|
595 | + ); |
|
596 | 596 | |
597 | - if ($character_count >= 0) { |
|
598 | - $query_args['excerpt_length'] = $character_count; |
|
599 | - } |
|
597 | + if ($character_count >= 0) { |
|
598 | + $query_args['excerpt_length'] = $character_count; |
|
599 | + } |
|
600 | 600 | |
601 | - if (!empty($args['post_author'])) { |
|
602 | - $query_args['post_author'] = $args['post_author']; |
|
603 | - } |
|
601 | + if (!empty($args['post_author'])) { |
|
602 | + $query_args['post_author'] = $args['post_author']; |
|
603 | + } |
|
604 | 604 | |
605 | - if (!empty($args['show_featured_only'])) { |
|
606 | - $query_args['show_featured_only'] = 1; |
|
607 | - } |
|
605 | + if (!empty($args['show_featured_only'])) { |
|
606 | + $query_args['show_featured_only'] = 1; |
|
607 | + } |
|
608 | 608 | |
609 | - if (!empty($args['show_special_only'])) { |
|
610 | - $query_args['show_special_only'] = 1; |
|
611 | - } |
|
609 | + if (!empty($args['show_special_only'])) { |
|
610 | + $query_args['show_special_only'] = 1; |
|
611 | + } |
|
612 | 612 | |
613 | - if (!empty($args['with_pics_only'])) { |
|
614 | - $query_args['with_pics_only'] = 0; |
|
615 | - $query_args['featured_image_only'] = 1; |
|
616 | - } |
|
613 | + if (!empty($args['with_pics_only'])) { |
|
614 | + $query_args['with_pics_only'] = 0; |
|
615 | + $query_args['featured_image_only'] = 1; |
|
616 | + } |
|
617 | 617 | |
618 | - if (!empty($args['with_videos_only'])) { |
|
619 | - $query_args['with_videos_only'] = 1; |
|
620 | - } |
|
621 | - $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
618 | + if (!empty($args['with_videos_only'])) { |
|
619 | + $query_args['with_videos_only'] = 1; |
|
620 | + } |
|
621 | + $with_no_results = !empty($args['without_no_results']) ? false : true; |
|
622 | 622 | |
623 | - if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
624 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
623 | + if (!empty($category) && isset($category[0]) && $category[0] != '0') { |
|
624 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
625 | 625 | |
626 | - ######### WPML ######### |
|
627 | - if (function_exists('icl_object_id')) { |
|
628 | - $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
629 | - } |
|
630 | - ######### WPML ######### |
|
626 | + ######### WPML ######### |
|
627 | + if (function_exists('icl_object_id')) { |
|
628 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
629 | + } |
|
630 | + ######### WPML ######### |
|
631 | 631 | |
632 | - $tax_query = array( |
|
633 | - 'taxonomy' => $category_taxonomy[0], |
|
634 | - 'field' => 'id', |
|
635 | - 'terms' => $category |
|
636 | - ); |
|
632 | + $tax_query = array( |
|
633 | + 'taxonomy' => $category_taxonomy[0], |
|
634 | + 'field' => 'id', |
|
635 | + 'terms' => $category |
|
636 | + ); |
|
637 | 637 | |
638 | - $query_args['tax_query'] = array($tax_query); |
|
639 | - } |
|
638 | + $query_args['tax_query'] = array($tax_query); |
|
639 | + } |
|
640 | 640 | |
641 | - if (!empty($tags)) { |
|
642 | - // Clean tags |
|
643 | - if (!is_array($tags)) { |
|
644 | - $comma = _x(',', 'tag delimiter'); |
|
645 | - if ( ',' !== $comma ) { |
|
646 | - $tags = str_replace($comma, ',', $tags); |
|
647 | - } |
|
648 | - $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
649 | - $tags = array_map('trim', $tags); |
|
650 | - } |
|
641 | + if (!empty($tags)) { |
|
642 | + // Clean tags |
|
643 | + if (!is_array($tags)) { |
|
644 | + $comma = _x(',', 'tag delimiter'); |
|
645 | + if ( ',' !== $comma ) { |
|
646 | + $tags = str_replace($comma, ',', $tags); |
|
647 | + } |
|
648 | + $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
|
649 | + $tags = array_map('trim', $tags); |
|
650 | + } |
|
651 | 651 | |
652 | - if (!empty($tags)) { |
|
653 | - $tag_query = array( |
|
654 | - 'taxonomy' => $post_type . '_tags', |
|
655 | - 'field' => 'name', |
|
656 | - 'terms' => $tags |
|
657 | - ); |
|
658 | - |
|
659 | - if (!empty($query_args['tax_query'])) { |
|
660 | - $query_args['tax_query'][] = $tag_query; |
|
661 | - } else { |
|
662 | - $query_args['tax_query'] = array($tag_query); |
|
663 | - } |
|
664 | - } |
|
665 | - } |
|
652 | + if (!empty($tags)) { |
|
653 | + $tag_query = array( |
|
654 | + 'taxonomy' => $post_type . '_tags', |
|
655 | + 'field' => 'name', |
|
656 | + 'terms' => $tags |
|
657 | + ); |
|
658 | + |
|
659 | + if (!empty($query_args['tax_query'])) { |
|
660 | + $query_args['tax_query'][] = $tag_query; |
|
661 | + } else { |
|
662 | + $query_args['tax_query'] = array($tag_query); |
|
663 | + } |
|
664 | + } |
|
665 | + } |
|
666 | 666 | |
667 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
667 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
668 | 668 | |
669 | - if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
669 | + if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
670 | 670 | global $geodir_event_widget_listview; |
671 | 671 | $geodir_event_widget_listview = true; |
672 | 672 | |
@@ -681,16 +681,16 @@ discard block |
||
681 | 681 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
682 | 682 | } |
683 | 683 | $current_gridview_columns_widget = $gridview_columns_widget; |
684 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
685 | - ob_start(); |
|
684 | + $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
685 | + ob_start(); |
|
686 | 686 | if (!empty($widget_listings) || $with_no_results) { |
687 | 687 | if (!$geodir_ajax) { |
688 | - /** |
|
689 | - * Called before the shortcode [gd_listings] content is output. |
|
690 | - * |
|
691 | - * @since 1.0.0 |
|
692 | - */ |
|
693 | - do_action('geodir_before_sc_gd_listings'); |
|
688 | + /** |
|
689 | + * Called before the shortcode [gd_listings] content is output. |
|
690 | + * |
|
691 | + * @since 1.0.0 |
|
692 | + */ |
|
693 | + do_action('geodir_before_sc_gd_listings'); |
|
694 | 694 | ?> |
695 | 695 | <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
696 | 696 | <?php if ($title != '') { ?> |
@@ -701,63 +701,63 @@ discard block |
||
701 | 701 | <div class="gd-sc-loader"> |
702 | 702 | <div class="gd-sc-content"> |
703 | 703 | <?php } |
704 | - if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
705 | - if (strstr($layout, 'gridview')) { |
|
706 | - $listing_view_exp = explode('_', $layout); |
|
707 | - $gridview_columns_widget = $layout; |
|
708 | - $layout = $listing_view_exp[0]; |
|
709 | - } else { |
|
710 | - $gridview_columns_widget = ''; |
|
711 | - } |
|
712 | - |
|
713 | - /** |
|
714 | - * Filter the widget listing listview template. |
|
715 | - * |
|
716 | - * @since 1.0.0 |
|
717 | - * |
|
718 | - * @param string The template file to display listing. |
|
719 | - */ |
|
720 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
704 | + if (!(empty($widget_listings) && !empty($shortcode_content))) { |
|
705 | + if (strstr($layout, 'gridview')) { |
|
706 | + $listing_view_exp = explode('_', $layout); |
|
707 | + $gridview_columns_widget = $layout; |
|
708 | + $layout = $listing_view_exp[0]; |
|
709 | + } else { |
|
710 | + $gridview_columns_widget = ''; |
|
711 | + } |
|
712 | + |
|
713 | + /** |
|
714 | + * Filter the widget listing listview template. |
|
715 | + * |
|
716 | + * @since 1.0.0 |
|
717 | + * |
|
718 | + * @param string The template file to display listing. |
|
719 | + */ |
|
720 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
721 | 721 | |
722 | - global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
723 | - |
|
724 | - $current_post = $post; |
|
725 | - $current_map_jason = $map_jason; |
|
726 | - $current_map_canvas_arr = $map_canvas_arr; |
|
727 | - $geodir_is_widget_listing = true; |
|
728 | - $gd_session->un_set('gd_listing_view'); |
|
729 | - |
|
730 | - if ($with_pagination && $top_pagination) { |
|
731 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
732 | - } |
|
733 | - |
|
734 | - /** |
|
735 | - * Includes listing listview template. |
|
736 | - * |
|
737 | - * @since 1.0.0 |
|
738 | - */ |
|
739 | - include($template); |
|
722 | + global $post, $map_jason, $map_canvas_arr, $gd_session; |
|
723 | + |
|
724 | + $current_post = $post; |
|
725 | + $current_map_jason = $map_jason; |
|
726 | + $current_map_canvas_arr = $map_canvas_arr; |
|
727 | + $geodir_is_widget_listing = true; |
|
728 | + $gd_session->un_set('gd_listing_view'); |
|
729 | + |
|
730 | + if ($with_pagination && $top_pagination) { |
|
731 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
732 | + } |
|
733 | + |
|
734 | + /** |
|
735 | + * Includes listing listview template. |
|
736 | + * |
|
737 | + * @since 1.0.0 |
|
738 | + */ |
|
739 | + include($template); |
|
740 | 740 | |
741 | - if ($with_pagination && $bottom_pagination) { |
|
742 | - echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
743 | - } |
|
744 | - |
|
745 | - $geodir_is_widget_listing = false; |
|
746 | - |
|
747 | - $GLOBALS['post'] = $current_post; |
|
748 | - if (!empty($current_post)) { |
|
749 | - setup_postdata($current_post); |
|
750 | - } |
|
751 | - $map_jason = $current_map_jason; |
|
752 | - $map_canvas_arr = $current_map_canvas_arr; |
|
753 | - global $gridview_columns_widget; |
|
754 | - $gridview_columns_widget = $current_gridview_columns_widget; |
|
755 | - } else { |
|
756 | - echo $shortcode_content; |
|
757 | - } |
|
741 | + if ($with_pagination && $bottom_pagination) { |
|
742 | + echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno); |
|
743 | + } |
|
744 | + |
|
745 | + $geodir_is_widget_listing = false; |
|
746 | + |
|
747 | + $GLOBALS['post'] = $current_post; |
|
748 | + if (!empty($current_post)) { |
|
749 | + setup_postdata($current_post); |
|
750 | + } |
|
751 | + $map_jason = $current_map_jason; |
|
752 | + $map_canvas_arr = $current_map_canvas_arr; |
|
753 | + global $gridview_columns_widget; |
|
754 | + $gridview_columns_widget = $current_gridview_columns_widget; |
|
755 | + } else { |
|
756 | + echo $shortcode_content; |
|
757 | + } |
|
758 | 758 | ?> |
759 | 759 | <?php |
760 | - if (!$geodir_ajax) { |
|
760 | + if (!$geodir_ajax) { |
|
761 | 761 | ?> |
762 | 762 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> |
763 | 763 | <script type="text/javascript"> |
@@ -795,10 +795,10 @@ discard block |
||
795 | 795 | loading.hide(); |
796 | 796 | jQuery(items).html(response); |
797 | 797 | <?php |
798 | - /** |
|
799 | - * if lazyload images enabled then refresh them once ajax page changed. |
|
800 | - */ |
|
801 | - if (get_option('geodir_lazy_load', 1)) { ?> |
|
798 | + /** |
|
799 | + * if lazyload images enabled then refresh them once ajax page changed. |
|
800 | + */ |
|
801 | + if (get_option('geodir_lazy_load', 1)) { ?> |
|
802 | 802 | geodir_init_lazy_load(); |
803 | 803 | <?php } ?> |
804 | 804 | } |
@@ -808,11 +808,11 @@ discard block |
||
808 | 808 | </div> |
809 | 809 | <?php } ?> |
810 | 810 | <?php |
811 | - } |
|
811 | + } |
|
812 | 812 | $output = ob_get_contents(); |
813 | - ob_end_clean(); |
|
813 | + ob_end_clean(); |
|
814 | 814 | |
815 | - return trim($output); |
|
815 | + return trim($output); |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | /** |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | * @return string Listings pagination HTML content. |
840 | 840 | */ |
841 | 841 | function geodir_sc_listings_pagination($total_posts, $posts_per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
842 | - if (empty($prelabel)) { |
|
843 | - $prelabel = '<strong>«</strong>'; |
|
844 | - } |
|
842 | + if (empty($prelabel)) { |
|
843 | + $prelabel = '<strong>«</strong>'; |
|
844 | + } |
|
845 | 845 | |
846 | - if (empty($nxtlabel)) { |
|
847 | - $nxtlabel = '<strong>»</strong>'; |
|
848 | - } |
|
846 | + if (empty($nxtlabel)) { |
|
847 | + $nxtlabel = '<strong>»</strong>'; |
|
848 | + } |
|
849 | 849 | |
850 | - $half_pages_to_show = round($pages_to_show / 2); |
|
850 | + $half_pages_to_show = round($pages_to_show / 2); |
|
851 | 851 | |
852 | 852 | $numposts = $total_posts; |
853 | 853 | |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | if (($pageno - 1) > 0) { |
883 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
883 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -903,9 +903,9 @@ discard block |
||
903 | 903 | echo "</div> $after </div>"; |
904 | 904 | } |
905 | 905 | $output = ob_get_contents(); |
906 | - ob_end_clean(); |
|
906 | + ob_end_clean(); |
|
907 | 907 | |
908 | - return trim($output); |
|
908 | + return trim($output); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -916,10 +916,10 @@ discard block |
||
916 | 916 | * @return string Listings HTML content. |
917 | 917 | */ |
918 | 918 | function geodir_sclistings_callback() { |
919 | - check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
920 | - //set variables |
|
921 | - $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
922 | - $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
919 | + check_ajax_referer('geodir-sclistings-nonce', 'geodir_sclistings_nonce'); |
|
920 | + //set variables |
|
921 | + $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
|
922 | + $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
|
923 | 923 | |
924 | 924 | $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
925 | 925 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | } else { |
932 | 932 | echo 0; |
933 | 933 | } |
934 | - wp_die(); |
|
934 | + wp_die(); |
|
935 | 935 | } |
936 | 936 | add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback'); |
937 | 937 | add_action('wp_ajax_nopriv_geodir_sclistings', 'geodir_sclistings_callback'); |
938 | 938 | \ No newline at end of file |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | $value = 100; |
30 | 30 | } |
31 | 31 | // Re-add the percent symbol |
32 | - $value = $value . '%'; |
|
32 | + $value = $value.'%'; |
|
33 | 33 | } elseif ((strlen($value) - 2) == strpos(trim($value), 'px')) { |
34 | 34 | // Get the absint & re-add the 'px' |
35 | - $value = preg_replace('/\D/', '', $value) . 'px'; |
|
35 | + $value = preg_replace('/\D/', '', $value).'px'; |
|
36 | 36 | } else { |
37 | 37 | $value = preg_replace('/\D/', '', $value); |
38 | 38 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
213 | 213 | |
214 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
214 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
215 | 215 | |
216 | 216 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
217 | 217 | add_filter('posts_join', 'geodir_posts_join', 1); |
@@ -560,10 +560,10 @@ discard block |
||
560 | 560 | $post_number = !empty($args['post_number']) ? $args['post_number'] : 10; |
561 | 561 | $add_location_filter = !empty($args['add_location_filter']) ? true : false; |
562 | 562 | $list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest'; |
563 | - $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
|
564 | - $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
565 | - $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
566 | - $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
563 | + $character_count = isset($args['character_count']) ? $args['character_count'] : ''; |
|
564 | + $layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf'; |
|
565 | + $with_pagination = !empty($args['with_pagination']) ? true : false; |
|
566 | + $event_type = !empty($args['event_type']) ? $args['event_type'] : ''; |
|
567 | 567 | $shortcode_content = !empty($args['shortcode_content']) ? trim($args['shortcode_content']) : ''; |
568 | 568 | $tags = !empty($args['tags']) ? $args['tags'] : array(); |
569 | 569 | /** |
@@ -577,13 +577,13 @@ discard block |
||
577 | 577 | $shortcode_content = apply_filters('geodir_sc_gd_listings_not_found_content', $shortcode_content, $args); |
578 | 578 | |
579 | 579 | $top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false; |
580 | - $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
580 | + $bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false; |
|
581 | 581 | |
582 | 582 | $shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array(); |
583 | 583 | |
584 | 584 | // ajax mode |
585 | - $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
586 | - $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
585 | + $geodir_ajax = !empty($args['geodir_ajax']) ? true : false; |
|
586 | + $pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1; |
|
587 | 587 | |
588 | 588 | $query_args = array( |
589 | 589 | 'posts_per_page' => $post_number, |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | // Clean tags |
643 | 643 | if (!is_array($tags)) { |
644 | 644 | $comma = _x(',', 'tag delimiter'); |
645 | - if ( ',' !== $comma ) { |
|
645 | + if (',' !== $comma) { |
|
646 | 646 | $tags = str_replace($comma, ',', $tags); |
647 | 647 | } |
648 | 648 | $tags = explode(',', trim($tags, " \n\t\r\0\x0B,")); |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | |
652 | 652 | if (!empty($tags)) { |
653 | 653 | $tag_query = array( |
654 | - 'taxonomy' => $post_type . '_tags', |
|
654 | + 'taxonomy' => $post_type.'_tags', |
|
655 | 655 | 'field' => 'name', |
656 | 656 | 'terms' => $tags |
657 | 657 | ); |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array(); |
682 | 682 | } |
683 | 683 | $current_gridview_columns_widget = $gridview_columns_widget; |
684 | - $identifier = ' gd-wgt-pagi-' . mt_rand(); |
|
684 | + $identifier = ' gd-wgt-pagi-'.mt_rand(); |
|
685 | 685 | ob_start(); |
686 | 686 | if (!empty($widget_listings) || $with_no_results) { |
687 | 687 | if (!$geodir_ajax) { |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | */ |
693 | 693 | do_action('geodir_before_sc_gd_listings'); |
694 | 694 | ?> |
695 | - <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier;?>"> |
|
695 | + <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings <?php echo $identifier; ?>"> |
|
696 | 696 | <?php if ($title != '') { ?> |
697 | 697 | <div class="geodir_list_heading clearfix"> |
698 | 698 | <?php echo $title; ?> |
@@ -761,8 +761,8 @@ discard block |
||
761 | 761 | ?> |
762 | 762 | </div><p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p></div> |
763 | 763 | <script type="text/javascript"> |
764 | -jQuery(document).on('click', '.<?php echo trim($identifier);?> .gd-wgt-page', function(e) { |
|
765 | - var container = jQuery( '.<?php echo trim($identifier);?>'); |
|
764 | +jQuery(document).on('click', '.<?php echo trim($identifier); ?> .gd-wgt-page', function(e) { |
|
765 | + var container = jQuery( '.<?php echo trim($identifier); ?>'); |
|
766 | 766 | var obj = this; |
767 | 767 | var pid = parseInt(jQuery(this).data('page')); |
768 | 768 | var items = jQuery(obj).closest('.gd-sc-content'); |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | return false; |
773 | 773 | } |
774 | 774 | |
775 | - var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>"; |
|
775 | + var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>"; |
|
776 | 776 | |
777 | 777 | var data = { |
778 | 778 | 'action': 'geodir_sclistings', |
@@ -861,16 +861,16 @@ discard block |
||
861 | 861 | if ($max_page > 1 || $always_show) { |
862 | 862 | // Extra pagination info |
863 | 863 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
864 | - $start_no = ( $pageno - 1 ) * $posts_per_page + 1; |
|
864 | + $start_no = ($pageno - 1) * $posts_per_page + 1; |
|
865 | 865 | $end_no = min($pageno * $posts_per_page, $numposts); |
866 | 866 | |
867 | 867 | if ($geodir_pagination_more_info != '') { |
868 | - $pagination_info = '<div class="gd-pagination-details gd-pagination-details-' . $geodir_pagination_more_info . '">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>'; |
|
868 | + $pagination_info = '<div class="gd-pagination-details gd-pagination-details-'.$geodir_pagination_more_info.'">'.wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts).'</div>'; |
|
869 | 869 | |
870 | 870 | if ($geodir_pagination_more_info == 'before') { |
871 | - $before = $before . $pagination_info; |
|
871 | + $before = $before.$pagination_info; |
|
872 | 872 | } else if ($geodir_pagination_more_info == 'after') { |
873 | - $after = $pagination_info . $after; |
|
873 | + $after = $pagination_info.$after; |
|
874 | 874 | } |
875 | 875 | } |
876 | 876 | |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | if (($pageno - 1) > 0) { |
883 | - echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="' . (int)($pageno - 1) . '" href="javascript:void(0);">' . $prelabel . '</a> '; |
|
883 | + echo '<a class="gd-page-sc-prev gd-wgt-page" data-page="'.(int) ($pageno - 1).'" href="javascript:void(0);">'.$prelabel.'</a> '; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) { |
@@ -888,17 +888,17 @@ discard block |
||
888 | 888 | if ($i == $pageno) { |
889 | 889 | echo "<strong class='on' class='gd-page-sc-act'>$i</strong>"; |
890 | 890 | } else { |
891 | - echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="' . (int)$i . '" href="javascript:void(0);">' . $i . '</a> '; |
|
891 | + echo ' <a class="gd-page-sc-no gd-wgt-page" data-page="'.(int) $i.'" href="javascript:void(0);">'.$i.'</a> '; |
|
892 | 892 | } |
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
896 | 896 | if (($pageno + 1) <= $max_page) { |
897 | - echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="' . (int)($pageno + 1) . '" href="javascript:void(0);">' . $nxtlabel . '</a>'; |
|
897 | + echo ' <a class="gd-page-sc-nxt gd-wgt-page" data-page="'.(int) ($pageno + 1).'" href="javascript:void(0);">'.$nxtlabel.'</a>'; |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | if ($pageno < $max_page) { |
901 | - echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="' . (int)$max_page . '" href="javascript:void(0);">»</a>'; |
|
901 | + echo ' <a class="gd-page-sc-lst gd-wgt-page" data-page="'.(int) $max_page.'" href="javascript:void(0);">»</a>'; |
|
902 | 902 | } |
903 | 903 | echo "</div> $after </div>"; |
904 | 904 | } |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL; |
922 | 922 | $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1; |
923 | 923 | |
924 | - $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL; |
|
924 | + $shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL; |
|
925 | 925 | |
926 | 926 | if (!empty($shortcode_atts) && is_array($shortcode_atts)) { |
927 | 927 | $shortcode_atts['pageno'] = $pageno; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function geodir_get_ajax_url() |
21 | 21 | { |
22 | - return admin_url('admin-ajax.php?action=geodir_ajax_action'); |
|
22 | + return admin_url('admin-ajax.php?action=geodir_ajax_action'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | ///////////////////// |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var'); |
88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8 |
89 | 89 | if (get_option('permalink_structure') != '') |
90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
91 | 91 | |
92 | 92 | add_filter('parse_query', 'geodir_modified_query'); |
93 | 93 | |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | /* POST AND LOOP ACTIONS */ |
155 | 155 | //////////////////////// |
156 | 156 | if (!is_admin()) { |
157 | - add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere |
|
158 | - add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100); |
|
159 | - /** Exclude Virtual Pages From Pages List **/ |
|
160 | - add_action('pre_get_posts', 'set_listing_request', 0); |
|
161 | - add_action('pre_get_posts', 'geodir_listing_loop_filter', 1); |
|
162 | - add_filter('excerpt_more', 'geodir_excerpt_more', 1000); |
|
163 | - add_filter('excerpt_length', 'geodir_excerpt_length', 1000); |
|
164 | - add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter |
|
157 | + add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere |
|
158 | + add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100); |
|
159 | + /** Exclude Virtual Pages From Pages List **/ |
|
160 | + add_action('pre_get_posts', 'set_listing_request', 0); |
|
161 | + add_action('pre_get_posts', 'geodir_listing_loop_filter', 1); |
|
162 | + add_filter('excerpt_more', 'geodir_excerpt_more', 1000); |
|
163 | + add_filter('excerpt_length', 'geodir_excerpt_length', 1000); |
|
164 | + add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | */ |
223 | 223 | function geodir_unset_prev_theme_nav_location($newname) |
224 | 224 | { |
225 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
226 | - if ($geodir_theme_location) { |
|
227 | - update_option('geodir_theme_location_nav', $geodir_theme_location); |
|
228 | - } else { |
|
229 | - update_option('geodir_theme_location_nav', ''); |
|
230 | - } |
|
225 | + $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
226 | + if ($geodir_theme_location) { |
|
227 | + update_option('geodir_theme_location_nav', $geodir_theme_location); |
|
228 | + } else { |
|
229 | + update_option('geodir_theme_location_nav', ''); |
|
230 | + } |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /// add action for theme switch to blank previous theme navigation location setting |
@@ -248,32 +248,32 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function geodir_add_post_filters() |
250 | 250 | { |
251 | - /** |
|
252 | - * Contains all function for filtering listing. |
|
253 | - * |
|
254 | - * @since 1.0.0 |
|
255 | - * @package GeoDirectory |
|
256 | - */ |
|
257 | - include_once('geodirectory-functions/listing_filters.php'); |
|
251 | + /** |
|
252 | + * Contains all function for filtering listing. |
|
253 | + * |
|
254 | + * @since 1.0.0 |
|
255 | + * @package GeoDirectory |
|
256 | + */ |
|
257 | + include_once('geodirectory-functions/listing_filters.php'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | 261 | if (!function_exists('geodir_init_defaults')) { |
262 | - /** |
|
263 | - * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
264 | - * |
|
265 | - * @since 1.0.0 |
|
266 | - * @package GeoDirectory |
|
267 | - */ |
|
268 | - function geodir_init_defaults() |
|
269 | - { |
|
270 | - if (function_exists('geodir_register_defaults')) { |
|
262 | + /** |
|
263 | + * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
264 | + * |
|
265 | + * @since 1.0.0 |
|
266 | + * @package GeoDirectory |
|
267 | + */ |
|
268 | + function geodir_init_defaults() |
|
269 | + { |
|
270 | + if (function_exists('geodir_register_defaults')) { |
|
271 | 271 | |
272 | - geodir_register_defaults(); |
|
272 | + geodir_register_defaults(); |
|
273 | 273 | |
274 | - } |
|
274 | + } |
|
275 | 275 | |
276 | - } |
|
276 | + } |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -295,26 +295,26 @@ discard block |
||
295 | 295 | // CALLED ON 'sidebars_widgets' FILTER |
296 | 296 | |
297 | 297 | if (!function_exists('geodir_restrict_widget')) { |
298 | - /** |
|
299 | - * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
300 | - * |
|
301 | - * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
302 | - * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
303 | - * @since 1.0.0 |
|
304 | - * @package GeoDirectory |
|
305 | - */ |
|
306 | - function geodir_restrict_widget() |
|
307 | - { |
|
308 | - global $is_listing, $is_single_place; |
|
298 | + /** |
|
299 | + * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
300 | + * |
|
301 | + * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
302 | + * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
303 | + * @since 1.0.0 |
|
304 | + * @package GeoDirectory |
|
305 | + */ |
|
306 | + function geodir_restrict_widget() |
|
307 | + { |
|
308 | + global $is_listing, $is_single_place; |
|
309 | 309 | |
310 | - // set is listing |
|
311 | - (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false; |
|
310 | + // set is listing |
|
311 | + (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false; |
|
312 | 312 | |
313 | - // set is single place |
|
314 | - (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false; |
|
313 | + // set is single place |
|
314 | + (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false; |
|
315 | 315 | |
316 | 316 | |
317 | - } |
|
317 | + } |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -335,32 +335,32 @@ discard block |
||
335 | 335 | */ |
336 | 336 | function geodir_detail_page_sidebar_content_sorting() |
337 | 337 | { |
338 | - $arr_detail_page_sidebar_content = |
|
339 | - /** |
|
340 | - * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
341 | - * |
|
342 | - * This filter can be used to remove sections of the details page sidebar, |
|
343 | - * add new sections or rearrange the order of the sections. |
|
344 | - * |
|
345 | - * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called. |
|
346 | - * @since 1.0.0 |
|
347 | - */ |
|
348 | - apply_filters('geodir_detail_page_sidebar_content', |
|
349 | - array('geodir_social_sharing_buttons', |
|
350 | - 'geodir_share_this_button', |
|
351 | - 'geodir_detail_page_google_analytics', |
|
352 | - 'geodir_edit_post_link', |
|
353 | - 'geodir_detail_page_review_rating', |
|
354 | - 'geodir_detail_page_more_info' |
|
355 | - ) // end of array |
|
356 | - ); // end of apply filter |
|
357 | - if (!empty($arr_detail_page_sidebar_content)) { |
|
358 | - foreach ($arr_detail_page_sidebar_content as $content_function) { |
|
359 | - if (function_exists($content_function)) { |
|
360 | - add_action('geodir_detail_page_sidebar', $content_function); |
|
361 | - } |
|
362 | - } |
|
363 | - } |
|
338 | + $arr_detail_page_sidebar_content = |
|
339 | + /** |
|
340 | + * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
341 | + * |
|
342 | + * This filter can be used to remove sections of the details page sidebar, |
|
343 | + * add new sections or rearrange the order of the sections. |
|
344 | + * |
|
345 | + * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called. |
|
346 | + * @since 1.0.0 |
|
347 | + */ |
|
348 | + apply_filters('geodir_detail_page_sidebar_content', |
|
349 | + array('geodir_social_sharing_buttons', |
|
350 | + 'geodir_share_this_button', |
|
351 | + 'geodir_detail_page_google_analytics', |
|
352 | + 'geodir_edit_post_link', |
|
353 | + 'geodir_detail_page_review_rating', |
|
354 | + 'geodir_detail_page_more_info' |
|
355 | + ) // end of array |
|
356 | + ); // end of apply filter |
|
357 | + if (!empty($arr_detail_page_sidebar_content)) { |
|
358 | + foreach ($arr_detail_page_sidebar_content as $content_function) { |
|
359 | + if (function_exists($content_function)) { |
|
360 | + add_action('geodir_detail_page_sidebar', $content_function); |
|
361 | + } |
|
362 | + } |
|
363 | + } |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1); |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | */ |
376 | 376 | function geodir_add_to_favourite_link() |
377 | 377 | { |
378 | - global $post, $preview; |
|
379 | - if (!$preview && geodir_is_page('detail')) { |
|
380 | - ?> |
|
378 | + global $post, $preview; |
|
379 | + if (!$preview && geodir_is_page('detail')) { |
|
380 | + ?> |
|
381 | 381 | <p class="edit_link"> |
382 | 382 | <?php geodir_favourite_html($post->post_author, $post->ID); ?> |
383 | 383 | </p> |
384 | 384 | <?php |
385 | - } |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -396,41 +396,41 @@ discard block |
||
396 | 396 | */ |
397 | 397 | function geodir_social_sharing_buttons() |
398 | 398 | { |
399 | - global $preview; |
|
400 | - ob_start(); // Start buffering; |
|
401 | - /** |
|
402 | - * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
403 | - * |
|
404 | - * @since 1.0.0 |
|
405 | - */ |
|
406 | - do_action('geodir_before_social_sharing_buttons'); |
|
407 | - if (!$preview) { |
|
408 | - ?> |
|
399 | + global $preview; |
|
400 | + ob_start(); // Start buffering; |
|
401 | + /** |
|
402 | + * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
403 | + * |
|
404 | + * @since 1.0.0 |
|
405 | + */ |
|
406 | + do_action('geodir_before_social_sharing_buttons'); |
|
407 | + if (!$preview) { |
|
408 | + ?> |
|
409 | 409 | <div class="likethis"> |
410 | 410 | <?php geodir_twitter_tweet_button(); ?> |
411 | 411 | <?php geodir_fb_like_button(); ?> |
412 | 412 | <?php geodir_google_plus_button(); ?> |
413 | 413 | </div> |
414 | 414 | <?php |
415 | - }// end of if, if its a preview or not |
|
416 | - |
|
417 | - /** |
|
418 | - * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
419 | - * |
|
420 | - * @since 1.0.0 |
|
421 | - */ |
|
422 | - do_action('geodir_after_social_sharing_buttons'); |
|
423 | - $content_html = ob_get_clean(); |
|
424 | - if (trim($content_html) != '') |
|
425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
426 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
427 | - /** |
|
428 | - * Filter the geodir_social_sharing_buttons() function content. |
|
429 | - * |
|
430 | - * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
431 | - */ |
|
432 | - echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html); |
|
433 | - } |
|
415 | + }// end of if, if its a preview or not |
|
416 | + |
|
417 | + /** |
|
418 | + * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
419 | + * |
|
420 | + * @since 1.0.0 |
|
421 | + */ |
|
422 | + do_action('geodir_after_social_sharing_buttons'); |
|
423 | + $content_html = ob_get_clean(); |
|
424 | + if (trim($content_html) != '') |
|
425 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
426 | + if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
427 | + /** |
|
428 | + * Filter the geodir_social_sharing_buttons() function content. |
|
429 | + * |
|
430 | + * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
431 | + */ |
|
432 | + echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html); |
|
433 | + } |
|
434 | 434 | |
435 | 435 | |
436 | 436 | } |
@@ -446,39 +446,39 @@ discard block |
||
446 | 446 | */ |
447 | 447 | function geodir_share_this_button() |
448 | 448 | { |
449 | - global $preview; |
|
450 | - ob_start(); // Start buffering; |
|
451 | - /** |
|
452 | - * This is called before the share this html in the function geodir_share_this_button() |
|
453 | - * |
|
454 | - * @since 1.0.0 |
|
455 | - */ |
|
456 | - do_action('geodir_before_share_this_button'); |
|
457 | - if (!$preview) { |
|
458 | - ?> |
|
449 | + global $preview; |
|
450 | + ob_start(); // Start buffering; |
|
451 | + /** |
|
452 | + * This is called before the share this html in the function geodir_share_this_button() |
|
453 | + * |
|
454 | + * @since 1.0.0 |
|
455 | + */ |
|
456 | + do_action('geodir_before_share_this_button'); |
|
457 | + if (!$preview) { |
|
458 | + ?> |
|
459 | 459 | <div class="share clearfix"> |
460 | 460 | <?php geodir_share_this_button_code(); ?> |
461 | 461 | </div> |
462 | 462 | <?php |
463 | - }// end of if, if its a preview or not |
|
464 | - /** |
|
465 | - * This is called after the share this html in the function geodir_share_this_button() |
|
466 | - * |
|
467 | - * @since 1.0.0 |
|
468 | - */ |
|
469 | - do_action('geodir_after_share_this_button'); |
|
470 | - $content_html = ob_get_clean(); |
|
471 | - if (trim($content_html) != '') |
|
472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
473 | - if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
|
474 | - /** |
|
475 | - * Filter the geodir_share_this_button() function content. |
|
476 | - * |
|
477 | - * @param string $content_html The output html of the geodir_share_this_button() function. |
|
478 | - * @since 1.0.0 |
|
479 | - */ |
|
480 | - echo $content_html = apply_filters('geodir_share_this_button_html', $content_html); |
|
481 | - } |
|
463 | + }// end of if, if its a preview or not |
|
464 | + /** |
|
465 | + * This is called after the share this html in the function geodir_share_this_button() |
|
466 | + * |
|
467 | + * @since 1.0.0 |
|
468 | + */ |
|
469 | + do_action('geodir_after_share_this_button'); |
|
470 | + $content_html = ob_get_clean(); |
|
471 | + if (trim($content_html) != '') |
|
472 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
473 | + if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
|
474 | + /** |
|
475 | + * Filter the geodir_share_this_button() function content. |
|
476 | + * |
|
477 | + * @param string $content_html The output html of the geodir_share_this_button() function. |
|
478 | + * @since 1.0.0 |
|
479 | + */ |
|
480 | + echo $content_html = apply_filters('geodir_share_this_button_html', $content_html); |
|
481 | + } |
|
482 | 482 | |
483 | 483 | } |
484 | 484 | |
@@ -494,46 +494,46 @@ discard block |
||
494 | 494 | */ |
495 | 495 | function geodir_edit_post_link() |
496 | 496 | { |
497 | - global $post, $preview; |
|
498 | - ob_start(); // Start buffering; |
|
499 | - /** |
|
500 | - * This is called before the edit post link html in the function geodir_edit_post_link() |
|
501 | - * |
|
502 | - * @since 1.0.0 |
|
503 | - */ |
|
504 | - do_action('geodir_before_edit_post_link'); |
|
505 | - if (!$preview) { |
|
506 | - $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
497 | + global $post, $preview; |
|
498 | + ob_start(); // Start buffering; |
|
499 | + /** |
|
500 | + * This is called before the edit post link html in the function geodir_edit_post_link() |
|
501 | + * |
|
502 | + * @since 1.0.0 |
|
503 | + */ |
|
504 | + do_action('geodir_before_edit_post_link'); |
|
505 | + if (!$preview) { |
|
506 | + $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
507 | 507 | |
508 | - if ($is_current_user_owner) { |
|
509 | - $post_id = $post->ID; |
|
508 | + if ($is_current_user_owner) { |
|
509 | + $post_id = $post->ID; |
|
510 | 510 | |
511 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
512 | - $post_id = (int)$_REQUEST['pid']; |
|
513 | - } |
|
511 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
512 | + $post_id = (int)$_REQUEST['pid']; |
|
513 | + } |
|
514 | 514 | |
515 | - $postlink = get_permalink(geodir_add_listing_page_id()); |
|
516 | - $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
|
517 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
518 | - } |
|
519 | - }// end of if, if its a preview or not |
|
520 | - /** |
|
521 | - * This is called after the edit post link html in the function geodir_edit_post_link() |
|
522 | - * |
|
523 | - * @since 1.0.0 |
|
524 | - */ |
|
525 | - do_action('geodir_after_edit_post_link'); |
|
526 | - $content_html = ob_get_clean(); |
|
527 | - if (trim($content_html) != '') |
|
528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
529 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
530 | - /** |
|
531 | - * Filter the geodir_edit_post_link() function content. |
|
532 | - * |
|
533 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
534 | - */ |
|
535 | - echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html); |
|
536 | - } |
|
515 | + $postlink = get_permalink(geodir_add_listing_page_id()); |
|
516 | + $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
|
517 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
518 | + } |
|
519 | + }// end of if, if its a preview or not |
|
520 | + /** |
|
521 | + * This is called after the edit post link html in the function geodir_edit_post_link() |
|
522 | + * |
|
523 | + * @since 1.0.0 |
|
524 | + */ |
|
525 | + do_action('geodir_after_edit_post_link'); |
|
526 | + $content_html = ob_get_clean(); |
|
527 | + if (trim($content_html) != '') |
|
528 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
529 | + if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
530 | + /** |
|
531 | + * Filter the geodir_edit_post_link() function content. |
|
532 | + * |
|
533 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
534 | + */ |
|
535 | + echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html); |
|
536 | + } |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -547,41 +547,41 @@ discard block |
||
547 | 547 | */ |
548 | 548 | function geodir_detail_page_google_analytics() |
549 | 549 | { |
550 | - global $post; |
|
551 | - $package_info = array(); |
|
552 | - $package_info = geodir_post_package_info($package_info, $post); |
|
550 | + global $post; |
|
551 | + $package_info = array(); |
|
552 | + $package_info = geodir_post_package_info($package_info, $post); |
|
553 | 553 | |
554 | - $id = trim(get_option('geodir_ga_id')); |
|
554 | + $id = trim(get_option('geodir_ga_id')); |
|
555 | 555 | |
556 | - if (!$id) { |
|
557 | - return; //if no Google Analytics ID then bail. |
|
558 | - } |
|
556 | + if (!$id) { |
|
557 | + return; //if no Google Analytics ID then bail. |
|
558 | + } |
|
559 | 559 | |
560 | - ob_start(); // Start buffering; |
|
561 | - /** |
|
562 | - * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
563 | - * |
|
564 | - * @since 1.0.0 |
|
565 | - */ |
|
566 | - do_action('geodir_before_google_analytics'); |
|
560 | + ob_start(); // Start buffering; |
|
561 | + /** |
|
562 | + * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
563 | + * |
|
564 | + * @since 1.0.0 |
|
565 | + */ |
|
566 | + do_action('geodir_before_google_analytics'); |
|
567 | 567 | |
568 | - $refresh_time = get_option('geodir_ga_refresh_time', 5); |
|
569 | - /** |
|
570 | - * Filter the time interval to check & refresh new users results. |
|
571 | - * |
|
572 | - * @since 1.5.9 |
|
573 | - * |
|
574 | - * @param int $refresh_time Time interval to check & refresh new users results. |
|
575 | - */ |
|
576 | - $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time); |
|
577 | - $refresh_time = absint($refresh_time * 1000); |
|
568 | + $refresh_time = get_option('geodir_ga_refresh_time', 5); |
|
569 | + /** |
|
570 | + * Filter the time interval to check & refresh new users results. |
|
571 | + * |
|
572 | + * @since 1.5.9 |
|
573 | + * |
|
574 | + * @param int $refresh_time Time interval to check & refresh new users results. |
|
575 | + */ |
|
576 | + $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time); |
|
577 | + $refresh_time = absint($refresh_time * 1000); |
|
578 | 578 | |
579 | - $hide_refresh = get_option('geodir_ga_auto_refresh'); |
|
579 | + $hide_refresh = get_option('geodir_ga_auto_refresh'); |
|
580 | 580 | |
581 | - $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
582 | - if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
583 | - $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
584 | - ?> |
|
581 | + $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
582 | + if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
583 | + $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
584 | + ?> |
|
585 | 585 | <script type="text/javascript"> |
586 | 586 | var gd_gaTimeOut; |
587 | 587 | var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
@@ -833,15 +833,15 @@ discard block |
||
833 | 833 | var labels = results[1].rows.map(function(row) { return +row[0]; }); |
834 | 834 | |
835 | 835 | <?php |
836 | - // Here we list the shorthand days of the week so it can be used in translation. |
|
837 | - __("Mon",'geodirectory'); |
|
838 | - __("Tue",'geodirectory'); |
|
839 | - __("Wed",'geodirectory'); |
|
840 | - __("Thu",'geodirectory'); |
|
841 | - __("Fri",'geodirectory'); |
|
842 | - __("Sat",'geodirectory'); |
|
843 | - __("Sun",'geodirectory'); |
|
844 | - ?> |
|
836 | + // Here we list the shorthand days of the week so it can be used in translation. |
|
837 | + __("Mon",'geodirectory'); |
|
838 | + __("Tue",'geodirectory'); |
|
839 | + __("Wed",'geodirectory'); |
|
840 | + __("Thu",'geodirectory'); |
|
841 | + __("Fri",'geodirectory'); |
|
842 | + __("Sat",'geodirectory'); |
|
843 | + __("Sun",'geodirectory'); |
|
844 | + ?> |
|
845 | 845 | |
846 | 846 | labels = [ |
847 | 847 | "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
@@ -1090,24 +1090,24 @@ discard block |
||
1090 | 1090 | </span> |
1091 | 1091 | |
1092 | 1092 | <?php |
1093 | - } |
|
1094 | - /** |
|
1095 | - * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
1096 | - * |
|
1097 | - * @since 1.0.0 |
|
1098 | - */ |
|
1099 | - do_action('geodir_after_google_analytics'); |
|
1100 | - $content_html = ob_get_clean(); |
|
1101 | - if (trim($content_html) != '') |
|
1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1103 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1104 | - /** |
|
1105 | - * Filter the geodir_edit_post_link() function content. |
|
1106 | - * |
|
1107 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
1108 | - */ |
|
1109 | - echo $content_html = apply_filters('geodir_google_analytic_html', $content_html); |
|
1110 | - } |
|
1093 | + } |
|
1094 | + /** |
|
1095 | + * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
1096 | + * |
|
1097 | + * @since 1.0.0 |
|
1098 | + */ |
|
1099 | + do_action('geodir_after_google_analytics'); |
|
1100 | + $content_html = ob_get_clean(); |
|
1101 | + if (trim($content_html) != '') |
|
1102 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1103 | + if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1104 | + /** |
|
1105 | + * Filter the geodir_edit_post_link() function content. |
|
1106 | + * |
|
1107 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
1108 | + */ |
|
1109 | + echo $content_html = apply_filters('geodir_google_analytic_html', $content_html); |
|
1110 | + } |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | /** |
@@ -1123,90 +1123,90 @@ discard block |
||
1123 | 1123 | */ |
1124 | 1124 | function geodir_detail_page_review_rating() |
1125 | 1125 | { |
1126 | - global $post, $preview, $post_images; |
|
1127 | - ob_start(); // Start buffering; |
|
1128 | - /** |
|
1129 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1130 | - * |
|
1131 | - * This is called outside the check for an actual rating and the check for preview page. |
|
1132 | - * |
|
1133 | - * @since 1.0.0 |
|
1134 | - */ |
|
1135 | - do_action('geodir_before_detail_page_review_rating'); |
|
1136 | - |
|
1137 | - $comment_count = geodir_get_review_count_total($post->ID); |
|
1138 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
1139 | - |
|
1140 | - if ($post_avgratings != 0 && !$preview) { |
|
1141 | - /** |
|
1142 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1143 | - * |
|
1144 | - * This is called inside the check for an actual rating and the check for preview page. |
|
1145 | - * |
|
1146 | - * @since 1.0.0 |
|
1147 | - * @param float $post_avgratings Average rating for the surrent post. |
|
1148 | - * @param int $post->ID Current post ID. |
|
1149 | - */ |
|
1150 | - do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1151 | - |
|
1152 | - $html = '<p style=" float:left;">'; |
|
1153 | - $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
1154 | - $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
1155 | - $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
1126 | + global $post, $preview, $post_images; |
|
1127 | + ob_start(); // Start buffering; |
|
1128 | + /** |
|
1129 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1130 | + * |
|
1131 | + * This is called outside the check for an actual rating and the check for preview page. |
|
1132 | + * |
|
1133 | + * @since 1.0.0 |
|
1134 | + */ |
|
1135 | + do_action('geodir_before_detail_page_review_rating'); |
|
1136 | + |
|
1137 | + $comment_count = geodir_get_review_count_total($post->ID); |
|
1138 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
1139 | + |
|
1140 | + if ($post_avgratings != 0 && !$preview) { |
|
1141 | + /** |
|
1142 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1143 | + * |
|
1144 | + * This is called inside the check for an actual rating and the check for preview page. |
|
1145 | + * |
|
1146 | + * @since 1.0.0 |
|
1147 | + * @param float $post_avgratings Average rating for the surrent post. |
|
1148 | + * @param int $post->ID Current post ID. |
|
1149 | + */ |
|
1150 | + do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1151 | + |
|
1152 | + $html = '<p style=" float:left;">'; |
|
1153 | + $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
1154 | + $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
1155 | + $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
1156 | 1156 | |
1157 | 1157 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1158 | 1158 | |
1159 | 1159 | $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />'; |
1160 | 1160 | |
1161 | - $html .= '<span class="item">'; |
|
1162 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1161 | + $html .= '<span class="item">'; |
|
1162 | + $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1163 | 1163 | |
1164 | - if ($post_images) { |
|
1165 | - foreach ($post_images as $img) { |
|
1166 | - $post_img = $img->src; |
|
1167 | - break; |
|
1168 | - } |
|
1169 | - } |
|
1170 | - |
|
1171 | - if (isset($post_img) && $post_img) { |
|
1172 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1173 | - } |
|
1174 | - |
|
1175 | - $html .= '</span>'; |
|
1176 | - |
|
1177 | - echo $html .= '</div>'; |
|
1178 | - /** |
|
1179 | - * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
1180 | - * |
|
1181 | - * This is called inside the check for an actual rating and the check for preview page. |
|
1182 | - * |
|
1183 | - * @since 1.0.0 |
|
1184 | - * @param float $post_avgratings Average rating for the surrent post. |
|
1185 | - * @param int $post->ID Current post ID. |
|
1186 | - */ |
|
1187 | - do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1188 | - } |
|
1189 | - /** |
|
1190 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1191 | - * |
|
1192 | - * This is called outside the check for an actual rating and the check for preview page. |
|
1193 | - * |
|
1194 | - * @since 1.0.0 |
|
1195 | - */ |
|
1196 | - do_action('geodir_after_detail_page_review_rating'); |
|
1197 | - $content_html = ob_get_clean(); |
|
1198 | - if (trim($content_html) != '') { |
|
1199 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1200 | - } |
|
1201 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1202 | - /** |
|
1203 | - * Filter the geodir_detail_page_review_rating() function content. |
|
1204 | - * |
|
1205 | - * @since 1.0.0 |
|
1206 | - * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
1207 | - */ |
|
1208 | - echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); |
|
1209 | - } |
|
1164 | + if ($post_images) { |
|
1165 | + foreach ($post_images as $img) { |
|
1166 | + $post_img = $img->src; |
|
1167 | + break; |
|
1168 | + } |
|
1169 | + } |
|
1170 | + |
|
1171 | + if (isset($post_img) && $post_img) { |
|
1172 | + $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1173 | + } |
|
1174 | + |
|
1175 | + $html .= '</span>'; |
|
1176 | + |
|
1177 | + echo $html .= '</div>'; |
|
1178 | + /** |
|
1179 | + * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
1180 | + * |
|
1181 | + * This is called inside the check for an actual rating and the check for preview page. |
|
1182 | + * |
|
1183 | + * @since 1.0.0 |
|
1184 | + * @param float $post_avgratings Average rating for the surrent post. |
|
1185 | + * @param int $post->ID Current post ID. |
|
1186 | + */ |
|
1187 | + do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1188 | + } |
|
1189 | + /** |
|
1190 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1191 | + * |
|
1192 | + * This is called outside the check for an actual rating and the check for preview page. |
|
1193 | + * |
|
1194 | + * @since 1.0.0 |
|
1195 | + */ |
|
1196 | + do_action('geodir_after_detail_page_review_rating'); |
|
1197 | + $content_html = ob_get_clean(); |
|
1198 | + if (trim($content_html) != '') { |
|
1199 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1200 | + } |
|
1201 | + if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1202 | + /** |
|
1203 | + * Filter the geodir_detail_page_review_rating() function content. |
|
1204 | + * |
|
1205 | + * @since 1.0.0 |
|
1206 | + * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
1207 | + */ |
|
1208 | + echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); |
|
1209 | + } |
|
1210 | 1210 | } |
1211 | 1211 | |
1212 | 1212 | /** |
@@ -1218,35 +1218,35 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | function geodir_detail_page_more_info() |
1220 | 1220 | { |
1221 | - ob_start(); // Start buffering; |
|
1222 | - /** |
|
1223 | - * This is called before the info section html. |
|
1224 | - * |
|
1225 | - * @since 1.0.0 |
|
1226 | - */ |
|
1227 | - do_action('geodir_before_detail_page_more_info'); |
|
1228 | - if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) { |
|
1229 | - echo $geodir_post_detail_fields; |
|
1230 | - } |
|
1231 | - /** |
|
1232 | - * This is called after the info section html. |
|
1233 | - * |
|
1234 | - * @since 1.0.0 |
|
1235 | - */ |
|
1236 | - do_action('geodir_after_detail_page_more_info'); |
|
1237 | - |
|
1238 | - $content_html = ob_get_clean(); |
|
1239 | - if (trim($content_html) != '') |
|
1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1241 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1242 | - /** |
|
1243 | - * Filter the output html for function geodir_detail_page_more_info(). |
|
1244 | - * |
|
1245 | - * @since 1.0.0 |
|
1246 | - * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
1247 | - */ |
|
1248 | - echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html); |
|
1249 | - } |
|
1221 | + ob_start(); // Start buffering; |
|
1222 | + /** |
|
1223 | + * This is called before the info section html. |
|
1224 | + * |
|
1225 | + * @since 1.0.0 |
|
1226 | + */ |
|
1227 | + do_action('geodir_before_detail_page_more_info'); |
|
1228 | + if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) { |
|
1229 | + echo $geodir_post_detail_fields; |
|
1230 | + } |
|
1231 | + /** |
|
1232 | + * This is called after the info section html. |
|
1233 | + * |
|
1234 | + * @since 1.0.0 |
|
1235 | + */ |
|
1236 | + do_action('geodir_after_detail_page_more_info'); |
|
1237 | + |
|
1238 | + $content_html = ob_get_clean(); |
|
1239 | + if (trim($content_html) != '') |
|
1240 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1241 | + if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1242 | + /** |
|
1243 | + * Filter the output html for function geodir_detail_page_more_info(). |
|
1244 | + * |
|
1245 | + * @since 1.0.0 |
|
1246 | + * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
1247 | + */ |
|
1248 | + echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html); |
|
1249 | + } |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | |
@@ -1260,15 +1260,15 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | function geodir_localize_all_js_msg() |
1262 | 1262 | {// 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 |
1263 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1264 | - $ajax_url = admin_url('admin-ajax.php'); |
|
1265 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1266 | - $ajax_url = admin_url('admin-ajax.php'); |
|
1267 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1268 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
1269 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1270 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
1271 | - } |
|
1263 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1264 | + $ajax_url = admin_url('admin-ajax.php'); |
|
1265 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1266 | + $ajax_url = admin_url('admin-ajax.php'); |
|
1267 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1268 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
1269 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1270 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
1271 | + } |
|
1272 | 1272 | |
1273 | 1273 | /** |
1274 | 1274 | * Filter the allowed image type extensions for post images. |
@@ -1278,60 +1278,60 @@ discard block |
||
1278 | 1278 | */ |
1279 | 1279 | $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png')); |
1280 | 1280 | |
1281 | - $default_marker_icon = get_option('geodir_default_marker_icon'); |
|
1282 | - $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34)); |
|
1283 | - $default_marker_width = $default_marker_size['w']; |
|
1284 | - $default_marker_height = $default_marker_size['h']; |
|
1281 | + $default_marker_icon = get_option('geodir_default_marker_icon'); |
|
1282 | + $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34)); |
|
1283 | + $default_marker_width = $default_marker_size['w']; |
|
1284 | + $default_marker_height = $default_marker_size['h']; |
|
1285 | 1285 | |
1286 | - $arr_alert_msg = array( |
|
1287 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
1288 | - 'geodir_admin_ajax_url' => $ajax_url, |
|
1289 | - 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'), |
|
1290 | - 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'), |
|
1291 | - 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'), |
|
1292 | - 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'), |
|
1293 | - //start not show alert msg |
|
1294 | - 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'), |
|
1295 | - 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'), |
|
1296 | - 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'), |
|
1297 | - 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'), |
|
1298 | - 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'), |
|
1299 | - // end not show alert msg |
|
1300 | - 'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'), |
|
1301 | - 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'), |
|
1302 | - //start not show alert msg |
|
1303 | - 'rating_error_msg' => __('Error : please retry', 'geodirectory'), |
|
1304 | - 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'), |
|
1305 | - 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'), |
|
1306 | - 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'), |
|
1307 | - 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'), |
|
1308 | - 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'), |
|
1309 | - 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'), |
|
1310 | - 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'), |
|
1311 | - 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'), |
|
1312 | - 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'), |
|
1313 | - 'geodir_field_id_required' => __('This field is required.', 'geodirectory'), |
|
1314 | - 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'), |
|
1315 | - 'geodir_default_marker_icon' => $default_marker_icon, |
|
1316 | - 'geodir_default_marker_w' => $default_marker_width, |
|
1317 | - 'geodir_default_marker_h' => $default_marker_height, |
|
1318 | - 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
1319 | - 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
1320 | - 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'), |
|
1321 | - 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'), |
|
1322 | - 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'), |
|
1323 | - 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'), |
|
1324 | - 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'), |
|
1325 | - 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'), |
|
1326 | - /* on/off dragging for phone devices */ |
|
1327 | - 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false, |
|
1328 | - 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
1329 | - 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'), |
|
1330 | - 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'), |
|
1331 | - 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'), |
|
1332 | - 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
|
1333 | - 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
|
1334 | - 'geodir_action_remove' => __('Remove', 'geodirectory'), |
|
1286 | + $arr_alert_msg = array( |
|
1287 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
1288 | + 'geodir_admin_ajax_url' => $ajax_url, |
|
1289 | + 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'), |
|
1290 | + 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'), |
|
1291 | + 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'), |
|
1292 | + 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'), |
|
1293 | + //start not show alert msg |
|
1294 | + 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'), |
|
1295 | + 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'), |
|
1296 | + 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'), |
|
1297 | + 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'), |
|
1298 | + 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'), |
|
1299 | + // end not show alert msg |
|
1300 | + 'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'), |
|
1301 | + 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'), |
|
1302 | + //start not show alert msg |
|
1303 | + 'rating_error_msg' => __('Error : please retry', 'geodirectory'), |
|
1304 | + 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'), |
|
1305 | + 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'), |
|
1306 | + 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'), |
|
1307 | + 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'), |
|
1308 | + 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'), |
|
1309 | + 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'), |
|
1310 | + 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'), |
|
1311 | + 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'), |
|
1312 | + 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'), |
|
1313 | + 'geodir_field_id_required' => __('This field is required.', 'geodirectory'), |
|
1314 | + 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'), |
|
1315 | + 'geodir_default_marker_icon' => $default_marker_icon, |
|
1316 | + 'geodir_default_marker_w' => $default_marker_width, |
|
1317 | + 'geodir_default_marker_h' => $default_marker_height, |
|
1318 | + 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
1319 | + 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
1320 | + 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'), |
|
1321 | + 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'), |
|
1322 | + 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'), |
|
1323 | + 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'), |
|
1324 | + 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'), |
|
1325 | + 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'), |
|
1326 | + /* on/off dragging for phone devices */ |
|
1327 | + 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false, |
|
1328 | + 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
1329 | + 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'), |
|
1330 | + 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'), |
|
1331 | + 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'), |
|
1332 | + 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
|
1333 | + 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
|
1334 | + 'geodir_action_remove' => __('Remove', 'geodirectory'), |
|
1335 | 1335 | 'geodir_txt_all_files' => __('Allowed files', 'geodirectory'), |
1336 | 1336 | 'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'), |
1337 | 1337 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
@@ -1339,32 +1339,32 @@ discard block |
||
1339 | 1339 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1340 | 1340 | 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
1341 | 1341 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1342 | - 'geodir_map_name' => geodir_map_name(), |
|
1343 | - 'osmStart' => __('Start', 'geodirectory'), |
|
1344 | - 'osmVia' => __('Via {viaNumber}', 'geodirectory'), |
|
1345 | - 'osmEnd' => __('Enter Your Location', 'geodirectory'), |
|
1346 | - ); |
|
1347 | - |
|
1348 | - /** |
|
1349 | - * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
1350 | - * |
|
1351 | - * With this filter you can add, remove or change translated JS strings. |
|
1352 | - * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
1353 | - * |
|
1354 | - * @since 1.0.0 |
|
1355 | - */ |
|
1356 | - $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
|
1357 | - |
|
1358 | - foreach ($arr_alert_msg as $key => $value) { |
|
1359 | - if (!is_scalar($value)) |
|
1360 | - continue; |
|
1361 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1362 | - } |
|
1342 | + 'geodir_map_name' => geodir_map_name(), |
|
1343 | + 'osmStart' => __('Start', 'geodirectory'), |
|
1344 | + 'osmVia' => __('Via {viaNumber}', 'geodirectory'), |
|
1345 | + 'osmEnd' => __('Enter Your Location', 'geodirectory'), |
|
1346 | + ); |
|
1347 | + |
|
1348 | + /** |
|
1349 | + * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
1350 | + * |
|
1351 | + * With this filter you can add, remove or change translated JS strings. |
|
1352 | + * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
1353 | + * |
|
1354 | + * @since 1.0.0 |
|
1355 | + */ |
|
1356 | + $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
|
1357 | + |
|
1358 | + foreach ($arr_alert_msg as $key => $value) { |
|
1359 | + if (!is_scalar($value)) |
|
1360 | + continue; |
|
1361 | + $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1362 | + } |
|
1363 | 1363 | |
1364 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1365 | - echo '<script>'; |
|
1366 | - echo $script; |
|
1367 | - echo '</script>'; |
|
1364 | + $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1365 | + echo '<script>'; |
|
1366 | + echo $script; |
|
1367 | + echo '</script>'; |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31); |
@@ -1380,11 +1380,11 @@ discard block |
||
1380 | 1380 | */ |
1381 | 1381 | function geodir_admin_bar_site_menu($wp_admin_bar) |
1382 | 1382 | { |
1383 | - if (get_option("geodir_installed")) { |
|
1384 | - if (current_user_can('manage_options')) { |
|
1385 | - $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory'))); |
|
1386 | - } |
|
1387 | - } |
|
1383 | + if (get_option("geodir_installed")) { |
|
1384 | + if (current_user_can('manage_options')) { |
|
1385 | + $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory'))); |
|
1386 | + } |
|
1387 | + } |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/ |
@@ -1410,25 +1410,25 @@ discard block |
||
1410 | 1410 | */ |
1411 | 1411 | function geodir_store_sidebars() |
1412 | 1412 | { |
1413 | - global $geodir_sidebars; |
|
1414 | - global $sidebars_widgets; |
|
1415 | - |
|
1416 | - if (!is_array($sidebars_widgets)) |
|
1417 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1418 | - $geodir_old_sidebars = array(); |
|
1419 | - |
|
1420 | - if (is_array($geodir_sidebars)) { |
|
1421 | - foreach ($geodir_sidebars as $val) { |
|
1422 | - if (is_array($sidebars_widgets)) { |
|
1423 | - if (array_key_exists($val, $sidebars_widgets)) |
|
1424 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1425 | - else |
|
1426 | - $geodir_old_sidebars[$val] = array(); |
|
1427 | - } |
|
1428 | - } |
|
1429 | - } |
|
1430 | - update_option('geodir_sidebars', $geodir_old_sidebars); |
|
1431 | - geodir_option_version_backup('geodir_sidebars'); |
|
1413 | + global $geodir_sidebars; |
|
1414 | + global $sidebars_widgets; |
|
1415 | + |
|
1416 | + if (!is_array($sidebars_widgets)) |
|
1417 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1418 | + $geodir_old_sidebars = array(); |
|
1419 | + |
|
1420 | + if (is_array($geodir_sidebars)) { |
|
1421 | + foreach ($geodir_sidebars as $val) { |
|
1422 | + if (is_array($sidebars_widgets)) { |
|
1423 | + if (array_key_exists($val, $sidebars_widgets)) |
|
1424 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1425 | + else |
|
1426 | + $geodir_old_sidebars[$val] = array(); |
|
1427 | + } |
|
1428 | + } |
|
1429 | + } |
|
1430 | + update_option('geodir_sidebars', $geodir_old_sidebars); |
|
1431 | + geodir_option_version_backup('geodir_sidebars'); |
|
1432 | 1432 | |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1442,28 +1442,28 @@ discard block |
||
1442 | 1442 | */ |
1443 | 1443 | function geodir_restore_sidebars() |
1444 | 1444 | { |
1445 | - global $sidebars_widgets; |
|
1446 | - |
|
1447 | - if (!is_array($sidebars_widgets)) |
|
1448 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1449 | - |
|
1450 | - if (is_array($sidebars_widgets)) { |
|
1451 | - $geodir_old_sidebars = get_option('geodir_sidebars'); |
|
1452 | - if (is_array($geodir_old_sidebars)) { |
|
1453 | - foreach ($geodir_old_sidebars as $key => $val) { |
|
1454 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1455 | - { |
|
1456 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1457 | - } |
|
1445 | + global $sidebars_widgets; |
|
1458 | 1446 | |
1447 | + if (!is_array($sidebars_widgets)) |
|
1448 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1459 | 1449 | |
1460 | - } |
|
1461 | - } |
|
1450 | + if (is_array($sidebars_widgets)) { |
|
1451 | + $geodir_old_sidebars = get_option('geodir_sidebars'); |
|
1452 | + if (is_array($geodir_old_sidebars)) { |
|
1453 | + foreach ($geodir_old_sidebars as $key => $val) { |
|
1454 | + if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1455 | + { |
|
1456 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1457 | + } |
|
1462 | 1458 | |
1463 | - } |
|
1464 | 1459 | |
1465 | - update_option('sidebars_widgets', $sidebars_widgets); |
|
1466 | - update_option('geodir_sidebars', ''); |
|
1460 | + } |
|
1461 | + } |
|
1462 | + |
|
1463 | + } |
|
1464 | + |
|
1465 | + update_option('sidebars_widgets', $sidebars_widgets); |
|
1466 | + update_option('geodir_sidebars', ''); |
|
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview'); |
@@ -1476,9 +1476,9 @@ discard block |
||
1476 | 1476 | */ |
1477 | 1477 | function geodir_after_listing_post_gridview() |
1478 | 1478 | { |
1479 | - global $gridview_columns; |
|
1479 | + global $gridview_columns; |
|
1480 | 1480 | |
1481 | - $gridview_columns = ''; |
|
1481 | + $gridview_columns = ''; |
|
1482 | 1482 | |
1483 | 1483 | } |
1484 | 1484 | |
@@ -1506,11 +1506,11 @@ discard block |
||
1506 | 1506 | */ |
1507 | 1507 | function so_handle_038($url, $original_url, $_context) |
1508 | 1508 | { |
1509 | - if (strstr($url, "maps.google.com/maps/api/js") !== false) { |
|
1510 | - $url = str_replace("&", "&", $url); // or $url = $original_url |
|
1511 | - } |
|
1509 | + if (strstr($url, "maps.google.com/maps/api/js") !== false) { |
|
1510 | + $url = str_replace("&", "&", $url); // or $url = $original_url |
|
1511 | + } |
|
1512 | 1512 | |
1513 | - return $url; |
|
1513 | + return $url; |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | |
@@ -1526,34 +1526,34 @@ discard block |
||
1526 | 1526 | function geodir_after_main_form_fields() { |
1527 | 1527 | global $gd_session; |
1528 | 1528 | |
1529 | - if (get_option('geodir_accept_term_condition')) { |
|
1530 | - global $post; |
|
1531 | - $term_condition = ''; |
|
1532 | - if (isset($_REQUEST['backandedit'])) { |
|
1533 | - $post = (object)$gd_session->get('listing'); |
|
1534 | - $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
1535 | - } |
|
1536 | - |
|
1537 | - ?> |
|
1529 | + if (get_option('geodir_accept_term_condition')) { |
|
1530 | + global $post; |
|
1531 | + $term_condition = ''; |
|
1532 | + if (isset($_REQUEST['backandedit'])) { |
|
1533 | + $post = (object)$gd_session->get('listing'); |
|
1534 | + $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
1535 | + } |
|
1536 | + |
|
1537 | + ?> |
|
1538 | 1538 | <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix"> |
1539 | 1539 | <label> </label> |
1540 | 1540 | |
1541 | 1541 | <div class="geodir_taxonomy_field" style="float:left; width:70%;"> |
1542 | 1542 | <span style="display:block"> |
1543 | 1543 | <input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') { |
1544 | - echo 'checked="checked"'; |
|
1545 | - } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
1544 | + echo 'checked="checked"'; |
|
1545 | + } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
1546 | 1546 | class="geodir_textfield" value="1" |
1547 | 1547 | style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
1548 | 1548 | </span> |
1549 | 1549 | </div> |
1550 | 1550 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
1551 | - _e($required_msg, 'geodirectory'); |
|
1552 | - } ?></span> |
|
1551 | + _e($required_msg, 'geodirectory'); |
|
1552 | + } ?></span> |
|
1553 | 1553 | </div> |
1554 | 1554 | <?php |
1555 | 1555 | |
1556 | - } |
|
1556 | + } |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | |
@@ -1578,42 +1578,42 @@ discard block |
||
1578 | 1578 | */ |
1579 | 1579 | function geodir_detail_page_tab_is_display($is_display, $tab) |
1580 | 1580 | { |
1581 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
1581 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
1582 | 1582 | |
1583 | - if ($tab == 'post_profile') { |
|
1584 | - /** This action is documented in geodirectory_template_actions.php */ |
|
1585 | - $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
|
1583 | + if ($tab == 'post_profile') { |
|
1584 | + /** This action is documented in geodirectory_template_actions.php */ |
|
1585 | + $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
|
1586 | 1586 | |
1587 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1588 | - $is_display = false; |
|
1589 | - } |
|
1590 | - } |
|
1587 | + if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1588 | + $is_display = false; |
|
1589 | + } |
|
1590 | + } |
|
1591 | 1591 | |
1592 | - if ($tab == 'post_info') |
|
1593 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1592 | + if ($tab == 'post_info') |
|
1593 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1594 | 1594 | |
1595 | - if ($tab == 'post_images') |
|
1596 | - $is_display = (!empty($post_images)) ? true : false; |
|
1595 | + if ($tab == 'post_images') |
|
1596 | + $is_display = (!empty($post_images)) ? true : false; |
|
1597 | 1597 | |
1598 | - if ($tab == 'post_video') |
|
1599 | - $is_display = (!empty($video)) ? true : false; |
|
1598 | + if ($tab == 'post_video') |
|
1599 | + $is_display = (!empty($video)) ? true : false; |
|
1600 | 1600 | |
1601 | - if ($tab == 'special_offers') |
|
1602 | - $is_display = (!empty($special_offers)) ? true : false; |
|
1601 | + if ($tab == 'special_offers') |
|
1602 | + $is_display = (!empty($special_offers)) ? true : false; |
|
1603 | 1603 | |
1604 | - if ($tab == 'reviews') |
|
1605 | - $is_display = (geodir_is_page('detail')) ? true : false; |
|
1604 | + if ($tab == 'reviews') |
|
1605 | + $is_display = (geodir_is_page('detail')) ? true : false; |
|
1606 | 1606 | |
1607 | - if ($tab == 'related_listing') { |
|
1608 | - $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1607 | + if ($tab == 'related_listing') { |
|
1608 | + $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1609 | 1609 | |
1610 | - /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1611 | - $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1610 | + /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1611 | + $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1612 | 1612 | |
1613 | - $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1614 | - } |
|
1613 | + $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1614 | + } |
|
1615 | 1615 | |
1616 | - return $is_display; |
|
1616 | + return $is_display; |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | |
@@ -1629,69 +1629,69 @@ discard block |
||
1629 | 1629 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
1630 | 1630 | */ |
1631 | 1631 | function geodir_changes_in_custom_fields_table() { |
1632 | - global $wpdb, $plugin_prefix; |
|
1632 | + global $wpdb, $plugin_prefix; |
|
1633 | 1633 | |
1634 | 1634 | // Remove unused virtual page |
1635 | 1635 | $listings_page_id = (int)get_option('geodir_listing_page'); |
1636 | 1636 | if ($listings_page_id) { |
1637 | 1637 | $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
1638 | - delete_option('geodir_listing_page'); |
|
1638 | + delete_option('geodir_listing_page'); |
|
1639 | 1639 | } |
1640 | 1640 | |
1641 | - if (!get_option('geodir_changes_in_custom_fields_table')) { |
|
1642 | - $wpdb->query( |
|
1643 | - $wpdb->prepare( |
|
1644 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1645 | - array('1', '1', 'admin') |
|
1646 | - ) |
|
1647 | - ); |
|
1641 | + if (!get_option('geodir_changes_in_custom_fields_table')) { |
|
1642 | + $wpdb->query( |
|
1643 | + $wpdb->prepare( |
|
1644 | + "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1645 | + array('1', '1', 'admin') |
|
1646 | + ) |
|
1647 | + ); |
|
1648 | 1648 | |
1649 | 1649 | |
1650 | - /* --- terms meta value set --- */ |
|
1650 | + /* --- terms meta value set --- */ |
|
1651 | 1651 | |
1652 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1652 | + update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1653 | 1653 | |
1654 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1654 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1655 | 1655 | |
1656 | - if (!empty($options_data)) { |
|
1656 | + if (!empty($options_data)) { |
|
1657 | 1657 | |
1658 | - foreach ($options_data as $optobj) { |
|
1658 | + foreach ($options_data as $optobj) { |
|
1659 | 1659 | |
1660 | - $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
|
1660 | + $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
|
1661 | 1661 | |
1662 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1662 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1663 | 1663 | |
1664 | - if (!empty($taxonomies_data)) { |
|
1664 | + if (!empty($taxonomies_data)) { |
|
1665 | 1665 | |
1666 | - foreach ($taxonomies_data as $taxobj) { |
|
1666 | + foreach ($taxonomies_data as $taxobj) { |
|
1667 | 1667 | |
1668 | - $taxObject = get_taxonomy($taxobj->taxonomy); |
|
1669 | - $post_type = $taxObject->object_type[0]; |
|
1668 | + $taxObject = get_taxonomy($taxobj->taxonomy); |
|
1669 | + $post_type = $taxObject->object_type[0]; |
|
1670 | 1670 | |
1671 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1671 | + $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1672 | 1672 | |
1673 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1673 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1674 | 1674 | |
1675 | - if ($duplicate_data) { |
|
1675 | + if ($duplicate_data) { |
|
1676 | 1676 | |
1677 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1677 | + $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1678 | 1678 | |
1679 | - } else { |
|
1679 | + } else { |
|
1680 | 1680 | |
1681 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1681 | + $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1682 | 1682 | |
1683 | - } |
|
1683 | + } |
|
1684 | 1684 | |
1685 | - } |
|
1685 | + } |
|
1686 | 1686 | |
1687 | - } |
|
1687 | + } |
|
1688 | 1688 | |
1689 | - } |
|
1690 | - } |
|
1689 | + } |
|
1690 | + } |
|
1691 | 1691 | |
1692 | - update_option('geodir_changes_in_custom_fields_table', '1'); |
|
1692 | + update_option('geodir_changes_in_custom_fields_table', '1'); |
|
1693 | 1693 | |
1694 | - } |
|
1694 | + } |
|
1695 | 1695 | |
1696 | 1696 | } |
1697 | 1697 | |
@@ -1710,24 +1710,24 @@ discard block |
||
1710 | 1710 | function geodir_location_slug_check($slug) |
1711 | 1711 | { |
1712 | 1712 | |
1713 | - global $wpdb, $table_prefix; |
|
1713 | + global $wpdb, $table_prefix; |
|
1714 | 1714 | |
1715 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1715 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1716 | 1716 | |
1717 | - if ($slug_exists) { |
|
1717 | + if ($slug_exists) { |
|
1718 | 1718 | |
1719 | - $suffix = 1; |
|
1720 | - do { |
|
1721 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1722 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1723 | - $suffix++; |
|
1724 | - } while ($location_slug_check && $suffix < 100); |
|
1719 | + $suffix = 1; |
|
1720 | + do { |
|
1721 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1722 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1723 | + $suffix++; |
|
1724 | + } while ($location_slug_check && $suffix < 100); |
|
1725 | 1725 | |
1726 | - $slug = $alt_location_name; |
|
1726 | + $slug = $alt_location_name; |
|
1727 | 1727 | |
1728 | - } |
|
1728 | + } |
|
1729 | 1729 | |
1730 | - return $slug; |
|
1730 | + return $slug; |
|
1731 | 1731 | |
1732 | 1732 | } |
1733 | 1733 | |
@@ -1752,42 +1752,42 @@ discard block |
||
1752 | 1752 | function geodir_update_term_slug($term_id, $tt_id, $taxonomy) |
1753 | 1753 | { |
1754 | 1754 | |
1755 | - global $wpdb, $plugin_prefix, $table_prefix; |
|
1755 | + global $wpdb, $plugin_prefix, $table_prefix; |
|
1756 | 1756 | |
1757 | - $tern_data = get_term_by('id', $term_id, $taxonomy); |
|
1757 | + $tern_data = get_term_by('id', $term_id, $taxonomy); |
|
1758 | 1758 | |
1759 | - $slug = $tern_data->slug; |
|
1759 | + $slug = $tern_data->slug; |
|
1760 | 1760 | |
1761 | - /** |
|
1762 | - * Filter if a term slug exists. |
|
1763 | - * |
|
1764 | - * @since 1.0.0 |
|
1765 | - * @package GeoDirectory |
|
1766 | - * @param bool $bool Default: false. |
|
1767 | - * @param string $slug The term slug. |
|
1768 | - * @param int $term_id The term ID. |
|
1769 | - */ |
|
1770 | - $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id); |
|
1761 | + /** |
|
1762 | + * Filter if a term slug exists. |
|
1763 | + * |
|
1764 | + * @since 1.0.0 |
|
1765 | + * @package GeoDirectory |
|
1766 | + * @param bool $bool Default: false. |
|
1767 | + * @param string $slug The term slug. |
|
1768 | + * @param int $term_id The term ID. |
|
1769 | + */ |
|
1770 | + $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id); |
|
1771 | 1771 | |
1772 | - if ($slug_exists) { |
|
1772 | + if ($slug_exists) { |
|
1773 | 1773 | |
1774 | - $suffix = 1; |
|
1775 | - do { |
|
1776 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1774 | + $suffix = 1; |
|
1775 | + do { |
|
1776 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1777 | 1777 | |
1778 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
1779 | - $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
|
1778 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
1779 | + $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
|
1780 | 1780 | |
1781 | - $suffix++; |
|
1782 | - } while ($term_slug_check && $suffix < 100); |
|
1781 | + $suffix++; |
|
1782 | + } while ($term_slug_check && $suffix < 100); |
|
1783 | 1783 | |
1784 | - $slug = $new_slug; |
|
1784 | + $slug = $new_slug; |
|
1785 | 1785 | |
1786 | - //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
|
1786 | + //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
|
1787 | 1787 | |
1788 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1788 | + $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1789 | 1789 | |
1790 | - } |
|
1790 | + } |
|
1791 | 1791 | |
1792 | 1792 | // Update tag in detail table. |
1793 | 1793 | $taxonomy_obj = get_taxonomy($taxonomy); |
@@ -1828,21 +1828,21 @@ discard block |
||
1828 | 1828 | function geodir_term_slug_is_exists($slug_exists, $slug, $term_id) |
1829 | 1829 | { |
1830 | 1830 | |
1831 | - global $wpdb, $table_prefix; |
|
1831 | + global $wpdb, $table_prefix; |
|
1832 | 1832 | |
1833 | - $default_location = geodir_get_default_location(); |
|
1833 | + $default_location = geodir_get_default_location(); |
|
1834 | 1834 | |
1835 | - $country_slug = $default_location->country_slug; |
|
1836 | - $region_slug = $default_location->region_slug; |
|
1837 | - $city_slug = $default_location->city_slug; |
|
1835 | + $country_slug = $default_location->country_slug; |
|
1836 | + $region_slug = $default_location->region_slug; |
|
1837 | + $city_slug = $default_location->city_slug; |
|
1838 | 1838 | |
1839 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1840 | - return $slug_exists = true; |
|
1839 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1840 | + return $slug_exists = true; |
|
1841 | 1841 | |
1842 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1843 | - return $slug_exists = true; |
|
1842 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1843 | + return $slug_exists = true; |
|
1844 | 1844 | |
1845 | - return $slug_exists; |
|
1845 | + return $slug_exists; |
|
1846 | 1846 | } |
1847 | 1847 | |
1848 | 1848 | |
@@ -1861,75 +1861,75 @@ discard block |
||
1861 | 1861 | */ |
1862 | 1862 | function geodir_custom_page_title($title = '', $sep = '') |
1863 | 1863 | { |
1864 | - global $wp; |
|
1865 | - if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
|
1866 | - return $title; |
|
1867 | - } |
|
1864 | + global $wp; |
|
1865 | + if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
|
1866 | + return $title; |
|
1867 | + } |
|
1868 | 1868 | |
1869 | - if ($sep == '') { |
|
1870 | - /** |
|
1871 | - * Filter the page title separator. |
|
1872 | - * |
|
1873 | - * @since 1.0.0 |
|
1874 | - * @package GeoDirectory |
|
1875 | - * @param string $sep The separator, default: `|`. |
|
1876 | - */ |
|
1877 | - $sep = apply_filters('geodir_page_title_separator', '|'); |
|
1878 | - } |
|
1869 | + if ($sep == '') { |
|
1870 | + /** |
|
1871 | + * Filter the page title separator. |
|
1872 | + * |
|
1873 | + * @since 1.0.0 |
|
1874 | + * @package GeoDirectory |
|
1875 | + * @param string $sep The separator, default: `|`. |
|
1876 | + */ |
|
1877 | + $sep = apply_filters('geodir_page_title_separator', '|'); |
|
1878 | + } |
|
1879 | 1879 | |
1880 | 1880 | |
1881 | - $gd_page = ''; |
|
1882 | - if(geodir_is_page('home')){ |
|
1883 | - $gd_page = 'home'; |
|
1884 | - $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
|
1885 | - } |
|
1886 | - elseif(geodir_is_page('detail')){ |
|
1887 | - $gd_page = 'detail'; |
|
1888 | - $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
|
1889 | - } |
|
1890 | - elseif(geodir_is_page('pt')){ |
|
1891 | - $gd_page = 'pt'; |
|
1892 | - $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
|
1893 | - } |
|
1894 | - elseif(geodir_is_page('listing')){ |
|
1895 | - $gd_page = 'listing'; |
|
1896 | - $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
|
1897 | - } |
|
1898 | - elseif(geodir_is_page('location')){ |
|
1899 | - $gd_page = 'location'; |
|
1900 | - $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
|
1901 | - } |
|
1902 | - elseif(geodir_is_page('search')){ |
|
1903 | - $gd_page = 'search'; |
|
1904 | - $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
|
1905 | - } |
|
1906 | - elseif(geodir_is_page('add-listing')){ |
|
1907 | - $gd_page = 'add-listing'; |
|
1908 | - $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
|
1909 | - } |
|
1910 | - elseif(geodir_is_page('author')){ |
|
1911 | - $gd_page = 'author'; |
|
1912 | - $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
|
1913 | - } |
|
1914 | - elseif(geodir_is_page('login')){ |
|
1915 | - $gd_page = 'login'; |
|
1916 | - $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
|
1917 | - } |
|
1918 | - elseif(geodir_is_page('listing-success')){ |
|
1919 | - $gd_page = 'listing-success'; |
|
1920 | - $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
|
1921 | - } |
|
1881 | + $gd_page = ''; |
|
1882 | + if(geodir_is_page('home')){ |
|
1883 | + $gd_page = 'home'; |
|
1884 | + $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
|
1885 | + } |
|
1886 | + elseif(geodir_is_page('detail')){ |
|
1887 | + $gd_page = 'detail'; |
|
1888 | + $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
|
1889 | + } |
|
1890 | + elseif(geodir_is_page('pt')){ |
|
1891 | + $gd_page = 'pt'; |
|
1892 | + $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
|
1893 | + } |
|
1894 | + elseif(geodir_is_page('listing')){ |
|
1895 | + $gd_page = 'listing'; |
|
1896 | + $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
|
1897 | + } |
|
1898 | + elseif(geodir_is_page('location')){ |
|
1899 | + $gd_page = 'location'; |
|
1900 | + $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
|
1901 | + } |
|
1902 | + elseif(geodir_is_page('search')){ |
|
1903 | + $gd_page = 'search'; |
|
1904 | + $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
|
1905 | + } |
|
1906 | + elseif(geodir_is_page('add-listing')){ |
|
1907 | + $gd_page = 'add-listing'; |
|
1908 | + $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
|
1909 | + } |
|
1910 | + elseif(geodir_is_page('author')){ |
|
1911 | + $gd_page = 'author'; |
|
1912 | + $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
|
1913 | + } |
|
1914 | + elseif(geodir_is_page('login')){ |
|
1915 | + $gd_page = 'login'; |
|
1916 | + $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
|
1917 | + } |
|
1918 | + elseif(geodir_is_page('listing-success')){ |
|
1919 | + $gd_page = 'listing-success'; |
|
1920 | + $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
|
1921 | + } |
|
1922 | 1922 | |
1923 | 1923 | |
1924 | - /** |
|
1925 | - * Filter page meta title to replace variables. |
|
1926 | - * |
|
1927 | - * @since 1.5.4 |
|
1928 | - * @param string $title The page title including variables. |
|
1929 | - * @param string $gd_page The GeoDirectory page type if any. |
|
1930 | - * @param string $sep The title separator symbol. |
|
1931 | - */ |
|
1932 | - return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep); |
|
1924 | + /** |
|
1925 | + * Filter page meta title to replace variables. |
|
1926 | + * |
|
1927 | + * @since 1.5.4 |
|
1928 | + * @param string $title The page title including variables. |
|
1929 | + * @param string $gd_page The GeoDirectory page type if any. |
|
1930 | + * @param string $sep The title separator symbol. |
|
1931 | + */ |
|
1932 | + return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep); |
|
1933 | 1933 | |
1934 | 1934 | } |
1935 | 1935 | |
@@ -1945,36 +1945,36 @@ discard block |
||
1945 | 1945 | function geodir_set_post_attachment() |
1946 | 1946 | { |
1947 | 1947 | |
1948 | - if (!get_option('geodir_set_post_attachments')) { |
|
1948 | + if (!get_option('geodir_set_post_attachments')) { |
|
1949 | 1949 | |
1950 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1951 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1950 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1951 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1952 | 1952 | |
1953 | - $all_postypes = geodir_get_posttypes(); |
|
1953 | + $all_postypes = geodir_get_posttypes(); |
|
1954 | 1954 | |
1955 | - foreach($all_postypes as $post_type){ |
|
1956 | - $args = array( |
|
1957 | - 'posts_per_page' => -1, |
|
1958 | - 'post_type' => $post_type, |
|
1959 | - 'post_status' => 'publish'); |
|
1955 | + foreach($all_postypes as $post_type){ |
|
1956 | + $args = array( |
|
1957 | + 'posts_per_page' => -1, |
|
1958 | + 'post_type' => $post_type, |
|
1959 | + 'post_status' => 'publish'); |
|
1960 | 1960 | |
1961 | - $posts_array = get_posts($args); |
|
1961 | + $posts_array = get_posts($args); |
|
1962 | 1962 | |
1963 | - if (!empty($posts_array)) { |
|
1963 | + if (!empty($posts_array)) { |
|
1964 | 1964 | |
1965 | - foreach ($posts_array as $post) { |
|
1965 | + foreach ($posts_array as $post) { |
|
1966 | 1966 | |
1967 | - geodir_set_wp_featured_image($post->ID); |
|
1967 | + geodir_set_wp_featured_image($post->ID); |
|
1968 | 1968 | |
1969 | - } |
|
1969 | + } |
|
1970 | 1970 | |
1971 | - } |
|
1972 | - } |
|
1971 | + } |
|
1972 | + } |
|
1973 | 1973 | |
1974 | 1974 | |
1975 | - update_option('geodir_set_post_attachments', '1'); |
|
1975 | + update_option('geodir_set_post_attachments', '1'); |
|
1976 | 1976 | |
1977 | - } |
|
1977 | + } |
|
1978 | 1978 | |
1979 | 1979 | } |
1980 | 1980 | |
@@ -1991,19 +1991,19 @@ discard block |
||
1991 | 1991 | function geodir_remove_url_seperator() |
1992 | 1992 | { |
1993 | 1993 | |
1994 | - if (!get_option('geodir_remove_url_seperator')) { |
|
1994 | + if (!get_option('geodir_remove_url_seperator')) { |
|
1995 | 1995 | |
1996 | - if (get_option('geodir_listingurl_separator')) |
|
1997 | - delete_option('geodir_listingurl_separator'); |
|
1996 | + if (get_option('geodir_listingurl_separator')) |
|
1997 | + delete_option('geodir_listingurl_separator'); |
|
1998 | 1998 | |
1999 | - if (get_option('geodir_detailurl_separator')) |
|
2000 | - delete_option('geodir_detailurl_separator'); |
|
1999 | + if (get_option('geodir_detailurl_separator')) |
|
2000 | + delete_option('geodir_detailurl_separator'); |
|
2001 | 2001 | |
2002 | - flush_rewrite_rules(false); |
|
2002 | + flush_rewrite_rules(false); |
|
2003 | 2003 | |
2004 | - update_option('geodir_remove_url_seperator', '1'); |
|
2004 | + update_option('geodir_remove_url_seperator', '1'); |
|
2005 | 2005 | |
2006 | - } |
|
2006 | + } |
|
2007 | 2007 | |
2008 | 2008 | } |
2009 | 2009 | |
@@ -2019,19 +2019,19 @@ discard block |
||
2019 | 2019 | */ |
2020 | 2020 | function geodir_remove_url_seperator_form_permalink_settings($permalink_arr) |
2021 | 2021 | { |
2022 | - foreach ($permalink_arr as $key => $value) { |
|
2022 | + foreach ($permalink_arr as $key => $value) { |
|
2023 | 2023 | |
2024 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2025 | - unset($permalink_arr[$key]); |
|
2024 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2025 | + unset($permalink_arr[$key]); |
|
2026 | 2026 | |
2027 | - } |
|
2027 | + } |
|
2028 | 2028 | |
2029 | - return $permalink_arr; |
|
2029 | + return $permalink_arr; |
|
2030 | 2030 | |
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | if (!is_admin()) { |
2034 | - add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
|
2034 | + add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
|
2035 | 2035 | } |
2036 | 2036 | /** |
2037 | 2037 | * Set status from draft to publish. |
@@ -2044,16 +2044,16 @@ discard block |
||
2044 | 2044 | */ |
2045 | 2045 | function geodir_set_status_draft_to_publish_for_own_post($post) |
2046 | 2046 | { |
2047 | - $user_id = get_current_user_id(); |
|
2047 | + $user_id = get_current_user_id(); |
|
2048 | 2048 | |
2049 | - if(!$user_id){return $post;} |
|
2049 | + if(!$user_id){return $post;} |
|
2050 | 2050 | |
2051 | - $gd_post_types = geodir_get_posttypes(); |
|
2051 | + $gd_post_types = geodir_get_posttypes(); |
|
2052 | 2052 | |
2053 | - if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) { |
|
2054 | - $post[0]->post_status = 'publish'; |
|
2055 | - } |
|
2056 | - return $post; |
|
2053 | + if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) { |
|
2054 | + $post[0]->post_status = 'publish'; |
|
2055 | + } |
|
2056 | + return $post; |
|
2057 | 2057 | } |
2058 | 2058 | |
2059 | 2059 | |
@@ -2145,33 +2145,33 @@ discard block |
||
2145 | 2145 | */ |
2146 | 2146 | function geodir_detail_page_tab_headings_change($tabs_arr) |
2147 | 2147 | { |
2148 | - global $wpdb; |
|
2148 | + global $wpdb; |
|
2149 | 2149 | |
2150 | - $post_type = geodir_get_current_posttype(); |
|
2150 | + $post_type = geodir_get_current_posttype(); |
|
2151 | 2151 | |
2152 | - $all_postypes = geodir_get_posttypes(); |
|
2152 | + $all_postypes = geodir_get_posttypes(); |
|
2153 | 2153 | |
2154 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) { |
|
2154 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) { |
|
2155 | 2155 | |
2156 | - if (array_key_exists('post_video', $tabs_arr)) { |
|
2156 | + if (array_key_exists('post_video', $tabs_arr)) { |
|
2157 | 2157 | |
2158 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2158 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2159 | 2159 | |
2160 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2161 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2162 | - } |
|
2160 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2161 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2162 | + } |
|
2163 | 2163 | |
2164 | - if (array_key_exists('special_offers', $tabs_arr)) { |
|
2164 | + if (array_key_exists('special_offers', $tabs_arr)) { |
|
2165 | 2165 | |
2166 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2166 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2167 | 2167 | |
2168 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2169 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2170 | - } |
|
2168 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2169 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2170 | + } |
|
2171 | 2171 | |
2172 | - } |
|
2172 | + } |
|
2173 | 2173 | |
2174 | - return $tabs_arr; |
|
2174 | + return $tabs_arr; |
|
2175 | 2175 | |
2176 | 2176 | } |
2177 | 2177 | |
@@ -2184,10 +2184,10 @@ discard block |
||
2184 | 2184 | */ |
2185 | 2185 | function geodir_remove_template_redirect_actions() |
2186 | 2186 | { |
2187 | - if (geodir_is_page('login')){ |
|
2188 | - remove_all_actions('template_redirect'); |
|
2189 | - remove_action('init', 'avia_modify_front', 10); |
|
2190 | - } |
|
2187 | + if (geodir_is_page('login')){ |
|
2188 | + remove_all_actions('template_redirect'); |
|
2189 | + remove_action('init', 'avia_modify_front', 10); |
|
2190 | + } |
|
2191 | 2191 | } |
2192 | 2192 | |
2193 | 2193 | |
@@ -2209,51 +2209,51 @@ discard block |
||
2209 | 2209 | function geodirectory_before_featured_image_delete($attachment_id) |
2210 | 2210 | { |
2211 | 2211 | |
2212 | - global $wpdb, $plugin_prefix; |
|
2212 | + global $wpdb, $plugin_prefix; |
|
2213 | 2213 | |
2214 | - $post_id = get_post_field('post_parent', $attachment_id); |
|
2214 | + $post_id = get_post_field('post_parent', $attachment_id); |
|
2215 | 2215 | |
2216 | - $attachment_url = wp_get_attachment_url($attachment_id); |
|
2216 | + $attachment_url = wp_get_attachment_url($attachment_id); |
|
2217 | 2217 | |
2218 | - if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { |
|
2218 | + if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { |
|
2219 | 2219 | |
2220 | - $post_type = get_post_type($post_id); |
|
2220 | + $post_type = get_post_type($post_id); |
|
2221 | 2221 | |
2222 | - $all_postypes = geodir_get_posttypes(); |
|
2222 | + $all_postypes = geodir_get_posttypes(); |
|
2223 | 2223 | |
2224 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2225 | - return false; |
|
2224 | + if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2225 | + return false; |
|
2226 | 2226 | |
2227 | - $uploads = wp_upload_dir(); |
|
2227 | + $uploads = wp_upload_dir(); |
|
2228 | 2228 | |
2229 | - $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
2229 | + $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
2230 | 2230 | |
2231 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
2231 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
2232 | 2232 | |
2233 | - $wpdb->query( |
|
2234 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2235 | - array($post_id, $split_img_file_path) |
|
2236 | - ) |
|
2237 | - ); |
|
2233 | + $wpdb->query( |
|
2234 | + $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2235 | + array($post_id, $split_img_file_path) |
|
2236 | + ) |
|
2237 | + ); |
|
2238 | 2238 | |
2239 | - $attachment_data = $wpdb->get_row( |
|
2240 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2241 | - array($post_id) |
|
2242 | - ) |
|
2243 | - ); |
|
2239 | + $attachment_data = $wpdb->get_row( |
|
2240 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2241 | + array($post_id) |
|
2242 | + ) |
|
2243 | + ); |
|
2244 | 2244 | |
2245 | - if (!empty($attachment_data)) { |
|
2246 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2247 | - } |
|
2245 | + if (!empty($attachment_data)) { |
|
2246 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2247 | + } |
|
2248 | 2248 | |
2249 | 2249 | |
2250 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2250 | + $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2251 | 2251 | |
2252 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2252 | + $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2253 | 2253 | |
2254 | - geodir_set_wp_featured_image($post_id); |
|
2254 | + geodir_set_wp_featured_image($post_id); |
|
2255 | 2255 | |
2256 | - } |
|
2256 | + } |
|
2257 | 2257 | |
2258 | 2258 | } |
2259 | 2259 | |
@@ -2271,79 +2271,79 @@ discard block |
||
2271 | 2271 | function geodir_temp_set_post_attachment() |
2272 | 2272 | { |
2273 | 2273 | |
2274 | - global $wpdb, $plugin_prefix; |
|
2274 | + global $wpdb, $plugin_prefix; |
|
2275 | 2275 | |
2276 | - $all_postypes = geodir_get_posttypes(); |
|
2276 | + $all_postypes = geodir_get_posttypes(); |
|
2277 | 2277 | |
2278 | - foreach ($all_postypes as $posttype) { |
|
2278 | + foreach ($all_postypes as $posttype) { |
|
2279 | 2279 | |
2280 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2280 | + $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2281 | 2281 | |
2282 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2282 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2283 | 2283 | |
2284 | - if (!empty($get_post_data)) { |
|
2284 | + if (!empty($get_post_data)) { |
|
2285 | 2285 | |
2286 | - foreach ($get_post_data as $data) { |
|
2286 | + foreach ($get_post_data as $data) { |
|
2287 | 2287 | |
2288 | - $post_id = $data->post_id; |
|
2288 | + $post_id = $data->post_id; |
|
2289 | 2289 | |
2290 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2290 | + $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2291 | 2291 | |
2292 | - if (!empty($attachment_data)) { |
|
2292 | + if (!empty($attachment_data)) { |
|
2293 | 2293 | |
2294 | - foreach ($attachment_data as $attach) { |
|
2294 | + foreach ($attachment_data as $attach) { |
|
2295 | 2295 | |
2296 | - $file_info = pathinfo($attach->file); |
|
2296 | + $file_info = pathinfo($attach->file); |
|
2297 | 2297 | |
2298 | - $sub_dir = ''; |
|
2299 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2300 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2298 | + $sub_dir = ''; |
|
2299 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2300 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2301 | 2301 | |
2302 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
2303 | - $uploads_path = $uploads['basedir']; |
|
2302 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
2303 | + $uploads_path = $uploads['basedir']; |
|
2304 | 2304 | |
2305 | - $file_name = $file_info['basename']; |
|
2305 | + $file_name = $file_info['basename']; |
|
2306 | 2306 | |
2307 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2307 | + $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2308 | 2308 | |
2309 | - if (!file_exists($img_arr['path'])) { |
|
2309 | + if (!file_exists($img_arr['path'])) { |
|
2310 | 2310 | |
2311 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2311 | + $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2312 | 2312 | |
2313 | - } |
|
2313 | + } |
|
2314 | 2314 | |
2315 | - } |
|
2315 | + } |
|
2316 | 2316 | |
2317 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2317 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2318 | 2318 | |
2319 | - if (!empty($attachment_data)) { |
|
2319 | + if (!empty($attachment_data)) { |
|
2320 | 2320 | |
2321 | - if ($attachment_data->ID) |
|
2322 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2321 | + if ($attachment_data->ID) |
|
2322 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2323 | 2323 | |
2324 | - } else { |
|
2324 | + } else { |
|
2325 | 2325 | |
2326 | - if (has_post_thumbnail($post_id)) { |
|
2326 | + if (has_post_thumbnail($post_id)) { |
|
2327 | 2327 | |
2328 | - $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
2328 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
2329 | 2329 | |
2330 | - wp_delete_attachment($post_thumbnail_id); |
|
2330 | + wp_delete_attachment($post_thumbnail_id); |
|
2331 | 2331 | |
2332 | - } |
|
2332 | + } |
|
2333 | 2333 | |
2334 | - } |
|
2334 | + } |
|
2335 | 2335 | |
2336 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2336 | + $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2337 | 2337 | |
2338 | - geodir_set_wp_featured_image($post_id); |
|
2338 | + geodir_set_wp_featured_image($post_id); |
|
2339 | 2339 | |
2340 | - } |
|
2340 | + } |
|
2341 | 2341 | |
2342 | - } |
|
2342 | + } |
|
2343 | 2343 | |
2344 | - } |
|
2344 | + } |
|
2345 | 2345 | |
2346 | - } |
|
2346 | + } |
|
2347 | 2347 | |
2348 | 2348 | } |
2349 | 2349 | |
@@ -2361,9 +2361,9 @@ discard block |
||
2361 | 2361 | function geodir_default_rating_star_icon() |
2362 | 2362 | { |
2363 | 2363 | |
2364 | - if (!get_option('geodir_default_rating_star_icon')) { |
|
2365 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2366 | - } |
|
2364 | + if (!get_option('geodir_default_rating_star_icon')) { |
|
2365 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2366 | + } |
|
2367 | 2367 | |
2368 | 2368 | } |
2369 | 2369 | |
@@ -2381,27 +2381,27 @@ discard block |
||
2381 | 2381 | */ |
2382 | 2382 | function geodir_user_post_listing_count($user_id=null) |
2383 | 2383 | { |
2384 | - global $wpdb, $plugin_prefix, $current_user; |
|
2385 | - if(!$user_id){ |
|
2386 | - $user_id = $current_user->ID; |
|
2387 | - } |
|
2384 | + global $wpdb, $plugin_prefix, $current_user; |
|
2385 | + if(!$user_id){ |
|
2386 | + $user_id = $current_user->ID; |
|
2387 | + } |
|
2388 | 2388 | |
2389 | - $user_id = $current_user->ID; |
|
2390 | - $all_postypes = geodir_get_posttypes(); |
|
2391 | - $all_posts = get_option('geodir_listing_link_user_dashboard'); |
|
2389 | + $user_id = $current_user->ID; |
|
2390 | + $all_postypes = geodir_get_posttypes(); |
|
2391 | + $all_posts = get_option('geodir_listing_link_user_dashboard'); |
|
2392 | 2392 | |
2393 | - $user_listing = array(); |
|
2394 | - if (is_array($all_posts) && !empty($all_posts)) { |
|
2395 | - foreach ($all_posts as $ptype) { |
|
2396 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2393 | + $user_listing = array(); |
|
2394 | + if (is_array($all_posts) && !empty($all_posts)) { |
|
2395 | + foreach ($all_posts as $ptype) { |
|
2396 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2397 | 2397 | |
2398 | - if ($total_posts > 0) { |
|
2399 | - $user_listing[$ptype] = $total_posts; |
|
2400 | - } |
|
2401 | - } |
|
2402 | - } |
|
2398 | + if ($total_posts > 0) { |
|
2399 | + $user_listing[$ptype] = $total_posts; |
|
2400 | + } |
|
2401 | + } |
|
2402 | + } |
|
2403 | 2403 | |
2404 | - return $user_listing; |
|
2404 | + return $user_listing; |
|
2405 | 2405 | } |
2406 | 2406 | |
2407 | 2407 | |
@@ -2421,170 +2421,170 @@ discard block |
||
2421 | 2421 | */ |
2422 | 2422 | function geodir_detail_page_custom_field_tab($tabs_arr) |
2423 | 2423 | { |
2424 | - global $post; |
|
2424 | + global $post; |
|
2425 | 2425 | |
2426 | - $post_type = geodir_get_current_posttype(); |
|
2427 | - $all_postypes = geodir_get_posttypes(); |
|
2426 | + $post_type = geodir_get_current_posttype(); |
|
2427 | + $all_postypes = geodir_get_posttypes(); |
|
2428 | 2428 | |
2429 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2430 | - $package_info = array(); |
|
2431 | - $package_info = geodir_post_package_info($package_info, $post); |
|
2432 | - $post_package_id = $package_info->pid; |
|
2433 | - $fields_location = 'owntab'; |
|
2429 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2430 | + $package_info = array(); |
|
2431 | + $package_info = geodir_post_package_info($package_info, $post); |
|
2432 | + $post_package_id = $package_info->pid; |
|
2433 | + $fields_location = 'owntab'; |
|
2434 | 2434 | |
2435 | - $custom_fields = geodir_post_custom_fields($post_package_id, 'custom', $post_type, $fields_location); |
|
2435 | + $custom_fields = geodir_post_custom_fields($post_package_id, 'custom', $post_type, $fields_location); |
|
2436 | 2436 | |
2437 | 2437 | |
2438 | 2438 | |
2439 | - if (!empty($custom_fields)) { |
|
2440 | - $parse_custom_fields = array(); |
|
2441 | - foreach ($custom_fields as $field) { |
|
2442 | - $field = stripslashes_deep($field); // strip slashes |
|
2439 | + if (!empty($custom_fields)) { |
|
2440 | + $parse_custom_fields = array(); |
|
2441 | + foreach ($custom_fields as $field) { |
|
2442 | + $field = stripslashes_deep($field); // strip slashes |
|
2443 | 2443 | |
2444 | - $type = $field; |
|
2445 | - $field_name = $field['htmlvar_name']; |
|
2446 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2447 | - $post->{$field_name} = $_REQUEST[$field_name]; |
|
2448 | - } |
|
2449 | - |
|
2450 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2451 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2452 | - continue; |
|
2453 | - } |
|
2454 | - |
|
2455 | - $parse_custom_fields[] = $field; |
|
2456 | - } |
|
2457 | - } |
|
2458 | - $custom_fields = $parse_custom_fields; |
|
2459 | - } |
|
2460 | - //print_r($custom_fields); |
|
2461 | - if (!empty($custom_fields)) { |
|
2444 | + $type = $field; |
|
2445 | + $field_name = $field['htmlvar_name']; |
|
2446 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2447 | + $post->{$field_name} = $_REQUEST[$field_name]; |
|
2448 | + } |
|
2449 | + |
|
2450 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2451 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2452 | + continue; |
|
2453 | + } |
|
2454 | + |
|
2455 | + $parse_custom_fields[] = $field; |
|
2456 | + } |
|
2457 | + } |
|
2458 | + $custom_fields = $parse_custom_fields; |
|
2459 | + } |
|
2460 | + //print_r($custom_fields); |
|
2461 | + if (!empty($custom_fields)) { |
|
2462 | 2462 | |
2463 | - global $field_set_start; |
|
2463 | + global $field_set_start; |
|
2464 | 2464 | |
2465 | - $post = stripslashes_deep($post); // strip slashes |
|
2465 | + $post = stripslashes_deep($post); // strip slashes |
|
2466 | 2466 | |
2467 | - $field_set_start = 0; |
|
2468 | - $fieldset_count = 0; |
|
2469 | - $fieldset = ''; |
|
2470 | - $total_fields = count($custom_fields); |
|
2471 | - $count_field = 0; |
|
2472 | - $fieldset_arr = array(); |
|
2473 | - $i = 0; |
|
2474 | - $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
2475 | - |
|
2476 | - foreach ($custom_fields as $field) { |
|
2477 | - $count_field++; |
|
2478 | - $field_name = $field['htmlvar_name']; |
|
2479 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2480 | - $post->{$field_name} = $_REQUEST[$field_name]; |
|
2481 | - } |
|
2482 | - |
|
2483 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2484 | - $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
2485 | - $site_title = trim($field['site_title']); |
|
2486 | - $type = $field; |
|
2487 | - $variables_array = array(); |
|
2488 | - |
|
2489 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2490 | - continue; |
|
2491 | - } |
|
2492 | - |
|
2493 | - if ($type['type'] != 'fieldset') { |
|
2494 | - $i++; |
|
2495 | - $variables_array['post_id'] = $post->ID; |
|
2496 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
2497 | - $variables_array['value'] = ''; |
|
2498 | - $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
2499 | - }else{ |
|
2500 | - $i = 0; |
|
2501 | - $fieldset_count++; |
|
2502 | - $field_set_start = 1; |
|
2503 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2504 | - $fieldset_arr[$fieldset_count]['label'] = $label; |
|
2505 | - } |
|
2506 | - |
|
2507 | - |
|
2508 | - $type = stripslashes_deep($type); // strip slashes |
|
2509 | - $html = ''; |
|
2510 | - $html_var = ''; |
|
2511 | - $field_icon = geodir_field_icon_proccess($type); |
|
2512 | - $filed_type = $type['type']; |
|
2513 | - |
|
2514 | - /** |
|
2515 | - * Filter the output for custom fields. |
|
2516 | - * |
|
2517 | - * Here we can remove or add new functions depending on the field type. |
|
2518 | - * |
|
2519 | - * @param string $html The html to be filtered (blank). |
|
2520 | - * @param string $fields_location The location the field is to be show. |
|
2521 | - * @param array $type The array of field values. |
|
2522 | - */ |
|
2523 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2524 | - |
|
2525 | - |
|
2526 | - /** |
|
2527 | - * Filter custom field output in tab. |
|
2528 | - * |
|
2529 | - * @since 1.5.6 |
|
2530 | - * |
|
2531 | - * @param string $html_var The HTML variable name for the field. |
|
2532 | - * @param string $html Custom field unfiltered HTML. |
|
2533 | - * @param array $variables_array Custom field variables array. |
|
2534 | - */ |
|
2535 | - $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array); |
|
2536 | - |
|
2537 | - $fieldset_html = ''; |
|
2538 | - if ($field_set_start == 1) { |
|
2539 | - $add_html = false; |
|
2540 | - if ($type['type'] == 'fieldset' && $fieldset_count > 1) { |
|
2541 | - if ($fieldset != '') { |
|
2542 | - $add_html = true; |
|
2543 | - $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
2544 | - $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
2545 | - } |
|
2546 | - $fieldset_html = $fieldset; |
|
2547 | - $fieldset = ''; |
|
2548 | - } else { |
|
2549 | - $fieldset .= $html; |
|
2550 | - if ($total_fields == $count_field && $fieldset != '') { |
|
2551 | - $add_html = true; |
|
2552 | - $label = $fieldset_arr[$fieldset_count]['label']; |
|
2553 | - $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
2554 | - $fieldset_html = $fieldset; |
|
2555 | - } |
|
2556 | - } |
|
2557 | - |
|
2558 | - if ($add_html) { |
|
2559 | - $tabs_arr[$htmlvar_name] = array( |
|
2560 | - 'heading_text' => __($label, 'geodirectory'), |
|
2561 | - 'is_active_tab' => false, |
|
2562 | - /** |
|
2563 | - * Filter if a custom field should be displayed on the details page tab. |
|
2564 | - * |
|
2565 | - * @since 1.0.0 |
|
2566 | - * @param string $htmlvar_name The field HTML var name. |
|
2567 | - */ |
|
2568 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
|
2569 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2570 | - ); |
|
2571 | - } |
|
2572 | - } else { |
|
2573 | - if ($html != '') { |
|
2574 | - $tabs_arr[$field['htmlvar_name']] = array( |
|
2575 | - 'heading_text' => __($label, 'geodirectory'), |
|
2576 | - 'is_active_tab' => false, |
|
2577 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
2578 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']), |
|
2579 | - 'tab_content' => $html |
|
2580 | - ); |
|
2581 | - } |
|
2582 | - } |
|
2583 | - } |
|
2584 | - } |
|
2585 | - } |
|
2586 | - } |
|
2587 | - return $tabs_arr; |
|
2467 | + $field_set_start = 0; |
|
2468 | + $fieldset_count = 0; |
|
2469 | + $fieldset = ''; |
|
2470 | + $total_fields = count($custom_fields); |
|
2471 | + $count_field = 0; |
|
2472 | + $fieldset_arr = array(); |
|
2473 | + $i = 0; |
|
2474 | + $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
2475 | + |
|
2476 | + foreach ($custom_fields as $field) { |
|
2477 | + $count_field++; |
|
2478 | + $field_name = $field['htmlvar_name']; |
|
2479 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2480 | + $post->{$field_name} = $_REQUEST[$field_name]; |
|
2481 | + } |
|
2482 | + |
|
2483 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2484 | + $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
2485 | + $site_title = trim($field['site_title']); |
|
2486 | + $type = $field; |
|
2487 | + $variables_array = array(); |
|
2488 | + |
|
2489 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2490 | + continue; |
|
2491 | + } |
|
2492 | + |
|
2493 | + if ($type['type'] != 'fieldset') { |
|
2494 | + $i++; |
|
2495 | + $variables_array['post_id'] = $post->ID; |
|
2496 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
2497 | + $variables_array['value'] = ''; |
|
2498 | + $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
2499 | + }else{ |
|
2500 | + $i = 0; |
|
2501 | + $fieldset_count++; |
|
2502 | + $field_set_start = 1; |
|
2503 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2504 | + $fieldset_arr[$fieldset_count]['label'] = $label; |
|
2505 | + } |
|
2506 | + |
|
2507 | + |
|
2508 | + $type = stripslashes_deep($type); // strip slashes |
|
2509 | + $html = ''; |
|
2510 | + $html_var = ''; |
|
2511 | + $field_icon = geodir_field_icon_proccess($type); |
|
2512 | + $filed_type = $type['type']; |
|
2513 | + |
|
2514 | + /** |
|
2515 | + * Filter the output for custom fields. |
|
2516 | + * |
|
2517 | + * Here we can remove or add new functions depending on the field type. |
|
2518 | + * |
|
2519 | + * @param string $html The html to be filtered (blank). |
|
2520 | + * @param string $fields_location The location the field is to be show. |
|
2521 | + * @param array $type The array of field values. |
|
2522 | + */ |
|
2523 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2524 | + |
|
2525 | + |
|
2526 | + /** |
|
2527 | + * Filter custom field output in tab. |
|
2528 | + * |
|
2529 | + * @since 1.5.6 |
|
2530 | + * |
|
2531 | + * @param string $html_var The HTML variable name for the field. |
|
2532 | + * @param string $html Custom field unfiltered HTML. |
|
2533 | + * @param array $variables_array Custom field variables array. |
|
2534 | + */ |
|
2535 | + $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array); |
|
2536 | + |
|
2537 | + $fieldset_html = ''; |
|
2538 | + if ($field_set_start == 1) { |
|
2539 | + $add_html = false; |
|
2540 | + if ($type['type'] == 'fieldset' && $fieldset_count > 1) { |
|
2541 | + if ($fieldset != '') { |
|
2542 | + $add_html = true; |
|
2543 | + $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
2544 | + $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
2545 | + } |
|
2546 | + $fieldset_html = $fieldset; |
|
2547 | + $fieldset = ''; |
|
2548 | + } else { |
|
2549 | + $fieldset .= $html; |
|
2550 | + if ($total_fields == $count_field && $fieldset != '') { |
|
2551 | + $add_html = true; |
|
2552 | + $label = $fieldset_arr[$fieldset_count]['label']; |
|
2553 | + $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
2554 | + $fieldset_html = $fieldset; |
|
2555 | + } |
|
2556 | + } |
|
2557 | + |
|
2558 | + if ($add_html) { |
|
2559 | + $tabs_arr[$htmlvar_name] = array( |
|
2560 | + 'heading_text' => __($label, 'geodirectory'), |
|
2561 | + 'is_active_tab' => false, |
|
2562 | + /** |
|
2563 | + * Filter if a custom field should be displayed on the details page tab. |
|
2564 | + * |
|
2565 | + * @since 1.0.0 |
|
2566 | + * @param string $htmlvar_name The field HTML var name. |
|
2567 | + */ |
|
2568 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
|
2569 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2570 | + ); |
|
2571 | + } |
|
2572 | + } else { |
|
2573 | + if ($html != '') { |
|
2574 | + $tabs_arr[$field['htmlvar_name']] = array( |
|
2575 | + 'heading_text' => __($label, 'geodirectory'), |
|
2576 | + 'is_active_tab' => false, |
|
2577 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
2578 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']), |
|
2579 | + 'tab_content' => $html |
|
2580 | + ); |
|
2581 | + } |
|
2582 | + } |
|
2583 | + } |
|
2584 | + } |
|
2585 | + } |
|
2586 | + } |
|
2587 | + return $tabs_arr; |
|
2588 | 2588 | } |
2589 | 2589 | |
2590 | 2590 | /* display add listing page for wpml */ |
@@ -2608,37 +2608,37 @@ discard block |
||
2608 | 2608 | */ |
2609 | 2609 | function geodir_add_post_status_author_page() |
2610 | 2610 | { |
2611 | - global $wpdb, $post; |
|
2612 | - |
|
2613 | - $html = ''; |
|
2614 | - if (get_current_user_id()) { |
|
2615 | - if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) { |
|
2616 | - |
|
2617 | - // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
2618 | - $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID"); |
|
2619 | - $status = "<strong>("; |
|
2620 | - $status_icon = '<i class="fa fa-play"></i>'; |
|
2621 | - if ($real_status == 'publish') { |
|
2622 | - $status .= __('Published', 'geodirectory'); |
|
2623 | - } else { |
|
2624 | - $status .= __('Not published', 'geodirectory'); |
|
2625 | - $status_icon = '<i class="fa fa-pause"></i>'; |
|
2626 | - } |
|
2627 | - $status .= ")</strong>"; |
|
2611 | + global $wpdb, $post; |
|
2612 | + |
|
2613 | + $html = ''; |
|
2614 | + if (get_current_user_id()) { |
|
2615 | + if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) { |
|
2616 | + |
|
2617 | + // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
2618 | + $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID"); |
|
2619 | + $status = "<strong>("; |
|
2620 | + $status_icon = '<i class="fa fa-play"></i>'; |
|
2621 | + if ($real_status == 'publish') { |
|
2622 | + $status .= __('Published', 'geodirectory'); |
|
2623 | + } else { |
|
2624 | + $status .= __('Not published', 'geodirectory'); |
|
2625 | + $status_icon = '<i class="fa fa-pause"></i>'; |
|
2626 | + } |
|
2627 | + $status .= ")</strong>"; |
|
2628 | 2628 | |
2629 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2630 | - } |
|
2631 | - } |
|
2629 | + $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2630 | + } |
|
2631 | + } |
|
2632 | 2632 | |
2633 | - if ($html != '') { |
|
2634 | - /** |
|
2635 | - * Filter the post status text on the author page. |
|
2636 | - * |
|
2637 | - * @since 1.0.0 |
|
2638 | - * @param string $html The HTML of the status. |
|
2639 | - */ |
|
2640 | - echo apply_filters('geodir_filter_status_text_on_author_page', $html); |
|
2641 | - } |
|
2633 | + if ($html != '') { |
|
2634 | + /** |
|
2635 | + * Filter the post status text on the author page. |
|
2636 | + * |
|
2637 | + * @since 1.0.0 |
|
2638 | + * @param string $html The HTML of the status. |
|
2639 | + */ |
|
2640 | + echo apply_filters('geodir_filter_status_text_on_author_page', $html); |
|
2641 | + } |
|
2642 | 2642 | |
2643 | 2643 | |
2644 | 2644 | } |
@@ -2652,21 +2652,21 @@ discard block |
||
2652 | 2652 | */ |
2653 | 2653 | function geodir_init_no_rating() |
2654 | 2654 | { |
2655 | - if (get_option('geodir_disable_rating')) { |
|
2656 | - remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields'); |
|
2657 | - remove_action('comment_form_before_fields', 'geodir_comment_rating_fields'); |
|
2658 | - remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields'); |
|
2659 | - remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields'); |
|
2660 | - remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box'); |
|
2661 | - remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13); |
|
2662 | - remove_filter('comment_text', 'geodir_wrap_comment_text', 40); |
|
2663 | - |
|
2664 | - add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields'); |
|
2665 | - add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields'); |
|
2666 | - add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2); |
|
2667 | - add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100); |
|
2668 | - add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2); |
|
2669 | - } |
|
2655 | + if (get_option('geodir_disable_rating')) { |
|
2656 | + remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields'); |
|
2657 | + remove_action('comment_form_before_fields', 'geodir_comment_rating_fields'); |
|
2658 | + remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields'); |
|
2659 | + remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields'); |
|
2660 | + remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box'); |
|
2661 | + remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13); |
|
2662 | + remove_filter('comment_text', 'geodir_wrap_comment_text', 40); |
|
2663 | + |
|
2664 | + add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields'); |
|
2665 | + add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields'); |
|
2666 | + add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2); |
|
2667 | + add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100); |
|
2668 | + add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2); |
|
2669 | + } |
|
2670 | 2670 | } |
2671 | 2671 | |
2672 | 2672 | /** |
@@ -2678,20 +2678,20 @@ discard block |
||
2678 | 2678 | */ |
2679 | 2679 | function geodir_no_rating_rating_fields() |
2680 | 2680 | { |
2681 | - global $post; |
|
2681 | + global $post; |
|
2682 | 2682 | |
2683 | - $post_types = geodir_get_posttypes(); |
|
2683 | + $post_types = geodir_get_posttypes(); |
|
2684 | 2684 | |
2685 | - if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) { |
|
2686 | - if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) { |
|
2687 | - echo '<input type="hidden" value="1" name="geodir_rating[overall]" />'; |
|
2688 | - if (get_option('geodir_reviewrating_enable_images')) { |
|
2689 | - geodir_reviewrating_rating_img_html(); |
|
2690 | - } |
|
2691 | - } else { |
|
2692 | - echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />'; |
|
2693 | - } |
|
2694 | - } |
|
2685 | + if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) { |
|
2686 | + if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) { |
|
2687 | + echo '<input type="hidden" value="1" name="geodir_rating[overall]" />'; |
|
2688 | + if (get_option('geodir_reviewrating_enable_images')) { |
|
2689 | + geodir_reviewrating_rating_img_html(); |
|
2690 | + } |
|
2691 | + } else { |
|
2692 | + echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />'; |
|
2693 | + } |
|
2694 | + } |
|
2695 | 2695 | } |
2696 | 2696 | |
2697 | 2697 | /** |
@@ -2705,11 +2705,11 @@ discard block |
||
2705 | 2705 | */ |
2706 | 2706 | function geodir_no_rating_comment_text($content, $comment = '') |
2707 | 2707 | { |
2708 | - if (!is_admin()) { |
|
2709 | - return '<div class="description">' . $content . '</div>'; |
|
2710 | - } else { |
|
2711 | - return $content; |
|
2712 | - } |
|
2708 | + if (!is_admin()) { |
|
2709 | + return '<div class="description">' . $content . '</div>'; |
|
2710 | + } else { |
|
2711 | + return $content; |
|
2712 | + } |
|
2713 | 2713 | } |
2714 | 2714 | |
2715 | 2715 | /** |
@@ -2722,7 +2722,7 @@ discard block |
||
2722 | 2722 | */ |
2723 | 2723 | function geodir_no_rating_review_rating_html($content = '') |
2724 | 2724 | { |
2725 | - return NULL; |
|
2725 | + return NULL; |
|
2726 | 2726 | } |
2727 | 2727 | |
2728 | 2728 | /** |
@@ -2736,19 +2736,19 @@ discard block |
||
2736 | 2736 | */ |
2737 | 2737 | function geodir_no_rating_get_sort_options($options, $post_type = '') |
2738 | 2738 | { |
2739 | - $new_options = array(); |
|
2740 | - if (!empty($options)) { |
|
2741 | - foreach ($options as $option) { |
|
2742 | - if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') { |
|
2743 | - continue; |
|
2744 | - } |
|
2745 | - $new_options[] = $option; |
|
2746 | - } |
|
2739 | + $new_options = array(); |
|
2740 | + if (!empty($options)) { |
|
2741 | + foreach ($options as $option) { |
|
2742 | + if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') { |
|
2743 | + continue; |
|
2744 | + } |
|
2745 | + $new_options[] = $option; |
|
2746 | + } |
|
2747 | 2747 | |
2748 | - $options = $new_options; |
|
2749 | - } |
|
2748 | + $options = $new_options; |
|
2749 | + } |
|
2750 | 2750 | |
2751 | - return $options; |
|
2751 | + return $options; |
|
2752 | 2752 | } |
2753 | 2753 | |
2754 | 2754 | add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100); |
@@ -2762,11 +2762,11 @@ discard block |
||
2762 | 2762 | */ |
2763 | 2763 | function geodir_all_js_msg_no_rating($msg = array()) |
2764 | 2764 | { |
2765 | - if (get_option('geodir_disable_rating')) { |
|
2766 | - $msg['gd_cmt_no_rating'] = true; |
|
2767 | - } |
|
2765 | + if (get_option('geodir_disable_rating')) { |
|
2766 | + $msg['gd_cmt_no_rating'] = true; |
|
2767 | + } |
|
2768 | 2768 | |
2769 | - return $msg; |
|
2769 | + return $msg; |
|
2770 | 2770 | } |
2771 | 2771 | |
2772 | 2772 | add_filter('body_class', 'geodir_body_class_no_rating', 100); |
@@ -2780,13 +2780,13 @@ discard block |
||
2780 | 2780 | */ |
2781 | 2781 | function geodir_body_class_no_rating($classes = array()) |
2782 | 2782 | { |
2783 | - if (get_option('geodir_disable_rating')) { |
|
2784 | - $classes[] = 'gd-no-rating'; |
|
2785 | - } |
|
2783 | + if (get_option('geodir_disable_rating')) { |
|
2784 | + $classes[] = 'gd-no-rating'; |
|
2785 | + } |
|
2786 | 2786 | |
2787 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2787 | + $classes[] = 'gd-map-' . geodir_map_name(); |
|
2788 | 2788 | |
2789 | - return $classes; |
|
2789 | + return $classes; |
|
2790 | 2790 | } |
2791 | 2791 | |
2792 | 2792 | add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100); |
@@ -2800,13 +2800,13 @@ discard block |
||
2800 | 2800 | */ |
2801 | 2801 | function geodir_admin_body_class_no_rating($class = '') |
2802 | 2802 | { |
2803 | - if (get_option('geodir_disable_rating')) { |
|
2804 | - $class .= ' gd-no-rating'; |
|
2805 | - } |
|
2803 | + if (get_option('geodir_disable_rating')) { |
|
2804 | + $class .= ' gd-no-rating'; |
|
2805 | + } |
|
2806 | 2806 | |
2807 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2807 | + $class .= ' gd-map-' . geodir_map_name(); |
|
2808 | 2808 | |
2809 | - return $class; |
|
2809 | + return $class; |
|
2810 | 2810 | } |
2811 | 2811 | |
2812 | 2812 | add_action('wp_head', 'geodir_wp_head_no_rating'); |
@@ -2819,10 +2819,10 @@ discard block |
||
2819 | 2819 | */ |
2820 | 2820 | function geodir_wp_head_no_rating() |
2821 | 2821 | { |
2822 | - if (get_option('geodir_disable_rating')) { |
|
2823 | - echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>'; |
|
2824 | - echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>'; |
|
2825 | - } |
|
2822 | + if (get_option('geodir_disable_rating')) { |
|
2823 | + echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>'; |
|
2824 | + echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>'; |
|
2825 | + } |
|
2826 | 2826 | } |
2827 | 2827 | |
2828 | 2828 | add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation'); |
@@ -2839,36 +2839,36 @@ discard block |
||
2839 | 2839 | * @return array Translation texts. |
2840 | 2840 | */ |
2841 | 2841 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2842 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2843 | - |
|
2844 | - $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
|
2845 | - |
|
2846 | - /** |
|
2847 | - * Filters the geodirectory option names that requires to add for translation. |
|
2848 | - * |
|
2849 | - * @since 1.5.7 |
|
2850 | - * @package GeoDirectory |
|
2851 | - * |
|
2852 | - * @param array $gd_options Array of option names. |
|
2853 | - */ |
|
2854 | - $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options); |
|
2855 | - $gd_options = array_unique($gd_options); |
|
2856 | - |
|
2857 | - if (!empty($gd_options)) { |
|
2858 | - foreach ($gd_options as $gd_option) { |
|
2859 | - if ($gd_option != '' && $option_value = get_option($gd_option)) { |
|
2860 | - $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
2842 | + $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2843 | + |
|
2844 | + $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
|
2845 | + |
|
2846 | + /** |
|
2847 | + * Filters the geodirectory option names that requires to add for translation. |
|
2848 | + * |
|
2849 | + * @since 1.5.7 |
|
2850 | + * @package GeoDirectory |
|
2851 | + * |
|
2852 | + * @param array $gd_options Array of option names. |
|
2853 | + */ |
|
2854 | + $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options); |
|
2855 | + $gd_options = array_unique($gd_options); |
|
2856 | + |
|
2857 | + if (!empty($gd_options)) { |
|
2858 | + foreach ($gd_options as $gd_option) { |
|
2859 | + if ($gd_option != '' && $option_value = get_option($gd_option)) { |
|
2860 | + $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
2861 | 2861 | |
2862 | - if ($option_value != '' && !in_array($option_value, $translation_texts)) { |
|
2863 | - $translation_texts[] = stripslashes_deep($option_value); |
|
2864 | - } |
|
2865 | - } |
|
2866 | - } |
|
2867 | - } |
|
2862 | + if ($option_value != '' && !in_array($option_value, $translation_texts)) { |
|
2863 | + $translation_texts[] = stripslashes_deep($option_value); |
|
2864 | + } |
|
2865 | + } |
|
2866 | + } |
|
2867 | + } |
|
2868 | 2868 | |
2869 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
2869 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
2870 | 2870 | |
2871 | - return $translation_texts; |
|
2871 | + return $translation_texts; |
|
2872 | 2872 | } |
2873 | 2873 | |
2874 | 2874 | add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation'); |
@@ -2882,15 +2882,15 @@ discard block |
||
2882 | 2882 | |
2883 | 2883 | add_filter('get_comments_link', 'gd_get_comments_link', 10, 2); |
2884 | 2884 | function gd_get_comments_link($comments_link, $post_id) { |
2885 | - $post_type = get_post_type($post_id); |
|
2885 | + $post_type = get_post_type($post_id); |
|
2886 | 2886 | |
2887 | - $all_postypes = geodir_get_posttypes(); |
|
2888 | - if (in_array($post_type, $all_postypes)) { |
|
2889 | - $comments_link = str_replace('#comments', '#reviews', $comments_link); |
|
2890 | - $comments_link = str_replace('#respond', '#reviews', $comments_link); |
|
2891 | - } |
|
2887 | + $all_postypes = geodir_get_posttypes(); |
|
2888 | + if (in_array($post_type, $all_postypes)) { |
|
2889 | + $comments_link = str_replace('#comments', '#reviews', $comments_link); |
|
2890 | + $comments_link = str_replace('#respond', '#reviews', $comments_link); |
|
2891 | + } |
|
2892 | 2892 | |
2893 | - return $comments_link; |
|
2893 | + return $comments_link; |
|
2894 | 2894 | } |
2895 | 2895 | |
2896 | 2896 | |
@@ -2908,11 +2908,11 @@ discard block |
||
2908 | 2908 | function geodir_add_nav_menu_class( $args ) |
2909 | 2909 | { |
2910 | 2910 | |
2911 | - if(isset($args['menu_class'])){ |
|
2912 | - $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
2913 | - } |
|
2911 | + if(isset($args['menu_class'])){ |
|
2912 | + $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
2913 | + } |
|
2914 | 2914 | |
2915 | - return $args; |
|
2915 | + return $args; |
|
2916 | 2916 | } |
2917 | 2917 | |
2918 | 2918 | add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
2919 | 2919 | \ No newline at end of file |