Passed
Pull Request — master (#227)
by Kiran
10:22
created
geodirectory-admin/admin_functions.php 3 patches
Indentation   +2714 added lines, -2714 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Admin functions.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /**
10 10
  * Updates option value when GeoDirectory get deactivated.
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 function geodir_deactivation()
16 16
 {
17 17
 
18
-    // Update installed variable
19
-    update_option("geodir_installed", 0);
18
+	// Update installed variable
19
+	update_option("geodir_installed", 0);
20 20
 
21
-    // Remove rewrite rules and then recreate rewrite rules.
22
-    flush_rewrite_rules();
21
+	// Remove rewrite rules and then recreate rewrite rules.
22
+	flush_rewrite_rules();
23 23
 }
24 24
 
25 25
 
@@ -32,105 +32,105 @@  discard block
 block discarded – undo
32 32
 function geodir_uninstall()
33 33
 {
34 34
 
35
-    delete_option('geodir_default_data_installed');
35
+	delete_option('geodir_default_data_installed');
36 36
 
37 37
 }
38 38
 
39 39
 if (!function_exists('geodir_admin_styles')) {
40
-    /**
41
-     * Enqueue Admin Styles.
42
-     *
43
-     * @since 1.0.0
44
-     * @package GeoDirectory
45
-     */
46
-    function geodir_admin_styles()
47
-    {
40
+	/**
41
+	 * Enqueue Admin Styles.
42
+	 *
43
+	 * @since 1.0.0
44
+	 * @package GeoDirectory
45
+	 */
46
+	function geodir_admin_styles()
47
+	{
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-admin-css');
49
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodirectory-frontend-style');
52
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-chosen-style');
55
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
58
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
-        wp_enqueue_style('geodirectory-jquery-ui-css');
61
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
+		wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
-        wp_enqueue_style('geodirectory-custom-fields-css');
64
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
+		wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
-        wp_enqueue_style('geodirectory-pluplodar-css');
67
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
+		wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('geodir-rating-style');
70
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
-        wp_enqueue_style('geodir-rtl-style');
73
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
+		wp_enqueue_style('geodir-rtl-style');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_styles_req')) {
80
-    /**
81
-     * Loads stylesheets from CDN.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_styles_req()
87
-    {
80
+	/**
81
+	 * Loads stylesheets from CDN.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_styles_req()
87
+	{
88 88
 
89
-        wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
-        wp_enqueue_style('geodirectory-font-awesome');
89
+		wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
+		wp_enqueue_style('geodirectory-font-awesome');
91 91
 
92
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
-        wp_enqueue_script('geodirectory-admin');
92
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
+		wp_enqueue_script('geodirectory-admin');
94 94
 
95
-    }
95
+	}
96 96
 }
97 97
 
98 98
 if (!function_exists('geodir_admin_scripts')) {
99
-    /**
100
-     * Enqueue Admin Scripts.
101
-     *
102
-     * @since 1.0.0
103
-     * @package GeoDirectory
104
-     */
105
-    function geodir_admin_scripts()
106
-    {
99
+	/**
100
+	 * Enqueue Admin Scripts.
101
+	 *
102
+	 * @since 1.0.0
103
+	 * @package GeoDirectory
104
+	 */
105
+	function geodir_admin_scripts()
106
+	{
107 107
 
108
-        wp_enqueue_script('jquery');
108
+		wp_enqueue_script('jquery');
109 109
 
110
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
110
+		wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111 111
 
112
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
-        wp_enqueue_script('chosen');
112
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
+		wp_enqueue_script('chosen');
114 114
 
115
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
-        wp_enqueue_script('geodirectory-choose-ajax');
115
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
+		wp_enqueue_script('geodirectory-choose-ajax');
117 117
 
118
-        if (isset($_REQUEST['listing_type'])) {
119
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
-        }
118
+		if (isset($_REQUEST['listing_type'])) {
119
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
+		}
121 121
 
122
-        wp_enqueue_script('geodirectory-custom-fields-script');
123
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
122
+		wp_enqueue_script('geodirectory-custom-fields-script');
123
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
124 124
 
125
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
125
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126 126
 
127
-        $map_lang = "&language=" . geodir_get_map_default_language();
128
-        /** This filter is documented in geodirectory_template_tags.php */
129
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
-        wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
127
+		$map_lang = "&language=" . geodir_get_map_default_language();
128
+		/** This filter is documented in geodirectory_template_tags.php */
129
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
+		wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
131 131
 
132
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
-        wp_enqueue_script('geodirectory-goMap-script');
132
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
+		wp_enqueue_script('geodirectory-goMap-script');
134 134
 
135 135
 		// font awesome rating script
136 136
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -141,167 +141,167 @@  discard block
 block discarded – undo
141 141
 			wp_enqueue_script('geodir-jRating-js');
142 142
 		}
143 143
 
144
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
-        wp_enqueue_script('geodir-on-document-load');
146
-
147
-
148
-        // SCRIPT FOR UPLOAD
149
-        wp_enqueue_script('plupload-all');
150
-        wp_enqueue_script('jquery-ui-sortable');
151
-
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
-        wp_enqueue_script('geodirectory-plupload-script');
154
-
155
-        // SCRIPT FOR UPLOAD END
156
-
157
-
158
-        // place js config array for plupload
159
-        $plupload_init = array(
160
-            'runtimes' => 'html5,silverlight,flash,html4',
161
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
-            'drop_element' => 'dropbox', // will be adjusted per uploader
164
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
165
-            'multiple_queues' => true,
166
-            'max_file_size' => geodir_max_upload_size(),
167
-            'url' => admin_url('admin-ajax.php'),
168
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
-            'multipart' => true,
172
-            'urlstream_upload' => true,
173
-            'multi_selection' => false, // will be added per uploader
174
-            // additional post data to send to our ajax hook
175
-            'multipart_params' => array(
176
-                '_ajax_nonce' => "", // will be added per uploader
177
-                'action' => 'plupload_action', // the ajax action name
178
-                'imgid' => 0 // will be added per uploader
179
-            )
180
-        );
181
-        $base_plupload_config = json_encode($plupload_init);
182
-
183
-
184
-        $thumb_img_arr = array();
185
-
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
-
189
-        $totImg = '';
190
-        $image_limit = '';
191
-        if (!empty($thumb_img_arr)) {
192
-            $totImg = count($thumb_img_arr);
193
-        }
144
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
+		wp_enqueue_script('geodir-on-document-load');
146
+
147
+
148
+		// SCRIPT FOR UPLOAD
149
+		wp_enqueue_script('plupload-all');
150
+		wp_enqueue_script('jquery-ui-sortable');
151
+
152
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
+		wp_enqueue_script('geodirectory-plupload-script');
154
+
155
+		// SCRIPT FOR UPLOAD END
156
+
157
+
158
+		// place js config array for plupload
159
+		$plupload_init = array(
160
+			'runtimes' => 'html5,silverlight,flash,html4',
161
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
+			'drop_element' => 'dropbox', // will be adjusted per uploader
164
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
165
+			'multiple_queues' => true,
166
+			'max_file_size' => geodir_max_upload_size(),
167
+			'url' => admin_url('admin-ajax.php'),
168
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
+			'multipart' => true,
172
+			'urlstream_upload' => true,
173
+			'multi_selection' => false, // will be added per uploader
174
+			// additional post data to send to our ajax hook
175
+			'multipart_params' => array(
176
+				'_ajax_nonce' => "", // will be added per uploader
177
+				'action' => 'plupload_action', // the ajax action name
178
+				'imgid' => 0 // will be added per uploader
179
+			)
180
+		);
181
+		$base_plupload_config = json_encode($plupload_init);
182
+
183
+
184
+		$thumb_img_arr = array();
185
+
186
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+
189
+		$totImg = '';
190
+		$image_limit = '';
191
+		if (!empty($thumb_img_arr)) {
192
+			$totImg = count($thumb_img_arr);
193
+		}
194 194
 
195
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
196
-            'totalImg' => $totImg,
197
-            'image_limit' => $image_limit,
198
-            'upload_img_size' => geodir_max_upload_size());
195
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
196
+			'totalImg' => $totImg,
197
+			'image_limit' => $image_limit,
198
+			'upload_img_size' => geodir_max_upload_size());
199 199
 
200
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
200
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
201 201
 
202
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
203
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
202
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
203
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
204 204
 
205 205
 
206
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
207
-        wp_enqueue_script('geodirectory-admin-script');
206
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
207
+		wp_enqueue_script('geodirectory-admin-script');
208 208
 
209
-        wp_enqueue_style('farbtastic');
210
-        wp_enqueue_script('farbtastic');
209
+		wp_enqueue_style('farbtastic');
210
+		wp_enqueue_script('farbtastic');
211 211
 
212
-        $screen = get_current_screen();
213
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
214
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
215
-        }
212
+		$screen = get_current_screen();
213
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
214
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
215
+		}
216 216
 
217
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
218
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
217
+		$ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
218
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
219 219
 
220
-    }
220
+	}
221 221
 }
222 222
 
223 223
 if (!function_exists('geodir_admin_menu')) {
224
-    /**
225
-     * Admin Menus
226
-     *
227
-     * Sets up the admin menus in wordpress.
228
-     *
229
-     * @since 1.0.0
230
-     * @package GeoDirectory
231
-     * @global array $menu Menu array.
232
-     * @global object $geodirectory GeoDirectory plugin object.
233
-     */
234
-    function geodir_admin_menu()
235
-    {
236
-        global $menu, $geodirectory;
224
+	/**
225
+	 * Admin Menus
226
+	 *
227
+	 * Sets up the admin menus in wordpress.
228
+	 *
229
+	 * @since 1.0.0
230
+	 * @package GeoDirectory
231
+	 * @global array $menu Menu array.
232
+	 * @global object $geodirectory GeoDirectory plugin object.
233
+	 */
234
+	function geodir_admin_menu()
235
+	{
236
+		global $menu, $geodirectory;
237 237
 
238
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
238
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
239 239
 
240
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
240
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
241 241
 
242 242
 
243
-    }
243
+	}
244 244
 }
245 245
 
246 246
 if (!function_exists('geodir_admin_menu_order')) {
247
-    /**
248
-     * Order admin menus.
249
-     *
250
-     * @since 1.0.0
251
-     * @package GeoDirectory
252
-     * @param array $menu_order Menu order array.
253
-     * @return array Modified menu order array.
254
-     */
255
-    function geodir_admin_menu_order($menu_order)
256
-    {
257
-
258
-        // Initialize our custom order array
259
-        $geodir_menu_order = array();
260
-
261
-        // Get the index of our custom separator
262
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
263
-
264
-        // Get index of posttype menu
265
-        $post_types = geodir_get_posttypes();
266
-
267
-        // Loop through menu order and do some rearranging
268
-        foreach ($menu_order as $index => $item) :
269
-
270
-            if ((('geodirectory') == $item)) :
271
-                $geodir_menu_order[] = 'separator-geodirectory';
272
-                if (!empty($post_types)) {
273
-                    foreach ($post_types as $post_type) {
274
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
275
-                    }
276
-                }
277
-                $geodir_menu_order[] = $item;
247
+	/**
248
+	 * Order admin menus.
249
+	 *
250
+	 * @since 1.0.0
251
+	 * @package GeoDirectory
252
+	 * @param array $menu_order Menu order array.
253
+	 * @return array Modified menu order array.
254
+	 */
255
+	function geodir_admin_menu_order($menu_order)
256
+	{
278 257
 
279
-                unset($menu_order[$geodir_separator]);
280
-            //unset( $menu_order[$geodir_places] );
281
-            elseif (!in_array($item, array('separator-geodirectory'))) :
282
-                $geodir_menu_order[] = $item;
283
-            endif;
258
+		// Initialize our custom order array
259
+		$geodir_menu_order = array();
284 260
 
285
-        endforeach;
261
+		// Get the index of our custom separator
262
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
286 263
 
287
-        // Return order
288
-        return $geodir_menu_order;
289
-    }
264
+		// Get index of posttype menu
265
+		$post_types = geodir_get_posttypes();
266
+
267
+		// Loop through menu order and do some rearranging
268
+		foreach ($menu_order as $index => $item) :
269
+
270
+			if ((('geodirectory') == $item)) :
271
+				$geodir_menu_order[] = 'separator-geodirectory';
272
+				if (!empty($post_types)) {
273
+					foreach ($post_types as $post_type) {
274
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
275
+					}
276
+				}
277
+				$geodir_menu_order[] = $item;
278
+
279
+				unset($menu_order[$geodir_separator]);
280
+			//unset( $menu_order[$geodir_places] );
281
+			elseif (!in_array($item, array('separator-geodirectory'))) :
282
+				$geodir_menu_order[] = $item;
283
+			endif;
284
+
285
+		endforeach;
286
+
287
+		// Return order
288
+		return $geodir_menu_order;
289
+	}
290 290
 }
291 291
 
292 292
 if (!function_exists('geodir_admin_custom_menu_order')) {
293
-    /**
294
-     * Enables custom menu order.
295
-     *
296
-     * @since 1.0.0
297
-     * @package GeoDirectory
298
-     * @return bool
299
-     */
300
-    function geodir_admin_custom_menu_order()
301
-    {
302
-        if (!current_user_can('manage_options')) return false;
303
-        return true;
304
-    }
293
+	/**
294
+	 * Enables custom menu order.
295
+	 *
296
+	 * @since 1.0.0
297
+	 * @package GeoDirectory
298
+	 * @return bool
299
+	 */
300
+	function geodir_admin_custom_menu_order()
301
+	{
302
+		if (!current_user_can('manage_options')) return false;
303
+		return true;
304
+	}
305 305
 }
306 306
 
307 307
 /**
@@ -312,41 +312,41 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_before_admin_panel()
314 314
 {
315
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
316
-        echo '<div id="message" class="updated fade">
315
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
316
+		echo '<div id="message" class="updated fade">
317 317
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
318 318
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
319 319
                 </div>';
320 320
 
321
-    }
321
+	}
322 322
 
323
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
324
-        switch ($_REQUEST['msg']) {
325
-            case 'success':
326
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
327
-                flush_rewrite_rules(false);
323
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
324
+		switch ($_REQUEST['msg']) {
325
+			case 'success':
326
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
327
+				flush_rewrite_rules(false);
328 328
 
329
-                break;
329
+				break;
330 330
 			case 'fail':
331 331
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
332 332
 				
333 333
 				if ($gderr == 21)
334
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
334
+					echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
335 335
 				else
336 336
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
337
-                break;
338
-        }
339
-    }
337
+				break;
338
+		}
339
+	}
340 340
 
341
-    if (!geodir_is_default_location_set()) {
342
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
341
+	if (!geodir_is_default_location_set()) {
342
+		echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
343 343
 
344
-    }
344
+	}
345 345
 
346
-    if (!function_exists('curl_init')) {
347
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
346
+	if (!function_exists('curl_init')) {
347
+		echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
348 348
 
349
-    }
349
+	}
350 350
 }
351 351
 
352 352
 /**
@@ -359,19 +359,19 @@  discard block
 block discarded – undo
359 359
  */
360 360
 function geodir_handle_option_form_submit($current_tab)
361 361
 {
362
-    global $geodir_settings;
363
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
364
-        /**
365
-         * Contains settings array for current tab.
366
-         *
367
-         * @since 1.0.0
368
-         * @package GeoDirectory
369
-         */
370
-        include_once('option-pages/' . $current_tab . '_array.php');
371
-    }
372
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
373
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
374
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
362
+	global $geodir_settings;
363
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
364
+		/**
365
+		 * Contains settings array for current tab.
366
+		 *
367
+		 * @since 1.0.0
368
+		 * @package GeoDirectory
369
+		 */
370
+		include_once('option-pages/' . $current_tab . '_array.php');
371
+	}
372
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
373
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
374
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
375 375
 		
376 376
 		/**
377 377
 		 * Fires before updating geodirectory admin settings.
@@ -383,100 +383,100 @@  discard block
 block discarded – undo
383 383
 		 */
384 384
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
385 385
 		
386
-        if (!empty($geodir_settings[$current_tab]))
387
-            geodir_update_options($geodir_settings[$current_tab]);
386
+		if (!empty($geodir_settings[$current_tab]))
387
+			geodir_update_options($geodir_settings[$current_tab]);
388 388
 
389
-        /**
390
-         * Called after GeoDirectory options settings are updated.
391
-         *
392
-         * @since 1.0.0
393
-         * @param array $geodir_settings The array of GeoDirectory settings.
394
-         * @see 'geodir_before_update_options'
395
-         */
396
-        do_action('geodir_update_options', $geodir_settings);
389
+		/**
390
+		 * Called after GeoDirectory options settings are updated.
391
+		 *
392
+		 * @since 1.0.0
393
+		 * @param array $geodir_settings The array of GeoDirectory settings.
394
+		 * @see 'geodir_before_update_options'
395
+		 */
396
+		do_action('geodir_update_options', $geodir_settings);
397 397
 
398
-        /**
399
-         * Called after GeoDirectory options settings are updated.
400
-         *
401
-         * Provides tab specific settings.
402
-         *
403
-         * @since 1.0.0
404
-         * @param string $current_tab The current settings tab name.
405
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
406
-         */
407
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
398
+		/**
399
+		 * Called after GeoDirectory options settings are updated.
400
+		 *
401
+		 * Provides tab specific settings.
402
+		 *
403
+		 * @since 1.0.0
404
+		 * @param string $current_tab The current settings tab name.
405
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
406
+		 */
407
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
408 408
 
409
-        flush_rewrite_rules(false);
409
+		flush_rewrite_rules(false);
410 410
 
411
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
411
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
412 412
 
413
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
413
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
414 414
 
415
-        wp_redirect($redirect_url);
416
-        exit();
417
-    endif;
415
+		wp_redirect($redirect_url);
416
+		exit();
417
+	endif;
418 418
 
419 419
 
420 420
 }
421 421
 
422 422
 
423 423
 if (!function_exists('geodir_autoinstall_admin_header') && get_option('geodir_installed')) {
424
-    /**
425
-     * GeoDirectory dummy data installation.
426
-     *
427
-     * @since 1.0.0
428
-     * @package GeoDirectory
429
-     * @global object $wpdb WordPress Database object.
430
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
431
-     * @param string $post_type The post type.
432
-     */
433
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
434
-    {
424
+	/**
425
+	 * GeoDirectory dummy data installation.
426
+	 *
427
+	 * @since 1.0.0
428
+	 * @package GeoDirectory
429
+	 * @global object $wpdb WordPress Database object.
430
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
431
+	 * @param string $post_type The post type.
432
+	 */
433
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
434
+	{
435 435
 
436
-        global $wpdb, $plugin_prefix;
436
+		global $wpdb, $plugin_prefix;
437 437
 
438
-        if (!geodir_is_default_location_set()) {
439
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
440
-        } else {
438
+		if (!geodir_is_default_location_set()) {
439
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
440
+		} else {
441 441
 
442
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
442
+			$geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
443 443
 
444
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
444
+			$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
445 445
 
446
-            if ($post_counts > 0) {
447
-                $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
446
+			if ($post_counts > 0) {
447
+				$nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
448 448
 
449
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
450
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
451
-            } else {
452
-                $options_list = '';
453
-                for ($option = 1; $option <= 30; $option++) {
454
-                    $selected = '';
455
-                    if ($option == 10)
456
-                        $selected = 'selected="selected"';
449
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
450
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
451
+			} else {
452
+				$options_list = '';
453
+				for ($option = 1; $option <= 30; $option++) {
454
+					$selected = '';
455
+					if ($option == 10)
456
+						$selected = 'selected="selected"';
457 457
 
458
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
459
-                }
458
+					$options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
459
+				}
460 460
 
461
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
461
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
462 462
 
463
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
464
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
463
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
464
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
465 465
 
466
-            }
467
-            echo $dummy_msg;
468
-            ?>
466
+			}
467
+			echo $dummy_msg;
468
+			?>
469 469
             <script>
470 470
                 <?php
471 471
 
472
-                    $default_location = geodir_get_default_location();
473
-                  $city =  isset($default_location->city) ? $default_location->city : '';
474
-                  $region =isset($default_location->region) ? $default_location->region : '';
475
-                  $country =isset($default_location->country) ? $default_location->country : '';
476
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
472
+					$default_location = geodir_get_default_location();
473
+				  $city =  isset($default_location->city) ? $default_location->city : '';
474
+				  $region =isset($default_location->region) ? $default_location->region : '';
475
+				  $country =isset($default_location->country) ? $default_location->country : '';
476
+				  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
+				  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478 478
 
479
-                ?>
479
+				?>
480 480
                 var geocoder = new google.maps.Geocoder();
481 481
                 var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
482 482
                 var bound_lat_lng;
@@ -561,8 +561,8 @@  discard block
 block discarded – undo
561 561
                 }
562 562
             </script>
563 563
         <?php
564
-        }
565
-    }
564
+		}
565
+	}
566 566
 }
567 567
 
568 568
 /**
@@ -575,19 +575,19 @@  discard block
 block discarded – undo
575 575
  */
576 576
 function geodir_insert_dummy_posts()
577 577
 {
578
-    geodir_default_taxonomies();
578
+	geodir_default_taxonomies();
579 579
 
580
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
580
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
581 581
 
582
-    global $wpdb, $current_user;
582
+	global $wpdb, $current_user;
583 583
 
584
-    /**
585
-     * Contains dumy post content.
586
-     *
587
-     * @since 1.0.0
588
-     * @package GeoDirectory
589
-     */
590
-    include_once('place_dummy_post.php');
584
+	/**
585
+	 * Contains dumy post content.
586
+	 *
587
+	 * @since 1.0.0
588
+	 * @package GeoDirectory
589
+	 */
590
+	include_once('place_dummy_post.php');
591 591
 
592 592
 }
593 593
 
@@ -601,18 +601,18 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function geodir_delete_dummy_posts()
603 603
 {
604
-    global $wpdb, $plugin_prefix;
604
+	global $wpdb, $plugin_prefix;
605 605
 
606 606
 
607
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
607
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
608 608
 
609 609
 
610
-    foreach ($post_ids as $post_ids_obj) {
611
-        wp_delete_post($post_ids_obj->post_id);
612
-    }
610
+	foreach ($post_ids as $post_ids_obj) {
611
+		wp_delete_post($post_ids_obj->post_id);
612
+	}
613 613
 
614
-    //double check posts are deleted
615
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
614
+	//double check posts are deleted
615
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
616 616
 }
617 617
 
618 618
 /**
@@ -626,114 +626,114 @@  discard block
 block discarded – undo
626 626
  * @global string $dummy_image_path The dummy image path.
627 627
  */
628 628
 function geodir_default_taxonomies() {
629
-    global $wpdb, $dummy_image_path;
629
+	global $wpdb, $dummy_image_path;
630 630
 
631
-    $category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
631
+	$category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
632 632
 
633
-    $last_catid = '';
633
+	$last_catid = '';
634 634
 
635
-    $uploads = wp_upload_dir(); // Array of key => value pairs
635
+	$uploads = wp_upload_dir(); // Array of key => value pairs
636 636
 
637
-    for ($i = 0; $i < count($category_array); $i++) {
638
-        $parent_catid = 0;
639
-        if (is_array($category_array[$i])) {
640
-            $cat_name_arr = $category_array[$i];
641
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
642
-                $catname = $cat_name_arr[$j];
637
+	for ($i = 0; $i < count($category_array); $i++) {
638
+		$parent_catid = 0;
639
+		if (is_array($category_array[$i])) {
640
+			$cat_name_arr = $category_array[$i];
641
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
642
+				$catname = $cat_name_arr[$j];
643 643
 
644
-                if (!term_exists($catname, 'gd_placecategory')) {
645
-                    $last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
644
+				if (!term_exists($catname, 'gd_placecategory')) {
645
+					$last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
646 646
 
647
-                    if ($j == 0) {
648
-                        $parent_catid = $last_catid;
649
-                    }
647
+					if ($j == 0) {
648
+						$parent_catid = $last_catid;
649
+					}
650 650
 
651 651
 
652
-                    if (geodir_dummy_folder_exists())
653
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
654
-                    else
655
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
652
+					if (geodir_dummy_folder_exists())
653
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
654
+					else
655
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
656 656
 
657
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
657
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
658 658
 
659
-                    $catname = str_replace(' ', '_', $catname);
660
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
659
+					$catname = str_replace(' ', '_', $catname);
660
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
661 661
 
662
-                    if (empty($uploaded['error'])) {
663
-                        $new_path = $uploaded['file'];
664
-                        $new_url = $uploaded['url'];
665
-                    }
662
+					if (empty($uploaded['error'])) {
663
+						$new_path = $uploaded['file'];
664
+						$new_url = $uploaded['url'];
665
+					}
666 666
 
667
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
668
-
669
-                    $attachment = array(
670
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
671
-                        'post_mime_type' => $wp_filetype['type'],
672
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
673
-                        'post_content' => '',
674
-                        'post_status' => 'inherit'
675
-                    );
676
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
677
-
678
-                    // you must first include the image.php file
679
-                    // for the function wp_generate_attachment_metadata() to work
680
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
681
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
682
-                    wp_update_attachment_metadata($attach_id, $attach_data);
683
-
684
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
685
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
686
-                    }
687
-                }
688
-            }
667
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
668
+
669
+					$attachment = array(
670
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
671
+						'post_mime_type' => $wp_filetype['type'],
672
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
673
+						'post_content' => '',
674
+						'post_status' => 'inherit'
675
+					);
676
+					$attach_id = wp_insert_attachment($attachment, $new_path);
677
+
678
+					// you must first include the image.php file
679
+					// for the function wp_generate_attachment_metadata() to work
680
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
681
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
682
+					wp_update_attachment_metadata($attach_id, $attach_data);
683
+
684
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
685
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
686
+					}
687
+				}
688
+			}
689 689
 
690
-        } else {
691
-            $catname = $category_array[$i];
690
+		} else {
691
+			$catname = $category_array[$i];
692 692
 
693
-            if (!term_exists($catname, 'gd_placecategory')) {
694
-                $last_catid = wp_insert_term($catname, 'gd_placecategory');
693
+			if (!term_exists($catname, 'gd_placecategory')) {
694
+				$last_catid = wp_insert_term($catname, 'gd_placecategory');
695 695
 
696
-                if (geodir_dummy_folder_exists())
697
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
698
-                else
699
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
696
+				if (geodir_dummy_folder_exists())
697
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
698
+				else
699
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
700 700
 
701
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
701
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
702 702
 
703
-                $catname = str_replace(' ', '_', $catname);
704
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
703
+				$catname = str_replace(' ', '_', $catname);
704
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
705 705
 
706
-                if (empty($uploaded['error'])) {
707
-                    $new_path = $uploaded['file'];
708
-                    $new_url = $uploaded['url'];
709
-                }
706
+				if (empty($uploaded['error'])) {
707
+					$new_path = $uploaded['file'];
708
+					$new_url = $uploaded['url'];
709
+				}
710 710
 
711
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
711
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
712 712
 
713
-                $attachment = array(
714
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
715
-                    'post_mime_type' => $wp_filetype['type'],
716
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
717
-                    'post_content' => '',
718
-                    'post_status' => 'inherit'
719
-                );
713
+				$attachment = array(
714
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
715
+					'post_mime_type' => $wp_filetype['type'],
716
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
717
+					'post_content' => '',
718
+					'post_status' => 'inherit'
719
+				);
720 720
 
721
-                $attach_id = wp_insert_attachment($attachment, $new_path);
721
+				$attach_id = wp_insert_attachment($attachment, $new_path);
722 722
 
723 723
 
724
-                // you must first include the image.php file
725
-                // for the function wp_generate_attachment_metadata() to work
726
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
727
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
728
-                wp_update_attachment_metadata($attach_id, $attach_data);
724
+				// you must first include the image.php file
725
+				// for the function wp_generate_attachment_metadata() to work
726
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
727
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
728
+				wp_update_attachment_metadata($attach_id, $attach_data);
729 729
 
730
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
731
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
732
-                }
733
-            }
734
-        }
730
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
731
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
732
+				}
733
+			}
734
+		}
735 735
 
736
-    }
736
+	}
737 737
 }
738 738
 
739 739
 /**
@@ -748,144 +748,144 @@  discard block
 block discarded – undo
748 748
  * @return bool Returns true if saved.
749 749
  */
750 750
 function geodir_update_options($options, $dummy = false) {
751
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
751
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
752 752
 
753
-    foreach ($options as $value) {
754
-        if ($dummy && isset($value['std']))
755
-            $_POST[$value['id']] = $value['std'];
753
+	foreach ($options as $value) {
754
+		if ($dummy && isset($value['std']))
755
+			$_POST[$value['id']] = $value['std'];
756 756
 
757 757
 
758
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
758
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
759 759
 
760
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
761
-                update_option($value['id'], $_POST[$value['id']]);
762
-            } else {
763
-                update_option($value['id'], 0);
764
-            }
760
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
761
+				update_option($value['id'], $_POST[$value['id']]);
762
+			} else {
763
+				update_option($value['id'], 0);
764
+			}
765 765
 
766
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
766
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
767 767
 
768
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
769
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
770
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
771
-                if (isset($_POST[$value['id'] . '_crop'])) :
772
-                    update_option($value['id'] . '_crop', 1);
773
-                else :
774
-                    update_option($value['id'] . '_crop', 0);
775
-                endif;
776
-            } else {
777
-                update_option($value['id'] . '_width', $value['std']);
778
-                update_option($value['id'] . '_height', $value['std']);
779
-                update_option($value['id'] . '_crop', 1);
780
-            }
768
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
769
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
770
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
771
+				if (isset($_POST[$value['id'] . '_crop'])) :
772
+					update_option($value['id'] . '_crop', 1);
773
+				else :
774
+					update_option($value['id'] . '_crop', 0);
775
+				endif;
776
+			} else {
777
+				update_option($value['id'] . '_width', $value['std']);
778
+				update_option($value['id'] . '_height', $value['std']);
779
+				update_option($value['id'] . '_crop', 1);
780
+			}
781 781
 
782
-        elseif (isset($value['type']) && $value['type'] == 'map') :
783
-            $post_types = array();
784
-            $categories = array();
782
+		elseif (isset($value['type']) && $value['type'] == 'map') :
783
+			$post_types = array();
784
+			$categories = array();
785 785
 
786
-            if (!empty($_POST['home_map_post_types'])) :
787
-                foreach ($_POST['home_map_post_types'] as $post_type) :
788
-                    $post_types[] = $post_type;
789
-                endforeach;
790
-            endif;
786
+			if (!empty($_POST['home_map_post_types'])) :
787
+				foreach ($_POST['home_map_post_types'] as $post_type) :
788
+					$post_types[] = $post_type;
789
+				endforeach;
790
+			endif;
791 791
 
792
-            update_option('geodir_exclude_post_type_on_map', $post_types);
792
+			update_option('geodir_exclude_post_type_on_map', $post_types);
793 793
 
794
-            if (!empty($_POST['post_category'])) :
795
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
796
-                    $categories[$texonomy] = array();
797
-                    foreach ($cat_arr as $category) :
798
-                        $categories[$texonomy][] = $category;
799
-                    endforeach;
800
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
801
-                endforeach;
802
-            endif;
803
-            update_option('geodir_exclude_cat_on_map', $categories);
804
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
805
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
794
+			if (!empty($_POST['post_category'])) :
795
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
796
+					$categories[$texonomy] = array();
797
+					foreach ($cat_arr as $category) :
798
+						$categories[$texonomy][] = $category;
799
+					endforeach;
800
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
801
+				endforeach;
802
+			endif;
803
+			update_option('geodir_exclude_cat_on_map', $categories);
804
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
805
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
806 806
 
807 807
 
808
-            if (!empty($_POST['geodir_default_map_language'])):
809
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
810
-            endif;
808
+			if (!empty($_POST['geodir_default_map_language'])):
809
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
810
+			endif;
811 811
 
812 812
 
813
-            if (!empty($_POST['geodir_default_map_search_pt'])):
814
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
815
-            endif;
813
+			if (!empty($_POST['geodir_default_map_search_pt'])):
814
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
815
+			endif;
816 816
 
817 817
 
818
-        elseif (isset($value['type']) && $value['type'] == 'file') :
818
+		elseif (isset($value['type']) && $value['type'] == 'file') :
819 819
 
820 820
 
821
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
821
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
822 822
 
823
-                if (get_option($value['id'])) {
824
-                    $image_name_arr = explode('/', get_option($value['id']));
825
-                    $noimg_name = end($image_name_arr);
826
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
827
-                    if (file_exists($img_path))
828
-                        unlink($img_path);
829
-                }
823
+				if (get_option($value['id'])) {
824
+					$image_name_arr = explode('/', get_option($value['id']));
825
+					$noimg_name = end($image_name_arr);
826
+					$img_path = $uploads['path'] . '/' . $noimg_name;
827
+					if (file_exists($img_path))
828
+						unlink($img_path);
829
+				}
830 830
 
831
-                update_option($value['id'], '');
832
-            }
831
+				update_option($value['id'], '');
832
+			}
833 833
 
834
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
835
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
836
-
837
-            if (!empty($filename)):
838
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
839
-                $uplaods = array();
840
-
841
-                foreach ($uploadedfile as $key => $uplaod):
842
-                    if ($key == 'name'):
843
-                        $uplaods[$key] = $filename;
844
-                    else :
845
-                        $uplaods[$key] = $uplaod;
846
-                    endif;
847
-                endforeach;
848
-
849
-                $uploads = wp_upload_dir();
850
-
851
-                if (get_option($value['id'])) {
852
-                    $image_name_arr = explode('/', get_option($value['id']));
853
-                    $noimg_name = end($image_name_arr);
854
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
855
-                    if (file_exists($img_path))
856
-                        unlink($img_path);
857
-                }
834
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
835
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
836
+
837
+			if (!empty($filename)):
838
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
839
+				$uplaods = array();
840
+
841
+				foreach ($uploadedfile as $key => $uplaod):
842
+					if ($key == 'name'):
843
+						$uplaods[$key] = $filename;
844
+					else :
845
+						$uplaods[$key] = $uplaod;
846
+					endif;
847
+				endforeach;
848
+
849
+				$uploads = wp_upload_dir();
850
+
851
+				if (get_option($value['id'])) {
852
+					$image_name_arr = explode('/', get_option($value['id']));
853
+					$noimg_name = end($image_name_arr);
854
+					$img_path = $uploads['path'] . '/' . $noimg_name;
855
+					if (file_exists($img_path))
856
+						unlink($img_path);
857
+				}
858 858
 
859
-                $upload_overrides = array('test_form' => false);
860
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
859
+				$upload_overrides = array('test_form' => false);
860
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
861 861
 
862
-                update_option($value['id'], $movefile['url']);
862
+				update_option($value['id'], $movefile['url']);
863 863
 
864
-            endif;
864
+			endif;
865 865
 
866
-            if (!get_option($value['id']) && isset($value['value'])):
867
-                update_option($value['id'], $value['value']);
868
-            endif;
866
+			if (!get_option($value['id']) && isset($value['value'])):
867
+				update_option($value['id'], $value['value']);
868
+			endif;
869 869
 
870 870
 
871
-        else :
872
-            // same menu setting per theme.
873
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
874
-                $theme = wp_get_theme();
875
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
876
-            }
871
+		else :
872
+			// same menu setting per theme.
873
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
874
+				$theme = wp_get_theme();
875
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
876
+			}
877 877
 
878
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
879
-                update_option($value['id'], $_POST[$value['id']]);
880
-            } else {
881
-                delete_option($value['id']);
882
-            }
878
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
879
+				update_option($value['id'], $_POST[$value['id']]);
880
+			} else {
881
+				delete_option($value['id']);
882
+			}
883 883
 
884
-        endif;
885
-    }
886
-    if ($dummy)
887
-        $_POST = array();
888
-    return true;
884
+		endif;
885
+	}
886
+	if ($dummy)
887
+		$_POST = array();
888
+	return true;
889 889
 
890 890
 }
891 891
 
@@ -934,33 +934,33 @@  discard block
 block discarded – undo
934 934
 function places_custom_fields_tab($tabs)
935 935
 {
936 936
 
937
-    $geodir_post_types = get_option('geodir_post_types');
937
+	$geodir_post_types = get_option('geodir_post_types');
938 938
 
939
-    if (!empty($geodir_post_types)) {
939
+	if (!empty($geodir_post_types)) {
940 940
 
941
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
941
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
942 942
 
943
-            $listing_slug = $geodir_posttype_info['labels']['singular_name'];
943
+			$listing_slug = $geodir_posttype_info['labels']['singular_name'];
944 944
 
945
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
946
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
947
-                'subtabs' => array(
948
-                    array('subtab' => 'custom_fields',
949
-                        'label' => __('Custom Fields', 'geodirectory'),
950
-                        'request' => array('listing_type' => $geodir_post_type)),
951
-                    array('subtab' => 'sorting_options',
952
-                        'label' => __('Sorting Options', 'geodirectory'),
953
-                        'request' => array('listing_type' => $geodir_post_type)),
954
-                ),
955
-                'tab_index' => 9,
956
-                'request' => array('listing_type' => $geodir_post_type)
957
-            );
945
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
946
+				'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
947
+				'subtabs' => array(
948
+					array('subtab' => 'custom_fields',
949
+						'label' => __('Custom Fields', 'geodirectory'),
950
+						'request' => array('listing_type' => $geodir_post_type)),
951
+					array('subtab' => 'sorting_options',
952
+						'label' => __('Sorting Options', 'geodirectory'),
953
+						'request' => array('listing_type' => $geodir_post_type)),
954
+				),
955
+				'tab_index' => 9,
956
+				'request' => array('listing_type' => $geodir_post_type)
957
+			);
958 958
 
959
-        endforeach;
959
+		endforeach;
960 960
 
961
-    }
961
+	}
962 962
 
963
-    return $tabs;
963
+	return $tabs;
964 964
 }
965 965
 
966 966
 
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
  */
977 977
 function geodir_tools_setting_tab($tabs)
978 978
 {
979
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
980
-    return $tabs;
979
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
980
+	return $tabs;
981 981
 }
982 982
 
983 983
 /**
@@ -992,8 +992,8 @@  discard block
 block discarded – undo
992 992
  */
993 993
 function geodir_compatibility_setting_tab($tabs)
994 994
 {
995
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
996
-    return $tabs;
995
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
996
+	return $tabs;
997 997
 }
998 998
 
999 999
 
@@ -1009,144 +1009,144 @@  discard block
 block discarded – undo
1009 1009
  */
1010 1010
 function geodir_extend_geodirectory_setting_tab($tabs)
1011 1011
 {
1012
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1013
-    return $tabs;
1012
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1013
+	return $tabs;
1014 1014
 }
1015 1015
 
1016 1016
 
1017 1017
 if (!function_exists('geodir_edit_post_columns')) {
1018
-    /**
1019
-     * Modify admin post listing page columns.
1020
-     *
1021
-     * @since 1.0.0
1022
-     * @package GeoDirectory
1023
-     * @param array $columns The column array.
1024
-     * @return array Altered column array.
1025
-     */
1026
-    function geodir_edit_post_columns($columns)
1027
-    {
1028
-
1029
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1030
-            'categorys' => __('Categories', 'geodirectory'));
1031
-
1032
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1033
-        {
1034
-            $offset = 0; // should we prepend $array with $data?
1035
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
1036
-        }
1018
+	/**
1019
+	 * Modify admin post listing page columns.
1020
+	 *
1021
+	 * @since 1.0.0
1022
+	 * @package GeoDirectory
1023
+	 * @param array $columns The column array.
1024
+	 * @return array Altered column array.
1025
+	 */
1026
+	function geodir_edit_post_columns($columns)
1027
+	{
1028
+
1029
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1030
+			'categorys' => __('Categories', 'geodirectory'));
1037 1031
 
1038
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1032
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1033
+		{
1034
+			$offset = 0; // should we prepend $array with $data?
1035
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
1036
+		}
1039 1037
 
1040
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1038
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1041 1039
 
1042
-        return $columns;
1043
-    }
1040
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1041
+
1042
+		return $columns;
1043
+	}
1044 1044
 }
1045 1045
 
1046 1046
 
1047 1047
 if (!function_exists('geodir_manage_post_columns')) {
1048
-    /**
1049
-     * Adds content to our custom post listing page columns.
1050
-     *
1051
-     * @since 1.0.0
1052
-     * @package GeoDirectory
1053
-     * @global object $wpdb WordPress Database object.
1054
-     * @global object $post WordPress Post object.
1055
-     * @param string $column The column name.
1056
-     * @param int $post_id The post ID.
1057
-     */
1058
-    function geodir_manage_post_columns($column, $post_id)
1059
-    {
1060
-        global $post, $wpdb;
1061
-
1062
-        switch ($column):
1063
-            /* If displaying the 'city' column. */
1064
-            case 'location' :
1065
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1066
-                $location = geodir_get_location($location_id);
1067
-                /* If no city is found, output a default message. */
1068
-                if (empty($location)) {
1069
-                    _e('Unknown', 'geodirectory');
1070
-                } else {
1071
-                    /* If there is a city id, append 'city name' to the text string. */
1072
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1073
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1074
-                }
1075
-                break;
1076
-
1077
-            /* If displaying the 'expire' column. */
1078
-            case 'expire' :
1079
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1080
-                $d1 = $expire_date; // get expire_date
1081
-                $d2 = date('Y-m-d'); // get current date
1082
-                $state = __('days left', 'geodirectory');
1083
-                $date_diff_text = '';
1084
-                $expire_class = 'expire_left';
1085
-                if ($expire_date != 'Never') {
1086
-                    if (strtotime($d1) < strtotime($d2)) {
1087
-                        $state = __('days overdue', 'geodirectory');
1088
-                        $expire_class = 'expire_over';
1089
-                    }
1090
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1091
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1092
-                }
1093
-                /* If no expire_date is found, output a default message. */
1094
-                if (empty($expire_date))
1095
-                    echo __('Unknown', 'geodirectory');
1096
-                /* If there is a expire_date, append 'days left' to the text string. */
1097
-                else
1098
-                    echo $expire_date . $date_diff_text;
1099
-                break;
1100
-
1101
-            /* If displaying the 'categorys' column. */
1102
-            case 'categorys' :
1103
-
1104
-                /* Get the categorys for the post. */
1105
-
1106
-
1107
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1108
-
1109
-                /* If terms were found. */
1110
-                if (!empty($terms)) {
1111
-                    $out = array();
1112
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
1113
-                    foreach ($terms as $term) {
1114
-                        if (!strstr($term->taxonomy, 'tag')) {
1115
-                            $out[] = sprintf('<a href="%s">%s</a>',
1116
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1117
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1118
-                            );
1119
-                        }
1120
-                    }
1121
-                    /* Join the terms, separating them with a comma. */
1122
-                    echo(join(', ', $out));
1123
-                } /* If no terms were found, output a default message. */
1124
-                else {
1125
-                    _e('No Categories', 'geodirectory');
1126
-                }
1127
-                break;
1048
+	/**
1049
+	 * Adds content to our custom post listing page columns.
1050
+	 *
1051
+	 * @since 1.0.0
1052
+	 * @package GeoDirectory
1053
+	 * @global object $wpdb WordPress Database object.
1054
+	 * @global object $post WordPress Post object.
1055
+	 * @param string $column The column name.
1056
+	 * @param int $post_id The post ID.
1057
+	 */
1058
+	function geodir_manage_post_columns($column, $post_id)
1059
+	{
1060
+		global $post, $wpdb;
1061
+
1062
+		switch ($column):
1063
+			/* If displaying the 'city' column. */
1064
+			case 'location' :
1065
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1066
+				$location = geodir_get_location($location_id);
1067
+				/* If no city is found, output a default message. */
1068
+				if (empty($location)) {
1069
+					_e('Unknown', 'geodirectory');
1070
+				} else {
1071
+					/* If there is a city id, append 'city name' to the text string. */
1072
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1073
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1074
+				}
1075
+				break;
1076
+
1077
+			/* If displaying the 'expire' column. */
1078
+			case 'expire' :
1079
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1080
+				$d1 = $expire_date; // get expire_date
1081
+				$d2 = date('Y-m-d'); // get current date
1082
+				$state = __('days left', 'geodirectory');
1083
+				$date_diff_text = '';
1084
+				$expire_class = 'expire_left';
1085
+				if ($expire_date != 'Never') {
1086
+					if (strtotime($d1) < strtotime($d2)) {
1087
+						$state = __('days overdue', 'geodirectory');
1088
+						$expire_class = 'expire_over';
1089
+					}
1090
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1091
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1092
+				}
1093
+				/* If no expire_date is found, output a default message. */
1094
+				if (empty($expire_date))
1095
+					echo __('Unknown', 'geodirectory');
1096
+				/* If there is a expire_date, append 'days left' to the text string. */
1097
+				else
1098
+					echo $expire_date . $date_diff_text;
1099
+				break;
1128 1100
 
1129
-        endswitch;
1130
-    }
1101
+			/* If displaying the 'categorys' column. */
1102
+			case 'categorys' :
1103
+
1104
+				/* Get the categorys for the post. */
1105
+
1106
+
1107
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1108
+
1109
+				/* If terms were found. */
1110
+				if (!empty($terms)) {
1111
+					$out = array();
1112
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
1113
+					foreach ($terms as $term) {
1114
+						if (!strstr($term->taxonomy, 'tag')) {
1115
+							$out[] = sprintf('<a href="%s">%s</a>',
1116
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1117
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1118
+							);
1119
+						}
1120
+					}
1121
+					/* Join the terms, separating them with a comma. */
1122
+					echo(join(', ', $out));
1123
+				} /* If no terms were found, output a default message. */
1124
+				else {
1125
+					_e('No Categories', 'geodirectory');
1126
+				}
1127
+				break;
1128
+
1129
+		endswitch;
1130
+	}
1131 1131
 }
1132 1132
 
1133 1133
 
1134 1134
 if (!function_exists('geodir_post_sortable_columns')) {
1135
-    /**
1136
-     * Makes admin post listing page columns sortable.
1137
-     *
1138
-     * @since 1.0.0
1139
-     * @package GeoDirectory
1140
-     * @param array $columns The column array.
1141
-     * @return array Altered column array.
1142
-     */
1143
-    function geodir_post_sortable_columns($columns)
1144
-    {
1145
-
1146
-        $columns['expire'] = 'expire';
1147
-
1148
-        return $columns;
1149
-    }
1135
+	/**
1136
+	 * Makes admin post listing page columns sortable.
1137
+	 *
1138
+	 * @since 1.0.0
1139
+	 * @package GeoDirectory
1140
+	 * @param array $columns The column array.
1141
+	 * @return array Altered column array.
1142
+	 */
1143
+	function geodir_post_sortable_columns($columns)
1144
+	{
1145
+
1146
+		$columns['expire'] = 'expire';
1147
+
1148
+		return $columns;
1149
+	}
1150 1150
 }
1151 1151
 
1152 1152
 /**
@@ -1160,32 +1160,32 @@  discard block
 block discarded – undo
1160 1160
  * @param int $post_id The post ID.
1161 1161
  */
1162 1162
 function geodir_post_information_save($post_id, $post) {
1163
-    global $wpdb, $current_user;
1163
+	global $wpdb, $current_user;
1164 1164
 
1165
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1166
-        return;
1167
-    }
1165
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1166
+		return;
1167
+	}
1168 1168
 
1169
-    $geodir_posttypes = geodir_get_posttypes();
1169
+	$geodir_posttypes = geodir_get_posttypes();
1170 1170
 
1171
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1172
-        return;
1171
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1172
+		return;
1173 1173
 
1174
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1175
-        if (isset($_REQUEST['_status']))
1176
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1174
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1175
+		if (isset($_REQUEST['_status']))
1176
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
1177 1177
 
1178
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1179
-            return;
1178
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1179
+			return;
1180 1180
 
1181
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1182
-            return;
1181
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1182
+			return;
1183 1183
 
1184
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1185
-            return;
1184
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1185
+			return;
1186 1186
 
1187
-        geodir_save_listing($_REQUEST);
1188
-    }
1187
+		geodir_save_listing($_REQUEST);
1188
+	}
1189 1189
 }
1190 1190
 
1191 1191
 /**
@@ -1201,102 +1201,102 @@  discard block
 block discarded – undo
1201 1201
  */
1202 1202
 function geodir_admin_fields($options)
1203 1203
 {
1204
-    global $geodirectory;
1205
-
1206
-    $first_title = true;
1207
-    $tab_id = '';
1208
-    $i = 0;
1209
-    foreach ($options as $value) :
1210
-        if (!isset($value['name'])) $value['name'] = '';
1211
-        if (!isset($value['class'])) $value['class'] = '';
1212
-        if (!isset($value['css'])) $value['css'] = '';
1213
-        if (!isset($value['std'])) $value['std'] = '';
1214
-        $desc = '';
1215
-        switch ($value['type']) :
1216
-            case 'dummy_installer':
1217
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1218
-                geodir_autoinstall_admin_header($post_type);
1219
-                break;
1220
-            case 'title':
1221
-
1222
-                if ($i == 0) {
1223
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1224
-                    echo '<div class="inner_content_tab_main">';
1225
-                }
1204
+	global $geodirectory;
1205
+
1206
+	$first_title = true;
1207
+	$tab_id = '';
1208
+	$i = 0;
1209
+	foreach ($options as $value) :
1210
+		if (!isset($value['name'])) $value['name'] = '';
1211
+		if (!isset($value['class'])) $value['class'] = '';
1212
+		if (!isset($value['css'])) $value['css'] = '';
1213
+		if (!isset($value['std'])) $value['std'] = '';
1214
+		$desc = '';
1215
+		switch ($value['type']) :
1216
+			case 'dummy_installer':
1217
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1218
+				geodir_autoinstall_admin_header($post_type);
1219
+				break;
1220
+			case 'title':
1221
+
1222
+				if ($i == 0) {
1223
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1224
+					echo '<div class="inner_content_tab_main">';
1225
+				}
1226 1226
 
1227
-                $i++;
1227
+				$i++;
1228 1228
 
1229
-                if (isset($value['id']) && $value['id'])
1230
-                    $tab_id = $value['id'];
1229
+				if (isset($value['id']) && $value['id'])
1230
+					$tab_id = $value['id'];
1231 1231
 
1232
-                if (isset($value['desc']) && $value['desc'])
1233
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1232
+				if (isset($value['desc']) && $value['desc'])
1233
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1234 1234
 
1235
-                if (isset($value['name']) && $value['name']) {
1236
-                    if ($first_title === true) {
1237
-                        $first_title = false;
1238
-                    } else {
1239
-                        echo '</div>';
1240
-                    }
1241
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1235
+				if (isset($value['name']) && $value['name']) {
1236
+					if ($first_title === true) {
1237
+						$first_title = false;
1238
+					} else {
1239
+						echo '</div>';
1240
+					}
1241
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1242 1242
 
1243
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1244
-                }
1243
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1244
+				}
1245 1245
 
1246
-                /**
1247
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
1248
-                 *
1249
-                 * The action is called dynamically geodir_settings_$value['id'].
1250
-                 *
1251
-                 * @since 1.0.0
1252
-                 */
1253
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1254
-                break;
1255
-
1256
-            case 'no_tabs':
1257
-
1258
-                echo '<div class="inner_content_tab_main">';
1259
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1260
-
1261
-                break;
1262
-
1263
-            case 'sectionstart':
1264
-                if (isset($value['desc']) && $value['desc'])
1265
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1266
-                if (isset($value['name']) && $value['name'])
1267
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1268
-                /**
1269
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1270
-                 *
1271
-                 * The action is called dynamically geodir_settings_$value['id']_start.
1272
-                 *
1273
-                 * @since 1.0.0
1274
-                 */
1275
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1276
-                echo '<table class="form-table">' . "\n\n";
1277
-
1278
-                break;
1279
-            case 'sectionend':
1280
-                /**
1281
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1282
-                 *
1283
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1284
-                 *
1285
-                 * @since 1.0.0
1286
-                 */
1287
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1288
-                echo '</table>';
1289
-                /**
1290
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1291
-                 *
1292
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1293
-                 *
1294
-                 * @since 1.0.0
1295
-                 */
1296
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1297
-                break;
1298
-            case 'text':
1299
-                ?>
1246
+				/**
1247
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
1248
+				 *
1249
+				 * The action is called dynamically geodir_settings_$value['id'].
1250
+				 *
1251
+				 * @since 1.0.0
1252
+				 */
1253
+				do_action('geodir_settings_' . sanitize_title($value['id']));
1254
+				break;
1255
+
1256
+			case 'no_tabs':
1257
+
1258
+				echo '<div class="inner_content_tab_main">';
1259
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1260
+
1261
+				break;
1262
+
1263
+			case 'sectionstart':
1264
+				if (isset($value['desc']) && $value['desc'])
1265
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1266
+				if (isset($value['name']) && $value['name'])
1267
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
1268
+				/**
1269
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1270
+				 *
1271
+				 * The action is called dynamically geodir_settings_$value['id']_start.
1272
+				 *
1273
+				 * @since 1.0.0
1274
+				 */
1275
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1276
+				echo '<table class="form-table">' . "\n\n";
1277
+
1278
+				break;
1279
+			case 'sectionend':
1280
+				/**
1281
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1282
+				 *
1283
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1284
+				 *
1285
+				 * @since 1.0.0
1286
+				 */
1287
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1288
+				echo '</table>';
1289
+				/**
1290
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1291
+				 *
1292
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1293
+				 *
1294
+				 * @since 1.0.0
1295
+				 */
1296
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1297
+				break;
1298
+			case 'text':
1299
+				?>
1300 1300
                 <tr valign="top">
1301 1301
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1302 1302
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1306 1306
                                            style=" <?php echo esc_attr($value['css']); ?>"
1307 1307
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1308
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1309
-                                           } else {
1310
-                                               echo esc_attr($value['std']);
1311
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1308
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1309
+										   } else {
1310
+											   echo esc_attr($value['std']);
1311
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1312 1312
                 </tr><?php
1313
-                break;
1313
+				break;
1314 1314
 
1315
-            case 'password':
1316
-                ?>
1315
+			case 'password':
1316
+				?>
1317 1317
                 <tr valign="top">
1318 1318
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1319 1319
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1322,42 +1322,42 @@  discard block
 block discarded – undo
1322 1322
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1323 1323
                                            style="<?php echo esc_attr($value['css']); ?>"
1324 1324
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1325
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1326
-                                           } else {
1327
-                                               echo esc_attr($value['std']);
1328
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1325
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1326
+										   } else {
1327
+											   echo esc_attr($value['std']);
1328
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1329 1329
                 </tr><?php
1330
-                break;
1330
+				break;
1331 1331
 
1332
-            case 'html_content':
1333
-                ?>
1332
+			case 'html_content':
1333
+				?>
1334 1334
                 <tr valign="top">
1335 1335
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1336 1336
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1337 1337
                 </tr><?php
1338
-                break;
1338
+				break;
1339 1339
 
1340
-            case 'color' :
1341
-                ?>
1340
+			case 'color' :
1341
+				?>
1342 1342
                 <tr valign="top">
1343 1343
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1344 1344
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1345 1345
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1346 1346
                                            style="<?php echo esc_attr($value['css']); ?>"
1347 1347
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1348
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1349
-                                           } else {
1350
-                                               echo esc_attr($value['std']);
1351
-                                           } ?>" class="colorpick"/> <span
1348
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1349
+										   } else {
1350
+											   echo esc_attr($value['std']);
1351
+										   } ?>" class="colorpick"/> <span
1352 1352
                         class="description"><?php echo $value['desc']; ?></span>
1353 1353
 
1354 1354
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1355 1355
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1356 1356
                 </td>
1357 1357
                 </tr><?php
1358
-                break;
1359
-            case 'image_width' :
1360
-                ?>
1358
+				break;
1359
+			case 'image_width' :
1360
+				?>
1361 1361
                 <tr valign="top">
1362 1362
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1363 1363
                 <td class="forminp">
@@ -1379,11 +1379,11 @@  discard block
 block discarded – undo
1379 1379
 
1380 1380
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1381 1381
                 </tr><?php
1382
-                break;
1383
-            case 'select':
1384
-                $option_value = get_option($value['id']);
1385
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1386
-                ?>
1382
+				break;
1383
+			case 'select':
1384
+				$option_value = get_option($value['id']);
1385
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1386
+				?>
1387 1387
                 <tr valign="top">
1388 1388
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1389 1389
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1392,33 +1392,33 @@  discard block
 block discarded – undo
1392 1392
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1393 1393
                                             option-ajaxchosen="false">
1394 1394
                         <?php
1395
-                        foreach ($value['options'] as $key => $val) {
1396
-                            $geodir_select_value = '';
1397
-                            if ($option_value != '') {
1398
-                                if ($option_value != '' && $option_value == $key)
1399
-                                    $geodir_select_value = ' selected="selected" ';
1400
-                            } else {
1401
-                                if ($value['std'] == $key)
1402
-                                    $geodir_select_value = ' selected="selected" ';
1403
-                            }
1404
-                            ?>
1395
+						foreach ($value['options'] as $key => $val) {
1396
+							$geodir_select_value = '';
1397
+							if ($option_value != '') {
1398
+								if ($option_value != '' && $option_value == $key)
1399
+									$geodir_select_value = ' selected="selected" ';
1400
+							} else {
1401
+								if ($value['std'] == $key)
1402
+									$geodir_select_value = ' selected="selected" ';
1403
+							}
1404
+							?>
1405 1405
                             <option
1406 1406
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option>
1407 1407
                         <?php
1408
-                        }
1409
-                        ?>
1408
+						}
1409
+						?>
1410 1410
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1411 1411
                 </td>
1412 1412
                 </tr><?php
1413
-                break;
1413
+				break;
1414 1414
 
1415
-            case 'multiselect':
1416
-                $option_values = get_option($value['id']);
1417
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1418
-                   $option_values = $value['std'];
1419
-                }
1420
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1421
-                ?>
1415
+			case 'multiselect':
1416
+				$option_values = get_option($value['id']);
1417
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1418
+				   $option_values = $value['std'];
1419
+				}
1420
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1421
+				?>
1422 1422
                 <tr valign="top">
1423 1423
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1424 1424
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1428,25 +1428,25 @@  discard block
 block discarded – undo
1428 1428
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1429 1429
                                             option-ajaxchosen="false">
1430 1430
                         <?php
1431
-                        foreach ($value['options'] as $key => $val) {
1432
-                            if (strpos($key, 'optgroup_start-') === 0) {
1433
-                                ?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1434
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1435
-                                ?></optgroup><?php
1436
-                            } else {
1437
-                                ?>
1431
+						foreach ($value['options'] as $key => $val) {
1432
+							if (strpos($key, 'optgroup_start-') === 0) {
1433
+								?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1434
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1435
+								?></optgroup><?php
1436
+							} else {
1437
+								?>
1438 1438
                                 <option
1439 1439
                                     value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1440 1440
                             <?php
1441
-                            }
1442
-                        }
1443
-                        ?>
1441
+							}
1442
+						}
1443
+						?>
1444 1444
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1445 1445
                 </td>
1446 1446
                 </tr><?php
1447
-                break;
1448
-            case 'file':
1449
-                ?>
1447
+				break;
1448
+			case 'file':
1449
+				?>
1450 1450
                 <tr valign="top">
1451 1451
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1452 1452
                 <td class="forminp">
@@ -1466,87 +1466,87 @@  discard block
 block discarded – undo
1466 1466
                     <?php } ?>
1467 1467
                 </td>
1468 1468
                 </tr><?php
1469
-                break;
1470
-            case 'map_default_settings' :
1471
-                ?>
1469
+				break;
1470
+			case 'map_default_settings' :
1471
+				?>
1472 1472
 
1473 1473
                 <tr valign="top">
1474 1474
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1475 1475
                     <td width="60%">
1476 1476
                         <select name="geodir_default_map_language" style="width:60%">
1477 1477
                             <?php
1478
-                            $arr_map_langages = array(
1479
-                                'ar' => __('ARABIC', 'geodirectory'),
1480
-                                'eu' => __('BASQUE', 'geodirectory'),
1481
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1482
-                                'bn' => __('BENGALI', 'geodirectory'),
1483
-                                'ca' => __('CATALAN', 'geodirectory'),
1484
-                                'cs' => __('CZECH', 'geodirectory'),
1485
-                                'da' => __('DANISH', 'geodirectory'),
1486
-                                'de' => __('GERMAN', 'geodirectory'),
1487
-                                'el' => __('GREEK', 'geodirectory'),
1488
-                                'en' => __('ENGLISH', 'geodirectory'),
1489
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1490
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1491
-                                'es' => __('SPANISH', 'geodirectory'),
1492
-                                'eu' => __('BASQUE', 'geodirectory'),
1493
-                                'fa' => __('FARSI', 'geodirectory'),
1494
-                                'fi' => __('FINNISH', 'geodirectory'),
1495
-                                'fil' => __('FILIPINO', 'geodirectory'),
1496
-                                'fr' => __('FRENCH', 'geodirectory'),
1497
-                                'gl' => __('GALICIAN', 'geodirectory'),
1498
-                                'gu' => __('GUJARATI', 'geodirectory'),
1499
-                                'hi' => __('HINDI', 'geodirectory'),
1500
-                                'hr' => __('CROATIAN', 'geodirectory'),
1501
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1502
-                                'id' => __('INDONESIAN', 'geodirectory'),
1503
-                                'it' => __('ITALIAN', 'geodirectory'),
1504
-                                'iw' => __('HEBREW', 'geodirectory'),
1505
-                                'ja' => __('JAPANESE', 'geodirectory'),
1506
-                                'kn' => __('KANNADA', 'geodirectory'),
1507
-                                'ko' => __('KOREAN', 'geodirectory'),
1508
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1509
-                                'lv' => __('LATVIAN', 'geodirectory'),
1510
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1511
-                                'mr' => __('MARATHI', 'geodirectory'),
1512
-                                'nl' => __('DUTCH', 'geodirectory'),
1513
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1514
-                                'pl' => __('POLISH', 'geodirectory'),
1515
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1516
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1517
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1518
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1519
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1520
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1521
-                                'sk' => __('SLOVAK', 'geodirectory'),
1522
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1523
-                                'sr' => __('SERBIAN', 'geodirectory'),
1524
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1525
-                                'tl' => __('TAGALOG', 'geodirectory'),
1526
-                                'ta' => __('TAMIL', 'geodirectory'),
1527
-                                'te' => __('TELUGU', 'geodirectory'),
1528
-                                'th' => __('THAI', 'geodirectory'),
1529
-                                'tr' => __('TURKISH', 'geodirectory'),
1530
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1531
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1532
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1533
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1534
-                            );
1535
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1536
-                            if (empty($geodir_default_map_language))
1537
-                                $geodir_default_map_language = 'en';
1538
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1539
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1540
-                                    $geodir_default_language_selected = "selected='selected'";
1541
-                                else
1542
-                                    $geodir_default_language_selected = '';
1543
-
1544
-                                ?>
1478
+							$arr_map_langages = array(
1479
+								'ar' => __('ARABIC', 'geodirectory'),
1480
+								'eu' => __('BASQUE', 'geodirectory'),
1481
+								'bg' => __('BULGARIAN', 'geodirectory'),
1482
+								'bn' => __('BENGALI', 'geodirectory'),
1483
+								'ca' => __('CATALAN', 'geodirectory'),
1484
+								'cs' => __('CZECH', 'geodirectory'),
1485
+								'da' => __('DANISH', 'geodirectory'),
1486
+								'de' => __('GERMAN', 'geodirectory'),
1487
+								'el' => __('GREEK', 'geodirectory'),
1488
+								'en' => __('ENGLISH', 'geodirectory'),
1489
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1490
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1491
+								'es' => __('SPANISH', 'geodirectory'),
1492
+								'eu' => __('BASQUE', 'geodirectory'),
1493
+								'fa' => __('FARSI', 'geodirectory'),
1494
+								'fi' => __('FINNISH', 'geodirectory'),
1495
+								'fil' => __('FILIPINO', 'geodirectory'),
1496
+								'fr' => __('FRENCH', 'geodirectory'),
1497
+								'gl' => __('GALICIAN', 'geodirectory'),
1498
+								'gu' => __('GUJARATI', 'geodirectory'),
1499
+								'hi' => __('HINDI', 'geodirectory'),
1500
+								'hr' => __('CROATIAN', 'geodirectory'),
1501
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1502
+								'id' => __('INDONESIAN', 'geodirectory'),
1503
+								'it' => __('ITALIAN', 'geodirectory'),
1504
+								'iw' => __('HEBREW', 'geodirectory'),
1505
+								'ja' => __('JAPANESE', 'geodirectory'),
1506
+								'kn' => __('KANNADA', 'geodirectory'),
1507
+								'ko' => __('KOREAN', 'geodirectory'),
1508
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1509
+								'lv' => __('LATVIAN', 'geodirectory'),
1510
+								'ml' => __('MALAYALAM', 'geodirectory'),
1511
+								'mr' => __('MARATHI', 'geodirectory'),
1512
+								'nl' => __('DUTCH', 'geodirectory'),
1513
+								'no' => __('NORWEGIAN', 'geodirectory'),
1514
+								'pl' => __('POLISH', 'geodirectory'),
1515
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1516
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1517
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1518
+								'ro' => __('ROMANIAN', 'geodirectory'),
1519
+								'ru' => __('RUSSIAN', 'geodirectory'),
1520
+								'ru' => __('RUSSIAN', 'geodirectory'),
1521
+								'sk' => __('SLOVAK', 'geodirectory'),
1522
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1523
+								'sr' => __('SERBIAN', 'geodirectory'),
1524
+								'sv' => __('	SWEDISH', 'geodirectory'),
1525
+								'tl' => __('TAGALOG', 'geodirectory'),
1526
+								'ta' => __('TAMIL', 'geodirectory'),
1527
+								'te' => __('TELUGU', 'geodirectory'),
1528
+								'th' => __('THAI', 'geodirectory'),
1529
+								'tr' => __('TURKISH', 'geodirectory'),
1530
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1531
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1532
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1533
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1534
+							);
1535
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1536
+							if (empty($geodir_default_map_language))
1537
+								$geodir_default_map_language = 'en';
1538
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1539
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1540
+									$geodir_default_language_selected = "selected='selected'";
1541
+								else
1542
+									$geodir_default_language_selected = '';
1543
+
1544
+								?>
1545 1545
                                 <option
1546 1546
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1547 1547
 
1548 1548
                             <?php }
1549
-                            ?>
1549
+							?>
1550 1550
                         </select>
1551 1551
                     </td>
1552 1552
                 </tr>
@@ -1557,46 +1557,46 @@  discard block
 block discarded – undo
1557 1557
                     <td width="60%">
1558 1558
                         <select name="geodir_default_map_search_pt" style="width:60%">
1559 1559
                             <?php
1560
-                            $post_types = geodir_get_posttypes('array');
1561
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1562
-                            if (empty($geodir_default_map_search_pt))
1563
-                                $geodir_default_map_search_pt = 'gd_place';
1564
-                            if (is_array($post_types)) {
1565
-                                foreach ($post_types as $key => $post_types_obj) {
1566
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1567
-                                        $geodir_search_pt_selected = "selected='selected'";
1568
-                                    else
1569
-                                        $geodir_search_pt_selected = '';
1570
-
1571
-                                    ?>
1560
+							$post_types = geodir_get_posttypes('array');
1561
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1562
+							if (empty($geodir_default_map_search_pt))
1563
+								$geodir_default_map_search_pt = 'gd_place';
1564
+							if (is_array($post_types)) {
1565
+								foreach ($post_types as $key => $post_types_obj) {
1566
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1567
+										$geodir_search_pt_selected = "selected='selected'";
1568
+									else
1569
+										$geodir_search_pt_selected = '';
1570
+
1571
+									?>
1572 1572
                                     <option
1573 1573
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option>
1574 1574
 
1575 1575
                                 <?php }
1576 1576
 
1577
-                            }
1577
+							}
1578 1578
 
1579
-                            ?>
1579
+							?>
1580 1580
                         </select>
1581 1581
                     </td>
1582 1582
                 </tr>
1583 1583
 
1584 1584
                 <?php
1585
-                break;
1585
+				break;
1586 1586
 
1587
-            case 'map':
1588
-                ?>
1587
+			case 'map':
1588
+				?>
1589 1589
                 <tr valign="top">
1590 1590
                     <td class="forminp">
1591 1591
                         <?php
1592
-                        global $post_cat, $cat_display;
1593
-                        $post_types = geodir_get_posttypes('object');
1594
-                        $cat_display = 'checkbox';
1595
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1596
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1597
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1598
-                        $count = 1;
1599
-                        ?>
1592
+						global $post_cat, $cat_display;
1593
+						$post_types = geodir_get_posttypes('object');
1594
+						$cat_display = 'checkbox';
1595
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1596
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1597
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1598
+						$count = 1;
1599
+						?>
1600 1600
                         <table width="70%" class="widefat">
1601 1601
                             <thead>
1602 1602
                             <tr>
@@ -1605,18 +1605,18 @@  discard block
 block discarded – undo
1605 1605
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1606 1606
                             </tr>
1607 1607
                             <?php
1608
-                            $gd_categs = $gd_cats;
1609
-                            foreach ($post_types as $key => $post_types_obj) :
1610
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1611
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1612
-                                if ($gd_cats_upgrade) {
1613
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1614
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1615
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1616
-                                }
1617
-                                $post_cat = implode(',', $gd_cats);
1618
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1619
-                                ?>
1608
+							$gd_categs = $gd_cats;
1609
+							foreach ($post_types as $key => $post_types_obj) :
1610
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1611
+								$gd_taxonomy = geodir_get_taxonomies($key);
1612
+								if ($gd_cats_upgrade) {
1613
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1614
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1615
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1616
+								}
1617
+								$post_cat = implode(',', $gd_cats);
1618
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1619
+								?>
1620 1620
                                 <tr>
1621 1621
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1622 1622
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1637,19 +1637,19 @@  discard block
 block discarded – undo
1637 1637
                     </td>
1638 1638
                 </tr>
1639 1639
                 <?php
1640
-                break;
1640
+				break;
1641 1641
 
1642
-            case 'checkbox' :
1642
+			case 'checkbox' :
1643 1643
 
1644
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1645
-                    ?>
1644
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1645
+					?>
1646 1646
                     <tr valign="top">
1647 1647
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1648 1648
                     <td class="forminp">
1649 1649
                 <?php
1650
-                endif;
1650
+				endif;
1651 1651
 
1652
-                ?>
1652
+				?>
1653 1653
                 <fieldset>
1654 1654
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1655 1655
                     <label for="<?php echo $value['id'] ?>">
@@ -1659,49 +1659,49 @@  discard block
 block discarded – undo
1659 1659
                 </fieldset>
1660 1660
                 <?php
1661 1661
 
1662
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1663
-                    ?>
1662
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1663
+					?>
1664 1664
                     </td>
1665 1665
                     </tr>
1666 1666
                 <?php
1667
-                endif;
1667
+				endif;
1668 1668
 
1669
-                break;
1669
+				break;
1670 1670
 
1671
-            case 'radio' :
1671
+			case 'radio' :
1672 1672
 
1673
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1674
-                    ?>
1673
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1674
+					?>
1675 1675
                     <tr valign="top">
1676 1676
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1677 1677
                     <td class="forminp">
1678 1678
                 <?php
1679
-                endif;
1679
+				endif;
1680 1680
 
1681
-                ?>
1681
+				?>
1682 1682
                 <fieldset>
1683 1683
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1684 1684
                     <label for="<?php echo $value['id'];?>">
1685 1685
                         <input name="<?php echo esc_attr($value['id']); ?>"
1686 1686
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1687 1687
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1688
-                            echo 'checked="checked"';
1689
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1688
+							echo 'checked="checked"';
1689
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1690 1690
                         <?php echo $value['desc']; ?></label><br>
1691 1691
                 </fieldset>
1692 1692
                 <?php
1693 1693
 
1694
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1695
-                    ?>
1694
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1695
+					?>
1696 1696
                     </td>
1697 1697
                     </tr>
1698 1698
                 <?php
1699
-                endif;
1699
+				endif;
1700 1700
 
1701
-                break;
1701
+				break;
1702 1702
 
1703
-            case 'textarea':
1704
-                ?>
1703
+			case 'textarea':
1704
+				?>
1705 1705
                 <tr valign="top">
1706 1706
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1707 1707
                 <td class="forminp">
@@ -1714,30 +1714,30 @@  discard block
 block discarded – undo
1714 1714
 
1715 1715
                 </td>
1716 1716
                 </tr><?php
1717
-                break;
1717
+				break;
1718 1718
 
1719
-            case 'editor':
1720
-                ?>
1719
+			case 'editor':
1720
+				?>
1721 1721
                 <tr valign="top">
1722 1722
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1723 1723
                 <td class="forminp"><?php
1724
-                    if (get_option($value['id']))
1725
-                        $content = stripslashes(get_option($value['id']));
1726
-                    else
1727
-                        $content = $value['std'];
1724
+					if (get_option($value['id']))
1725
+						$content = stripslashes(get_option($value['id']));
1726
+					else
1727
+						$content = $value['std'];
1728 1728
 
1729
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1729
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1730 1730
 
1731
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1731
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1732 1732
 
1733
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1733
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1734 1734
 
1735 1735
                 </td>
1736 1736
                 </tr><?php
1737
-                break;
1737
+				break;
1738 1738
 
1739
-            case 'single_select_page' :
1740
-                // WPML
1739
+			case 'single_select_page' :
1740
+				// WPML
1741 1741
 				$switch_lang = false;
1742 1742
 				$disabled = '';
1743 1743
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1755,18 +1755,18 @@  discard block
 block discarded – undo
1755 1755
 				//
1756 1756
 				$page_setting = (int)get_option($value['id']);
1757 1757
 
1758
-                $args = array('name' => $value['id'],
1759
-                    'id' => $value['id'],
1760
-                    'sort_column' => 'menu_order',
1761
-                    'sort_order' => 'ASC',
1762
-                    'show_option_none' => ' ',
1763
-                    'class' => $value['class'],
1764
-                    'echo' => false,
1765
-                    'selected' => $page_setting);
1758
+				$args = array('name' => $value['id'],
1759
+					'id' => $value['id'],
1760
+					'sort_column' => 'menu_order',
1761
+					'sort_order' => 'ASC',
1762
+					'show_option_none' => ' ',
1763
+					'class' => $value['class'],
1764
+					'echo' => false,
1765
+					'selected' => $page_setting);
1766 1766
 
1767
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1767
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1768 1768
 
1769
-                ?>
1769
+				?>
1770 1770
                 <tr valign="top" class="single_select_page">
1771 1771
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1772 1772
                 <td class="forminp">
@@ -1777,17 +1777,17 @@  discard block
 block discarded – undo
1777 1777
 				if ($switch_lang) {
1778 1778
 					$sitepress->switch_lang($switch_lang, true);
1779 1779
 				}
1780
-                break;
1781
-            case 'single_select_country' :
1782
-                $country_setting = (string)get_option($value['id']);
1783
-                if (strstr($country_setting, ':')) :
1784
-                    $country = current(explode(':', $country_setting));
1785
-                    $state = end(explode(':', $country_setting));
1786
-                else :
1787
-                    $country = $country_setting;
1788
-                    $state = '*';
1789
-                endif;
1790
-                ?>
1780
+				break;
1781
+			case 'single_select_country' :
1782
+				$country_setting = (string)get_option($value['id']);
1783
+				if (strstr($country_setting, ':')) :
1784
+					$country = current(explode(':', $country_setting));
1785
+					$state = end(explode(':', $country_setting));
1786
+				else :
1787
+					$country = $country_setting;
1788
+					$state = '*';
1789
+				endif;
1790
+				?>
1791 1791
                 <tr valign="top">
1792 1792
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1793 1793
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1798,12 +1798,12 @@  discard block
 block discarded – undo
1798 1798
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1799 1799
                 </td>
1800 1800
                 </tr><?php
1801
-                break;
1802
-            case 'multi_select_countries' :
1803
-                $countries = $geodirectory->countries->countries;
1804
-                asort($countries);
1805
-                $selections = (array)get_option($value['id']);
1806
-                ?>
1801
+				break;
1802
+			case 'multi_select_countries' :
1803
+				$countries = $geodirectory->countries->countries;
1804
+				asort($countries);
1805
+				$selections = (array)get_option($value['id']);
1806
+				?>
1807 1807
                 <tr valign="top">
1808 1808
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1809 1809
                 <td class="forminp">
@@ -1811,22 +1811,22 @@  discard block
 block discarded – undo
1811 1811
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1812 1812
                             title="Country" class="chosen_select">
1813 1813
                         <?php
1814
-                        if ($countries) foreach ($countries as $key => $val) :
1815
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1816
-                        endforeach;
1817
-                        ?>
1814
+						if ($countries) foreach ($countries as $key => $val) :
1815
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1816
+						endforeach;
1817
+						?>
1818 1818
                     </select>
1819 1819
                 </td>
1820 1820
                 </tr>
1821 1821
 
1822 1822
                 <?php
1823 1823
 
1824
-                break;
1824
+				break;
1825 1825
 
1826
-            case 'google_analytics' :
1827
-                $selections = (array)get_option($value['id']);
1828
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1829
-                    ?>
1826
+			case 'google_analytics' :
1827
+				$selections = (array)get_option($value['id']);
1828
+				if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1829
+					?>
1830 1830
                     <tr valign="top">
1831 1831
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1832 1832
                         <td class="forminp">
@@ -1834,19 +1834,19 @@  discard block
 block discarded – undo
1834 1834
 
1835 1835
                             <?php
1836 1836
 
1837
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1838
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1839
-                            $state = "&state=123";//any string
1840
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1841
-                            $response_type = "&response_type=code";
1842
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1843
-                            $access_type = "&access_type=offline";
1844
-                            $approval_prompt = "&approval_prompt=force";
1837
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1838
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1839
+							$state = "&state=123";//any string
1840
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1841
+							$response_type = "&response_type=code";
1842
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1843
+							$access_type = "&access_type=offline";
1844
+							$approval_prompt = "&approval_prompt=force";
1845 1845
 
1846
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1846
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1847 1847
 
1848 1848
 
1849
-                            ?>
1849
+							?>
1850 1850
                             <script>
1851 1851
                                 function gd_ga_popup() {
1852 1852
                                     var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
@@ -1861,47 +1861,47 @@  discard block
 block discarded – undo
1861 1861
                             </script>
1862 1862
 
1863 1863
                             <?php
1864
-                            if (get_option('gd_ga_refresh_token')) {
1865
-                                ?>
1864
+							if (get_option('gd_ga_refresh_token')) {
1865
+								?>
1866 1866
                                 <span class="button-primary"
1867 1867
                                       onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
1868 1868
                                 <span
1869 1869
                                     style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1870 1870
                             <?php
1871
-                            } else {
1872
-                                ?>
1871
+							} else {
1872
+								?>
1873 1873
                                 <span class="button-primary"
1874 1874
                                       onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1875 1875
                             <?php
1876
-                            }
1877
-                            ?>
1876
+							}
1877
+							?>
1878 1878
                         </td>
1879 1879
                     </tr>
1880 1880
 
1881 1881
                 <?php
1882
-                }
1882
+				}
1883 1883
 
1884
-                break;
1884
+				break;
1885 1885
 
1886
-            case 'field_seperator' :
1886
+			case 'field_seperator' :
1887 1887
 
1888
-                ?>
1888
+				?>
1889 1889
                 <tr valign="top">
1890 1890
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1891 1891
                 </tr>
1892 1892
                 <?php
1893 1893
 
1894
-                break;
1894
+				break;
1895 1895
 
1896
-        endswitch;
1896
+		endswitch;
1897 1897
 
1898
-    endforeach;
1898
+	endforeach;
1899 1899
 
1900
-    if ($first_title === false) {
1901
-        echo "</div>";
1902
-    }
1900
+	if ($first_title === false) {
1901
+		echo "</div>";
1902
+	}
1903 1903
 
1904
-    ?>
1904
+	?>
1905 1905
 
1906 1906
     <script type="text/javascript">
1907 1907
 
@@ -1961,33 +1961,33 @@  discard block
 block discarded – undo
1961 1961
  */
1962 1962
 function geodir_post_info_setting()
1963 1963
 {
1964
-    global $post, $post_id;
1965
-
1966
-    $post_type = get_post_type();
1967
-
1968
-    $package_info = array();
1969
-
1970
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1971
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1972
-    echo '<div id="geodir_wrapper">';
1973
-    /**
1974
-     * Called before the GD custom fields are output in the wp-admin area.
1975
-     *
1976
-     * @since 1.0.0
1977
-     * @see 'geodir_after_default_field_in_meta_box'
1978
-     */
1979
-    do_action('geodir_before_default_field_in_meta_box');
1980
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1981
-    // to display all fields in one information box
1982
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1983
-    /**
1984
-     * Called after the GD custom fields are output in the wp-admin area.
1985
-     *
1986
-     * @since 1.0.0
1987
-     * @see 'geodir_before_default_field_in_meta_box'
1988
-     */
1989
-    do_action('geodir_after_default_field_in_meta_box');
1990
-    echo '</div>';
1964
+	global $post, $post_id;
1965
+
1966
+	$post_type = get_post_type();
1967
+
1968
+	$package_info = array();
1969
+
1970
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1971
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1972
+	echo '<div id="geodir_wrapper">';
1973
+	/**
1974
+	 * Called before the GD custom fields are output in the wp-admin area.
1975
+	 *
1976
+	 * @since 1.0.0
1977
+	 * @see 'geodir_after_default_field_in_meta_box'
1978
+	 */
1979
+	do_action('geodir_before_default_field_in_meta_box');
1980
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1981
+	// to display all fields in one information box
1982
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1983
+	/**
1984
+	 * Called after the GD custom fields are output in the wp-admin area.
1985
+	 *
1986
+	 * @since 1.0.0
1987
+	 * @see 'geodir_before_default_field_in_meta_box'
1988
+	 */
1989
+	do_action('geodir_after_default_field_in_meta_box');
1990
+	echo '</div>';
1991 1991
 }
1992 1992
 
1993 1993
 /**
@@ -2000,18 +2000,18 @@  discard block
 block discarded – undo
2000 2000
  */
2001 2001
 function geodir_post_addinfo_setting()
2002 2002
 {
2003
-    global $post, $post_id;
2003
+	global $post, $post_id;
2004 2004
 
2005
-    $post_type = get_post_type();
2005
+	$post_type = get_post_type();
2006 2006
 
2007
-    $package_info = array();
2007
+	$package_info = array();
2008 2008
 
2009
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2009
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2010 2010
 
2011
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2012
-    echo '<div id="geodir_wrapper">';
2013
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2014
-    echo '</div>';
2011
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2012
+	echo '<div id="geodir_wrapper">';
2013
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2014
+	echo '</div>';
2015 2015
 
2016 2016
 }
2017 2017
 
@@ -2025,60 +2025,60 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_post_attachments()
2027 2027
 {
2028
-    global $post, $post_id;
2028
+	global $post, $post_id;
2029 2029
 
2030
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2030
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2031 2031
 
2032
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
2033
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2034
-        geodir_show_featured_image($post_id, 'thumbnail');
2035
-    }
2032
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
2033
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2034
+		geodir_show_featured_image($post_id, 'thumbnail');
2035
+	}
2036 2036
 
2037
-    $image_limit = 0;
2037
+	$image_limit = 0;
2038 2038
 
2039
-    ?>
2039
+	?>
2040 2040
 
2041 2041
 
2042 2042
     <h5 class="form_title">
2043 2043
         <?php if ($image_limit != 0 && $image_limit == 1) {
2044
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2045
-        } ?>
2044
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2045
+		} ?>
2046 2046
         <?php if ($image_limit != 0 && $image_limit > 1) {
2047
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2048
-        } ?>
2047
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2048
+		} ?>
2049 2049
         <?php if ($image_limit == 0) {
2050
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2051
-        } ?>
2050
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2051
+		} ?>
2052 2052
     </h5>
2053 2053
 
2054 2054
 
2055 2055
     <?php
2056 2056
 
2057
-    $curImages = geodir_get_images($post_id);
2058
-    $place_img_array = array();
2057
+	$curImages = geodir_get_images($post_id);
2058
+	$place_img_array = array();
2059 2059
 
2060
-    if (!empty($curImages)):
2061
-        foreach ($curImages as $p_img):
2062
-            $place_img_array[] = $p_img->src;
2063
-        endforeach;
2064
-    endif;
2060
+	if (!empty($curImages)):
2061
+		foreach ($curImages as $p_img):
2062
+			$place_img_array[] = $p_img->src;
2063
+		endforeach;
2064
+	endif;
2065 2065
 
2066
-    if (!empty($place_img_array))
2067
-        $curImages = implode(',', $place_img_array);
2066
+	if (!empty($place_img_array))
2067
+		$curImages = implode(',', $place_img_array);
2068 2068
 
2069 2069
 
2070
-    // adjust values here
2071
-    $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2070
+	// adjust values here
2071
+	$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2072 2072
 
2073
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2073
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2074 2074
 
2075
-    $multiple = true; // allow multiple files upload
2075
+	$multiple = true; // allow multiple files upload
2076 2076
 
2077
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2077
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2078 2078
 
2079
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2079
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2080 2080
 
2081
-    ?>
2081
+	?>
2082 2082
 
2083 2083
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
2084 2084
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -2120,13 +2120,13 @@  discard block
 block discarded – undo
2120 2120
  */
2121 2121
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
2122 2122
 {
2123
-    $post_type = get_post_type($post_ID);
2123
+	$post_type = get_post_type($post_ID);
2124 2124
 
2125
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2126
-        if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2127
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2128
-        }
2129
-    }
2125
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2126
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2127
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2128
+		}
2129
+	}
2130 2130
 }
2131 2131
 
2132 2132
 /**
@@ -2141,39 +2141,39 @@  discard block
 block discarded – undo
2141 2141
  */
2142 2142
 function geodir_notification_add_bcc_option($settings)
2143 2143
 {
2144
-    if (!empty($settings)) {
2145
-        $new_settings = array();
2146
-        foreach ($settings as $setting) {
2147
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2148
-                $geodir_bcc_listing_published_yes = array(
2149
-                    'name' => __('Listing published', 'geodirectory'),
2150
-                    'desc' => __('Yes', 'geodirectory'),
2151
-                    'id' => 'geodir_bcc_listing_published',
2152
-                    'std' => 'yes',
2153
-                    'type' => 'radio',
2154
-                    'value' => '1',
2155
-                    'radiogroup' => 'start'
2156
-                );
2157
-
2158
-                $geodir_bcc_listing_published_no = array(
2159
-                    'name' => __('Listing published', 'geodirectory'),
2160
-                    'desc' => __('No', 'geodirectory'),
2161
-                    'id' => 'geodir_bcc_listing_published',
2162
-                    'std' => 'yes',
2163
-                    'type' => 'radio',
2164
-                    'value' => '0',
2165
-                    'radiogroup' => 'end'
2166
-                );
2167
-
2168
-                $new_settings[] = $geodir_bcc_listing_published_yes;
2169
-                $new_settings[] = $geodir_bcc_listing_published_no;
2170
-            }
2171
-            $new_settings[] = $setting;
2172
-        }
2173
-        $settings = $new_settings;
2174
-    }
2144
+	if (!empty($settings)) {
2145
+		$new_settings = array();
2146
+		foreach ($settings as $setting) {
2147
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2148
+				$geodir_bcc_listing_published_yes = array(
2149
+					'name' => __('Listing published', 'geodirectory'),
2150
+					'desc' => __('Yes', 'geodirectory'),
2151
+					'id' => 'geodir_bcc_listing_published',
2152
+					'std' => 'yes',
2153
+					'type' => 'radio',
2154
+					'value' => '1',
2155
+					'radiogroup' => 'start'
2156
+				);
2157
+
2158
+				$geodir_bcc_listing_published_no = array(
2159
+					'name' => __('Listing published', 'geodirectory'),
2160
+					'desc' => __('No', 'geodirectory'),
2161
+					'id' => 'geodir_bcc_listing_published',
2162
+					'std' => 'yes',
2163
+					'type' => 'radio',
2164
+					'value' => '0',
2165
+					'radiogroup' => 'end'
2166
+				);
2167
+
2168
+				$new_settings[] = $geodir_bcc_listing_published_yes;
2169
+				$new_settings[] = $geodir_bcc_listing_published_no;
2170
+			}
2171
+			$new_settings[] = $setting;
2172
+		}
2173
+		$settings = $new_settings;
2174
+	}
2175 2175
 
2176
-    return $settings;
2176
+	return $settings;
2177 2177
 }
2178 2178
 
2179 2179
 
@@ -2188,19 +2188,19 @@  discard block
 block discarded – undo
2188 2188
  */
2189 2189
 function get_gd_theme_compat_callback()
2190 2190
 {
2191
-    global $wpdb;
2192
-    $themes = get_option('gd_theme_compats');
2193
-
2194
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2195
-        if (isset($_POST['export'])) {
2196
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2197
-        } else {
2198
-            echo json_encode($themes[$_POST['theme']]);
2199
-        }
2191
+	global $wpdb;
2192
+	$themes = get_option('gd_theme_compats');
2200 2193
 
2201
-    }
2194
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2195
+		if (isset($_POST['export'])) {
2196
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2197
+		} else {
2198
+			echo json_encode($themes[$_POST['theme']]);
2199
+		}
2202 2200
 
2203
-    die();
2201
+	}
2202
+
2203
+	die();
2204 2204
 }
2205 2205
 
2206 2206
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -2214,20 +2214,20 @@  discard block
 block discarded – undo
2214 2214
  */
2215 2215
 function get_gd_theme_compat_import_callback()
2216 2216
 {
2217
-    global $wpdb;
2218
-    $themes = get_option('gd_theme_compats');
2219
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2220
-        $json = json_decode(stripslashes($_POST['theme']), true);
2221
-        if (!empty($json) && is_array($json)) {
2222
-            $key = sanitize_text_field(key($json));
2223
-            $themes[$key] = $json[$key];
2224
-            update_option('gd_theme_compats', $themes);
2225
-            echo $key;
2226
-            die();
2227
-        }
2228
-    }
2229
-    echo '0';
2230
-    die();
2217
+	global $wpdb;
2218
+	$themes = get_option('gd_theme_compats');
2219
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2220
+		$json = json_decode(stripslashes($_POST['theme']), true);
2221
+		if (!empty($json) && is_array($json)) {
2222
+			$key = sanitize_text_field(key($json));
2223
+			$themes[$key] = $json[$key];
2224
+			update_option('gd_theme_compats', $themes);
2225
+			echo $key;
2226
+			die();
2227
+		}
2228
+	}
2229
+	echo '0';
2230
+	die();
2231 2231
 }
2232 2232
 
2233 2233
 
@@ -2240,39 +2240,39 @@  discard block
 block discarded – undo
2240 2240
  */
2241 2241
 function gd_set_theme_compat()
2242 2242
 {
2243
-    global $wpdb;
2244
-    $theme = wp_get_theme();
2243
+	global $wpdb;
2244
+	$theme = wp_get_theme();
2245 2245
 
2246
-    if ($theme->parent()) {
2247
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2248
-    } else {
2249
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
2250
-    }
2246
+	if ($theme->parent()) {
2247
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2248
+	} else {
2249
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
2250
+	}
2251 2251
 
2252
-    $theme_compats = get_option('gd_theme_compats');
2253
-    $current_compat = get_option('gd_theme_compat');
2254
-    $current_compat = str_replace("_custom", "", $current_compat);
2252
+	$theme_compats = get_option('gd_theme_compats');
2253
+	$current_compat = get_option('gd_theme_compat');
2254
+	$current_compat = str_replace("_custom", "", $current_compat);
2255 2255
 
2256
-    if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2257
-        return;
2258
-    }// if already running corect compat then bail
2256
+	if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2257
+		return;
2258
+	}// if already running corect compat then bail
2259 2259
 
2260
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2261
-        update_option('gd_theme_compat', $theme_name);
2262
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2260
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2261
+		update_option('gd_theme_compat', $theme_name);
2262
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2263 2263
 
2264
-        // if there are default options to set then set them
2265
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2264
+		// if there are default options to set then set them
2265
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2266 2266
 
2267
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2268
-                update_option($key, $val);
2269
-            }
2270
-        }
2267
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2268
+				update_option($key, $val);
2269
+			}
2270
+		}
2271 2271
 
2272
-    } else {
2273
-        update_option('gd_theme_compat', '');
2274
-        update_option('theme_compatibility_setting', '');
2275
-    }
2272
+	} else {
2273
+		update_option('gd_theme_compat', '');
2274
+		update_option('theme_compatibility_setting', '');
2275
+	}
2276 2276
 
2277 2277
 
2278 2278
 }
@@ -2287,9 +2287,9 @@  discard block
 block discarded – undo
2287 2287
  */
2288 2288
 function gd_check_avada_compat()
2289 2289
 {
2290
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2291
-        add_action('admin_notices', 'gd_avada_compat_warning');
2292
-    }
2290
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2291
+		add_action('admin_notices', 'gd_avada_compat_warning');
2292
+	}
2293 2293
 }
2294 2294
 
2295 2295
 
@@ -2302,22 +2302,22 @@  discard block
 block discarded – undo
2302 2302
 function gd_avada_compat_warning()
2303 2303
 {
2304 2304
 
2305
-    /*
2305
+	/*
2306 2306
     $msg_type = error
2307 2307
     $msg_type = updated fade
2308 2308
     $msg_type = update-nag
2309 2309
     */
2310 2310
 
2311
-    $plugin = 'avada-nag';
2312
-    $timestamp = 'avada-nag1234';
2313
-    $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2314
-    echo '<div id="' . $timestamp . '"  class="error">';
2315
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2316
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2317
-    echo "<p>$message</p>";
2318
-    echo "</div>";
2311
+	$plugin = 'avada-nag';
2312
+	$timestamp = 'avada-nag1234';
2313
+	$message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2314
+	echo '<div id="' . $timestamp . '"  class="error">';
2315
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2316
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2317
+	echo "<p>$message</p>";
2318
+	echo "</div>";
2319 2319
 
2320
-    ?>
2320
+	?>
2321 2321
     <script>
2322 2322
         function gdRemoveANotification($plugin, $timestamp) {
2323 2323
 
@@ -2385,10 +2385,10 @@  discard block
 block discarded – undo
2385 2385
  */
2386 2386
 function geodir_avada_remove_notification()
2387 2387
 {
2388
-    update_option('avada_nag', TRUE);
2388
+	update_option('avada_nag', TRUE);
2389 2389
 
2390
-    // Always die in functions echoing ajax content
2391
-    die();
2390
+	// Always die in functions echoing ajax content
2391
+	die();
2392 2392
 }
2393 2393
 
2394 2394
 
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 		// Don't allow same slug url for listing and location
2448 2448
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2449 2449
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2450
-        	wp_redirect($redirect_url);
2450
+			wp_redirect($redirect_url);
2451 2451
 			exit;
2452 2452
 		}
2453 2453
 		
@@ -2477,10 +2477,10 @@  discard block
 block discarded – undo
2477 2477
  * @package GeoDirectory
2478 2478
  */
2479 2479
 function geodir_hide_admin_preview_button() {
2480
-    global $post_type;
2481
-    $post_types = geodir_get_posttypes();
2482
-    if(in_array($post_type, $post_types))
2483
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2480
+	global $post_type;
2481
+	$post_types = geodir_get_posttypes();
2482
+	if(in_array($post_type, $post_types))
2483
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2484 2484
 }
2485 2485
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2486 2486
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
  */
2496 2496
 function geodir_import_export_tab( $tabs ) {
2497 2497
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2498
-    return $tabs;
2498
+	return $tabs;
2499 2499
 }
2500 2500
 
2501 2501
 /**
@@ -2510,26 +2510,26 @@  discard block
 block discarded – undo
2510 2510
 function geodir_import_export_page() {
2511 2511
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2512 2512
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2513
-    /**
2514
-     * Filter sample category data csv file url.
2515
-     *
2516
-     * @since 1.0.0
2517
-     * @package GeoDirectory
2518
-     *
2519
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2520
-     */
2513
+	/**
2514
+	 * Filter sample category data csv file url.
2515
+	 *
2516
+	 * @since 1.0.0
2517
+	 * @package GeoDirectory
2518
+	 *
2519
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2520
+	 */
2521 2521
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2522 2522
 	
2523 2523
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2524
-    /**
2525
-     * Filter sample post data csv file url.
2526
-     *
2527
-     * @since 1.0.0
2528
-     * @package GeoDirectory
2529
-     *
2530
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2531
-     */
2532
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2524
+	/**
2525
+	 * Filter sample post data csv file url.
2526
+	 *
2527
+	 * @since 1.0.0
2528
+	 * @package GeoDirectory
2529
+	 *
2530
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2531
+	 */
2532
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2533 2533
 	
2534 2534
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2535 2535
 	
@@ -2552,14 +2552,14 @@  discard block
 block discarded – undo
2552 2552
 	$gd_chunksize_options[100000] = 100000;
2553 2553
 	 
2554 2554
 	 /**
2555
-     * Filter max entries per export csv file.
2556
-     *
2557
-     * @since 1.5.6
2558
-     * @package GeoDirectory
2559
-     *
2560
-     * @param string $gd_chunksize_options Entries options.
2561
-     */
2562
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2555
+	  * Filter max entries per export csv file.
2556
+	  *
2557
+	  * @since 1.5.6
2558
+	  * @package GeoDirectory
2559
+	  *
2560
+	  * @param string $gd_chunksize_options Entries options.
2561
+	  */
2562
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2563 2563
 	
2564 2564
 	$gd_chunksize_option = '';
2565 2565
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2575,12 +2575,12 @@  discard block
 block discarded – undo
2575 2575
   <div class="gd-content-heading">
2576 2576
 
2577 2577
   <?php
2578
-    ini_set('max_execution_time', 999999);
2579
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2580
-    ini_restore('max_execution_time');
2578
+	ini_set('max_execution_time', 999999);
2579
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2580
+	ini_restore('max_execution_time');
2581 2581
 
2582
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2583
-        ?>
2582
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2583
+		?>
2584 2584
 	<div id="gd_ie_reqs" class="metabox-holder">
2585 2585
       <div class="meta-box-sortables ui-sortable">
2586 2586
         <div class="postbox">
@@ -2749,7 +2749,7 @@  discard block
 block discarded – undo
2749 2749
 						 * Called just after the sample CSV download link.
2750 2750
 						 *
2751 2751
 						 * @since 1.0.0
2752
-                         * @package GeoDirectory
2752
+						 * @package GeoDirectory
2753 2753
 						 */
2754 2754
 						do_action('geodir_sample_cats_csv_download_link');
2755 2755
 						?>
@@ -2834,11 +2834,11 @@  discard block
 block discarded – undo
2834 2834
 	 *
2835 2835
 	 * Called after the last setting on the GD > Import & Export page.
2836 2836
 	 * @since 1.4.6
2837
-     * @package GeoDirectory
2837
+	 * @package GeoDirectory
2838 2838
 	 *
2839 2839
 	 * @param array $gd_posttypes GD post types.
2840
-     * @param array $gd_chunksize_options File chunk size options.
2841
-     * @param string $nonce Wordpress security token for GD import & export.
2840
+	 * @param array $gd_chunksize_options File chunk size options.
2841
+	 * @param string $nonce Wordpress security token for GD import & export.
2842 2842
 	 */
2843 2843
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2844 2844
 	?>
@@ -3503,44 +3503,44 @@  discard block
 block discarded – undo
3503 3503
 function geodir_init_filesystem()
3504 3504
 {
3505 3505
 
3506
-    if(!function_exists('get_filesystem_method')){
3507
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3508
-    }
3509
-    $access_type = get_filesystem_method();
3510
-    if ($access_type === 'direct') {
3511
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3512
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3513
-
3514
-        /* initialize the API */
3515
-        if (!WP_Filesystem($creds)) {
3516
-            /* any problems and we exit */
3517
-            //return '@@@3';
3518
-            return false;
3519
-        }
3520
-
3521
-        global $wp_filesystem;
3522
-        return $wp_filesystem;
3523
-        /* do our file manipulations below */
3524
-    } elseif (defined('FTP_USER')) {
3525
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3506
+	if(!function_exists('get_filesystem_method')){
3507
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3508
+	}
3509
+	$access_type = get_filesystem_method();
3510
+	if ($access_type === 'direct') {
3511
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3512
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3513
+
3514
+		/* initialize the API */
3515
+		if (!WP_Filesystem($creds)) {
3516
+			/* any problems and we exit */
3517
+			//return '@@@3';
3518
+			return false;
3519
+		}
3526 3520
 
3527
-        /* initialize the API */
3528
-        if (!WP_Filesystem($creds)) {
3529
-            /* any problems and we exit */
3530
-            //return '@@@33';
3531
-            return false;
3532
-        }
3521
+		global $wp_filesystem;
3522
+		return $wp_filesystem;
3523
+		/* do our file manipulations below */
3524
+	} elseif (defined('FTP_USER')) {
3525
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3526
+
3527
+		/* initialize the API */
3528
+		if (!WP_Filesystem($creds)) {
3529
+			/* any problems and we exit */
3530
+			//return '@@@33';
3531
+			return false;
3532
+		}
3533 3533
 
3534
-        global $wp_filesystem;
3535
-        //return '@@@1';
3536
-        return $wp_filesystem;
3534
+		global $wp_filesystem;
3535
+		//return '@@@1';
3536
+		return $wp_filesystem;
3537 3537
 
3538
-    } else {
3539
-        //return '@@@2';
3540
-        /* don't have direct write access. Prompt user with our notice */
3541
-        add_action('admin_notice', 'geodir_filesystem_notice');
3542
-        return false;
3543
-    }
3538
+	} else {
3539
+		//return '@@@2';
3540
+		/* don't have direct write access. Prompt user with our notice */
3541
+		add_action('admin_notice', 'geodir_filesystem_notice');
3542
+		return false;
3543
+	}
3544 3544
 
3545 3545
 }
3546 3546
 
@@ -3558,10 +3558,10 @@  discard block
 block discarded – undo
3558 3558
  */
3559 3559
 function geodir_filesystem_notice()
3560 3560
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3561
-    $access_type = get_filesystem_method();
3562
-    if ($access_type === 'direct') {
3563
-    } elseif (!defined('FTP_USER')) {
3564
-        ?>
3561
+	$access_type = get_filesystem_method();
3562
+	if ($access_type === 'direct') {
3563
+	} elseif (!defined('FTP_USER')) {
3564
+		?>
3565 3565
         <div class="error">
3566 3566
             <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
3567 3567
                 <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a>
@@ -3587,1444 +3587,1444 @@  discard block
 block discarded – undo
3587 3587
  * @return string Json data.
3588 3588
  */
3589 3589
 function geodir_ajax_import_export() {
3590
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3590
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3591 3591
     
3592
-    error_reporting(0);
3592
+	error_reporting(0);
3593 3593
 
3594
-    // try to set higher limits for import
3595
-    $max_input_time = ini_get('max_input_time');
3596
-    $max_execution_time = ini_get('max_execution_time');
3597
-    $memory_limit= ini_get('memory_limit');
3594
+	// try to set higher limits for import
3595
+	$max_input_time = ini_get('max_input_time');
3596
+	$max_execution_time = ini_get('max_execution_time');
3597
+	$memory_limit= ini_get('memory_limit');
3598 3598
 
3599
-    if(!$max_input_time || $max_input_time<3000){
3600
-        ini_set('max_input_time', 3000);
3601
-    }
3599
+	if(!$max_input_time || $max_input_time<3000){
3600
+		ini_set('max_input_time', 3000);
3601
+	}
3602 3602
 
3603
-    if(!$max_execution_time || $max_execution_time<3000){
3604
-        ini_set('max_execution_time', 3000);
3605
-    }
3603
+	if(!$max_execution_time || $max_execution_time<3000){
3604
+		ini_set('max_execution_time', 3000);
3605
+	}
3606 3606
 
3607
-    if($memory_limit && str_replace('M','',$memory_limit)){
3608
-        if(str_replace('M','',$memory_limit)<256){
3609
-            ini_set('memory_limit', '256M');
3610
-        }
3611
-    }
3607
+	if($memory_limit && str_replace('M','',$memory_limit)){
3608
+		if(str_replace('M','',$memory_limit)<256){
3609
+			ini_set('memory_limit', '256M');
3610
+		}
3611
+	}
3612 3612
 
3613
-    $json = array();
3613
+	$json = array();
3614 3614
 
3615
-    if ( !current_user_can( 'manage_options' ) ) {
3616
-        wp_send_json( $json );
3617
-    }
3615
+	if ( !current_user_can( 'manage_options' ) ) {
3616
+		wp_send_json( $json );
3617
+	}
3618 3618
 
3619
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3620
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3621
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3619
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3620
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3621
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3622 3622
 
3623
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3624
-        wp_send_json( $json );
3625
-    }
3623
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3624
+		wp_send_json( $json );
3625
+	}
3626 3626
 
3627
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3628
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3629
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3630
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3627
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3628
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3629
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3630
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3631 3631
 
3632
-    $wp_filesystem = geodir_init_filesystem();
3633
-    if (!$wp_filesystem) {
3634
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3635
-        wp_send_json( $json );
3636
-    }
3632
+	$wp_filesystem = geodir_init_filesystem();
3633
+	if (!$wp_filesystem) {
3634
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3635
+		wp_send_json( $json );
3636
+	}
3637 3637
 
3638
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3639
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3640
-        wp_send_json( $json );
3641
-    }
3638
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3639
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3640
+		wp_send_json( $json );
3641
+	}
3642 3642
 
3643
-    $csv_file_dir = geodir_path_import_export( false );
3644
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3645
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3646
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3647
-            wp_send_json( $json );
3648
-        }
3649
-    }
3643
+	$csv_file_dir = geodir_path_import_export( false );
3644
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3645
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3646
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3647
+			wp_send_json( $json );
3648
+		}
3649
+	}
3650 3650
     
3651
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3652
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3653
-
3654
-    switch ( $task ) {
3655
-        case 'export_posts': {
3656
-            // WPML
3657
-            $is_wpml = geodir_is_wpml();
3658
-            if ($is_wpml) {
3659
-                global $sitepress;
3660
-                $active_lang = ICL_LANGUAGE_CODE;
3651
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3652
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3653
+
3654
+	switch ( $task ) {
3655
+		case 'export_posts': {
3656
+			// WPML
3657
+			$is_wpml = geodir_is_wpml();
3658
+			if ($is_wpml) {
3659
+				global $sitepress;
3660
+				$active_lang = ICL_LANGUAGE_CODE;
3661 3661
                 
3662
-                $sitepress->switch_lang('all', true);
3663
-            }
3664
-            // WPML
3665
-            if ( $post_type == 'gd_event' ) {
3666
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3667
-            }
3668
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3669
-            $posts_count = geodir_get_posts_count( $post_type );
3670
-            $file_url_base = geodir_path_import_export() . '/';
3671
-            $file_url = $file_url_base . $file_name . '.csv';
3672
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3673
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3662
+				$sitepress->switch_lang('all', true);
3663
+			}
3664
+			// WPML
3665
+			if ( $post_type == 'gd_event' ) {
3666
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3667
+			}
3668
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3669
+			$posts_count = geodir_get_posts_count( $post_type );
3670
+			$file_url_base = geodir_path_import_export() . '/';
3671
+			$file_url = $file_url_base . $file_name . '.csv';
3672
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3673
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3674 3674
             
3675
-            $chunk_file_paths = array();
3675
+			$chunk_file_paths = array();
3676 3676
 
3677
-            if ( isset( $_REQUEST['_st'] ) ) {
3678
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3679
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3680
-                $percentage = min( $percentage, 100 );
3677
+			if ( isset( $_REQUEST['_st'] ) ) {
3678
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3679
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3680
+				$percentage = min( $percentage, 100 );
3681 3681
                 
3682
-                $json['percentage'] = $percentage;
3683
-                // WPML
3684
-                if ($is_wpml) {
3685
-                    $sitepress->switch_lang($active_lang, true);
3686
-                }
3687
-                // WPML
3688
-                wp_send_json( $json );
3689
-                exit;
3690
-            } else {
3691
-                if ( !$posts_count > 0 ) {
3692
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3693
-                } else {
3694
-                    $total_posts = $posts_count;
3695
-                    if ($chunk_per_page > $total_posts) {
3696
-                        $chunk_per_page = $total_posts;
3697
-                    }
3698
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3682
+				$json['percentage'] = $percentage;
3683
+				// WPML
3684
+				if ($is_wpml) {
3685
+					$sitepress->switch_lang($active_lang, true);
3686
+				}
3687
+				// WPML
3688
+				wp_send_json( $json );
3689
+				exit;
3690
+			} else {
3691
+				if ( !$posts_count > 0 ) {
3692
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3693
+				} else {
3694
+					$total_posts = $posts_count;
3695
+					if ($chunk_per_page > $total_posts) {
3696
+						$chunk_per_page = $total_posts;
3697
+					}
3698
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3699 3699
                     
3700
-                    $j = $chunk_page_no;
3701
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3700
+					$j = $chunk_page_no;
3701
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3702 3702
                     
3703
-                    $per_page = 500;
3704
-                    if ($per_page > $chunk_per_page) {
3705
-                        $per_page = $chunk_per_page;
3706
-                    }
3707
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3703
+					$per_page = 500;
3704
+					if ($per_page > $chunk_per_page) {
3705
+						$per_page = $chunk_per_page;
3706
+					}
3707
+					$total_pages = ceil( $chunk_per_page / $per_page );
3708 3708
                     
3709
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3710
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3709
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3710
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3711 3711
                         
3712
-                        $clear = $i == 0 ? true : false;
3713
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3714
-                    }
3712
+						$clear = $i == 0 ? true : false;
3713
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3714
+					}
3715 3715
                         
3716
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3717
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3718
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3719
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3720
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3716
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3717
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3718
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3719
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3720
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3721 3721
                         
3722
-                        $file_url = $file_url_base . $chunk_file_name;
3723
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3724
-                    }
3722
+						$file_url = $file_url_base . $chunk_file_name;
3723
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3724
+					}
3725 3725
                     
3726
-                    if ( !empty($chunk_file_paths) ) {
3727
-                        $json['total'] = $posts_count;
3728
-                        $json['files'] = $chunk_file_paths;
3729
-                    } else {
3730
-                        if ($j > 1) {
3731
-                            $json['total'] = $posts_count;
3732
-                            $json['files'] = array();
3733
-                        } else {
3734
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3735
-                        }
3736
-                    }
3737
-                }
3738
-                // WPML
3739
-                if ($is_wpml) {
3740
-                    $sitepress->switch_lang($active_lang, true);
3741
-                }
3742
-                // WPML
3743
-                wp_send_json( $json );
3744
-            }
3745
-        }
3746
-        break;
3747
-        case 'export_cats': {
3748
-            // WPML
3749
-            $is_wpml = geodir_is_wpml();
3750
-            if ($is_wpml) {
3751
-                global $sitepress;
3752
-                $active_lang = ICL_LANGUAGE_CODE;
3726
+					if ( !empty($chunk_file_paths) ) {
3727
+						$json['total'] = $posts_count;
3728
+						$json['files'] = $chunk_file_paths;
3729
+					} else {
3730
+						if ($j > 1) {
3731
+							$json['total'] = $posts_count;
3732
+							$json['files'] = array();
3733
+						} else {
3734
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3735
+						}
3736
+					}
3737
+				}
3738
+				// WPML
3739
+				if ($is_wpml) {
3740
+					$sitepress->switch_lang($active_lang, true);
3741
+				}
3742
+				// WPML
3743
+				wp_send_json( $json );
3744
+			}
3745
+		}
3746
+		break;
3747
+		case 'export_cats': {
3748
+			// WPML
3749
+			$is_wpml = geodir_is_wpml();
3750
+			if ($is_wpml) {
3751
+				global $sitepress;
3752
+				$active_lang = ICL_LANGUAGE_CODE;
3753 3753
                 
3754
-                $sitepress->switch_lang('all', true);
3755
-            }
3756
-            // WPML
3757
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3754
+				$sitepress->switch_lang('all', true);
3755
+			}
3756
+			// WPML
3757
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3758 3758
             
3759
-            $terms_count = geodir_get_terms_count( $post_type );
3760
-            $file_url_base = geodir_path_import_export() . '/';
3761
-            $file_url = $file_url_base . $file_name . '.csv';
3762
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3763
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3759
+			$terms_count = geodir_get_terms_count( $post_type );
3760
+			$file_url_base = geodir_path_import_export() . '/';
3761
+			$file_url = $file_url_base . $file_name . '.csv';
3762
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3763
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3764 3764
             
3765
-            $chunk_file_paths = array();
3765
+			$chunk_file_paths = array();
3766 3766
             
3767
-            if ( isset( $_REQUEST['_st'] ) ) {
3768
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3769
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3770
-                $percentage = min( $percentage, 100 );
3767
+			if ( isset( $_REQUEST['_st'] ) ) {
3768
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3769
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3770
+				$percentage = min( $percentage, 100 );
3771 3771
                 
3772
-                $json['percentage'] = $percentage;
3773
-                // WPML
3774
-                if ($is_wpml) {
3775
-                    $sitepress->switch_lang($active_lang, true);
3776
-                }
3777
-                // WPML
3778
-                wp_send_json( $json );
3779
-            } else {
3780
-                if ( !$terms_count > 0 ) {
3781
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3782
-                } else {
3783
-                    $total_terms = $terms_count;
3784
-                    if ($chunk_per_page > $terms_count) {
3785
-                        $chunk_per_page = $terms_count;
3786
-                    }
3787
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3772
+				$json['percentage'] = $percentage;
3773
+				// WPML
3774
+				if ($is_wpml) {
3775
+					$sitepress->switch_lang($active_lang, true);
3776
+				}
3777
+				// WPML
3778
+				wp_send_json( $json );
3779
+			} else {
3780
+				if ( !$terms_count > 0 ) {
3781
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3782
+				} else {
3783
+					$total_terms = $terms_count;
3784
+					if ($chunk_per_page > $terms_count) {
3785
+						$chunk_per_page = $terms_count;
3786
+					}
3787
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3788 3788
                     
3789
-                    $j = $chunk_page_no;
3790
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3789
+					$j = $chunk_page_no;
3790
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3791 3791
                     
3792
-                    $per_page = 500;
3793
-                    if ($per_page > $chunk_per_page) {
3794
-                        $per_page = $chunk_per_page;
3795
-                    }
3796
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3792
+					$per_page = 500;
3793
+					if ($per_page > $chunk_per_page) {
3794
+						$per_page = $chunk_per_page;
3795
+					}
3796
+					$total_pages = ceil( $chunk_per_page / $per_page );
3797 3797
                     
3798
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3799
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3798
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3799
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3800 3800
                         
3801
-                        $clear = $i == 0 ? true : false;
3802
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3803
-                    }
3801
+						$clear = $i == 0 ? true : false;
3802
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3803
+					}
3804 3804
                     
3805
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3806
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3807
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3808
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3809
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3805
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3806
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3807
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3808
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3809
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3810 3810
                         
3811
-                        $file_url = $file_url_base . $chunk_file_name;
3812
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3813
-                    }
3811
+						$file_url = $file_url_base . $chunk_file_name;
3812
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3813
+					}
3814 3814
                     
3815
-                    if ( !empty($chunk_file_paths) ) {
3816
-                        $json['total'] = $terms_count;
3817
-                        $json['files'] = $chunk_file_paths;
3818
-                    } else {
3819
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3820
-                    }
3821
-                }
3822
-                // WPML
3823
-                if ($is_wpml) {
3824
-                    $sitepress->switch_lang($active_lang, true);
3825
-                }
3826
-                // WPML
3827
-                wp_send_json( $json );
3828
-            }
3829
-        }
3830
-        break;
3831
-        case 'export_locations': {
3832
-            $file_url_base = geodir_path_import_export() . '/';
3833
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3834
-            $file_url = $file_url_base . $file_name . '.csv';
3835
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3836
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3815
+					if ( !empty($chunk_file_paths) ) {
3816
+						$json['total'] = $terms_count;
3817
+						$json['files'] = $chunk_file_paths;
3818
+					} else {
3819
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3820
+					}
3821
+				}
3822
+				// WPML
3823
+				if ($is_wpml) {
3824
+					$sitepress->switch_lang($active_lang, true);
3825
+				}
3826
+				// WPML
3827
+				wp_send_json( $json );
3828
+			}
3829
+		}
3830
+		break;
3831
+		case 'export_locations': {
3832
+			$file_url_base = geodir_path_import_export() . '/';
3833
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3834
+			$file_url = $file_url_base . $file_name . '.csv';
3835
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3836
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3837 3837
             
3838
-            $items_count = (int)geodir_location_imex_count_locations();
3838
+			$items_count = (int)geodir_location_imex_count_locations();
3839 3839
             
3840
-            if ( isset( $_REQUEST['_st'] ) ) {
3841
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3842
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3843
-                $percentage = min( $percentage, 100 );
3840
+			if ( isset( $_REQUEST['_st'] ) ) {
3841
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3842
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3843
+				$percentage = min( $percentage, 100 );
3844 3844
                 
3845
-                $json['percentage'] = $percentage;
3846
-                wp_send_json( $json );
3847
-            } else {
3848
-                $chunk_file_paths = array();
3845
+				$json['percentage'] = $percentage;
3846
+				wp_send_json( $json );
3847
+			} else {
3848
+				$chunk_file_paths = array();
3849 3849
                 
3850
-                if ( !$items_count > 0 ) {
3851
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3852
-                } else {
3853
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3854
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3850
+				if ( !$items_count > 0 ) {
3851
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3852
+				} else {
3853
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3854
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3855 3855
                     
3856
-                    $j = $chunk_page_no;
3857
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3856
+					$j = $chunk_page_no;
3857
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3858 3858
                     
3859
-                    $per_page = 500;
3860
-                    $per_page = min( $per_page, $chunk_per_page );
3861
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3859
+					$per_page = 500;
3860
+					$per_page = min( $per_page, $chunk_per_page );
3861
+					$total_pages = ceil( $chunk_per_page / $per_page );
3862 3862
                     
3863
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3864
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3863
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3864
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3865 3865
                         
3866
-                        $clear = $i == 0 ? true : false;
3867
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3868
-                    }
3866
+						$clear = $i == 0 ? true : false;
3867
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3868
+					}
3869 3869
                     
3870
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3871
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3872
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3873
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3874
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3870
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3871
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3872
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3873
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3874
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3875 3875
                         
3876
-                        $file_url = $file_url_base . $chunk_file_name;
3877
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3878
-                    }
3876
+						$file_url = $file_url_base . $chunk_file_name;
3877
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3878
+					}
3879 3879
                     
3880
-                    if ( !empty($chunk_file_paths) ) {
3881
-                        $json['total'] = $items_count;
3882
-                        $json['files'] = $chunk_file_paths;
3883
-                    } else {
3884
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3885
-                    }
3886
-                }
3887
-                wp_send_json( $json );
3888
-            }
3889
-        }
3890
-        break;
3891
-        case 'export_hoods': {
3892
-            $file_url_base = geodir_path_import_export() . '/';
3893
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3894
-            $file_url = $file_url_base . $file_name . '.csv';
3895
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3896
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3880
+					if ( !empty($chunk_file_paths) ) {
3881
+						$json['total'] = $items_count;
3882
+						$json['files'] = $chunk_file_paths;
3883
+					} else {
3884
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3885
+					}
3886
+				}
3887
+				wp_send_json( $json );
3888
+			}
3889
+		}
3890
+		break;
3891
+		case 'export_hoods': {
3892
+			$file_url_base = geodir_path_import_export() . '/';
3893
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3894
+			$file_url = $file_url_base . $file_name . '.csv';
3895
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3896
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3897 3897
             
3898
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3898
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3899 3899
             
3900
-            if ( isset( $_REQUEST['_st'] ) ) {
3901
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3902
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3903
-                $percentage = min( $percentage, 100 );
3900
+			if ( isset( $_REQUEST['_st'] ) ) {
3901
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3902
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3903
+				$percentage = min( $percentage, 100 );
3904 3904
                 
3905
-                $json['percentage'] = $percentage;
3906
-                wp_send_json( $json );
3907
-            } else {
3908
-                $chunk_file_paths = array();
3905
+				$json['percentage'] = $percentage;
3906
+				wp_send_json( $json );
3907
+			} else {
3908
+				$chunk_file_paths = array();
3909 3909
                 
3910
-                if ( !$items_count > 0 ) {
3911
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3912
-                } else {
3913
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3914
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3910
+				if ( !$items_count > 0 ) {
3911
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3912
+				} else {
3913
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3914
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3915 3915
                     
3916
-                    $j = $chunk_page_no;
3917
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3916
+					$j = $chunk_page_no;
3917
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3918 3918
                     
3919
-                    $per_page = 500;
3920
-                    $per_page = min( $per_page, $chunk_per_page );
3921
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3919
+					$per_page = 500;
3920
+					$per_page = min( $per_page, $chunk_per_page );
3921
+					$total_pages = ceil( $chunk_per_page / $per_page );
3922 3922
                     
3923
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3924
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3923
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3924
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3925 3925
                         
3926
-                        $clear = $i == 0 ? true : false;
3927
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3928
-                    }
3926
+						$clear = $i == 0 ? true : false;
3927
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3928
+					}
3929 3929
                     
3930
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3931
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3932
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3933
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3934
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3930
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3931
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3932
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3933
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3934
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3935 3935
                         
3936
-                        $file_url = $file_url_base . $chunk_file_name;
3937
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3938
-                    }
3936
+						$file_url = $file_url_base . $chunk_file_name;
3937
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3938
+					}
3939 3939
                     
3940
-                    if ( !empty($chunk_file_paths) ) {
3941
-                        $json['total'] = $items_count;
3942
-                        $json['files'] = $chunk_file_paths;
3943
-                    } else {
3944
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3945
-                    }
3946
-                }
3947
-                wp_send_json( $json );
3948
-            }
3949
-        }
3950
-        break;
3951
-        case 'prepare_import':
3952
-        case 'import_cat':
3953
-        case 'import_post':
3954
-        case 'import_loc':
3955
-        case 'import_hood': {
3956
-            // WPML
3957
-            $is_wpml = geodir_is_wpml();
3958
-            if ($is_wpml) {
3959
-                global $sitepress;
3960
-                $active_lang = ICL_LANGUAGE_CODE;
3961
-            }
3962
-            // WPML
3940
+					if ( !empty($chunk_file_paths) ) {
3941
+						$json['total'] = $items_count;
3942
+						$json['files'] = $chunk_file_paths;
3943
+					} else {
3944
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3945
+					}
3946
+				}
3947
+				wp_send_json( $json );
3948
+			}
3949
+		}
3950
+		break;
3951
+		case 'prepare_import':
3952
+		case 'import_cat':
3953
+		case 'import_post':
3954
+		case 'import_loc':
3955
+		case 'import_hood': {
3956
+			// WPML
3957
+			$is_wpml = geodir_is_wpml();
3958
+			if ($is_wpml) {
3959
+				global $sitepress;
3960
+				$active_lang = ICL_LANGUAGE_CODE;
3961
+			}
3962
+			// WPML
3963 3963
             
3964
-            ini_set( 'auto_detect_line_endings', true );
3964
+			ini_set( 'auto_detect_line_endings', true );
3965 3965
             
3966
-            $uploads = wp_upload_dir();
3967
-            $uploads_dir = $uploads['path'];
3968
-            $uploads_subdir = $uploads['subdir'];
3966
+			$uploads = wp_upload_dir();
3967
+			$uploads_dir = $uploads['path'];
3968
+			$uploads_subdir = $uploads['subdir'];
3969 3969
             
3970
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3971
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3970
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3971
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3972 3972
             
3973
-            $csv_file_arr = explode( '/', $csv_file );
3974
-            $csv_filename = end( $csv_file_arr );
3975
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3973
+			$csv_file_arr = explode( '/', $csv_file );
3974
+			$csv_filename = end( $csv_file_arr );
3975
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3976 3976
             
3977
-            $json['file'] = $csv_file;
3978
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3979
-            $file = array();
3977
+			$json['file'] = $csv_file;
3978
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3979
+			$file = array();
3980 3980
 
3981
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3982
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3981
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3982
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3983 3983
                 
3984
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3985
-                    $json['error'] = NULL;
3986
-                    $json['rows'] = 0;
3984
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3985
+					$json['error'] = NULL;
3986
+					$json['rows'] = 0;
3987 3987
                     
3988
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3989
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3990
-                            if ( !empty( $data ) ) {
3991
-                                $file[] = $data;
3992
-                            }
3993
-                        }
3994
-                        fclose($handle);
3995
-                    }
3988
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3989
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3990
+							if ( !empty( $data ) ) {
3991
+								$file[] = $data;
3992
+							}
3993
+						}
3994
+						fclose($handle);
3995
+					}
3996 3996
 
3997
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3997
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3998 3998
                     
3999
-                    if (!$json['rows'] > 0) {
4000
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4001
-                    }
4002
-                } else {
4003
-                    wp_send_json( $json );
4004
-                }
4005
-            } else {
4006
-                wp_send_json( $json );
4007
-            }
3999
+					if (!$json['rows'] > 0) {
4000
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4001
+					}
4002
+				} else {
4003
+					wp_send_json( $json );
4004
+				}
4005
+			} else {
4006
+				wp_send_json( $json );
4007
+			}
4008 4008
             
4009
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4010
-                wp_send_json( $json );
4011
-            }
4009
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4010
+				wp_send_json( $json );
4011
+			}
4012 4012
             
4013
-            $total = $json['rows'];
4014
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4015
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4013
+			$total = $json['rows'];
4014
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4015
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4016 4016
             
4017
-            $count = $limit;
4017
+			$count = $limit;
4018 4018
             
4019
-            if ($count < $total) {
4020
-                $count = $processed + $count;
4021
-                if ($count > $total) {
4022
-                    $count = $total;
4023
-                }
4024
-            } else {
4025
-                $count = $total;
4026
-            }
4019
+			if ($count < $total) {
4020
+				$count = $processed + $count;
4021
+				if ($count > $total) {
4022
+					$count = $total;
4023
+				}
4024
+			} else {
4025
+				$count = $total;
4026
+			}
4027 4027
             
4028
-            $created = 0;
4029
-            $updated = 0;
4030
-            $skipped = 0;
4031
-            $invalid = 0;
4032
-            $invalid_addr = 0;
4033
-            $images = 0;
4028
+			$created = 0;
4029
+			$updated = 0;
4030
+			$skipped = 0;
4031
+			$invalid = 0;
4032
+			$invalid_addr = 0;
4033
+			$images = 0;
4034 4034
             
4035
-            $gd_post_info = array();
4036
-            $countpost = 0;
4035
+			$gd_post_info = array();
4036
+			$countpost = 0;
4037 4037
             
4038
-            $post_types = geodir_get_posttypes();
4038
+			$post_types = geodir_get_posttypes();
4039 4039
 
4040
-            if ( $task == 'import_cat' ) {
4041
-                if (!empty($file)) {
4042
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4040
+			if ( $task == 'import_cat' ) {
4041
+				if (!empty($file)) {
4042
+					$columns = isset($file[0]) ? $file[0] : NULL;
4043 4043
                     
4044
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4045
-                        $json['error'] = CSV_INVAILD_FILE;
4046
-                        wp_send_json( $json );
4047
-                        exit;
4048
-                    }
4044
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4045
+						$json['error'] = CSV_INVAILD_FILE;
4046
+						wp_send_json( $json );
4047
+						exit;
4048
+					}
4049 4049
                     
4050
-                    for ($i = 1; $i <= $limit; $i++) {
4051
-                        $index = $processed + $i;
4050
+					for ($i = 1; $i <= $limit; $i++) {
4051
+						$index = $processed + $i;
4052 4052
                         
4053
-                        if (isset($file[$index])) {
4054
-                            $row = $file[$index];
4055
-                            $row = array_map( 'trim', $row );
4056
-                            //$row = array_map( 'utf8_encode', $row );
4053
+						if (isset($file[$index])) {
4054
+							$row = $file[$index];
4055
+							$row = array_map( 'trim', $row );
4056
+							//$row = array_map( 'utf8_encode', $row );
4057 4057
                             
4058
-                            $cat_id = '';
4059
-                            $cat_name = '';
4060
-                            $cat_slug = '';
4061
-                            $cat_posttype = '';
4062
-                            $cat_parent = '';
4063
-                            $cat_description = '';
4064
-                            $cat_schema = '';
4065
-                            $cat_top_description = '';
4066
-                            $cat_image = '';
4067
-                            $cat_icon = '';
4068
-                            $cat_language = '';
4058
+							$cat_id = '';
4059
+							$cat_name = '';
4060
+							$cat_slug = '';
4061
+							$cat_posttype = '';
4062
+							$cat_parent = '';
4063
+							$cat_description = '';
4064
+							$cat_schema = '';
4065
+							$cat_top_description = '';
4066
+							$cat_image = '';
4067
+							$cat_icon = '';
4068
+							$cat_language = '';
4069 4069
                             
4070
-                            $c = 0;
4071
-                            foreach ($columns as $column ) {
4072
-                                if ( $column == 'cat_id' ) {
4073
-                                    $cat_id = (int)$row[$c];
4074
-                                } else if ( $column == 'cat_name' ) {
4075
-                                    $cat_name = $row[$c];
4076
-                                } else if ( $column == 'cat_slug' ) {
4077
-                                    $cat_slug = $row[$c];
4078
-                                } else if ( $column == 'cat_posttype' ) {
4079
-                                    $cat_posttype = $row[$c];
4080
-                                } else if ( $column == 'cat_parent' ) {
4081
-                                    $cat_parent = trim($row[$c]);
4082
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4083
-                                    $cat_schema = $row[$c];
4084
-                                } else if ( $column == 'cat_description' ) {
4085
-                                    $cat_description = $row[$c];
4086
-                                } else if ( $column == 'cat_top_description' ) {
4087
-                                    $cat_top_description = $row[$c];
4088
-                                } else if ( $column == 'cat_image' ) {
4089
-                                    $cat_image = $row[$c];
4090
-                                } else if ( $column == 'cat_icon' ) {
4091
-                                    $cat_icon = $row[$c];
4092
-                                }
4093
-                                // WPML
4094
-                                if ($is_wpml && $column == 'cat_language') {
4095
-                                    $cat_language = geodir_strtolower(trim($row[$c]));
4096
-                                }
4097
-                                // WPML
4098
-                                $c++;
4099
-                            }
4070
+							$c = 0;
4071
+							foreach ($columns as $column ) {
4072
+								if ( $column == 'cat_id' ) {
4073
+									$cat_id = (int)$row[$c];
4074
+								} else if ( $column == 'cat_name' ) {
4075
+									$cat_name = $row[$c];
4076
+								} else if ( $column == 'cat_slug' ) {
4077
+									$cat_slug = $row[$c];
4078
+								} else if ( $column == 'cat_posttype' ) {
4079
+									$cat_posttype = $row[$c];
4080
+								} else if ( $column == 'cat_parent' ) {
4081
+									$cat_parent = trim($row[$c]);
4082
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4083
+									$cat_schema = $row[$c];
4084
+								} else if ( $column == 'cat_description' ) {
4085
+									$cat_description = $row[$c];
4086
+								} else if ( $column == 'cat_top_description' ) {
4087
+									$cat_top_description = $row[$c];
4088
+								} else if ( $column == 'cat_image' ) {
4089
+									$cat_image = $row[$c];
4090
+								} else if ( $column == 'cat_icon' ) {
4091
+									$cat_icon = $row[$c];
4092
+								}
4093
+								// WPML
4094
+								if ($is_wpml && $column == 'cat_language') {
4095
+									$cat_language = geodir_strtolower(trim($row[$c]));
4096
+								}
4097
+								// WPML
4098
+								$c++;
4099
+							}
4100 4100
                             
4101
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4102
-                                $invalid++;
4103
-                                continue;
4104
-                            }
4101
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4102
+								$invalid++;
4103
+								continue;
4104
+							}
4105 4105
                             
4106
-                            // WPML
4107
-                            if ($is_wpml && $cat_language != '') {
4108
-                                $sitepress->switch_lang($cat_language, true);
4109
-                            }
4110
-                            // WPML
4106
+							// WPML
4107
+							if ($is_wpml && $cat_language != '') {
4108
+								$sitepress->switch_lang($cat_language, true);
4109
+							}
4110
+							// WPML
4111 4111
                                                         
4112
-                            $term_data = array();
4113
-                            $term_data['name'] = $cat_name;
4114
-                            $term_data['slug'] = $cat_slug;
4115
-                            $term_data['description'] = $cat_description;
4116
-                            $term_data['cat_schema'] = $cat_schema;
4117
-                            $term_data['top_description'] = $cat_top_description;
4118
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4119
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4112
+							$term_data = array();
4113
+							$term_data['name'] = $cat_name;
4114
+							$term_data['slug'] = $cat_slug;
4115
+							$term_data['description'] = $cat_description;
4116
+							$term_data['cat_schema'] = $cat_schema;
4117
+							$term_data['top_description'] = $cat_top_description;
4118
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4119
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4120 4120
                             
4121
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4121
+							//$term_data = array_map( 'utf8_encode', $term_data );
4122 4122
                             
4123
-                            $taxonomy = $cat_posttype . 'category';
4123
+							$taxonomy = $cat_posttype . 'category';
4124 4124
                             
4125
-                            $term_data['taxonomy'] = $taxonomy;
4125
+							$term_data['taxonomy'] = $taxonomy;
4126 4126
 
4127
-                            $term_parent_id = 0;
4128
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4129
-                                $term_parent = '';
4127
+							$term_parent_id = 0;
4128
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4129
+								$term_parent = '';
4130 4130
                                 
4131
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4132
-                                    //
4133
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4134
-                                    //
4135
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4136
-                                    //
4137
-                                } else {
4138
-                                    $term_parent_data = array();
4139
-                                    $term_parent_data['name'] = $cat_parent;
4140
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4141
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4131
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4132
+									//
4133
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4134
+									//
4135
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4136
+									//
4137
+								} else {
4138
+									$term_parent_data = array();
4139
+									$term_parent_data['name'] = $cat_parent;
4140
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4141
+									$term_parent_data['taxonomy'] = $taxonomy;
4142 4142
                                     
4143
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4144
-                                }
4143
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4144
+								}
4145 4145
                                 
4146
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4147
-                                    $term_parent_id = (int)$term_parent->term_id;
4148
-                                }
4149
-                            }
4150
-                            $term_data['parent'] = (int)$term_parent_id;
4146
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4147
+									$term_parent_id = (int)$term_parent->term_id;
4148
+								}
4149
+							}
4150
+							$term_data['parent'] = (int)$term_parent_id;
4151 4151
 
4152
-                            $term_id = NULL;
4153
-                            if ( $import_choice == 'update' ) {
4154
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4155
-                                    $term_data['term_id'] = $term['term_id'];
4152
+							$term_id = NULL;
4153
+							if ( $import_choice == 'update' ) {
4154
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4155
+									$term_data['term_id'] = $term['term_id'];
4156 4156
                                     
4157
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4158
-                                        $updated++;
4159
-                                    } else {
4160
-                                        $invalid++;
4161
-                                    }
4162
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4163
-                                    $term_data['term_id'] = $term['term_id'];
4157
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4158
+										$updated++;
4159
+									} else {
4160
+										$invalid++;
4161
+									}
4162
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4163
+									$term_data['term_id'] = $term['term_id'];
4164 4164
                                     
4165
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4166
-                                        $updated++;
4167
-                                    } else {
4168
-                                        $invalid++;
4169
-                                    }
4170
-                                } else {
4171
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4172
-                                        $created++;
4173
-                                    } else {
4174
-                                        $invalid++;
4175
-                                    }
4176
-                                }
4177
-                            } else if ( $import_choice == 'skip' ) {
4178
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4179
-                                    $skipped++;
4180
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4181
-                                    $skipped++;
4182
-                                } else {
4183
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4184
-                                        $created++;
4185
-                                    } else {
4186
-                                        $invalid++;
4187
-                                    }
4188
-                                }
4189
-                            } else {
4190
-                                $invalid++;
4191
-                            }
4165
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4166
+										$updated++;
4167
+									} else {
4168
+										$invalid++;
4169
+									}
4170
+								} else {
4171
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4172
+										$created++;
4173
+									} else {
4174
+										$invalid++;
4175
+									}
4176
+								}
4177
+							} else if ( $import_choice == 'skip' ) {
4178
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4179
+									$skipped++;
4180
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4181
+									$skipped++;
4182
+								} else {
4183
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4184
+										$created++;
4185
+									} else {
4186
+										$invalid++;
4187
+									}
4188
+								}
4189
+							} else {
4190
+								$invalid++;
4191
+							}
4192 4192
                             
4193
-                            if ( $term_id ) {
4194
-                                if ( isset( $term_data['top_description'] ) ) {
4195
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4196
-                                }
4193
+							if ( $term_id ) {
4194
+								if ( isset( $term_data['top_description'] ) ) {
4195
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4196
+								}
4197 4197
                                 
4198
-                                if ( isset( $term_data['cat_schema'] ) ) {
4199
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4200
-                                }
4198
+								if ( isset( $term_data['cat_schema'] ) ) {
4199
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4200
+								}
4201 4201
             
4202
-                                $attachment = false;
4203
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4204
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4205
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4202
+								$attachment = false;
4203
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4204
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4205
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4206 4206
                                     
4207
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4208
-                                        $attachment = true;
4209
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4210
-                                    }
4211
-                                }
4207
+									if ( basename($cat_image) != $term_data['image'] ) {
4208
+										$attachment = true;
4209
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4210
+									}
4211
+								}
4212 4212
                                 
4213
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4214
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4215
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4213
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4214
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4215
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4216 4216
                                         
4217
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4218
-                                        $attachment = true;
4219
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4220
-                                    }
4221
-                                }
4217
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4218
+										$attachment = true;
4219
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4220
+									}
4221
+								}
4222 4222
                                 
4223
-                                if ( $attachment ) {
4224
-                                    $images++;
4225
-                                }
4226
-                            }
4223
+								if ( $attachment ) {
4224
+									$images++;
4225
+								}
4226
+							}
4227 4227
                             
4228
-                            // WPML
4229
-                            if ($is_wpml && $cat_language != '') {
4230
-                                $sitepress->switch_lang($active_lang, true);
4231
-                            }
4232
-                            // WPML
4233
-                        }
4234
-                    }
4235
-                }
4228
+							// WPML
4229
+							if ($is_wpml && $cat_language != '') {
4230
+								$sitepress->switch_lang($active_lang, true);
4231
+							}
4232
+							// WPML
4233
+						}
4234
+					}
4235
+				}
4236 4236
                 
4237
-                $json = array();
4238
-                $json['processed'] = $limit;
4239
-                $json['created'] = $created;
4240
-                $json['updated'] = $updated;
4241
-                $json['skipped'] = $skipped;
4242
-                $json['invalid'] = $invalid;
4243
-                $json['images'] = $images;
4237
+				$json = array();
4238
+				$json['processed'] = $limit;
4239
+				$json['created'] = $created;
4240
+				$json['updated'] = $updated;
4241
+				$json['skipped'] = $skipped;
4242
+				$json['invalid'] = $invalid;
4243
+				$json['images'] = $images;
4244 4244
                 
4245
-                wp_send_json( $json );
4246
-                exit;
4247
-            } else if ( $task == 'import_post' ) {
4248
-
4249
-                //run some stuff to make the import quicker
4250
-                wp_defer_term_counting( true );
4251
-                wp_defer_comment_counting( true );
4252
-                $wpdb->query( 'SET autocommit = 0;' );
4253
-
4254
-                //remove_all_actions('publish_post');
4255
-                //remove_all_actions('transition_post_status');
4256
-                //remove_all_actions('publish_future_post');
4257
-
4258
-                if (!empty($file)) {
4259
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4260
-                    $default_status = 'publish';
4261
-                    $current_date = date_i18n( 'Y-m-d', time() );
4245
+				wp_send_json( $json );
4246
+				exit;
4247
+			} else if ( $task == 'import_post' ) {
4248
+
4249
+				//run some stuff to make the import quicker
4250
+				wp_defer_term_counting( true );
4251
+				wp_defer_comment_counting( true );
4252
+				$wpdb->query( 'SET autocommit = 0;' );
4253
+
4254
+				//remove_all_actions('publish_post');
4255
+				//remove_all_actions('transition_post_status');
4256
+				//remove_all_actions('publish_future_post');
4257
+
4258
+				if (!empty($file)) {
4259
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4260
+					$default_status = 'publish';
4261
+					$current_date = date_i18n( 'Y-m-d', time() );
4262 4262
                     
4263
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4263
+					$columns = isset($file[0]) ? $file[0] : NULL;
4264 4264
                     
4265
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4266
-                        $json['error'] = CSV_INVAILD_FILE;
4267
-                        wp_send_json( $json );
4268
-                        exit;
4269
-                    }
4265
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4266
+						$json['error'] = CSV_INVAILD_FILE;
4267
+						wp_send_json( $json );
4268
+						exit;
4269
+					}
4270 4270
 
4271
-                    $processed_actual=0;
4272
-                    for ($i = 1; $i <= $limit; $i++) {
4273
-                        $index = $processed + $i;
4274
-                        $gd_post = array();
4271
+					$processed_actual=0;
4272
+					for ($i = 1; $i <= $limit; $i++) {
4273
+						$index = $processed + $i;
4274
+						$gd_post = array();
4275 4275
                         
4276
-                        if (isset($file[$index])) {$processed_actual++;
4277
-                            $row = $file[$index];
4278
-                            $row = array_map( 'trim', $row );
4279
-                            //$row = array_map( 'utf8_encode', $row );
4280
-                            $row = array_map( 'addslashes_gpc', $row );
4276
+						if (isset($file[$index])) {$processed_actual++;
4277
+							$row = $file[$index];
4278
+							$row = array_map( 'trim', $row );
4279
+							//$row = array_map( 'utf8_encode', $row );
4280
+							$row = array_map( 'addslashes_gpc', $row );
4281 4281
                             
4282
-                            $post_id = '';
4283
-                            $post_title = '';
4284
-                            $post_author = '';
4285
-                            $post_content = '';
4286
-                            $post_category_arr = array();
4287
-                            $default_category = '';
4288
-                            $post_tags = array();
4289
-                            $post_type = '';
4290
-                            $post_status = '';
4291
-                            $geodir_video = '';
4292
-                            $post_address = '';
4293
-                            $post_city = '';
4294
-                            $post_region = '';
4295
-                            $post_country = '';
4296
-                            $post_zip = '';
4297
-                            $post_latitude = '';
4298
-                            $post_longitude = '';
4299
-                            $post_neighbourhood = '';
4300
-                            $neighbourhood_latitude = '';
4301
-                            $neighbourhood_longitude = '';
4302
-                            $geodir_timing = '';
4303
-                            $geodir_contact = '';
4304
-                            $geodir_email = '';
4305
-                            $geodir_website = '';
4306
-                            $geodir_twitter = '';
4307
-                            $geodir_facebook = '';
4308
-                            $geodir_twitter = '';
4309
-                            $post_images = array();
4282
+							$post_id = '';
4283
+							$post_title = '';
4284
+							$post_author = '';
4285
+							$post_content = '';
4286
+							$post_category_arr = array();
4287
+							$default_category = '';
4288
+							$post_tags = array();
4289
+							$post_type = '';
4290
+							$post_status = '';
4291
+							$geodir_video = '';
4292
+							$post_address = '';
4293
+							$post_city = '';
4294
+							$post_region = '';
4295
+							$post_country = '';
4296
+							$post_zip = '';
4297
+							$post_latitude = '';
4298
+							$post_longitude = '';
4299
+							$post_neighbourhood = '';
4300
+							$neighbourhood_latitude = '';
4301
+							$neighbourhood_longitude = '';
4302
+							$geodir_timing = '';
4303
+							$geodir_contact = '';
4304
+							$geodir_email = '';
4305
+							$geodir_website = '';
4306
+							$geodir_twitter = '';
4307
+							$geodir_facebook = '';
4308
+							$geodir_twitter = '';
4309
+							$post_images = array();
4310 4310
                             
4311
-                            $expire_date = 'Never';
4311
+							$expire_date = 'Never';
4312 4312
                             
4313
-                            $language = '';
4314
-                            $original_post_id = '';
4313
+							$language = '';
4314
+							$original_post_id = '';
4315 4315
                                                         
4316
-                            $c = 0;
4317
-                            foreach ($columns as $column ) {
4318
-                                $gd_post[$column] = $row[$c];
4316
+							$c = 0;
4317
+							foreach ($columns as $column ) {
4318
+								$gd_post[$column] = $row[$c];
4319 4319
                                 
4320
-                                if ( $column == 'post_id' ) {
4321
-                                    $post_id = $row[$c];
4322
-                                } else if ( $column == 'post_title' ) {
4323
-                                    $post_title = sanitize_text_field($row[$c]);
4324
-                                } else if ( $column == 'post_author' ) {
4325
-                                    $post_author = $row[$c];
4326
-                                } else if ( $column == 'post_content' ) {
4327
-                                    $post_content = $row[$c];
4328
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4329
-                                    $post_category_arr = explode( ',', $row[$c] );
4330
-                                } else if ( $column == 'default_category' ) {
4331
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4332
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4333
-                                    $post_tags = explode( ',', $row[$c] );
4334
-                                } else if ( $column == 'post_type' ) {
4335
-                                    $post_type = $row[$c];
4336
-                                } else if ( $column == 'post_status' ) {
4337
-                                    $post_status = sanitize_key( $row[$c] );
4338
-                                } else if ( $column == 'is_featured' ) {
4339
-                                    $is_featured = (int)$row[$c];
4340
-                                } else if ( $column == 'geodir_video' ) {
4341
-                                    $geodir_video = $row[$c];
4342
-                                } else if ( $column == 'post_address' ) {
4343
-                                    $post_address = $row[$c];
4344
-                                } else if ( $column == 'post_city' ) {
4345
-                                    $post_city = $row[$c];
4346
-                                } else if ( $column == 'post_region' ) {
4347
-                                    $post_region = $row[$c];
4348
-                                } else if ( $column == 'post_country' ) {
4349
-                                    $post_country = $row[$c];
4350
-                                } else if ( $column == 'post_zip' ) {
4351
-                                    $post_zip = $row[$c];
4352
-                                } else if ( $column == 'post_latitude' ) {
4353
-                                    $post_latitude = $row[$c];
4354
-                                } else if ( $column == 'post_longitude' ) {
4355
-                                    $post_longitude = $row[$c];
4356
-                                } else if ( $column == 'post_neighbourhood' ) {
4357
-                                    $post_neighbourhood = $row[$c];
4358
-                                    unset($gd_post[$column]);
4359
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4360
-                                    $neighbourhood_latitude = $row[$c];
4361
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4362
-                                    $neighbourhood_longitude = $row[$c];
4363
-                                } else if ( $column == 'geodir_timing' ) {
4364
-                                    $geodir_timing = $row[$c];
4365
-                                } else if ( $column == 'geodir_contact' ) {
4366
-                                    $geodir_contact = $row[$c];
4367
-                                } else if ( $column == 'geodir_email' ) {
4368
-                                    $geodir_email = $row[$c];
4369
-                                } else if ( $column == 'geodir_website' ) {
4370
-                                    $geodir_website = $row[$c];
4371
-                                } else if ( $column == 'geodir_twitter' ) {
4372
-                                    $geodir_twitter = $row[$c];
4373
-                                } else if ( $column == 'geodir_facebook' ) {
4374
-                                    $geodir_facebook = $row[$c];
4375
-                                } else if ( $column == 'geodir_twitter' ) {
4376
-                                    $geodir_twitter = $row[$c];
4377
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4378
-                                    $post_images[] = $row[$c];
4379
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4380
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4381
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4382
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4383
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4384
-                                }
4385
-                                // WPML
4386
-                                if ($is_wpml) {
4387
-                                    if ($column == 'language') {
4388
-                                        $language = geodir_strtolower(trim($row[$c]));
4389
-                                    } else if ($column == 'original_post_id') {
4390
-                                        $original_post_id = (int)$row[$c];
4391
-                                    }
4392
-                                }
4393
-                                // WPML
4394
-                                $c++;
4395
-                            }
4320
+								if ( $column == 'post_id' ) {
4321
+									$post_id = $row[$c];
4322
+								} else if ( $column == 'post_title' ) {
4323
+									$post_title = sanitize_text_field($row[$c]);
4324
+								} else if ( $column == 'post_author' ) {
4325
+									$post_author = $row[$c];
4326
+								} else if ( $column == 'post_content' ) {
4327
+									$post_content = $row[$c];
4328
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4329
+									$post_category_arr = explode( ',', $row[$c] );
4330
+								} else if ( $column == 'default_category' ) {
4331
+									$default_category = wp_kses_normalize_entities($row[$c]);
4332
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4333
+									$post_tags = explode( ',', $row[$c] );
4334
+								} else if ( $column == 'post_type' ) {
4335
+									$post_type = $row[$c];
4336
+								} else if ( $column == 'post_status' ) {
4337
+									$post_status = sanitize_key( $row[$c] );
4338
+								} else if ( $column == 'is_featured' ) {
4339
+									$is_featured = (int)$row[$c];
4340
+								} else if ( $column == 'geodir_video' ) {
4341
+									$geodir_video = $row[$c];
4342
+								} else if ( $column == 'post_address' ) {
4343
+									$post_address = $row[$c];
4344
+								} else if ( $column == 'post_city' ) {
4345
+									$post_city = $row[$c];
4346
+								} else if ( $column == 'post_region' ) {
4347
+									$post_region = $row[$c];
4348
+								} else if ( $column == 'post_country' ) {
4349
+									$post_country = $row[$c];
4350
+								} else if ( $column == 'post_zip' ) {
4351
+									$post_zip = $row[$c];
4352
+								} else if ( $column == 'post_latitude' ) {
4353
+									$post_latitude = $row[$c];
4354
+								} else if ( $column == 'post_longitude' ) {
4355
+									$post_longitude = $row[$c];
4356
+								} else if ( $column == 'post_neighbourhood' ) {
4357
+									$post_neighbourhood = $row[$c];
4358
+									unset($gd_post[$column]);
4359
+								} else if ( $column == 'neighbourhood_latitude' ) {
4360
+									$neighbourhood_latitude = $row[$c];
4361
+								} else if ( $column == 'neighbourhood_longitude' ) {
4362
+									$neighbourhood_longitude = $row[$c];
4363
+								} else if ( $column == 'geodir_timing' ) {
4364
+									$geodir_timing = $row[$c];
4365
+								} else if ( $column == 'geodir_contact' ) {
4366
+									$geodir_contact = $row[$c];
4367
+								} else if ( $column == 'geodir_email' ) {
4368
+									$geodir_email = $row[$c];
4369
+								} else if ( $column == 'geodir_website' ) {
4370
+									$geodir_website = $row[$c];
4371
+								} else if ( $column == 'geodir_twitter' ) {
4372
+									$geodir_twitter = $row[$c];
4373
+								} else if ( $column == 'geodir_facebook' ) {
4374
+									$geodir_facebook = $row[$c];
4375
+								} else if ( $column == 'geodir_twitter' ) {
4376
+									$geodir_twitter = $row[$c];
4377
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4378
+									$post_images[] = $row[$c];
4379
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4380
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4381
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4382
+									$row[$c] = str_replace('/', '-', $row[$c]);
4383
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4384
+								}
4385
+								// WPML
4386
+								if ($is_wpml) {
4387
+									if ($column == 'language') {
4388
+										$language = geodir_strtolower(trim($row[$c]));
4389
+									} else if ($column == 'original_post_id') {
4390
+										$original_post_id = (int)$row[$c];
4391
+									}
4392
+								}
4393
+								// WPML
4394
+								$c++;
4395
+							}
4396 4396
                             
4397
-                            // WPML
4398
-                            if ($is_wpml && $language != '') {
4399
-                                $sitepress->switch_lang($language, true);
4400
-                            }
4401
-                            // WPML
4397
+							// WPML
4398
+							if ($is_wpml && $language != '') {
4399
+								$sitepress->switch_lang($language, true);
4400
+							}
4401
+							// WPML
4402 4402
 
4403
-                            $gd_post['IMAGE'] = $post_images;
4403
+							$gd_post['IMAGE'] = $post_images;
4404 4404
                             
4405
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4406
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4405
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4406
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4407 4407
                                                                                                                 
4408
-                            $valid = true;
4408
+							$valid = true;
4409 4409
                             
4410
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4411
-                                $invalid++;
4412
-                                $valid = false;
4413
-                            }
4410
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4411
+								$invalid++;
4412
+								$valid = false;
4413
+							}
4414 4414
                             
4415
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4416
-                            if ( $location_allowed ) {
4417
-                                $location_result = geodir_get_default_location();
4418
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4419
-                                    $invalid_addr++;
4420
-                                    $valid = false;
4421
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4422
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4423
-                                        $invalid_addr++;
4424
-                                        $valid = false;
4425
-                                    } else {
4426
-                                        if (!$location_manager) {
4427
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4428
-                                        }
4429
-                                    }
4430
-                                }
4431
-                            }
4415
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4416
+							if ( $location_allowed ) {
4417
+								$location_result = geodir_get_default_location();
4418
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4419
+									$invalid_addr++;
4420
+									$valid = false;
4421
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4422
+									if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4423
+										$invalid_addr++;
4424
+										$valid = false;
4425
+									} else {
4426
+										if (!$location_manager) {
4427
+											$gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4428
+										}
4429
+									}
4430
+								}
4431
+							}
4432 4432
                             
4433
-                            if ( !$valid ) {
4434
-                                continue;
4435
-                            }
4433
+							if ( !$valid ) {
4434
+								continue;
4435
+							}
4436 4436
 
4437
-                            $cat_taxonomy = $post_type . 'category';
4438
-                            $tags_taxonomy = $post_type . '_tags';
4437
+							$cat_taxonomy = $post_type . 'category';
4438
+							$tags_taxonomy = $post_type . '_tags';
4439 4439
                             
4440
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4441
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4442
-                            }
4440
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4441
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4442
+							}
4443 4443
 
4444
-                            $post_category = array();
4445
-                            $default_category_id = NULL;
4446
-                            if ( !empty( $post_category_arr ) ) {
4447
-                                foreach ( $post_category_arr as $value ) {
4448
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4444
+							$post_category = array();
4445
+							$default_category_id = NULL;
4446
+							if ( !empty( $post_category_arr ) ) {
4447
+								foreach ( $post_category_arr as $value ) {
4448
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4449 4449
                                     
4450
-                                    if ( $category_name != '' ) {
4451
-                                        $term_category = array();
4450
+									if ( $category_name != '' ) {
4451
+										$term_category = array();
4452 4452
                                         
4453
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4454
-                                            $term_category = $term;
4455
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4456
-                                            $term_category = $term;
4457
-                                        } else {
4458
-                                            $term_data = array();
4459
-                                            $term_data['name'] = $category_name;
4460
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4453
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4454
+											$term_category = $term;
4455
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4456
+											$term_category = $term;
4457
+										} else {
4458
+											$term_data = array();
4459
+											$term_data['name'] = $category_name;
4460
+											$term_data['taxonomy'] = $cat_taxonomy;
4461 4461
                                             
4462
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4463
-                                            if ( $term_id ) {
4464
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4465
-                                            }
4466
-                                        }
4462
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4463
+											if ( $term_id ) {
4464
+												$term_category = get_term( $term_id, $cat_taxonomy );
4465
+											}
4466
+										}
4467 4467
                                         
4468
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4469
-                                            $post_category[] = intval($term_category->term_id);
4468
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4469
+											$post_category[] = intval($term_category->term_id);
4470 4470
                                             
4471
-                                            if ($category_name == $default_category) {
4472
-                                                $default_category_id = intval($term_category->term_id);
4473
-                                            }
4474
-                                        }
4475
-                                    }
4476
-                                }
4477
-                            }
4471
+											if ($category_name == $default_category) {
4472
+												$default_category_id = intval($term_category->term_id);
4473
+											}
4474
+										}
4475
+									}
4476
+								}
4477
+							}
4478 4478
 
4479
-                            $save_post = array();
4480
-                            $save_post['post_title'] = $post_title;
4481
-                            $save_post['post_content'] = $post_content;
4482
-                            $save_post['post_type'] = $post_type;
4483
-                            $save_post['post_author'] = $post_author;
4484
-                            $save_post['post_status'] = $post_status;
4485
-                            $save_post['post_category'] = $post_category;
4486
-                            $save_post['post_tags'] = $post_tags;
4487
-
4488
-                            $saved_post_id = NULL;
4489
-                            if ( $import_choice == 'update' ) {
4490
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4491
-                                    $save_post['ID'] = $post_id;
4479
+							$save_post = array();
4480
+							$save_post['post_title'] = $post_title;
4481
+							$save_post['post_content'] = $post_content;
4482
+							$save_post['post_type'] = $post_type;
4483
+							$save_post['post_author'] = $post_author;
4484
+							$save_post['post_status'] = $post_status;
4485
+							$save_post['post_category'] = $post_category;
4486
+							$save_post['post_tags'] = $post_tags;
4487
+
4488
+							$saved_post_id = NULL;
4489
+							if ( $import_choice == 'update' ) {
4490
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4491
+									$save_post['ID'] = $post_id;
4492 4492
                                     
4493
-                                    if ( wp_update_post( $save_post ) ) {
4494
-                                        $saved_post_id = $post_id;
4495
-                                        $updated++;
4496
-                                    }
4497
-                                } else {
4498
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4499
-                                        $created++;
4500
-                                    }
4501
-                                }
4493
+									if ( wp_update_post( $save_post ) ) {
4494
+										$saved_post_id = $post_id;
4495
+										$updated++;
4496
+									}
4497
+								} else {
4498
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4499
+										$created++;
4500
+									}
4501
+								}
4502 4502
                                 
4503
-                                if ( !$saved_post_id > 0 ) {
4504
-                                    $invalid++;
4505
-                                }
4506
-                            } else if ( $import_choice == 'skip' ) {
4507
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4508
-                                    $skipped++;	
4509
-                                } else {
4510
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4511
-                                        $created++;	
4512
-                                    } else {
4513
-                                        $invalid++;
4514
-                                    }
4515
-                                }
4516
-                            } else {
4517
-                                $invalid++;
4518
-                            }
4503
+								if ( !$saved_post_id > 0 ) {
4504
+									$invalid++;
4505
+								}
4506
+							} else if ( $import_choice == 'skip' ) {
4507
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4508
+									$skipped++;	
4509
+								} else {
4510
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4511
+										$created++;	
4512
+									} else {
4513
+										$invalid++;
4514
+									}
4515
+								}
4516
+							} else {
4517
+								$invalid++;
4518
+							}
4519 4519
 
4520
-                            if ( (int)$saved_post_id > 0 ) {
4521
-                                // WPML
4522
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4523
-                                    $wpml_post_type = 'post_' . $post_type;
4524
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4525
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4520
+							if ( (int)$saved_post_id > 0 ) {
4521
+								// WPML
4522
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4523
+									$wpml_post_type = 'post_' . $post_type;
4524
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4525
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4526 4526
 
4527
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4527
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4528 4528
                                     
4529
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4530
-                                }
4531
-                                // WPML
4532
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4529
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4530
+								}
4531
+								// WPML
4532
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4533 4533
                                 
4534
-                                $gd_post['post_id'] = $saved_post_id;
4535
-                                $gd_post['ID'] = $saved_post_id;
4536
-                                $gd_post['post_tags'] = $post_tags;
4537
-                                $gd_post['post_title'] = $post_title;
4538
-                                $gd_post['post_status'] = $post_status;
4539
-                                $gd_post['submit_time'] = time();
4540
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4534
+								$gd_post['post_id'] = $saved_post_id;
4535
+								$gd_post['ID'] = $saved_post_id;
4536
+								$gd_post['post_tags'] = $post_tags;
4537
+								$gd_post['post_title'] = $post_title;
4538
+								$gd_post['post_status'] = $post_status;
4539
+								$gd_post['submit_time'] = time();
4540
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4541 4541
                                                     
4542
-                                // post location
4543
-                                $post_location_id = 0;
4544
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4545
-                                    $gd_post['post_neighbourhood'] = '';
4542
+								// post location
4543
+								$post_location_id = 0;
4544
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4545
+									$gd_post['post_neighbourhood'] = '';
4546 4546
                                     
4547
-                                    $post_location_info = array(
4548
-                                                                'city' => $post_city,
4549
-                                                                'region' => $post_region,
4550
-                                                                'country' => $post_country,
4551
-                                                                'geo_lat' => $post_latitude,
4552
-                                                                'geo_lng' => $post_longitude
4553
-                                                            );
4554
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4555
-                                        $post_location_id = $location_id;
4556
-                                    }
4547
+									$post_location_info = array(
4548
+																'city' => $post_city,
4549
+																'region' => $post_region,
4550
+																'country' => $post_country,
4551
+																'geo_lat' => $post_latitude,
4552
+																'geo_lng' => $post_longitude
4553
+															);
4554
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4555
+										$post_location_id = $location_id;
4556
+									}
4557 4557
                                     
4558
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4559
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4558
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4559
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4560 4560
 
4561
-                                        $hood_data = array();
4562
-                                        $hood_data['hood_location_id'] = $post_location_id;
4563
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4561
+										$hood_data = array();
4562
+										$hood_data['hood_location_id'] = $post_location_id;
4563
+										$hood_data['hood_name'] = $post_neighbourhood;
4564 4564
                                         
4565
-                                        if (!empty($neighbourhood_info)) {
4566
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4567
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4565
+										if (!empty($neighbourhood_info)) {
4566
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4567
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4568 4568
                                             
4569
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4570
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4571
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4572
-                                            }
4573
-                                        }
4569
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4570
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4571
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4572
+											}
4573
+										}
4574 4574
                                         
4575
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4576
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4577
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4578
-                                        }
4575
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4576
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4577
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4578
+										}
4579 4579
                                         
4580
-                                        $hood_data['hood_latitude'] = $post_latitude;
4581
-                                        $hood_data['hood_longitude'] = $post_longitude;
4580
+										$hood_data['hood_latitude'] = $post_latitude;
4581
+										$hood_data['hood_longitude'] = $post_longitude;
4582 4582
 
4583
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4584
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4585
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4586
-                                        }
4587
-                                    }
4588
-                                }
4589
-                                $gd_post['post_location_id'] = $post_location_id;
4583
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4584
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4585
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4586
+										}
4587
+									}
4588
+								}
4589
+								$gd_post['post_location_id'] = $post_location_id;
4590 4590
                                 
4591
-                                // post package info
4592
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4593
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4594
-                                    $package_id = $gd_post_info->package_id;
4595
-                                }
4591
+								// post package info
4592
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4593
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4594
+									$package_id = $gd_post_info->package_id;
4595
+								}
4596 4596
                                 
4597
-                                $package_info = array();
4598
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4599
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4597
+								$package_info = array();
4598
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4599
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4600 4600
                                     
4601
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4602
-                                        $package_info = array();
4603
-                                    }
4604
-                                }
4601
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4602
+										$package_info = array();
4603
+									}
4604
+								}
4605 4605
                                 
4606
-                                if (empty($package_info)) {
4607
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4608
-                                }
4606
+								if (empty($package_info)) {
4607
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4608
+								}
4609 4609
                                  
4610
-                                if (!empty($package_info))	 {
4611
-                                    $package_id = $package_info['pid'];
4610
+								if (!empty($package_info))	 {
4611
+									$package_id = $package_info['pid'];
4612 4612
                                     
4613
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4614
-                                        $gd_post['expire_date'] = $expire_date;
4615
-                                    } else {
4616
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4617
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4618
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4619
-                                        } else {
4620
-                                            $gd_post['expire_date'] = 'Never';
4621
-                                        }
4622
-                                    }
4613
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4614
+										$gd_post['expire_date'] = $expire_date;
4615
+									} else {
4616
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4617
+											$gd_post['alive_days'] = (int)$package_info['days'];
4618
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4619
+										} else {
4620
+											$gd_post['expire_date'] = 'Never';
4621
+										}
4622
+									}
4623 4623
                                     
4624
-                                    $gd_post['package_id'] = $package_id;
4625
-                                }
4624
+									$gd_post['package_id'] = $package_id;
4625
+								}
4626 4626
 
4627
-                                $table = $plugin_prefix . $post_type . '_detail';
4627
+								$table = $plugin_prefix . $post_type . '_detail';
4628 4628
                                 
4629
-                                if ($post_type == 'gd_event') {
4630
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4631
-                                }
4629
+								if ($post_type == 'gd_event') {
4630
+									$gd_post = geodir_imex_process_event_data($gd_post);
4631
+								}
4632 4632
                                 
4633
-                                if (isset($gd_post['post_id'])) {
4634
-                                    unset($gd_post['post_id']);
4635
-                                }
4633
+								if (isset($gd_post['post_id'])) {
4634
+									unset($gd_post['post_id']);
4635
+								}
4636 4636
 
4637
-                                // Export franchise fields
4638
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4639
-                                if ($is_franchise_active) {
4640
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4641
-                                        $gd_franchise_lock = array();
4637
+								// Export franchise fields
4638
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4639
+								if ($is_franchise_active) {
4640
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4641
+										$gd_franchise_lock = array();
4642 4642
                                         
4643
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4644
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4645
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4646
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4647
-                                        }
4643
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4644
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4645
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4646
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4647
+										}
4648 4648
                                         
4649
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4650
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4651
-                                    } else {
4652
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4653
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4654
-                                        }
4655
-                                    }
4656
-                                }
4649
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4650
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4651
+									} else {
4652
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4653
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4654
+										}
4655
+									}
4656
+								}
4657 4657
                                 
4658
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4659
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4660
-                                    if ($default_category_id) {
4661
-                                        $save_post['post_default_category'] = $default_category_id;
4662
-                                        $gd_post['default_category'] = $default_category_id;
4663
-                                    }
4664
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4665
-                                }
4658
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4659
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4660
+									if ($default_category_id) {
4661
+										$save_post['post_default_category'] = $default_category_id;
4662
+										$gd_post['default_category'] = $default_category_id;
4663
+									}
4664
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4665
+								}
4666 4666
                                 
4667
-                                // Save post info
4668
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4669
-                                // post taxonomies
4670
-                                if ( !empty( $save_post['post_category'] ) ) {
4671
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4667
+								// Save post info
4668
+								geodir_save_post_info( $saved_post_id, $gd_post );
4669
+								// post taxonomies
4670
+								if ( !empty( $save_post['post_category'] ) ) {
4671
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4672 4672
                                     
4673
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4674
-                                    if ($default_category_id) {
4675
-                                        $post_default_category = $default_category_id;
4676
-                                    }
4677
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4678
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4679
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4673
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4674
+									if ($default_category_id) {
4675
+										$post_default_category = $default_category_id;
4676
+									}
4677
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4678
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4679
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4680 4680
                                     
4681
-                                    if ($post_category_str != '' && $post_default_category) {
4682
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4683
-                                    }
4681
+									if ($post_category_str != '' && $post_default_category) {
4682
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4683
+									}
4684 4684
                                     
4685
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4685
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4686 4686
                                     
4687
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4688
-                                }
4687
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4688
+								}
4689 4689
 
4690
-                                if ( !empty( $save_post['post_tags'] ) ) {
4691
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4692
-                                }
4690
+								if ( !empty( $save_post['post_tags'] ) ) {
4691
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4692
+								}
4693 4693
 
4694
-                                // Post images
4695
-                                if ( !empty( $post_images ) ) {
4696
-                                    $post_images = array_unique($post_images);
4694
+								// Post images
4695
+								if ( !empty( $post_images ) ) {
4696
+									$post_images = array_unique($post_images);
4697 4697
                                     
4698
-                                    $old_post_images_arr = array();
4699
-                                    $saved_post_images_arr = array();
4698
+									$old_post_images_arr = array();
4699
+									$saved_post_images_arr = array();
4700 4700
                                     
4701
-                                    $order = 1;
4701
+									$order = 1;
4702 4702
                                     
4703
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4704
-                                    if (!empty($old_post_images)) {
4705
-                                        foreach( $old_post_images as $old_post_image ) {
4706
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4707
-                                                $old_post_images_arr[] = $old_post_image->file;
4708
-                                            }
4709
-                                        }
4710
-                                    }
4703
+									$old_post_images = geodir_get_images( $saved_post_id );
4704
+									if (!empty($old_post_images)) {
4705
+										foreach( $old_post_images as $old_post_image ) {
4706
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4707
+												$old_post_images_arr[] = $old_post_image->file;
4708
+											}
4709
+										}
4710
+									}
4711 4711
                                     
4712
-                                    foreach ( $post_images as $post_image ) {
4713
-                                        $image_name = basename( $post_image );
4714
-                                        $saved_post_images_arr[] = $image_name;
4712
+									foreach ( $post_images as $post_image ) {
4713
+										$image_name = basename( $post_image );
4714
+										$saved_post_images_arr[] = $image_name;
4715 4715
                                         
4716
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4717
-                                            continue; // Skip if image already exists.
4718
-                                        }
4716
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4717
+											continue; // Skip if image already exists.
4718
+										}
4719 4719
                                         
4720
-                                        $image_name_parts = explode( '.', $image_name );
4721
-                                        array_pop( $image_name_parts );
4722
-                                        $proper_image_name = implode( '.', $image_name_parts );
4720
+										$image_name_parts = explode( '.', $image_name );
4721
+										array_pop( $image_name_parts );
4722
+										$proper_image_name = implode( '.', $image_name_parts );
4723 4723
                                         
4724
-                                        $arr_file_type = wp_check_filetype( $image_name );
4724
+										$arr_file_type = wp_check_filetype( $image_name );
4725 4725
                                         
4726
-                                        if ( !empty( $arr_file_type ) ) {
4727
-                                            $uploaded_file_type = $arr_file_type['type'];
4726
+										if ( !empty( $arr_file_type ) ) {
4727
+											$uploaded_file_type = $arr_file_type['type'];
4728 4728
                                             
4729
-                                            $attachment = array();
4730
-                                            $attachment['post_id'] = $saved_post_id;
4731
-                                            $attachment['title'] = $proper_image_name;
4732
-                                            $attachment['content'] = '';
4733
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4734
-                                            $attachment['mime_type'] = $uploaded_file_type;
4735
-                                            $attachment['menu_order'] = $order;
4736
-                                            $attachment['is_featured'] = 0;
4737
-
4738
-                                            $attachment_set = '';
4739
-                                            foreach ( $attachment as $key => $val ) {
4740
-                                                if ( $val != '' ) {
4741
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4742
-                                                }
4743
-                                            }
4744
-                                            $attachment_set = trim( $attachment_set, ", " );
4729
+											$attachment = array();
4730
+											$attachment['post_id'] = $saved_post_id;
4731
+											$attachment['title'] = $proper_image_name;
4732
+											$attachment['content'] = '';
4733
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4734
+											$attachment['mime_type'] = $uploaded_file_type;
4735
+											$attachment['menu_order'] = $order;
4736
+											$attachment['is_featured'] = 0;
4737
+
4738
+											$attachment_set = '';
4739
+											foreach ( $attachment as $key => $val ) {
4740
+												if ( $val != '' ) {
4741
+													$attachment_set .= $key . " = '" . $val . "', ";
4742
+												}
4743
+											}
4744
+											$attachment_set = trim( $attachment_set, ", " );
4745 4745
                                                                                         
4746
-                                            // Add new attachment
4747
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4746
+											// Add new attachment
4747
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4748 4748
                                                                                         
4749
-                                            $order++;
4750
-                                        }
4751
-                                    }
4749
+											$order++;
4750
+										}
4751
+									}
4752 4752
 
4753
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4754
-                                    // Remove previous attachment
4755
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4753
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4754
+									// Remove previous attachment
4755
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4756 4756
                                     
4757
-                                    if ( !empty( $saved_post_images_arr ) ) {
4758
-                                        $menu_order = 1;
4757
+									if ( !empty( $saved_post_images_arr ) ) {
4758
+										$menu_order = 1;
4759 4759
                                         
4760
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4761
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4760
+										foreach ( $saved_post_images_arr as $img_name ) {
4761
+											$wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4762 4762
                                             
4763
-                                            if( $menu_order == 1 ) {
4764
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4765
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4766
-                                                }
4767
-                                            }
4768
-                                            $menu_order++;
4769
-                                        }
4770
-                                    }
4763
+											if( $menu_order == 1 ) {
4764
+												if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4765
+													$wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4766
+												}
4767
+											}
4768
+											$menu_order++;
4769
+										}
4770
+									}
4771 4771
                                     
4772
-                                    if ( $order > 1 ) {
4773
-                                        $images++;
4774
-                                    }
4775
-                                }
4772
+									if ( $order > 1 ) {
4773
+										$images++;
4774
+									}
4775
+								}
4776 4776
 
4777
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4778
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4777
+								/** This action is documented in geodirectory-functions/post-functions.php */
4778
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4779 4779
                                 
4780
-                                if (isset($is_featured)) {
4781
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4782
-                                }
4783
-                                if (isset($gd_post['expire_date'])) {
4784
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4785
-                                }
4786
-                            }
4780
+								if (isset($is_featured)) {
4781
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4782
+								}
4783
+								if (isset($gd_post['expire_date'])) {
4784
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4785
+								}
4786
+							}
4787 4787
                             
4788
-                            // WPML
4789
-                            if ($is_wpml && $language != '') {
4790
-                                $sitepress->switch_lang($active_lang, true);
4791
-                            }
4792
-                            // WPML
4793
-                        }
4794
-                    }
4795
-                }
4788
+							// WPML
4789
+							if ($is_wpml && $language != '') {
4790
+								$sitepress->switch_lang($active_lang, true);
4791
+							}
4792
+							// WPML
4793
+						}
4794
+					}
4795
+				}
4796 4796
 
4797
-                //undo some stuff to make the import quicker
4798
-                wp_defer_term_counting( false );
4799
-                wp_defer_comment_counting( false );
4800
-                $wpdb->query( 'COMMIT;' );
4801
-                $wpdb->query( 'SET autocommit = 1;' );
4802
-
4803
-                $json = array();
4804
-                $json['processed'] = $processed_actual;
4805
-                $json['created'] = $created;
4806
-                $json['updated'] = $updated;
4807
-                $json['skipped'] = $skipped;
4808
-                $json['invalid'] = $invalid;
4809
-                $json['invalid_addr'] = $invalid_addr;
4810
-                $json['images'] = $images;
4797
+				//undo some stuff to make the import quicker
4798
+				wp_defer_term_counting( false );
4799
+				wp_defer_comment_counting( false );
4800
+				$wpdb->query( 'COMMIT;' );
4801
+				$wpdb->query( 'SET autocommit = 1;' );
4802
+
4803
+				$json = array();
4804
+				$json['processed'] = $processed_actual;
4805
+				$json['created'] = $created;
4806
+				$json['updated'] = $updated;
4807
+				$json['skipped'] = $skipped;
4808
+				$json['invalid'] = $invalid;
4809
+				$json['invalid_addr'] = $invalid_addr;
4810
+				$json['images'] = $images;
4811 4811
                 
4812
-                wp_send_json( $json );
4813
-                exit;
4814
-            } else if ( $task == 'import_loc' ) {
4815
-                global $gd_post_types;
4816
-                $gd_post_types = $post_types;
4812
+				wp_send_json( $json );
4813
+				exit;
4814
+			} else if ( $task == 'import_loc' ) {
4815
+				global $gd_post_types;
4816
+				$gd_post_types = $post_types;
4817 4817
                 
4818
-                if (!empty($file)) {
4819
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4818
+				if (!empty($file)) {
4819
+					$columns = isset($file[0]) ? $file[0] : NULL;
4820 4820
                     
4821
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4822
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4823
-                        wp_send_json( $json );
4824
-                    }
4821
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4822
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4823
+						wp_send_json( $json );
4824
+					}
4825 4825
                     
4826
-                    for ($i = 1; $i <= $limit; $i++) {
4827
-                        $index = $processed + $i;
4826
+					for ($i = 1; $i <= $limit; $i++) {
4827
+						$index = $processed + $i;
4828 4828
                         
4829
-                        if (isset($file[$index])) {
4830
-                            $row = $file[$index];
4831
-                            $row = array_map( 'trim', $row );
4832
-                            $data = array();
4829
+						if (isset($file[$index])) {
4830
+							$row = $file[$index];
4831
+							$row = array_map( 'trim', $row );
4832
+							$data = array();
4833 4833
                             
4834
-                            foreach ($columns as $c => $column ) {
4835
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4836
-                                    $data[$column] = $row[$c];
4837
-                                }
4838
-                            }
4834
+							foreach ($columns as $c => $column ) {
4835
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4836
+									$data[$column] = $row[$c];
4837
+								}
4838
+							}
4839 4839
 
4840
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4841
-                                $invalid++;
4842
-                                continue;
4843
-                            }
4840
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4841
+								$invalid++;
4842
+								continue;
4843
+							}
4844 4844
                             
4845
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4845
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4846 4846
                             
4847
-                            if ( $import_choice == 'update' ) {
4848
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4849
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4850
-                                        $updated++;
4851
-                                    } else {
4852
-                                        $invalid++;
4853
-                                    }
4854
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4855
-                                    $data['location_id'] = (int)$location->location_id;
4847
+							if ( $import_choice == 'update' ) {
4848
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4849
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4850
+										$updated++;
4851
+									} else {
4852
+										$invalid++;
4853
+									}
4854
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4855
+									$data['location_id'] = (int)$location->location_id;
4856 4856
                                     
4857
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4858
-                                        $data['location_id'] = (int)$location->location_id;
4859
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4860
-                                        $data['location_id'] = (int)$location->location_id;
4861
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4862
-                                        $data['location_id'] = (int)$location->location_id;
4863
-                                    }
4857
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4858
+										$data['location_id'] = (int)$location->location_id;
4859
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4860
+										$data['location_id'] = (int)$location->location_id;
4861
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4862
+										$data['location_id'] = (int)$location->location_id;
4863
+									}
4864 4864
                                     
4865
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4866
-                                        $updated++;
4867
-                                    } else {
4868
-                                        $invalid++;
4869
-                                    }
4870
-                                } else {
4871
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4872
-                                        $created++;
4873
-                                    } else {
4874
-                                        $invalid++;
4875
-                                    }
4876
-                                }
4877
-                            } elseif ( $import_choice == 'skip' ) {
4878
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4879
-                                    $skipped++;
4880
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4881
-                                    $skipped++;
4882
-                                } else {
4883
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4884
-                                        $created++;
4885
-                                    } else {
4886
-                                        $invalid++;
4887
-                                    }
4888
-                                }
4889
-                            } else {
4890
-                                $invalid++;
4891
-                            }
4892
-                        }
4893
-                    }
4894
-                }
4865
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4866
+										$updated++;
4867
+									} else {
4868
+										$invalid++;
4869
+									}
4870
+								} else {
4871
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4872
+										$created++;
4873
+									} else {
4874
+										$invalid++;
4875
+									}
4876
+								}
4877
+							} elseif ( $import_choice == 'skip' ) {
4878
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4879
+									$skipped++;
4880
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4881
+									$skipped++;
4882
+								} else {
4883
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4884
+										$created++;
4885
+									} else {
4886
+										$invalid++;
4887
+									}
4888
+								}
4889
+							} else {
4890
+								$invalid++;
4891
+							}
4892
+						}
4893
+					}
4894
+				}
4895 4895
                 
4896
-                $json = array();
4897
-                $json['processed'] = $limit;
4898
-                $json['created'] = $created;
4899
-                $json['updated'] = $updated;
4900
-                $json['skipped'] = $skipped;
4901
-                $json['invalid'] = $invalid;
4902
-                $json['images'] = $images;
4896
+				$json = array();
4897
+				$json['processed'] = $limit;
4898
+				$json['created'] = $created;
4899
+				$json['updated'] = $updated;
4900
+				$json['skipped'] = $skipped;
4901
+				$json['invalid'] = $invalid;
4902
+				$json['images'] = $images;
4903 4903
                 
4904
-                wp_send_json( $json );
4905
-            } else if ( $task == 'import_hood' ) {               
4906
-                if (!empty($file)) {
4907
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4904
+				wp_send_json( $json );
4905
+			} else if ( $task == 'import_hood' ) {               
4906
+				if (!empty($file)) {
4907
+					$columns = isset($file[0]) ? $file[0] : NULL;
4908 4908
                     
4909
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4910
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4911
-                        wp_send_json( $json );
4912
-                    }
4909
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4910
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4911
+						wp_send_json( $json );
4912
+					}
4913 4913
                     
4914
-                    for ($i = 1; $i <= $limit; $i++) {
4915
-                        $index = $processed + $i;
4914
+					for ($i = 1; $i <= $limit; $i++) {
4915
+						$index = $processed + $i;
4916 4916
                         
4917
-                        if (isset($file[$index])) {
4918
-                            $row = $file[$index];
4919
-                            $row = array_map( 'trim', $row );
4920
-                            $data = array();
4917
+						if (isset($file[$index])) {
4918
+							$row = $file[$index];
4919
+							$row = array_map( 'trim', $row );
4920
+							$data = array();
4921 4921
                             
4922
-                            foreach ($columns as $c => $column) {
4923
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4924
-                                    $data[$column] = sanitize_text_field($row[$c]);
4925
-                                }
4926
-                            }
4922
+							foreach ($columns as $c => $column) {
4923
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4924
+									$data[$column] = sanitize_text_field($row[$c]);
4925
+								}
4926
+							}
4927 4927
 
4928
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4929
-                                $invalid++;
4930
-                                continue;
4931
-                            }
4928
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4929
+								$invalid++;
4930
+								continue;
4931
+							}
4932 4932
                             
4933
-                            $location_info = array();
4934
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4935
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4936
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4937
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4938
-                            }
4933
+							$location_info = array();
4934
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4935
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4936
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4937
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4938
+							}
4939 4939
 
4940
-                            if (empty($location_info)) {
4941
-                                $invalid++;
4942
-                                continue;
4943
-                            }
4940
+							if (empty($location_info)) {
4941
+								$invalid++;
4942
+								continue;
4943
+							}
4944 4944
                             
4945
-                            $location_id = $location_info->location_id;
4945
+							$location_id = $location_info->location_id;
4946 4946
 
4947
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4947
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4948 4948
                             
4949
-                            $hood_data = array();
4950
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
4951
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
4952
-                            $hood_data['hood_latitude'] = $data['longitude'];
4953
-                            $hood_data['hood_longitude'] = $data['longitude'];
4954
-                            $hood_data['hood_location_id'] = $location_id;
4949
+							$hood_data = array();
4950
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
4951
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
4952
+							$hood_data['hood_latitude'] = $data['longitude'];
4953
+							$hood_data['hood_longitude'] = $data['longitude'];
4954
+							$hood_data['hood_location_id'] = $location_id;
4955 4955
                                     
4956
-                            if ( $import_choice == 'update' ) {
4957
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4958
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4956
+							if ( $import_choice == 'update' ) {
4957
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4958
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4959 4959
                                     
4960
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4961
-                                        $updated++;
4962
-                                    } else {
4963
-                                        $invalid++;
4964
-                                    }
4965
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4966
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4960
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4961
+										$updated++;
4962
+									} else {
4963
+										$invalid++;
4964
+									}
4965
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4966
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4967 4967
                                     
4968
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4969
-                                        $updated++;
4970
-                                    } else {
4971
-                                        $invalid++;
4972
-                                    }
4973
-                                } else {
4974
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4975
-                                        $created++;
4976
-                                    } else {
4977
-                                        $invalid++;
4978
-                                    }
4979
-                                }
4980
-                            } elseif ( $import_choice == 'skip' ) {
4981
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4982
-                                    $skipped++;
4983
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4984
-                                    $skipped++;
4985
-                                } else {
4968
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4969
+										$updated++;
4970
+									} else {
4971
+										$invalid++;
4972
+									}
4973
+								} else {
4974
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4975
+										$created++;
4976
+									} else {
4977
+										$invalid++;
4978
+									}
4979
+								}
4980
+							} elseif ( $import_choice == 'skip' ) {
4981
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4982
+									$skipped++;
4983
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4984
+									$skipped++;
4985
+								} else {
4986 4986
                                     
4987
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4988
-                                        $created++;
4989
-                                    } else {
4990
-                                        $invalid++;
4991
-                                    }
4992
-                                }
4993
-                            } else {
4994
-                                $invalid++;
4995
-                            }
4996
-                        }
4997
-                    }
4998
-                }
4987
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4988
+										$created++;
4989
+									} else {
4990
+										$invalid++;
4991
+									}
4992
+								}
4993
+							} else {
4994
+								$invalid++;
4995
+							}
4996
+						}
4997
+					}
4998
+				}
4999 4999
                 
5000
-                $json = array();
5001
-                $json['processed'] = $limit;
5002
-                $json['created'] = $created;
5003
-                $json['updated'] = $updated;
5004
-                $json['skipped'] = $skipped;
5005
-                $json['invalid'] = $invalid;
5006
-                $json['images'] = $images;
5000
+				$json = array();
5001
+				$json['processed'] = $limit;
5002
+				$json['created'] = $created;
5003
+				$json['updated'] = $updated;
5004
+				$json['skipped'] = $skipped;
5005
+				$json['invalid'] = $invalid;
5006
+				$json['images'] = $images;
5007 5007
                 
5008
-                wp_send_json( $json );
5009
-            }
5010
-        }
5011
-        break;
5012
-        case 'import_finish':{
5013
-            /**
5014
-             * Run an action when an import finishes.
5015
-             *
5016
-             * This action can be used to fire functions after an import ends.
5017
-             *
5018
-             * @since 1.5.3
5019
-             * @package GeoDirectory
5020
-             */
5021
-            do_action('geodir_import_finished');
5022
-        }
5023
-        break;
5008
+				wp_send_json( $json );
5009
+			}
5010
+		}
5011
+		break;
5012
+		case 'import_finish':{
5013
+			/**
5014
+			 * Run an action when an import finishes.
5015
+			 *
5016
+			 * This action can be used to fire functions after an import ends.
5017
+			 *
5018
+			 * @since 1.5.3
5019
+			 * @package GeoDirectory
5020
+			 */
5021
+			do_action('geodir_import_finished');
5022
+		}
5023
+		break;
5024 5024
 
5025
-    }
5026
-    echo '0';
5027
-    wp_die();
5025
+	}
5026
+	echo '0';
5027
+	wp_die();
5028 5028
 }
5029 5029
 
5030 5030
 /**
@@ -5068,12 +5068,12 @@  discard block
 block discarded – undo
5068 5068
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5069 5069
 	}
5070 5070
 	
5071
-    if( !empty( $term ) ) {
5071
+	if( !empty( $term ) ) {
5072 5072
 		$result = wp_insert_term( $term, $taxonomy, $args );
5073
-        if( !is_wp_error( $result ) ) {
5074
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5075
-        }
5076
-    }
5073
+		if( !is_wp_error( $result ) ) {
5074
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5075
+		}
5076
+	}
5077 5077
 	
5078 5078
 	return false;
5079 5079
 }
@@ -5119,16 +5119,16 @@  discard block
 block discarded – undo
5119 5119
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5120 5120
 		
5121 5121
 		if( !is_wp_error( $result ) ) {
5122
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5123
-        }
5122
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5123
+		}
5124 5124
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5125 5125
 		$term_data['term_id'] = $term_info['term_id'];
5126 5126
 		
5127 5127
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5128 5128
 		
5129 5129
 		if( !is_wp_error( $result ) ) {
5130
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5131
-        }
5130
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5131
+		}
5132 5132
 	} else {
5133 5133
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5134 5134
 	}
@@ -5149,37 +5149,37 @@  discard block
 block discarded – undo
5149 5149
  * @return int Posts count.
5150 5150
  */
5151 5151
 function geodir_get_posts_count( $post_type ) {
5152
-    global $wpdb, $plugin_prefix;
5152
+	global $wpdb, $plugin_prefix;
5153 5153
 
5154
-    if ( !post_type_exists( $post_type ) ) {
5155
-        return 0;
5156
-    }
5154
+	if ( !post_type_exists( $post_type ) ) {
5155
+		return 0;
5156
+	}
5157 5157
         
5158
-    $table = $plugin_prefix . $post_type . '_detail';
5158
+	$table = $plugin_prefix . $post_type . '_detail';
5159 5159
 
5160
-    // Skip listing with statuses trash, auto-draft etc...
5161
-    $skip_statuses = geodir_imex_export_skip_statuses();
5162
-    $where_statuses = '';
5163
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5164
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5165
-    }
5160
+	// Skip listing with statuses trash, auto-draft etc...
5161
+	$skip_statuses = geodir_imex_export_skip_statuses();
5162
+	$where_statuses = '';
5163
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5164
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5165
+	}
5166 5166
 
5167
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5167
+	$query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5168 5168
 
5169
-    $posts_count = (int)$wpdb->get_var( $query );
5169
+	$posts_count = (int)$wpdb->get_var( $query );
5170 5170
     
5171
-    /**
5172
-     * Modify returned post counts for the current post type.
5173
-     *
5174
-     * @since 1.4.6
5175
-     * @package GeoDirectory
5176
-     *
5177
-     * @param int $posts_count Post counts.
5178
-     * @param string $post_type Post type.
5179
-     */
5180
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5181
-
5182
-    return $posts_count;
5171
+	/**
5172
+	 * Modify returned post counts for the current post type.
5173
+	 *
5174
+	 * @since 1.4.6
5175
+	 * @package GeoDirectory
5176
+	 *
5177
+	 * @param int $posts_count Post counts.
5178
+	 * @param string $post_type Post type.
5179
+	 */
5180
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5181
+
5182
+	return $posts_count;
5183 5183
 }
5184 5184
 
5185 5185
 /**
@@ -5207,9 +5207,9 @@  discard block
 block discarded – undo
5207 5207
 	
5208 5208
 	if ( !empty( $posts ) ) {
5209 5209
 		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5210
-        $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5211
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5212
-        $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5210
+		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5211
+		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5212
+		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5213 5213
 		
5214 5214
 		$csv_row = array();
5215 5215
 		$csv_row[] = 'post_id';
@@ -5253,11 +5253,11 @@  discard block
 block discarded – undo
5253 5253
 		$csv_row[] = 'post_zip';
5254 5254
 		$csv_row[] = 'post_latitude';
5255 5255
 		$csv_row[] = 'post_longitude';
5256
-        if ($neighbourhood_active) {
5257
-            $csv_row[] = 'post_neighbourhood';
5258
-            $csv_row[] = 'neighbourhood_latitude';
5259
-            $csv_row[] = 'neighbourhood_longitude';
5260
-        }
5256
+		if ($neighbourhood_active) {
5257
+			$csv_row[] = 'post_neighbourhood';
5258
+			$csv_row[] = 'neighbourhood_latitude';
5259
+			$csv_row[] = 'neighbourhood_longitude';
5260
+		}
5261 5261
 		$csv_row[] = 'geodir_timing';
5262 5262
 		$csv_row[] = 'geodir_contact';
5263 5263
 		$csv_row[] = 'geodir_email';
@@ -5292,7 +5292,7 @@  discard block
 block discarded – undo
5292 5292
 		$csv_rows[] = $csv_row;
5293 5293
 
5294 5294
 		$images_count = 5;
5295
-        $xx=0;
5295
+		$xx=0;
5296 5296
 		foreach ( $posts as $post ) {$xx++;
5297 5297
 			$post_id = $post['ID'];
5298 5298
 			
@@ -5435,21 +5435,21 @@  discard block
 block discarded – undo
5435 5435
 			$csv_row[] = $post_info['post_zip']; // post_zip
5436 5436
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5437 5437
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5438
-            if ($neighbourhood_active) {
5439
-                $post_neighbourhood = '';
5440
-                $neighbourhood_latitude = '';
5441
-                $neighbourhood_longitude = '';
5442
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5443
-                    if (!empty($hood_info)) {
5444
-                        $post_neighbourhood = $hood_info->hood_name;
5445
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5446
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5447
-                    }
5448
-                }
5449
-                $csv_row[] = $post_neighbourhood; // post_neighbourhood
5450
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5451
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5452
-            }
5438
+			if ($neighbourhood_active) {
5439
+				$post_neighbourhood = '';
5440
+				$neighbourhood_latitude = '';
5441
+				$neighbourhood_longitude = '';
5442
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5443
+					if (!empty($hood_info)) {
5444
+						$post_neighbourhood = $hood_info->hood_name;
5445
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5446
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5447
+					}
5448
+				}
5449
+				$csv_row[] = $post_neighbourhood; // post_neighbourhood
5450
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5451
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5452
+			}
5453 5453
 			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
5454 5454
 			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
5455 5455
 			$csv_row[] = $post_info['geodir_email']; // geodir_email
@@ -5520,55 +5520,55 @@  discard block
 block discarded – undo
5520 5520
  * @return array Array of posts data.
5521 5521
  */
5522 5522
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5523
-    global $wpdb, $plugin_prefix;
5523
+	global $wpdb, $plugin_prefix;
5524 5524
 
5525
-    if ( ! post_type_exists( $post_type ) )
5526
-        return new stdClass;
5525
+	if ( ! post_type_exists( $post_type ) )
5526
+		return new stdClass;
5527 5527
         
5528
-    $table = $plugin_prefix . $post_type . '_detail';
5528
+	$table = $plugin_prefix . $post_type . '_detail';
5529 5529
 
5530
-    $limit = '';
5531
-    if ( $per_page > 0 && $page_no > 0 ) {
5532
-        $offset = ( $page_no - 1 ) * $per_page;
5530
+	$limit = '';
5531
+	if ( $per_page > 0 && $page_no > 0 ) {
5532
+		$offset = ( $page_no - 1 ) * $per_page;
5533 5533
         
5534
-        if ( $offset > 0 ) {
5535
-            $limit = " LIMIT " . $offset . "," . $per_page;
5536
-        } else {
5537
-            $limit = " LIMIT " . $per_page;
5538
-        }
5539
-    }
5534
+		if ( $offset > 0 ) {
5535
+			$limit = " LIMIT " . $offset . "," . $per_page;
5536
+		} else {
5537
+			$limit = " LIMIT " . $per_page;
5538
+		}
5539
+	}
5540 5540
 
5541
-    // Skip listing with statuses trash, auto-draft etc...
5542
-    $skip_statuses = geodir_imex_export_skip_statuses();
5543
-    $where_statuses = '';
5544
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5545
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5546
-    }
5541
+	// Skip listing with statuses trash, auto-draft etc...
5542
+	$skip_statuses = geodir_imex_export_skip_statuses();
5543
+	$where_statuses = '';
5544
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5545
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5546
+	}
5547
+
5548
+	$query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
5549
+	/**
5550
+	 * Modify returned posts SQL query for the current post type.
5551
+	 *
5552
+	 * @since 1.4.6
5553
+	 * @package GeoDirectory
5554
+	 *
5555
+	 * @param int $query The SQL query.
5556
+	 * @param string $post_type Post type.
5557
+	 */
5558
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5559
+
5560
+	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5547 5561
 
5548
-    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
5549
-    /**
5550
-     * Modify returned posts SQL query for the current post type.
5551
-     *
5552
-     * @since 1.4.6
5553
-     * @package GeoDirectory
5554
-     *
5555
-     * @param int $query The SQL query.
5556
-     * @param string $post_type Post type.
5557
-     */
5558
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5559
-
5560
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5561
-
5562
-    /**
5563
-     * Modify returned post results for the current post type.
5564
-     *
5565
-     * @since 1.4.6
5566
-     * @package GeoDirectory
5567
-     *
5568
-     * @param object $results An object containing all post ids.
5569
-     * @param string $post_type Post type.
5570
-     */
5571
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5562
+	/**
5563
+	 * Modify returned post results for the current post type.
5564
+	 *
5565
+	 * @since 1.4.6
5566
+	 * @package GeoDirectory
5567
+	 *
5568
+	 * @param object $results An object containing all post ids.
5569
+	 * @param string $post_type Post type.
5570
+	 */
5571
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5572 5572
 }
5573 5573
 
5574 5574
 /**
@@ -5586,23 +5586,23 @@  discard block
 block discarded – undo
5586 5586
  * @return string The SQL query.
5587 5587
  */
5588 5588
 function geodir_imex_get_events_query( $query, $post_type ) {
5589
-    if ( $post_type == 'gd_event' ) {
5590
-        global $wpdb, $plugin_prefix;
5589
+	if ( $post_type == 'gd_event' ) {
5590
+		global $wpdb, $plugin_prefix;
5591 5591
         
5592
-        $table = $plugin_prefix . $post_type . '_detail';
5593
-        $schedule_table = EVENT_SCHEDULE;
5592
+		$table = $plugin_prefix . $post_type . '_detail';
5593
+		$schedule_table = EVENT_SCHEDULE;
5594 5594
         
5595
-        // Skip listing with statuses trash, auto-draft etc...
5596
-        $skip_statuses = geodir_imex_export_skip_statuses();
5597
-        $where_statuses = '';
5598
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5599
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5600
-        }
5595
+		// Skip listing with statuses trash, auto-draft etc...
5596
+		$skip_statuses = geodir_imex_export_skip_statuses();
5597
+		$where_statuses = '';
5598
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5599
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5600
+		}
5601 5601
 
5602
-        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5603
-    }
5602
+		$query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
5603
+	}
5604 5604
 
5605
-    return $query;
5605
+	return $query;
5606 5606
 }
5607 5607
 
5608 5608
 /**
@@ -6294,43 +6294,43 @@  discard block
 block discarded – undo
6294 6294
  * @param string $status Post status.
6295 6295
  */
6296 6296
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6297
-    global $wpdb, $current_user;
6298
-
6299
-    $option_value = get_option($option);
6300
-
6301
-    if ($option_value > 0) :
6302
-        if (get_post($option_value)) :
6303
-            // Page exists
6304
-            return;
6305
-        endif;
6306
-    endif;
6307
-
6308
-    $page_found = $wpdb->get_var(
6309
-        $wpdb->prepare(
6310
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6311
-            array($slug)
6312
-        )
6313
-    );
6314
-
6315
-    if ($page_found) :
6316
-        // Page exists
6317
-        if (!$option_value) update_option($option, $page_found);
6318
-        return;
6319
-    endif;
6320
-
6321
-    $page_data = array(
6322
-        'post_status' => $status,
6323
-        'post_type' => 'page',
6324
-        'post_author' => $current_user->ID,
6325
-        'post_name' => $slug,
6326
-        'post_title' => $page_title,
6327
-        'post_content' => $page_content,
6328
-        'post_parent' => $post_parent,
6329
-        'comment_status' => 'closed'
6330
-    );
6331
-    $page_id = wp_insert_post($page_data);
6332
-
6333
-    add_option($option, $page_id);
6297
+	global $wpdb, $current_user;
6298
+
6299
+	$option_value = get_option($option);
6300
+
6301
+	if ($option_value > 0) :
6302
+		if (get_post($option_value)) :
6303
+			// Page exists
6304
+			return;
6305
+		endif;
6306
+	endif;
6307
+
6308
+	$page_found = $wpdb->get_var(
6309
+		$wpdb->prepare(
6310
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6311
+			array($slug)
6312
+		)
6313
+	);
6314
+
6315
+	if ($page_found) :
6316
+		// Page exists
6317
+		if (!$option_value) update_option($option, $page_found);
6318
+		return;
6319
+	endif;
6320
+
6321
+	$page_data = array(
6322
+		'post_status' => $status,
6323
+		'post_type' => 'page',
6324
+		'post_author' => $current_user->ID,
6325
+		'post_name' => $slug,
6326
+		'post_title' => $page_title,
6327
+		'post_content' => $page_content,
6328
+		'post_parent' => $post_parent,
6329
+		'comment_status' => 'closed'
6330
+	);
6331
+	$page_id = wp_insert_post($page_data);
6332
+
6333
+	add_option($option, $page_id);
6334 6334
 
6335 6335
 }
6336 6336
 
@@ -6361,9 +6361,9 @@  discard block
 block discarded – undo
6361 6361
  * @package GeoDirectory
6362 6362
  */
6363 6363
 function geodir_admin_upgrade_notice() {
6364
-    $class = "error";
6365
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6366
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6364
+	$class = "error";
6365
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6366
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6367 6367
 }
6368 6368
 
6369 6369
 /**
@@ -6376,18 +6376,18 @@  discard block
 block discarded – undo
6376 6376
  */
6377 6377
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6378 6378
 {
6379
-    // readme contents
6380
-    $args = array(
6381
-        'timeout'     => 15,
6382
-        'redirection' => 5
6383
-    );
6384
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6385
-    $data       = wp_remote_get( $url, $args );
6379
+	// readme contents
6380
+	$args = array(
6381
+		'timeout'     => 15,
6382
+		'redirection' => 5
6383
+	);
6384
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6385
+	$data       = wp_remote_get( $url, $args );
6386 6386
 
6387
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6387
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6388 6388
 
6389
-        geodir_in_plugin_update_message($data['body']);
6390
-    }
6389
+		geodir_in_plugin_update_message($data['body']);
6390
+	}
6391 6391
 }
6392 6392
 
6393 6393
 
@@ -6395,28 +6395,28 @@  discard block
 block discarded – undo
6395 6395
 * @param string $content http response body
6396 6396
 */
6397 6397
 function geodir_in_plugin_update_message($content) {
6398
-    // Output Upgrade Notice
6399
-    $matches        = null;
6400
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6401
-    $upgrade_notice = '';
6402
-    if ( preg_match( $regexp, $content, $matches ) ) {
6403
-        if(empty($matches)){return;}
6404
-
6405
-        $version = trim( $matches[1] );
6406
-        if($version && $version>GEODIRECTORY_VERSION){
6407
-
6408
-
6409
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6410
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6411
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6412
-            foreach ( $notices as $index => $line ) {
6413
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6414
-            }
6415
-            $upgrade_notice .= '</div> ';
6416
-        }
6417
-        }
6418
-    }
6419
-    echo $upgrade_notice;
6398
+	// Output Upgrade Notice
6399
+	$matches        = null;
6400
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6401
+	$upgrade_notice = '';
6402
+	if ( preg_match( $regexp, $content, $matches ) ) {
6403
+		if(empty($matches)){return;}
6404
+
6405
+		$version = trim( $matches[1] );
6406
+		if($version && $version>GEODIRECTORY_VERSION){
6407
+
6408
+
6409
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6410
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6411
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6412
+			foreach ( $notices as $index => $line ) {
6413
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6414
+			}
6415
+			$upgrade_notice .= '</div> ';
6416
+		}
6417
+		}
6418
+	}
6419
+	echo $upgrade_notice;
6420 6420
 }
6421 6421
 
6422 6422
 /**
@@ -6449,19 +6449,19 @@  discard block
 block discarded – undo
6449 6449
  * @param array Listing statuses to be skipped.
6450 6450
  */
6451 6451
 function geodir_imex_export_skip_statuses() {
6452
-    $statuses = array( 'trash', 'auto-draft' );
6452
+	$statuses = array( 'trash', 'auto-draft' );
6453 6453
     
6454
-    /**
6455
-     * Filter the statuses to skip during GD export listings.
6456
-     *
6457
-     * @since 1.6.0
6458
-     * @package GeoDirectory
6459
-     *
6460
-     * @param array $statuses Listing statuses to be skipped.
6461
-     */
6462
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6454
+	/**
6455
+	 * Filter the statuses to skip during GD export listings.
6456
+	 *
6457
+	 * @since 1.6.0
6458
+	 * @package GeoDirectory
6459
+	 *
6460
+	 * @param array $statuses Listing statuses to be skipped.
6461
+	 */
6462
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6463 6463
      
6464
-    return $statuses;
6464
+	return $statuses;
6465 6465
 }
6466 6466
 
6467 6467
 /*
Please login to merge, or discard this patch.
Spacing   +673 added lines, -673 removed lines patch added patch discarded remove patch
@@ -470,15 +470,15 @@  discard block
 block discarded – undo
470 470
                 <?php
471 471
 
472 472
                     $default_location = geodir_get_default_location();
473
-                  $city =  isset($default_location->city) ? $default_location->city : '';
474
-                  $region =isset($default_location->region) ? $default_location->region : '';
475
-                  $country =isset($default_location->country) ? $default_location->country : '';
476
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
473
+                  $city = isset($default_location->city) ? $default_location->city : '';
474
+                  $region = isset($default_location->region) ? $default_location->region : '';
475
+                  $country = isset($default_location->country) ? $default_location->country : '';
476
+                  $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
+                  $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478 478
 
479 479
                 ?>
480 480
                 var geocoder = new google.maps.Geocoder();
481
-                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
481
+                var CITY_ADDRESS = '<?php echo $city . ',' . $region . ',' . $country; ?>';
482 482
                 var bound_lat_lng;
483 483
                 var lat = <?php echo $city_latitude; ?>;
484 484
                 var lng = <?php echo $city_longitude; ?>;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                             );
516 516
 
517 517
                         } else {
518
-                            alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
518
+                            alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
519 519
                         }
520 520
                     });
521 521
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
529 529
 
530 530
                     if (id == 'geodir_dummy_delete') {
531
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
531
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
532 532
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
533 533
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
534 534
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce,
548 548
                             function (data) {
549 549
 
550
-                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + '');
550
+                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + '');
551 551
                                 dummy_post_index++;
552 552
                                 if (dummy_post_index <= total_dummy_post_count)
553 553
                                     geodir_autoinstall(obj, id, nonce, posttype);
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
658 658
 
659 659
                     $catname = str_replace(' ', '_', $catname);
660
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
660
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
661 661
 
662 662
                     if (empty($uploaded['error'])) {
663 663
                         $new_path = $uploaded['file'];
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
702 702
 
703 703
                 $catname = str_replace(' ', '_', $catname);
704
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
704
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
705 705
 
706 706
                 if (empty($uploaded['error'])) {
707 707
                     $new_path = $uploaded['file'];
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  */
1010 1010
 function geodir_extend_geodirectory_setting_tab($tabs)
1011 1011
 {
1012
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1012
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory') . ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1013 1013
     return $tabs;
1014 1014
 }
1015 1015
 
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 function geodir_post_information_save($post_id, $post) {
1163 1163
     global $wpdb, $current_user;
1164 1164
 
1165
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1165
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
1166 1166
         return;
1167 1167
     }
1168 1168
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1303 1303
                                            id="<?php echo esc_attr($value['id']); ?>"
1304 1304
                                            type="<?php echo esc_attr($value['type']); ?>"
1305
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1305
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1306 1306
                                            style=" <?php echo esc_attr($value['css']); ?>"
1307 1307
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1308 1308
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1320 1320
                                            id="<?php echo esc_attr($value['id']); ?>"
1321 1321
                                            type="<?php echo esc_attr($value['type']); ?>"
1322
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1322
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1323 1323
                                            style="<?php echo esc_attr($value['css']); ?>"
1324 1324
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1325 1325
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
                                             id="<?php echo esc_attr($value['id']); ?>"
1426 1426
                                             style="<?php echo esc_attr($value['css']); ?>"
1427 1427
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1428
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1428
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1429 1429
                                             option-ajaxchosen="false">
1430 1430
                         <?php
1431 1431
                         foreach ($value['options'] as $key => $val) {
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                             } else {
1437 1437
                                 ?>
1438 1438
                                 <option
1439
-                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1439
+                                    value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>><?php echo ucfirst($val) ?></option>
1440 1440
                             <?php
1441 1441
                             }
1442 1442
                         }
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
                 ?>
1472 1472
 
1473 1473
                 <tr valign="top">
1474
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1474
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1475 1475
                     <td width="60%">
1476 1476
                         <select name="geodir_default_map_language" style="width:60%">
1477 1477
                             <?php
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
                 <tr valign="top">
1555 1555
                     <th class="titledesc"
1556
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1556
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1557 1557
                     <td width="60%">
1558 1558
                         <select name="geodir_default_map_search_pt" style="width:60%">
1559 1559
                             <?php
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
                         $cat_display = 'checkbox';
1595 1595
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1596 1596
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1597
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1597
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1598 1598
                         $count = 1;
1599 1599
                         ?>
1600 1600
                         <table width="70%" class="widefat">
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
                                                                                            name="home_map_post_types[]"
1624 1624
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1625 1625
                                                                                            value="<?php echo $key; ?>"
1626
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1626
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1627 1627
                                         <?php echo $post_types_obj->labels->singular_name; ?></td>
1628 1628
                                     <td width="40%">
1629 1629
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1681,12 +1681,12 @@  discard block
 block discarded – undo
1681 1681
                 ?>
1682 1682
                 <fieldset>
1683 1683
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1684
-                    <label for="<?php echo $value['id'];?>">
1684
+                    <label for="<?php echo $value['id']; ?>">
1685 1685
                         <input name="<?php echo esc_attr($value['id']); ?>"
1686 1686
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1687 1687
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1688 1688
                             echo 'checked="checked"';
1689
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1689
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1690 1690
                         <?php echo $value['desc']; ?></label><br>
1691 1691
                 </fieldset>
1692 1692
                 <?php
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
                     <textarea
1709 1709
                         <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1710 1710
                         id="<?php echo esc_attr($value['id']); ?>"
1711
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1711
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1712 1712
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1713 1713
                         class="description"><?php echo $value['desc'] ?></span>
1714 1714
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 					}
1754 1754
 				}
1755 1755
 				//
1756
-				$page_setting = (int)get_option($value['id']);
1756
+				$page_setting = (int) get_option($value['id']);
1757 1757
 
1758 1758
                 $args = array('name' => $value['id'],
1759 1759
                     'id' => $value['id'],
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 				}
1780 1780
                 break;
1781 1781
             case 'single_select_country' :
1782
-                $country_setting = (string)get_option($value['id']);
1782
+                $country_setting = (string) get_option($value['id']);
1783 1783
                 if (strstr($country_setting, ':')) :
1784 1784
                     $country = current(explode(':', $country_setting));
1785 1785
                     $state = end(explode(':', $country_setting));
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
             case 'multi_select_countries' :
1803 1803
                 $countries = $geodirectory->countries->countries;
1804 1804
                 asort($countries);
1805
-                $selections = (array)get_option($value['id']);
1805
+                $selections = (array) get_option($value['id']);
1806 1806
                 ?>
1807 1807
                 <tr valign="top">
1808 1808
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1824,8 +1824,8 @@  discard block
 block discarded – undo
1824 1824
                 break;
1825 1825
 
1826 1826
             case 'google_analytics' :
1827
-                $selections = (array)get_option($value['id']);
1828
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1827
+                $selections = (array) get_option($value['id']);
1828
+                if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
1829 1829
                     ?>
1830 1830
                     <tr valign="top">
1831 1831
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1836,10 +1836,10 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1838 1838
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1839
-                            $state = "&state=123";//any string
1839
+                            $state = "&state=123"; //any string
1840 1840
                             $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1841 1841
                             $response_type = "&response_type=code";
1842
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1842
+                            $client_id = "&client_id=" . get_option('geodir_ga_client_id');
1843 1843
                             $access_type = "&access_type=offline";
1844 1844
                             $approval_prompt = "&approval_prompt=force";
1845 1845
 
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
                             ?>
1850 1850
                             <script>
1851 1851
                                 function gd_ga_popup() {
1852
-                                    var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
1852
+                                    var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
1853 1853
                                     var pollTimer = window.setInterval(function () {
1854 1854
                                         if (win.closed !== false) { // !== is required for compatibility with Opera
1855 1855
                                             window.clearInterval(pollTimer);
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
                             } else {
1872 1872
                                 ?>
1873 1873
                                 <span class="button-primary"
1874
-                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1874
+                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
1875 1875
                             <?php
1876 1876
                             }
1877 1877
                             ?>
@@ -1942,9 +1942,9 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1944 1944
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1945
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1945
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1946 1946
             jQuery('.gd-content-heading').hide();
1947
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1947
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1948 1948
             <?php } ?>
1949 1949
         });
1950 1950
     </script>
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
         <div
2087 2087
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2088 2088
             id="<?php echo $id; ?>plupload-upload-ui">
2089
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
2089
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
2090 2090
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2091 2091
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
2092 2092
             <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2102 2102
         </div>
2103 2103
         <span
2104
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2104
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2105 2105
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2106 2106
     </div>
2107 2107
 
@@ -2479,11 +2479,11 @@  discard block
 block discarded – undo
2479 2479
 function geodir_hide_admin_preview_button() {
2480 2480
     global $post_type;
2481 2481
     $post_types = geodir_get_posttypes();
2482
-    if(in_array($post_type, $post_types))
2482
+    if (in_array($post_type, $post_types))
2483 2483
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2484 2484
 }
2485
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2486
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2485
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2486
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2487 2487
 
2488 2488
 /**
2489 2489
  * Add the tab in left sidebar menu fro import & export page.
@@ -2493,8 +2493,8 @@  discard block
 block discarded – undo
2493 2493
  *
2494 2494
  * @return array Array of tab data.
2495 2495
  */
2496
-function geodir_import_export_tab( $tabs ) {
2497
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2496
+function geodir_import_export_tab($tabs) {
2497
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2498 2498
     return $tabs;
2499 2499
 }
2500 2500
 
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
  * @return string Html content.
2509 2509
  */
2510 2510
 function geodir_import_export_page() {
2511
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2511
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2512 2512
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2513 2513
     /**
2514 2514
      * Filter sample category data csv file url.
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
      *
2519 2519
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2520 2520
      */
2521
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2521
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2522 2522
 	
2523 2523
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2524 2524
     /**
@@ -2529,15 +2529,15 @@  discard block
 block discarded – undo
2529 2529
      *
2530 2530
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2531 2531
      */
2532
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2532
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2533 2533
 	
2534
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2534
+	$gd_posttypes = geodir_get_posttypes('array');
2535 2535
 	
2536 2536
 	$gd_posttypes_option = '';
2537
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2538
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2537
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2538
+		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int) geodir_get_terms_count($gd_posttype) . '" data-posts="' . (int) geodir_get_posts_count($gd_posttype) . '">' . __($row['labels']['name'], 'geodirectory') . '</option>';
2539 2539
 	}
2540
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2540
+	wp_enqueue_script('jquery-ui-progressbar');
2541 2541
 	
2542 2542
 	$gd_chunksize_options = array();
2543 2543
 	$gd_chunksize_options[100] = 100;
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
      *
2560 2560
      * @param string $gd_chunksize_options Entries options.
2561 2561
      */
2562
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2562
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2563 2563
 	
2564 2564
 	$gd_chunksize_option = '';
2565 2565
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2570,38 +2570,38 @@  discard block
 block discarded – undo
2570 2570
 ?>
2571 2571
 </form>
2572 2572
 <div class="inner_content_tab_main gd-import-export">
2573
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2574
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2573
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2574
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2575 2575
   <div class="gd-content-heading">
2576 2576
 
2577 2577
   <?php
2578 2578
     ini_set('max_execution_time', 999999);
2579
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2579
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2580 2580
     ini_restore('max_execution_time');
2581 2581
 
2582
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2582
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2583 2583
         ?>
2584 2584
 	<div id="gd_ie_reqs" class="metabox-holder">
2585 2585
       <div class="meta-box-sortables ui-sortable">
2586 2586
         <div class="postbox">
2587
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2587
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2588 2588
           <div class="inside">
2589
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
2589
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
2590 2590
 			<table class="form-table">
2591 2591
 				<thead>
2592 2592
 				  <tr>
2593
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2593
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2594 2594
 				  </tr>
2595 2595
 				</thead>
2596 2596
 				<tbody>
2597 2597
 				  <tr>
2598
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2598
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2599 2599
 				  </tr>
2600 2600
 				  <tr>
2601
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2601
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2602 2602
 				  </tr>
2603 2603
 				  <tr>
2604
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2604
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2605 2605
 				  </tr>
2606 2606
 				</tbody>
2607 2607
 		    </table>
@@ -2613,21 +2613,21 @@  discard block
 block discarded – undo
2613 2613
 	<div id="gd_ie_imposts" class="metabox-holder">
2614 2614
       <div class="meta-box-sortables ui-sortable">
2615 2615
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2616
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2617
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2616
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2617
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2618 2618
           <div class="inside">
2619 2619
             <table class="form-table">
2620 2620
 				<tbody>
2621 2621
 				  <tr>
2622 2622
 					<td class="gd-imex-box">
2623 2623
 						<div class="gd-im-choices">
2624
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2625
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2624
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2625
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2626 2626
 						</div>
2627 2627
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2628 2628
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
2629
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2630
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2629
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2630
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2631 2631
 							<?php
2632 2632
 							/**
2633 2633
 							 * Called just after the sample CSV download link.
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
 							 */
2637 2637
 							do_action('geodir_sample_csv_download_link');
2638 2638
 							?>
2639
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2639
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2640 2640
 							<div class="filelist"></div>
2641 2641
 						</div>
2642 2642
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2654,7 +2654,7 @@  discard block
 block discarded – undo
2654 2654
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2655 2655
 						</div>
2656 2656
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2657
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2657
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2658 2658
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2659 2659
 									id="gd-import-perc">0%</font> )
2660 2660
 								<div class="gd-fileprogress"></div>
@@ -2666,10 +2666,10 @@  discard block
 block discarded – undo
2666 2666
                     	<div class="gd-imex-btns" style="display:none;">
2667 2667
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2668 2668
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2669
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2670
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2669
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2670
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2671 2671
 							<div id="gd_process_data" style="display:none">
2672
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2672
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2673 2673
 							</div>
2674 2674
 						</div>
2675 2675
 					</td>
@@ -2683,26 +2683,26 @@  discard block
 block discarded – undo
2683 2683
 	<div id="gd_ie_excategs" class="metabox-holder">
2684 2684
 	  <div class="meta-box-sortables ui-sortable">
2685 2685
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2686
-		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2687
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2686
+		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2687
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2688 2688
 		  <div class="inside">
2689 2689
 			<table class="form-table">
2690 2690
 			  <tbody>
2691 2691
 				<tr>
2692 2692
 				  <td class="fld"><label for="gd_post_type">
2693
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2693
+					<?php _e('Post Type:', 'geodirectory'); ?>
2694 2694
 					</label></td>
2695 2695
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2696
-					  <?php echo $gd_posttypes_option;?>
2696
+					  <?php echo $gd_posttypes_option; ?>
2697 2697
 					</select></td>
2698 2698
 				</tr>
2699 2699
 				<tr>
2700
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2701
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2700
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2701
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2702 2702
 				  </tr>
2703 2703
 				<tr>
2704 2704
 				  <td class="fld" style="vertical-align:top"><label>
2705
-					<?php _e( 'Progress:', 'geodirectory' );?>
2705
+					<?php _e('Progress:', 'geodirectory'); ?>
2706 2706
 					</label></td>
2707 2707
 				  <td><div id='gd_progressbar_box'>
2708 2708
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2710,13 +2710,13 @@  discard block
 block discarded – undo
2710 2710
 					  </div>
2711 2711
 					</div>
2712 2712
 					<p style="display:inline-block">
2713
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2713
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2714 2714
 					</p>
2715 2715
 					  
2716 2716
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2717 2717
 				</tr>
2718 2718
 				<tr class="gd-ie-actions">
2719
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2719
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2720 2720
 				  </td>
2721 2721
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2722 2722
 				</tr>
@@ -2729,21 +2729,21 @@  discard block
 block discarded – undo
2729 2729
 	<div id="gd_ie_imcategs" class="metabox-holder">
2730 2730
       <div class="meta-box-sortables ui-sortable">
2731 2731
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2732
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2733
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2732
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2733
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2734 2734
           <div class="inside">
2735 2735
             <table class="form-table">
2736 2736
 				<tbody>
2737 2737
 				  <tr>
2738 2738
 					<td class="gd-imex-box">
2739 2739
 						<div class="gd-im-choices">
2740
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2741
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2740
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2741
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2742 2742
 						</div>
2743 2743
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2744 2744
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
2745
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2746
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2745
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2746
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2747 2747
 						<?php
2748 2748
 						/**
2749 2749
 						 * Called just after the sample CSV download link.
@@ -2753,7 +2753,7 @@  discard block
 block discarded – undo
2753 2753
 						 */
2754 2754
 						do_action('geodir_sample_cats_csv_download_link');
2755 2755
 						?>
2756
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2756
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2757 2757
 							<div class="filelist"></div>
2758 2758
 						</div>
2759 2759
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2770,7 +2770,7 @@  discard block
 block discarded – undo
2770 2770
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2771 2771
 						</div>
2772 2772
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2773
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2773
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2774 2774
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2775 2775
 									id="gd-import-perc">0%</font> )
2776 2776
 								<div class="gd-fileprogress"></div>
@@ -2782,10 +2782,10 @@  discard block
 block discarded – undo
2782 2782
                     	<div class="gd-imex-btns" style="display:none;">
2783 2783
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2784 2784
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2785
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2786
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2785
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2786
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2787 2787
 							<div id="gd_process_data" style="display:none">
2788
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2788
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2789 2789
 							</div>
2790 2790
 						</div>
2791 2791
 					</td>
@@ -2799,26 +2799,26 @@  discard block
 block discarded – undo
2799 2799
 	<div id="gd_ie_excategs" class="metabox-holder">
2800 2800
       <div class="meta-box-sortables ui-sortable">
2801 2801
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2802
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2803
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2802
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2803
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2804 2804
           <div class="inside">
2805 2805
             <table class="form-table">
2806 2806
 				<tbody>
2807 2807
 				  <tr>
2808
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2809
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2808
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2809
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2810 2810
 				  </tr>
2811 2811
 				   <tr>
2812
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2813
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2812
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2813
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2814 2814
 				  </tr>
2815 2815
 				  <tr>
2816
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2817
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2816
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2817
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2818 2818
 				  </tr>
2819 2819
 				  <tr class="gd-ie-actions">
2820 2820
 					<td style="vertical-align:top">
2821
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2821
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2822 2822
 					</td>
2823 2823
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2824 2824
 				  </tr>
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
      * @param array $gd_chunksize_options File chunk size options.
2841 2841
      * @param string $nonce Wordpress security token for GD import & export.
2842 2842
 	 */
2843
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2843
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2844 2844
 	?>
2845 2845
   </div>
2846 2846
 </div>
@@ -2859,7 +2859,7 @@  discard block
 block discarded – undo
2859 2859
         jQuery.ajax({
2860 2860
             url: ajaxurl,
2861 2861
             type: "POST",
2862
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2862
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2863 2863
             dataType: 'json',
2864 2864
             cache: false,
2865 2865
             success: function(data) {
@@ -2911,7 +2911,7 @@  discard block
 block discarded – undo
2911 2911
 
2912 2912
         jQuery(cont).find('.filelist .file').remove();
2913 2913
         
2914
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2914
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2915 2915
         jQuery('#gd-import-msg', cont).show();
2916 2916
         
2917 2917
         return false;
@@ -2970,7 +2970,7 @@  discard block
 block discarded – undo
2970 2970
     jQuery.ajax({
2971 2971
         url: ajaxurl,
2972 2972
         type: "POST",
2973
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2973
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2974 2974
         dataType : 'json',
2975 2975
         cache: false,
2976 2976
         success: function (data) {
@@ -3159,27 +3159,27 @@  discard block
 block discarded – undo
3159 3159
 
3160 3160
     var gdMsg = '<p></p>';
3161 3161
     if ( processed > 0 ) {
3162
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
3162
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
3163 3163
         msgParse = msgParse.replace("%s", processed);
3164 3164
         gdMsg += msgParse;
3165 3165
     }
3166 3166
 
3167 3167
     if ( updated > 0 ) {
3168
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3168
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
3169 3169
         msgParse = msgParse.replace("%s", updated);
3170 3170
         msgParse = msgParse.replace("%d", processed);
3171 3171
         gdMsg += msgParse;
3172 3172
     }
3173 3173
 
3174 3174
     if ( created > 0 ) {
3175
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3175
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
3176 3176
         msgParse = msgParse.replace("%s", created);
3177 3177
         msgParse = msgParse.replace("%d", processed);
3178 3178
         gdMsg += msgParse;
3179 3179
     }
3180 3180
 
3181 3181
     if ( skipped > 0 ) {
3182
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3182
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
3183 3183
         msgParse = msgParse.replace("%s", skipped);
3184 3184
         msgParse = msgParse.replace("%d", processed);
3185 3185
         gdMsg += msgParse;
@@ -3189,17 +3189,17 @@  discard block
 block discarded – undo
3189 3189
         if (type=='loc') {
3190 3190
             invalid_addr = invalid;
3191 3191
         }
3192
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
3192
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
3193 3193
         msgParse = msgParse.replace("%s", invalid_addr);
3194 3194
         msgParse = msgParse.replace("%d", total);
3195 3195
         gdMsg += msgParse;
3196 3196
     }
3197 3197
 
3198 3198
     if (invalid > 0 && type!='loc') {
3199
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory' ), '%s', '%d' ) );?></p>';
3199
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory'), '%s', '%d')); ?></p>';
3200 3200
         
3201 3201
         if (type=='hood') {
3202
-            msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>';
3202
+            msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
3203 3203
         }
3204 3204
         msgParse = msgParse.replace("%s", invalid);
3205 3205
         msgParse = msgParse.replace("%d", total);
@@ -3207,7 +3207,7 @@  discard block
 block discarded – undo
3207 3207
     }
3208 3208
 
3209 3209
     if (images > 0) {
3210
-        gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
3210
+        gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
3211 3211
     }
3212 3212
     gdMsg += '<p></p>';
3213 3213
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3364,7 +3364,7 @@  discard block
 block discarded – undo
3364 3364
         
3365 3365
     function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
3366 3366
         if (page < 2) {
3367
-            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3367
+            gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3368 3368
             jQuery(el).find('#gd_timer').text('00:00:01');
3369 3369
             jQuery('#gd_ie_ex_files', el).html('');
3370 3370
         }
@@ -3372,7 +3372,7 @@  discard block
 block discarded – undo
3372 3372
         jQuery.ajax({
3373 3373
             url: ajaxurl,
3374 3374
             type: "POST",
3375
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3375
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3376 3376
             dataType : 'json',
3377 3377
             cache: false,
3378 3378
             beforeSend: function (jqXHR, settings) {},
@@ -3386,11 +3386,11 @@  discard block
 block discarded – undo
3386 3386
                     } else {
3387 3387
                         if (pages < page || pages == page) {
3388 3388
                             window.clearInterval(timer_posts);
3389
-                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3389
+                            gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3390 3390
                         } else {
3391 3391
                             var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3392 3392
                             percentage = percentage > 100 ? 100 : percentage;
3393
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3393
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3394 3394
                         }
3395 3395
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3396 3396
                             var obj_files = data.files;
@@ -3420,7 +3420,7 @@  discard block
 block discarded – undo
3420 3420
 
3421 3421
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3422 3422
         if (page < 2) {
3423
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3423
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3424 3424
             jQuery(el).find('#gd_timer').text('00:00:01');
3425 3425
             jQuery('#gd_ie_ex_files', el).html('');
3426 3426
         }
@@ -3428,7 +3428,7 @@  discard block
 block discarded – undo
3428 3428
         jQuery.ajax({
3429 3429
             url: ajaxurl,
3430 3430
             type: "POST",
3431
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3431
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3432 3432
             dataType : 'json',
3433 3433
             cache: false,
3434 3434
             beforeSend: function (jqXHR, settings) {},
@@ -3442,11 +3442,11 @@  discard block
 block discarded – undo
3442 3442
                     } else {
3443 3443
                         if (pages < page || pages == page) {
3444 3444
                             window.clearInterval(timer_cats);
3445
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3445
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3446 3446
                         } else {
3447 3447
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3448 3448
                             percentage = percentage > 100 ? 100 : percentage;
3449
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3449
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3450 3450
                         }
3451 3451
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3452 3452
                             var obj_files = data.files;
@@ -3503,8 +3503,8 @@  discard block
 block discarded – undo
3503 3503
 function geodir_init_filesystem()
3504 3504
 {
3505 3505
 
3506
-    if(!function_exists('get_filesystem_method')){
3507
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3506
+    if (!function_exists('get_filesystem_method')) {
3507
+        require_once(ABSPATH . "/wp-admin/includes/file.php");
3508 3508
     }
3509 3509
     $access_type = get_filesystem_method();
3510 3510
     if ($access_type === 'direct') {
@@ -3557,7 +3557,7 @@  discard block
 block discarded – undo
3557 3557
  * @package GeoDirectory
3558 3558
  */
3559 3559
 function geodir_filesystem_notice()
3560
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3560
+{   if (defined('DOING_AJAX')) {return; }
3561 3561
     $access_type = get_filesystem_method();
3562 3562
     if ($access_type === 'direct') {
3563 3563
     } elseif (!defined('FTP_USER')) {
@@ -3594,64 +3594,64 @@  discard block
 block discarded – undo
3594 3594
     // try to set higher limits for import
3595 3595
     $max_input_time = ini_get('max_input_time');
3596 3596
     $max_execution_time = ini_get('max_execution_time');
3597
-    $memory_limit= ini_get('memory_limit');
3597
+    $memory_limit = ini_get('memory_limit');
3598 3598
 
3599
-    if(!$max_input_time || $max_input_time<3000){
3599
+    if (!$max_input_time || $max_input_time < 3000) {
3600 3600
         ini_set('max_input_time', 3000);
3601 3601
     }
3602 3602
 
3603
-    if(!$max_execution_time || $max_execution_time<3000){
3603
+    if (!$max_execution_time || $max_execution_time < 3000) {
3604 3604
         ini_set('max_execution_time', 3000);
3605 3605
     }
3606 3606
 
3607
-    if($memory_limit && str_replace('M','',$memory_limit)){
3608
-        if(str_replace('M','',$memory_limit)<256){
3607
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3608
+        if (str_replace('M', '', $memory_limit) < 256) {
3609 3609
             ini_set('memory_limit', '256M');
3610 3610
         }
3611 3611
     }
3612 3612
 
3613 3613
     $json = array();
3614 3614
 
3615
-    if ( !current_user_can( 'manage_options' ) ) {
3616
-        wp_send_json( $json );
3615
+    if (!current_user_can('manage_options')) {
3616
+        wp_send_json($json);
3617 3617
     }
3618 3618
 
3619
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3620
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3621
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3619
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3620
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3621
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3622 3622
 
3623
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3624
-        wp_send_json( $json );
3623
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3624
+        wp_send_json($json);
3625 3625
     }
3626 3626
 
3627
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3628
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3627
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3628
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3629 3629
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3630
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3630
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3631 3631
 
3632 3632
     $wp_filesystem = geodir_init_filesystem();
3633 3633
     if (!$wp_filesystem) {
3634
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3635
-        wp_send_json( $json );
3634
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3635
+        wp_send_json($json);
3636 3636
     }
3637 3637
 
3638 3638
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3639
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3640
-        wp_send_json( $json );
3639
+        $json['error'] = __('Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory');
3640
+        wp_send_json($json);
3641 3641
     }
3642 3642
 
3643
-    $csv_file_dir = geodir_path_import_export( false );
3644
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3645
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3646
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3647
-            wp_send_json( $json );
3643
+    $csv_file_dir = geodir_path_import_export(false);
3644
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3645
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3646
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3647
+            wp_send_json($json);
3648 3648
         }
3649 3649
     }
3650 3650
     
3651 3651
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3652 3652
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3653 3653
 
3654
-    switch ( $task ) {
3654
+    switch ($task) {
3655 3655
         case 'export_posts': {
3656 3656
             // WPML
3657 3657
             $is_wpml = geodir_is_wpml();
@@ -3662,11 +3662,11 @@  discard block
 block discarded – undo
3662 3662
                 $sitepress->switch_lang('all', true);
3663 3663
             }
3664 3664
             // WPML
3665
-            if ( $post_type == 'gd_event' ) {
3666
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3665
+            if ($post_type == 'gd_event') {
3666
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3667 3667
             }
3668
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3669
-            $posts_count = geodir_get_posts_count( $post_type );
3668
+            $file_name = $post_type . '_' . date('dmyHi');
3669
+            $posts_count = geodir_get_posts_count($post_type);
3670 3670
             $file_url_base = geodir_path_import_export() . '/';
3671 3671
             $file_url = $file_url_base . $file_name . '.csv';
3672 3672
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -3674,10 +3674,10 @@  discard block
 block discarded – undo
3674 3674
             
3675 3675
             $chunk_file_paths = array();
3676 3676
 
3677
-            if ( isset( $_REQUEST['_st'] ) ) {
3678
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3679
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3680
-                $percentage = min( $percentage, 100 );
3677
+            if (isset($_REQUEST['_st'])) {
3678
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3679
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3680
+                $percentage = min($percentage, 100);
3681 3681
                 
3682 3682
                 $json['percentage'] = $percentage;
3683 3683
                 // WPML
@@ -3685,45 +3685,45 @@  discard block
 block discarded – undo
3685 3685
                     $sitepress->switch_lang($active_lang, true);
3686 3686
                 }
3687 3687
                 // WPML
3688
-                wp_send_json( $json );
3688
+                wp_send_json($json);
3689 3689
                 exit;
3690 3690
             } else {
3691
-                if ( !$posts_count > 0 ) {
3692
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3691
+                if (!$posts_count > 0) {
3692
+                    $json['error'] = __('No records to export.', 'geodirectory');
3693 3693
                 } else {
3694 3694
                     $total_posts = $posts_count;
3695 3695
                     if ($chunk_per_page > $total_posts) {
3696 3696
                         $chunk_per_page = $total_posts;
3697 3697
                     }
3698
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3698
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3699 3699
                     
3700 3700
                     $j = $chunk_page_no;
3701
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3701
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3702 3702
                     
3703 3703
                     $per_page = 500;
3704 3704
                     if ($per_page > $chunk_per_page) {
3705 3705
                         $per_page = $chunk_per_page;
3706 3706
                     }
3707
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3707
+                    $total_pages = ceil($chunk_per_page / $per_page);
3708 3708
                     
3709
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3710
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3709
+                    for ($i = 0; $i <= $total_pages; $i++) {
3710
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3711 3711
                         
3712 3712
                         $clear = $i == 0 ? true : false;
3713
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3713
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3714 3714
                     }
3715 3715
                         
3716
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3716
+                    if ($wp_filesystem->exists($file_path_temp)) {
3717 3717
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3718 3718
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3719 3719
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3720
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3720
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3721 3721
                         
3722 3722
                         $file_url = $file_url_base . $chunk_file_name;
3723 3723
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3724 3724
                     }
3725 3725
                     
3726
-                    if ( !empty($chunk_file_paths) ) {
3726
+                    if (!empty($chunk_file_paths)) {
3727 3727
                         $json['total'] = $posts_count;
3728 3728
                         $json['files'] = $chunk_file_paths;
3729 3729
                     } else {
@@ -3731,7 +3731,7 @@  discard block
 block discarded – undo
3731 3731
                             $json['total'] = $posts_count;
3732 3732
                             $json['files'] = array();
3733 3733
                         } else {
3734
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3734
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3735 3735
                         }
3736 3736
                     }
3737 3737
                 }
@@ -3740,7 +3740,7 @@  discard block
 block discarded – undo
3740 3740
                     $sitepress->switch_lang($active_lang, true);
3741 3741
                 }
3742 3742
                 // WPML
3743
-                wp_send_json( $json );
3743
+                wp_send_json($json);
3744 3744
             }
3745 3745
         }
3746 3746
         break;
@@ -3754,9 +3754,9 @@  discard block
 block discarded – undo
3754 3754
                 $sitepress->switch_lang('all', true);
3755 3755
             }
3756 3756
             // WPML
3757
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3757
+            $file_name = $post_type . 'category_' . date('dmyHi');
3758 3758
             
3759
-            $terms_count = geodir_get_terms_count( $post_type );
3759
+            $terms_count = geodir_get_terms_count($post_type);
3760 3760
             $file_url_base = geodir_path_import_export() . '/';
3761 3761
             $file_url = $file_url_base . $file_name . '.csv';
3762 3762
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -3764,10 +3764,10 @@  discard block
 block discarded – undo
3764 3764
             
3765 3765
             $chunk_file_paths = array();
3766 3766
             
3767
-            if ( isset( $_REQUEST['_st'] ) ) {
3768
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3769
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3770
-                $percentage = min( $percentage, 100 );
3767
+            if (isset($_REQUEST['_st'])) {
3768
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3769
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3770
+                $percentage = min($percentage, 100);
3771 3771
                 
3772 3772
                 $json['percentage'] = $percentage;
3773 3773
                 // WPML
@@ -3775,48 +3775,48 @@  discard block
 block discarded – undo
3775 3775
                     $sitepress->switch_lang($active_lang, true);
3776 3776
                 }
3777 3777
                 // WPML
3778
-                wp_send_json( $json );
3778
+                wp_send_json($json);
3779 3779
             } else {
3780
-                if ( !$terms_count > 0 ) {
3781
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3780
+                if (!$terms_count > 0) {
3781
+                    $json['error'] = __('No records to export.', 'geodirectory');
3782 3782
                 } else {
3783 3783
                     $total_terms = $terms_count;
3784 3784
                     if ($chunk_per_page > $terms_count) {
3785 3785
                         $chunk_per_page = $terms_count;
3786 3786
                     }
3787
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3787
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3788 3788
                     
3789 3789
                     $j = $chunk_page_no;
3790
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3790
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3791 3791
                     
3792 3792
                     $per_page = 500;
3793 3793
                     if ($per_page > $chunk_per_page) {
3794 3794
                         $per_page = $chunk_per_page;
3795 3795
                     }
3796
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3796
+                    $total_pages = ceil($chunk_per_page / $per_page);
3797 3797
                     
3798
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3799
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3798
+                    for ($i = 0; $i <= $total_pages; $i++) {
3799
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3800 3800
                         
3801 3801
                         $clear = $i == 0 ? true : false;
3802
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3802
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3803 3803
                     }
3804 3804
                     
3805
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3805
+                    if ($wp_filesystem->exists($file_path_temp)) {
3806 3806
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3807 3807
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3808 3808
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3809
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3809
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3810 3810
                         
3811 3811
                         $file_url = $file_url_base . $chunk_file_name;
3812 3812
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3813 3813
                     }
3814 3814
                     
3815
-                    if ( !empty($chunk_file_paths) ) {
3815
+                    if (!empty($chunk_file_paths)) {
3816 3816
                         $json['total'] = $terms_count;
3817 3817
                         $json['files'] = $chunk_file_paths;
3818 3818
                     } else {
3819
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3819
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3820 3820
                     }
3821 3821
                 }
3822 3822
                 // WPML
@@ -3824,127 +3824,127 @@  discard block
 block discarded – undo
3824 3824
                     $sitepress->switch_lang($active_lang, true);
3825 3825
                 }
3826 3826
                 // WPML
3827
-                wp_send_json( $json );
3827
+                wp_send_json($json);
3828 3828
             }
3829 3829
         }
3830 3830
         break;
3831 3831
         case 'export_locations': {
3832 3832
             $file_url_base = geodir_path_import_export() . '/';
3833
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3833
+            $file_name = 'gd_locations_' . date('dmyHi');
3834 3834
             $file_url = $file_url_base . $file_name . '.csv';
3835 3835
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3836 3836
             $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3837 3837
             
3838
-            $items_count = (int)geodir_location_imex_count_locations();
3838
+            $items_count = (int) geodir_location_imex_count_locations();
3839 3839
             
3840
-            if ( isset( $_REQUEST['_st'] ) ) {
3841
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3842
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3843
-                $percentage = min( $percentage, 100 );
3840
+            if (isset($_REQUEST['_st'])) {
3841
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3842
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3843
+                $percentage = min($percentage, 100);
3844 3844
                 
3845 3845
                 $json['percentage'] = $percentage;
3846
-                wp_send_json( $json );
3846
+                wp_send_json($json);
3847 3847
             } else {
3848 3848
                 $chunk_file_paths = array();
3849 3849
                 
3850
-                if ( !$items_count > 0 ) {
3851
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3850
+                if (!$items_count > 0) {
3851
+                    $json['error'] = __('No records to export.', 'geodirectory');
3852 3852
                 } else {
3853
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3854
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3853
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3854
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3855 3855
                     
3856 3856
                     $j = $chunk_page_no;
3857
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3857
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3858 3858
                     
3859 3859
                     $per_page = 500;
3860
-                    $per_page = min( $per_page, $chunk_per_page );
3861
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3860
+                    $per_page = min($per_page, $chunk_per_page);
3861
+                    $total_pages = ceil($chunk_per_page / $per_page);
3862 3862
                     
3863
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3864
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3863
+                    for ($i = 0; $i <= $total_pages; $i++) {
3864
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3865 3865
                         
3866 3866
                         $clear = $i == 0 ? true : false;
3867
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3867
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3868 3868
                     }
3869 3869
                     
3870
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3870
+                    if ($wp_filesystem->exists($file_path_temp)) {
3871 3871
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3872 3872
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3873 3873
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3874
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3874
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3875 3875
                         
3876 3876
                         $file_url = $file_url_base . $chunk_file_name;
3877 3877
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3878 3878
                     }
3879 3879
                     
3880
-                    if ( !empty($chunk_file_paths) ) {
3880
+                    if (!empty($chunk_file_paths)) {
3881 3881
                         $json['total'] = $items_count;
3882 3882
                         $json['files'] = $chunk_file_paths;
3883 3883
                     } else {
3884
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3884
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3885 3885
                     }
3886 3886
                 }
3887
-                wp_send_json( $json );
3887
+                wp_send_json($json);
3888 3888
             }
3889 3889
         }
3890 3890
         break;
3891 3891
         case 'export_hoods': {
3892 3892
             $file_url_base = geodir_path_import_export() . '/';
3893
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3893
+            $file_name = 'gd_neighbourhoods_' . date('dmyHi');
3894 3894
             $file_url = $file_url_base . $file_name . '.csv';
3895 3895
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3896 3896
             $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3897 3897
             
3898
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3898
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3899 3899
             
3900
-            if ( isset( $_REQUEST['_st'] ) ) {
3901
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3902
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3903
-                $percentage = min( $percentage, 100 );
3900
+            if (isset($_REQUEST['_st'])) {
3901
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3902
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3903
+                $percentage = min($percentage, 100);
3904 3904
                 
3905 3905
                 $json['percentage'] = $percentage;
3906
-                wp_send_json( $json );
3906
+                wp_send_json($json);
3907 3907
             } else {
3908 3908
                 $chunk_file_paths = array();
3909 3909
                 
3910
-                if ( !$items_count > 0 ) {
3911
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3910
+                if (!$items_count > 0) {
3911
+                    $json['error'] = __('No records to export.', 'geodirectory');
3912 3912
                 } else {
3913
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3914
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3913
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3914
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3915 3915
                     
3916 3916
                     $j = $chunk_page_no;
3917
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3917
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3918 3918
                     
3919 3919
                     $per_page = 500;
3920
-                    $per_page = min( $per_page, $chunk_per_page );
3921
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3920
+                    $per_page = min($per_page, $chunk_per_page);
3921
+                    $total_pages = ceil($chunk_per_page / $per_page);
3922 3922
                     
3923
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3924
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3923
+                    for ($i = 0; $i <= $total_pages; $i++) {
3924
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3925 3925
                         
3926 3926
                         $clear = $i == 0 ? true : false;
3927
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3927
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3928 3928
                     }
3929 3929
                     
3930
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3930
+                    if ($wp_filesystem->exists($file_path_temp)) {
3931 3931
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3932 3932
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3933 3933
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
3934
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3934
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3935 3935
                         
3936 3936
                         $file_url = $file_url_base . $chunk_file_name;
3937 3937
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3938 3938
                     }
3939 3939
                     
3940
-                    if ( !empty($chunk_file_paths) ) {
3940
+                    if (!empty($chunk_file_paths)) {
3941 3941
                         $json['total'] = $items_count;
3942 3942
                         $json['files'] = $chunk_file_paths;
3943 3943
                     } else {
3944
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3944
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3945 3945
                     }
3946 3946
                 }
3947
-                wp_send_json( $json );
3947
+                wp_send_json($json);
3948 3948
             }
3949 3949
         }
3950 3950
         break;
@@ -3961,33 +3961,33 @@  discard block
 block discarded – undo
3961 3961
             }
3962 3962
             // WPML
3963 3963
             
3964
-            ini_set( 'auto_detect_line_endings', true );
3964
+            ini_set('auto_detect_line_endings', true);
3965 3965
             
3966 3966
             $uploads = wp_upload_dir();
3967 3967
             $uploads_dir = $uploads['path'];
3968 3968
             $uploads_subdir = $uploads['subdir'];
3969 3969
             
3970
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3971
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3970
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3971
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3972 3972
             
3973
-            $csv_file_arr = explode( '/', $csv_file );
3974
-            $csv_filename = end( $csv_file_arr );
3973
+            $csv_file_arr = explode('/', $csv_file);
3974
+            $csv_filename = end($csv_file_arr);
3975 3975
             $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3976 3976
             
3977 3977
             $json['file'] = $csv_file;
3978
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3978
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3979 3979
             $file = array();
3980 3980
 
3981
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3982
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3981
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3982
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
3983 3983
                 
3984 3984
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3985 3985
                     $json['error'] = NULL;
3986 3986
                     $json['rows'] = 0;
3987 3987
                     
3988
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3989
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3990
-                            if ( !empty( $data ) ) {
3988
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
3989
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
3990
+                            if (!empty($data)) {
3991 3991
                                 $file[] = $data;
3992 3992
                             }
3993 3993
                         }
@@ -4000,19 +4000,19 @@  discard block
 block discarded – undo
4000 4000
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
4001 4001
                     }
4002 4002
                 } else {
4003
-                    wp_send_json( $json );
4003
+                    wp_send_json($json);
4004 4004
                 }
4005 4005
             } else {
4006
-                wp_send_json( $json );
4006
+                wp_send_json($json);
4007 4007
             }
4008 4008
             
4009
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4010
-                wp_send_json( $json );
4009
+            if ($task == 'prepare_import' || !empty($json['error'])) {
4010
+                wp_send_json($json);
4011 4011
             }
4012 4012
             
4013 4013
             $total = $json['rows'];
4014
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4015
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4014
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
4015
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
4016 4016
             
4017 4017
             $count = $limit;
4018 4018
             
@@ -4037,13 +4037,13 @@  discard block
 block discarded – undo
4037 4037
             
4038 4038
             $post_types = geodir_get_posttypes();
4039 4039
 
4040
-            if ( $task == 'import_cat' ) {
4040
+            if ($task == 'import_cat') {
4041 4041
                 if (!empty($file)) {
4042 4042
                     $columns = isset($file[0]) ? $file[0] : NULL;
4043 4043
                     
4044 4044
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4045 4045
                         $json['error'] = CSV_INVAILD_FILE;
4046
-                        wp_send_json( $json );
4046
+                        wp_send_json($json);
4047 4047
                         exit;
4048 4048
                     }
4049 4049
                     
@@ -4052,7 +4052,7 @@  discard block
 block discarded – undo
4052 4052
                         
4053 4053
                         if (isset($file[$index])) {
4054 4054
                             $row = $file[$index];
4055
-                            $row = array_map( 'trim', $row );
4055
+                            $row = array_map('trim', $row);
4056 4056
                             //$row = array_map( 'utf8_encode', $row );
4057 4057
                             
4058 4058
                             $cat_id = '';
@@ -4068,26 +4068,26 @@  discard block
 block discarded – undo
4068 4068
                             $cat_language = '';
4069 4069
                             
4070 4070
                             $c = 0;
4071
-                            foreach ($columns as $column ) {
4072
-                                if ( $column == 'cat_id' ) {
4073
-                                    $cat_id = (int)$row[$c];
4074
-                                } else if ( $column == 'cat_name' ) {
4071
+                            foreach ($columns as $column) {
4072
+                                if ($column == 'cat_id') {
4073
+                                    $cat_id = (int) $row[$c];
4074
+                                } else if ($column == 'cat_name') {
4075 4075
                                     $cat_name = $row[$c];
4076
-                                } else if ( $column == 'cat_slug' ) {
4076
+                                } else if ($column == 'cat_slug') {
4077 4077
                                     $cat_slug = $row[$c];
4078
-                                } else if ( $column == 'cat_posttype' ) {
4078
+                                } else if ($column == 'cat_posttype') {
4079 4079
                                     $cat_posttype = $row[$c];
4080
-                                } else if ( $column == 'cat_parent' ) {
4080
+                                } else if ($column == 'cat_parent') {
4081 4081
                                     $cat_parent = trim($row[$c]);
4082
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4082
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
4083 4083
                                     $cat_schema = $row[$c];
4084
-                                } else if ( $column == 'cat_description' ) {
4084
+                                } else if ($column == 'cat_description') {
4085 4085
                                     $cat_description = $row[$c];
4086
-                                } else if ( $column == 'cat_top_description' ) {
4086
+                                } else if ($column == 'cat_top_description') {
4087 4087
                                     $cat_top_description = $row[$c];
4088
-                                } else if ( $column == 'cat_image' ) {
4088
+                                } else if ($column == 'cat_image') {
4089 4089
                                     $cat_image = $row[$c];
4090
-                                } else if ( $column == 'cat_icon' ) {
4090
+                                } else if ($column == 'cat_icon') {
4091 4091
                                     $cat_icon = $row[$c];
4092 4092
                                 }
4093 4093
                                 // WPML
@@ -4098,7 +4098,7 @@  discard block
 block discarded – undo
4098 4098
                                 $c++;
4099 4099
                             }
4100 4100
                             
4101
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4101
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
4102 4102
                                 $invalid++;
4103 4103
                                 continue;
4104 4104
                             }
@@ -4115,8 +4115,8 @@  discard block
 block discarded – undo
4115 4115
                             $term_data['description'] = $cat_description;
4116 4116
                             $term_data['cat_schema'] = $cat_schema;
4117 4117
                             $term_data['top_description'] = $cat_top_description;
4118
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4119
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4118
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
4119
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
4120 4120
                             
4121 4121
                             //$term_data = array_map( 'utf8_encode', $term_data );
4122 4122
                             
@@ -4125,14 +4125,14 @@  discard block
 block discarded – undo
4125 4125
                             $term_data['taxonomy'] = $taxonomy;
4126 4126
 
4127 4127
                             $term_parent_id = 0;
4128
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4128
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
4129 4129
                                 $term_parent = '';
4130 4130
                                 
4131
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4131
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
4132 4132
                                     //
4133
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4133
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
4134 4134
                                     //
4135
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4135
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
4136 4136
                                     //
4137 4137
                                 } else {
4138 4138
                                     $term_parent_data = array();
@@ -4140,47 +4140,47 @@  discard block
 block discarded – undo
4140 4140
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
4141 4141
                                     $term_parent_data['taxonomy'] = $taxonomy;
4142 4142
                                     
4143
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4143
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
4144 4144
                                 }
4145 4145
                                 
4146
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4147
-                                    $term_parent_id = (int)$term_parent->term_id;
4146
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
4147
+                                    $term_parent_id = (int) $term_parent->term_id;
4148 4148
                                 }
4149 4149
                             }
4150
-                            $term_data['parent'] = (int)$term_parent_id;
4150
+                            $term_data['parent'] = (int) $term_parent_id;
4151 4151
 
4152 4152
                             $term_id = NULL;
4153
-                            if ( $import_choice == 'update' ) {
4154
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4153
+                            if ($import_choice == 'update') {
4154
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4155 4155
                                     $term_data['term_id'] = $term['term_id'];
4156 4156
                                     
4157
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4157
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4158 4158
                                         $updated++;
4159 4159
                                     } else {
4160 4160
                                         $invalid++;
4161 4161
                                     }
4162
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4162
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4163 4163
                                     $term_data['term_id'] = $term['term_id'];
4164 4164
                                     
4165
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4165
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
4166 4166
                                         $updated++;
4167 4167
                                     } else {
4168 4168
                                         $invalid++;
4169 4169
                                     }
4170 4170
                                 } else {
4171
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4171
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
4172 4172
                                         $created++;
4173 4173
                                     } else {
4174 4174
                                         $invalid++;
4175 4175
                                     }
4176 4176
                                 }
4177
-                            } else if ( $import_choice == 'skip' ) {
4178
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4177
+                            } else if ($import_choice == 'skip') {
4178
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
4179 4179
                                     $skipped++;
4180
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4180
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
4181 4181
                                     $skipped++;
4182 4182
                                 } else {
4183
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4183
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {										
4184 4184
                                         $created++;
4185 4185
                                     } else {
4186 4186
                                         $invalid++;
@@ -4190,37 +4190,37 @@  discard block
 block discarded – undo
4190 4190
                                 $invalid++;
4191 4191
                             }
4192 4192
                             
4193
-                            if ( $term_id ) {
4194
-                                if ( isset( $term_data['top_description'] ) ) {
4195
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4193
+                            if ($term_id) {
4194
+                                if (isset($term_data['top_description'])) {
4195
+                                    update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
4196 4196
                                 }
4197 4197
                                 
4198
-                                if ( isset( $term_data['cat_schema'] ) ) {
4199
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4198
+                                if (isset($term_data['cat_schema'])) {
4199
+                                    update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
4200 4200
                                 }
4201 4201
             
4202 4202
                                 $attachment = false;
4203
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4204
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4205
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4203
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
4204
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
4205
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
4206 4206
                                     
4207
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4207
+                                    if (basename($cat_image) != $term_data['image']) {
4208 4208
                                         $attachment = true;
4209
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4209
+                                        update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image']), $cat_posttype);
4210 4210
                                     }
4211 4211
                                 }
4212 4212
                                 
4213
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4214
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4215
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4213
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4214
+                                    $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4215
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4216 4216
                                         
4217
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4217
+                                    if (basename($cat_icon) != $term_data['icon']) {
4218 4218
                                         $attachment = true;
4219
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4219
+                                        update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon']), $cat_posttype);
4220 4220
                                     }
4221 4221
                                 }
4222 4222
                                 
4223
-                                if ( $attachment ) {
4223
+                                if ($attachment) {
4224 4224
                                     $images++;
4225 4225
                                 }
4226 4226
                             }
@@ -4242,14 +4242,14 @@  discard block
 block discarded – undo
4242 4242
                 $json['invalid'] = $invalid;
4243 4243
                 $json['images'] = $images;
4244 4244
                 
4245
-                wp_send_json( $json );
4245
+                wp_send_json($json);
4246 4246
                 exit;
4247
-            } else if ( $task == 'import_post' ) {
4247
+            } else if ($task == 'import_post') {
4248 4248
 
4249 4249
                 //run some stuff to make the import quicker
4250
-                wp_defer_term_counting( true );
4251
-                wp_defer_comment_counting( true );
4252
-                $wpdb->query( 'SET autocommit = 0;' );
4250
+                wp_defer_term_counting(true);
4251
+                wp_defer_comment_counting(true);
4252
+                $wpdb->query('SET autocommit = 0;');
4253 4253
 
4254 4254
                 //remove_all_actions('publish_post');
4255 4255
                 //remove_all_actions('transition_post_status');
@@ -4258,26 +4258,26 @@  discard block
 block discarded – undo
4258 4258
                 if (!empty($file)) {
4259 4259
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4260 4260
                     $default_status = 'publish';
4261
-                    $current_date = date_i18n( 'Y-m-d', time() );
4261
+                    $current_date = date_i18n('Y-m-d', time());
4262 4262
                     
4263 4263
                     $columns = isset($file[0]) ? $file[0] : NULL;
4264 4264
                     
4265 4265
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4266 4266
                         $json['error'] = CSV_INVAILD_FILE;
4267
-                        wp_send_json( $json );
4267
+                        wp_send_json($json);
4268 4268
                         exit;
4269 4269
                     }
4270 4270
 
4271
-                    $processed_actual=0;
4271
+                    $processed_actual = 0;
4272 4272
                     for ($i = 1; $i <= $limit; $i++) {
4273 4273
                         $index = $processed + $i;
4274 4274
                         $gd_post = array();
4275 4275
                         
4276 4276
                         if (isset($file[$index])) {$processed_actual++;
4277 4277
                             $row = $file[$index];
4278
-                            $row = array_map( 'trim', $row );
4278
+                            $row = array_map('trim', $row);
4279 4279
                             //$row = array_map( 'utf8_encode', $row );
4280
-                            $row = array_map( 'addslashes_gpc', $row );
4280
+                            $row = array_map('addslashes_gpc', $row);
4281 4281
                             
4282 4282
                             $post_id = '';
4283 4283
                             $post_title = '';
@@ -4314,80 +4314,80 @@  discard block
 block discarded – undo
4314 4314
                             $original_post_id = '';
4315 4315
                                                         
4316 4316
                             $c = 0;
4317
-                            foreach ($columns as $column ) {
4317
+                            foreach ($columns as $column) {
4318 4318
                                 $gd_post[$column] = $row[$c];
4319 4319
                                 
4320
-                                if ( $column == 'post_id' ) {
4320
+                                if ($column == 'post_id') {
4321 4321
                                     $post_id = $row[$c];
4322
-                                } else if ( $column == 'post_title' ) {
4322
+                                } else if ($column == 'post_title') {
4323 4323
                                     $post_title = sanitize_text_field($row[$c]);
4324
-                                } else if ( $column == 'post_author' ) {
4324
+                                } else if ($column == 'post_author') {
4325 4325
                                     $post_author = $row[$c];
4326
-                                } else if ( $column == 'post_content' ) {
4326
+                                } else if ($column == 'post_content') {
4327 4327
                                     $post_content = $row[$c];
4328
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4329
-                                    $post_category_arr = explode( ',', $row[$c] );
4330
-                                } else if ( $column == 'default_category' ) {
4328
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4329
+                                    $post_category_arr = explode(',', $row[$c]);
4330
+                                } else if ($column == 'default_category') {
4331 4331
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4332
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4333
-                                    $post_tags = explode( ',', $row[$c] );
4334
-                                } else if ( $column == 'post_type' ) {
4332
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4333
+                                    $post_tags = explode(',', $row[$c]);
4334
+                                } else if ($column == 'post_type') {
4335 4335
                                     $post_type = $row[$c];
4336
-                                } else if ( $column == 'post_status' ) {
4337
-                                    $post_status = sanitize_key( $row[$c] );
4338
-                                } else if ( $column == 'is_featured' ) {
4339
-                                    $is_featured = (int)$row[$c];
4340
-                                } else if ( $column == 'geodir_video' ) {
4336
+                                } else if ($column == 'post_status') {
4337
+                                    $post_status = sanitize_key($row[$c]);
4338
+                                } else if ($column == 'is_featured') {
4339
+                                    $is_featured = (int) $row[$c];
4340
+                                } else if ($column == 'geodir_video') {
4341 4341
                                     $geodir_video = $row[$c];
4342
-                                } else if ( $column == 'post_address' ) {
4342
+                                } else if ($column == 'post_address') {
4343 4343
                                     $post_address = $row[$c];
4344
-                                } else if ( $column == 'post_city' ) {
4344
+                                } else if ($column == 'post_city') {
4345 4345
                                     $post_city = $row[$c];
4346
-                                } else if ( $column == 'post_region' ) {
4346
+                                } else if ($column == 'post_region') {
4347 4347
                                     $post_region = $row[$c];
4348
-                                } else if ( $column == 'post_country' ) {
4348
+                                } else if ($column == 'post_country') {
4349 4349
                                     $post_country = $row[$c];
4350
-                                } else if ( $column == 'post_zip' ) {
4350
+                                } else if ($column == 'post_zip') {
4351 4351
                                     $post_zip = $row[$c];
4352
-                                } else if ( $column == 'post_latitude' ) {
4352
+                                } else if ($column == 'post_latitude') {
4353 4353
                                     $post_latitude = $row[$c];
4354
-                                } else if ( $column == 'post_longitude' ) {
4354
+                                } else if ($column == 'post_longitude') {
4355 4355
                                     $post_longitude = $row[$c];
4356
-                                } else if ( $column == 'post_neighbourhood' ) {
4356
+                                } else if ($column == 'post_neighbourhood') {
4357 4357
                                     $post_neighbourhood = $row[$c];
4358 4358
                                     unset($gd_post[$column]);
4359
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4359
+                                } else if ($column == 'neighbourhood_latitude') {
4360 4360
                                     $neighbourhood_latitude = $row[$c];
4361
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4361
+                                } else if ($column == 'neighbourhood_longitude') {
4362 4362
                                     $neighbourhood_longitude = $row[$c];
4363
-                                } else if ( $column == 'geodir_timing' ) {
4363
+                                } else if ($column == 'geodir_timing') {
4364 4364
                                     $geodir_timing = $row[$c];
4365
-                                } else if ( $column == 'geodir_contact' ) {
4365
+                                } else if ($column == 'geodir_contact') {
4366 4366
                                     $geodir_contact = $row[$c];
4367
-                                } else if ( $column == 'geodir_email' ) {
4367
+                                } else if ($column == 'geodir_email') {
4368 4368
                                     $geodir_email = $row[$c];
4369
-                                } else if ( $column == 'geodir_website' ) {
4369
+                                } else if ($column == 'geodir_website') {
4370 4370
                                     $geodir_website = $row[$c];
4371
-                                } else if ( $column == 'geodir_twitter' ) {
4371
+                                } else if ($column == 'geodir_twitter') {
4372 4372
                                     $geodir_twitter = $row[$c];
4373
-                                } else if ( $column == 'geodir_facebook' ) {
4373
+                                } else if ($column == 'geodir_facebook') {
4374 4374
                                     $geodir_facebook = $row[$c];
4375
-                                } else if ( $column == 'geodir_twitter' ) {
4375
+                                } else if ($column == 'geodir_twitter') {
4376 4376
                                     $geodir_twitter = $row[$c];
4377
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4377
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4378 4378
                                     $post_images[] = $row[$c];
4379
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4380
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4381
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4379
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4380
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $row[$c] . ' days'));
4381
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4382 4382
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4383
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4383
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4384 4384
                                 }
4385 4385
                                 // WPML
4386 4386
                                 if ($is_wpml) {
4387 4387
                                     if ($column == 'language') {
4388 4388
                                         $language = geodir_strtolower(trim($row[$c]));
4389 4389
                                     } else if ($column == 'original_post_id') {
4390
-                                        $original_post_id = (int)$row[$c];
4390
+                                        $original_post_id = (int) $row[$c];
4391 4391
                                     }
4392 4392
                                 }
4393 4393
                                 // WPML
@@ -4402,24 +4402,24 @@  discard block
 block discarded – undo
4402 4402
 
4403 4403
                             $gd_post['IMAGE'] = $post_images;
4404 4404
                             
4405
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4406
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4405
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4406
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4407 4407
                                                                                                                 
4408 4408
                             $valid = true;
4409 4409
                             
4410
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4410
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4411 4411
                                 $invalid++;
4412 4412
                                 $valid = false;
4413 4413
                             }
4414 4414
                             
4415
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4416
-                            if ( $location_allowed ) {
4415
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4416
+                            if ($location_allowed) {
4417 4417
                                 $location_result = geodir_get_default_location();
4418
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4418
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4419 4419
                                     $invalid_addr++;
4420 4420
                                     $valid = false;
4421
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4422
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4421
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4422
+                                    if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
4423 4423
                                         $invalid_addr++;
4424 4424
                                         $valid = false;
4425 4425
                                     } else {
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
                                 }
4431 4431
                             }
4432 4432
                             
4433
-                            if ( !$valid ) {
4433
+                            if (!$valid) {
4434 4434
                                 continue;
4435 4435
                             }
4436 4436
 
@@ -4443,29 +4443,29 @@  discard block
 block discarded – undo
4443 4443
 
4444 4444
                             $post_category = array();
4445 4445
                             $default_category_id = NULL;
4446
-                            if ( !empty( $post_category_arr ) ) {
4447
-                                foreach ( $post_category_arr as $value ) {
4448
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4446
+                            if (!empty($post_category_arr)) {
4447
+                                foreach ($post_category_arr as $value) {
4448
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4449 4449
                                     
4450
-                                    if ( $category_name != '' ) {
4450
+                                    if ($category_name != '') {
4451 4451
                                         $term_category = array();
4452 4452
                                         
4453
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4453
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4454 4454
                                             $term_category = $term;
4455
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4455
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4456 4456
                                             $term_category = $term;
4457 4457
                                         } else {
4458 4458
                                             $term_data = array();
4459 4459
                                             $term_data['name'] = $category_name;
4460 4460
                                             $term_data['taxonomy'] = $cat_taxonomy;
4461 4461
                                             
4462
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4463
-                                            if ( $term_id ) {
4464
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4462
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4463
+                                            if ($term_id) {
4464
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4465 4465
                                             }
4466 4466
                                         }
4467 4467
                                         
4468
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4468
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4469 4469
                                             $post_category[] = intval($term_category->term_id);
4470 4470
                                             
4471 4471
                                             if ($category_name == $default_category) {
@@ -4486,28 +4486,28 @@  discard block
 block discarded – undo
4486 4486
                             $save_post['post_tags'] = $post_tags;
4487 4487
 
4488 4488
                             $saved_post_id = NULL;
4489
-                            if ( $import_choice == 'update' ) {
4490
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4489
+                            if ($import_choice == 'update') {
4490
+                                if ($post_id > 0 && get_post($post_id)) {
4491 4491
                                     $save_post['ID'] = $post_id;
4492 4492
                                     
4493
-                                    if ( wp_update_post( $save_post ) ) {
4493
+                                    if (wp_update_post($save_post)) {
4494 4494
                                         $saved_post_id = $post_id;
4495 4495
                                         $updated++;
4496 4496
                                     }
4497 4497
                                 } else {
4498
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4498
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
4499 4499
                                         $created++;
4500 4500
                                     }
4501 4501
                                 }
4502 4502
                                 
4503
-                                if ( !$saved_post_id > 0 ) {
4503
+                                if (!$saved_post_id > 0) {
4504 4504
                                     $invalid++;
4505 4505
                                 }
4506
-                            } else if ( $import_choice == 'skip' ) {
4507
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4506
+                            } else if ($import_choice == 'skip') {
4507
+                                if ($post_id > 0 && get_post($post_id)) {
4508 4508
                                     $skipped++;	
4509 4509
                                 } else {
4510
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4510
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
4511 4511
                                         $created++;	
4512 4512
                                     } else {
4513 4513
                                         $invalid++;
@@ -4517,19 +4517,19 @@  discard block
 block discarded – undo
4517 4517
                                 $invalid++;
4518 4518
                             }
4519 4519
 
4520
-                            if ( (int)$saved_post_id > 0 ) {
4520
+                            if ((int) $saved_post_id > 0) {
4521 4521
                                 // WPML
4522 4522
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
4523 4523
                                     $wpml_post_type = 'post_' . $post_type;
4524
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4524
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4525 4525
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4526 4526
 
4527
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4527
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4528 4528
                                     
4529
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4529
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4530 4530
                                 }
4531 4531
                                 // WPML
4532
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4532
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4533 4533
                                 
4534 4534
                                 $gd_post['post_id'] = $saved_post_id;
4535 4535
                                 $gd_post['ID'] = $saved_post_id;
@@ -4541,7 +4541,7 @@  discard block
 block discarded – undo
4541 4541
                                                     
4542 4542
                                 // post location
4543 4543
                                 $post_location_id = 0;
4544
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4544
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4545 4545
                                     $gd_post['post_neighbourhood'] = '';
4546 4546
                                     
4547 4547
                                     $post_location_info = array(
@@ -4551,7 +4551,7 @@  discard block
 block discarded – undo
4551 4551
                                                                 'geo_lat' => $post_latitude,
4552 4552
                                                                 'geo_lng' => $post_longitude
4553 4553
                                                             );
4554
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4554
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4555 4555
                                         $post_location_id = $location_id;
4556 4556
                                     }
4557 4557
                                     
@@ -4589,14 +4589,14 @@  discard block
 block discarded – undo
4589 4589
                                 $gd_post['post_location_id'] = $post_location_id;
4590 4590
                                 
4591 4591
                                 // post package info
4592
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4592
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4593 4593
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4594 4594
                                     $package_id = $gd_post_info->package_id;
4595 4595
                                 }
4596 4596
                                 
4597 4597
                                 $package_info = array();
4598 4598
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4599
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4599
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4600 4600
                                     
4601 4601
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4602 4602
                                         $package_info = array();
@@ -4604,18 +4604,18 @@  discard block
 block discarded – undo
4604 4604
                                 }
4605 4605
                                 
4606 4606
                                 if (empty($package_info)) {
4607
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4607
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4608 4608
                                 }
4609 4609
                                  
4610
-                                if (!empty($package_info))	 {
4610
+                                if (!empty($package_info)) {
4611 4611
                                     $package_id = $package_info['pid'];
4612 4612
                                     
4613 4613
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4614 4614
                                         $gd_post['expire_date'] = $expire_date;
4615 4615
                                     } else {
4616
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4617
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4618
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4616
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4617
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4618
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $package_info['days'] . ' days'));
4619 4619
                                         } else {
4620 4620
                                             $gd_post['expire_date'] = 'Never';
4621 4621
                                         }
@@ -4635,28 +4635,28 @@  discard block
 block discarded – undo
4635 4635
                                 }
4636 4636
 
4637 4637
                                 // Export franchise fields
4638
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4638
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4639 4639
                                 if ($is_franchise_active) {
4640
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4640
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
4641 4641
                                         $gd_franchise_lock = array();
4642 4642
                                         
4643
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4644
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4645
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4646
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4643
+                                        if (isset($gd_post['gd_franchise_lock'])) {
4644
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4645
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
4646
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
4647 4647
                                         }
4648 4648
                                         
4649
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4650
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4649
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4650
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4651 4651
                                     } else {
4652
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4653
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4652
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4653
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4654 4654
                                         }
4655 4655
                                     }
4656 4656
                                 }
4657 4657
                                 
4658 4658
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4659
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4659
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4660 4660
                                     if ($default_category_id) {
4661 4661
                                         $save_post['post_default_category'] = $default_category_id;
4662 4662
                                         $gd_post['default_category'] = $default_category_id;
@@ -4665,12 +4665,12 @@  discard block
 block discarded – undo
4665 4665
                                 }
4666 4666
                                 
4667 4667
                                 // Save post info
4668
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4668
+                                geodir_save_post_info($saved_post_id, $gd_post);
4669 4669
                                 // post taxonomies
4670
-                                if ( !empty( $save_post['post_category'] ) ) {
4671
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4670
+                                if (!empty($save_post['post_category'])) {
4671
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4672 4672
                                     
4673
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4673
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4674 4674
                                     if ($default_category_id) {
4675 4675
                                         $post_default_category = $default_category_id;
4676 4676
                                     }
@@ -4684,15 +4684,15 @@  discard block
 block discarded – undo
4684 4684
                                     
4685 4685
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4686 4686
                                     
4687
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4687
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4688 4688
                                 }
4689 4689
 
4690
-                                if ( !empty( $save_post['post_tags'] ) ) {
4691
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4690
+                                if (!empty($save_post['post_tags'])) {
4691
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4692 4692
                                 }
4693 4693
 
4694 4694
                                 // Post images
4695
-                                if ( !empty( $post_images ) ) {
4695
+                                if (!empty($post_images)) {
4696 4696
                                     $post_images = array_unique($post_images);
4697 4697
                                     
4698 4698
                                     $old_post_images_arr = array();
@@ -4700,30 +4700,30 @@  discard block
 block discarded – undo
4700 4700
                                     
4701 4701
                                     $order = 1;
4702 4702
                                     
4703
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4703
+                                    $old_post_images = geodir_get_images($saved_post_id);
4704 4704
                                     if (!empty($old_post_images)) {
4705
-                                        foreach( $old_post_images as $old_post_image ) {
4705
+                                        foreach ($old_post_images as $old_post_image) {
4706 4706
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4707 4707
                                                 $old_post_images_arr[] = $old_post_image->file;
4708 4708
                                             }
4709 4709
                                         }
4710 4710
                                     }
4711 4711
                                     
4712
-                                    foreach ( $post_images as $post_image ) {
4713
-                                        $image_name = basename( $post_image );
4712
+                                    foreach ($post_images as $post_image) {
4713
+                                        $image_name = basename($post_image);
4714 4714
                                         $saved_post_images_arr[] = $image_name;
4715 4715
                                         
4716
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4716
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4717 4717
                                             continue; // Skip if image already exists.
4718 4718
                                         }
4719 4719
                                         
4720
-                                        $image_name_parts = explode( '.', $image_name );
4721
-                                        array_pop( $image_name_parts );
4722
-                                        $proper_image_name = implode( '.', $image_name_parts );
4720
+                                        $image_name_parts = explode('.', $image_name);
4721
+                                        array_pop($image_name_parts);
4722
+                                        $proper_image_name = implode('.', $image_name_parts);
4723 4723
                                         
4724
-                                        $arr_file_type = wp_check_filetype( $image_name );
4724
+                                        $arr_file_type = wp_check_filetype($image_name);
4725 4725
                                         
4726
-                                        if ( !empty( $arr_file_type ) ) {
4726
+                                        if (!empty($arr_file_type)) {
4727 4727
                                             $uploaded_file_type = $arr_file_type['type'];
4728 4728
                                             
4729 4729
                                             $attachment = array();
@@ -4736,46 +4736,46 @@  discard block
 block discarded – undo
4736 4736
                                             $attachment['is_featured'] = 0;
4737 4737
 
4738 4738
                                             $attachment_set = '';
4739
-                                            foreach ( $attachment as $key => $val ) {
4740
-                                                if ( $val != '' ) {
4739
+                                            foreach ($attachment as $key => $val) {
4740
+                                                if ($val != '') {
4741 4741
                                                     $attachment_set .= $key . " = '" . $val . "', ";
4742 4742
                                                 }
4743 4743
                                             }
4744
-                                            $attachment_set = trim( $attachment_set, ", " );
4744
+                                            $attachment_set = trim($attachment_set, ", ");
4745 4745
                                                                                         
4746 4746
                                             // Add new attachment
4747
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4747
+                                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
4748 4748
                                                                                         
4749 4749
                                             $order++;
4750 4750
                                         }
4751 4751
                                     }
4752 4752
 
4753
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4753
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
4754 4754
                                     // Remove previous attachment
4755
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4755
+                                    $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int) $saved_post_id . " " . $saved_post_images_sql);
4756 4756
                                     
4757
-                                    if ( !empty( $saved_post_images_arr ) ) {
4757
+                                    if (!empty($saved_post_images_arr)) {
4758 4758
                                         $menu_order = 1;
4759 4759
                                         
4760
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4761
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
4760
+                                        foreach ($saved_post_images_arr as $img_name) {
4761
+                                            $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/' . $img_name)));
4762 4762
                                             
4763
-                                            if( $menu_order == 1 ) {
4764
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
4765
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4763
+                                            if ($menu_order == 1) {
4764
+                                                if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/' . $img_name)))) {
4765
+                                                    $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
4766 4766
                                                 }
4767 4767
                                             }
4768 4768
                                             $menu_order++;
4769 4769
                                         }
4770 4770
                                     }
4771 4771
                                     
4772
-                                    if ( $order > 1 ) {
4772
+                                    if ($order > 1) {
4773 4773
                                         $images++;
4774 4774
                                     }
4775 4775
                                 }
4776 4776
 
4777 4777
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4778
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4778
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4779 4779
                                 
4780 4780
                                 if (isset($is_featured)) {
4781 4781
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
@@ -4795,10 +4795,10 @@  discard block
 block discarded – undo
4795 4795
                 }
4796 4796
 
4797 4797
                 //undo some stuff to make the import quicker
4798
-                wp_defer_term_counting( false );
4799
-                wp_defer_comment_counting( false );
4800
-                $wpdb->query( 'COMMIT;' );
4801
-                $wpdb->query( 'SET autocommit = 1;' );
4798
+                wp_defer_term_counting(false);
4799
+                wp_defer_comment_counting(false);
4800
+                $wpdb->query('COMMIT;');
4801
+                $wpdb->query('SET autocommit = 1;');
4802 4802
 
4803 4803
                 $json = array();
4804 4804
                 $json['processed'] = $processed_actual;
@@ -4809,9 +4809,9 @@  discard block
 block discarded – undo
4809 4809
                 $json['invalid_addr'] = $invalid_addr;
4810 4810
                 $json['images'] = $images;
4811 4811
                 
4812
-                wp_send_json( $json );
4812
+                wp_send_json($json);
4813 4813
                 exit;
4814
-            } else if ( $task == 'import_loc' ) {
4814
+            } else if ($task == 'import_loc') {
4815 4815
                 global $gd_post_types;
4816 4816
                 $gd_post_types = $post_types;
4817 4817
                 
@@ -4820,7 +4820,7 @@  discard block
 block discarded – undo
4820 4820
                     
4821 4821
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4822 4822
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4823
-                        wp_send_json( $json );
4823
+                        wp_send_json($json);
4824 4824
                     }
4825 4825
                     
4826 4826
                     for ($i = 1; $i <= $limit; $i++) {
@@ -4828,59 +4828,59 @@  discard block
 block discarded – undo
4828 4828
                         
4829 4829
                         if (isset($file[$index])) {
4830 4830
                             $row = $file[$index];
4831
-                            $row = array_map( 'trim', $row );
4831
+                            $row = array_map('trim', $row);
4832 4832
                             $data = array();
4833 4833
                             
4834
-                            foreach ($columns as $c => $column ) {
4834
+                            foreach ($columns as $c => $column) {
4835 4835
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
4836 4836
                                     $data[$column] = $row[$c];
4837 4837
                                 }
4838 4838
                             }
4839 4839
 
4840
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4840
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4841 4841
                                 $invalid++;
4842 4842
                                 continue;
4843 4843
                             }
4844 4844
                             
4845 4845
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4846 4846
                             
4847
-                            if ( $import_choice == 'update' ) {
4848
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4849
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4847
+                            if ($import_choice == 'update') {
4848
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4849
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4850 4850
                                         $updated++;
4851 4851
                                     } else {
4852 4852
                                         $invalid++;
4853 4853
                                     }
4854
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4855
-                                    $data['location_id'] = (int)$location->location_id;
4854
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4855
+                                    $data['location_id'] = (int) $location->location_id;
4856 4856
                                     
4857
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4858
-                                        $data['location_id'] = (int)$location->location_id;
4859
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4860
-                                        $data['location_id'] = (int)$location->location_id;
4861
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4862
-                                        $data['location_id'] = (int)$location->location_id;
4857
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4858
+                                        $data['location_id'] = (int) $location->location_id;
4859
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4860
+                                        $data['location_id'] = (int) $location->location_id;
4861
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4862
+                                        $data['location_id'] = (int) $location->location_id;
4863 4863
                                     }
4864 4864
                                     
4865
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4865
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4866 4866
                                         $updated++;
4867 4867
                                     } else {
4868 4868
                                         $invalid++;
4869 4869
                                     }
4870 4870
                                 } else {
4871
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4871
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4872 4872
                                         $created++;
4873 4873
                                     } else {
4874 4874
                                         $invalid++;
4875 4875
                                     }
4876 4876
                                 }
4877
-                            } elseif ( $import_choice == 'skip' ) {
4878
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4877
+                            } elseif ($import_choice == 'skip') {
4878
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4879 4879
                                     $skipped++;
4880
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4880
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4881 4881
                                     $skipped++;
4882 4882
                                 } else {
4883
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4883
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4884 4884
                                         $created++;
4885 4885
                                     } else {
4886 4886
                                         $invalid++;
@@ -4901,14 +4901,14 @@  discard block
 block discarded – undo
4901 4901
                 $json['invalid'] = $invalid;
4902 4902
                 $json['images'] = $images;
4903 4903
                 
4904
-                wp_send_json( $json );
4905
-            } else if ( $task == 'import_hood' ) {               
4904
+                wp_send_json($json);
4905
+            } else if ($task == 'import_hood') {               
4906 4906
                 if (!empty($file)) {
4907 4907
                     $columns = isset($file[0]) ? $file[0] : NULL;
4908 4908
                     
4909 4909
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4910 4910
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4911
-                        wp_send_json( $json );
4911
+                        wp_send_json($json);
4912 4912
                     }
4913 4913
                     
4914 4914
                     for ($i = 1; $i <= $limit; $i++) {
@@ -4916,7 +4916,7 @@  discard block
 block discarded – undo
4916 4916
                         
4917 4917
                         if (isset($file[$index])) {
4918 4918
                             $row = $file[$index];
4919
-                            $row = array_map( 'trim', $row );
4919
+                            $row = array_map('trim', $row);
4920 4920
                             $data = array();
4921 4921
                             
4922 4922
                             foreach ($columns as $c => $column) {
@@ -4931,8 +4931,8 @@  discard block
 block discarded – undo
4931 4931
                             }
4932 4932
                             
4933 4933
                             $location_info = array();
4934
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4935
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4934
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
4935
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
4936 4936
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4937 4937
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4938 4938
                             }
@@ -4953,9 +4953,9 @@  discard block
 block discarded – undo
4953 4953
                             $hood_data['hood_longitude'] = $data['longitude'];
4954 4954
                             $hood_data['hood_location_id'] = $location_id;
4955 4955
                                     
4956
-                            if ( $import_choice == 'update' ) {
4957
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4958
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4956
+                            if ($import_choice == 'update') {
4957
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4958
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
4959 4959
                                     
4960 4960
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4961 4961
                                         $updated++;
@@ -4963,7 +4963,7 @@  discard block
 block discarded – undo
4963 4963
                                         $invalid++;
4964 4964
                                     }
4965 4965
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4966
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4966
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
4967 4967
                                     
4968 4968
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4969 4969
                                         $updated++;
@@ -4977,8 +4977,8 @@  discard block
 block discarded – undo
4977 4977
                                         $invalid++;
4978 4978
                                     }
4979 4979
                                 }
4980
-                            } elseif ( $import_choice == 'skip' ) {
4981
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4980
+                            } elseif ($import_choice == 'skip') {
4981
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4982 4982
                                     $skipped++;
4983 4983
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4984 4984
                                     $skipped++;
@@ -5005,7 +5005,7 @@  discard block
 block discarded – undo
5005 5005
                 $json['invalid'] = $invalid;
5006 5006
                 $json['images'] = $images;
5007 5007
                 
5008
-                wp_send_json( $json );
5008
+                wp_send_json($json);
5009 5009
             }
5010 5010
         }
5011 5011
         break;
@@ -5049,29 +5049,29 @@  discard block
 block discarded – undo
5049 5049
  * }
5050 5050
  * @return int|bool Term id when success, false when fail.
5051 5051
  */
5052
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
5053
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5052
+function geodir_imex_insert_term($taxonomy, $term_data) {
5053
+	if (empty($taxonomy) || empty($term_data)) {
5054 5054
 		return false;
5055 5055
 	}
5056 5056
 	
5057
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5057
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5058 5058
 	$args = array();
5059
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5060
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5061
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5059
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5060
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5061
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5062 5062
 	
5063
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5064
-		$term_args = array_merge( $term_data, $args );
5065
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5066
-		$term_args = wp_parse_args( $term_args, $defaults );
5067
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5068
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5063
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
5064
+		$term_args = array_merge($term_data, $args);
5065
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5066
+		$term_args = wp_parse_args($term_args, $defaults);
5067
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
5068
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
5069 5069
 	}
5070 5070
 	
5071
-    if( !empty( $term ) ) {
5072
-		$result = wp_insert_term( $term, $taxonomy, $args );
5073
-        if( !is_wp_error( $result ) ) {
5074
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5071
+    if (!empty($term)) {
5072
+		$result = wp_insert_term($term, $taxonomy, $args);
5073
+        if (!is_wp_error($result)) {
5074
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5075 5075
         }
5076 5076
     }
5077 5077
 	
@@ -5101,36 +5101,36 @@  discard block
 block discarded – undo
5101 5101
  * }
5102 5102
  * @return int|bool Term id when success, false when fail.
5103 5103
  */
5104
-function geodir_imex_update_term( $taxonomy, $term_data ) {
5105
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5104
+function geodir_imex_update_term($taxonomy, $term_data) {
5105
+	if (empty($taxonomy) || empty($term_data)) {
5106 5106
 		return false;
5107 5107
 	}
5108 5108
 	
5109
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5109
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
5110 5110
 	
5111 5111
 	$args = array();
5112
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5113
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5114
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5112
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5113
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5114
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5115 5115
 	
5116
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5116
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
5117 5117
 		$term_data['term_id'] = $term_info['term_id'];
5118 5118
 		
5119
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5119
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5120 5120
 		
5121
-		if( !is_wp_error( $result ) ) {
5122
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5121
+		if (!is_wp_error($result)) {
5122
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5123 5123
         }
5124
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5124
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5125 5125
 		$term_data['term_id'] = $term_info['term_id'];
5126 5126
 		
5127
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5127
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5128 5128
 		
5129
-		if( !is_wp_error( $result ) ) {
5130
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5129
+		if (!is_wp_error($result)) {
5130
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5131 5131
         }
5132 5132
 	} else {
5133
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5133
+		return geodir_imex_insert_term($taxonomy, $term_data);
5134 5134
 	}
5135 5135
 	
5136 5136
 	return false;
@@ -5148,10 +5148,10 @@  discard block
 block discarded – undo
5148 5148
  * @param string $post_type Post type.
5149 5149
  * @return int Posts count.
5150 5150
  */
5151
-function geodir_get_posts_count( $post_type ) {
5151
+function geodir_get_posts_count($post_type) {
5152 5152
     global $wpdb, $plugin_prefix;
5153 5153
 
5154
-    if ( !post_type_exists( $post_type ) ) {
5154
+    if (!post_type_exists($post_type)) {
5155 5155
         return 0;
5156 5156
     }
5157 5157
         
@@ -5160,13 +5160,13 @@  discard block
 block discarded – undo
5160 5160
     // Skip listing with statuses trash, auto-draft etc...
5161 5161
     $skip_statuses = geodir_imex_export_skip_statuses();
5162 5162
     $where_statuses = '';
5163
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5164
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5163
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5164
+        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode("','", $skip_statuses) . "')";
5165 5165
     }
5166 5166
 
5167
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5167
+    $query = $wpdb->prepare("SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type);
5168 5168
 
5169
-    $posts_count = (int)$wpdb->get_var( $query );
5169
+    $posts_count = (int) $wpdb->get_var($query);
5170 5170
     
5171 5171
     /**
5172 5172
      * Modify returned post counts for the current post type.
@@ -5177,7 +5177,7 @@  discard block
 block discarded – undo
5177 5177
      * @param int $posts_count Post counts.
5178 5178
      * @param string $post_type Post type.
5179 5179
      */
5180
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5180
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5181 5181
 
5182 5182
     return $posts_count;
5183 5183
 }
@@ -5198,17 +5198,17 @@  discard block
 block discarded – undo
5198 5198
  * @param int $page_no Page number. Default 0.
5199 5199
  * @return array Array of posts data.
5200 5200
  */
5201
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5201
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5202 5202
 	global $wp_filesystem;
5203 5203
 
5204
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5204
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5205 5205
 
5206 5206
 	$csv_rows = array();
5207 5207
 	
5208
-	if ( !empty( $posts ) ) {
5209
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5208
+	if (!empty($posts)) {
5209
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5210 5210
         $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5211
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5211
+        $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5212 5212
         $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5213 5213
 		
5214 5214
 		$csv_row = array();
@@ -5220,7 +5220,7 @@  discard block
 block discarded – undo
5220 5220
 		$csv_row[] = 'default_category';
5221 5221
 		$csv_row[] = 'post_tags';
5222 5222
 		$csv_row[] = 'post_type';
5223
-		if ( $post_type == 'gd_event' ) {
5223
+		if ($post_type == 'gd_event') {
5224 5224
 			$csv_row[] = 'event_date';
5225 5225
 			$csv_row[] = 'event_enddate';
5226 5226
 			$csv_row[] = 'starttime';
@@ -5274,15 +5274,15 @@  discard block
 block discarded – undo
5274 5274
 		}
5275 5275
 		// WPML
5276 5276
 
5277
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5278
-		if ( !empty( $custom_fields ) ) {
5279
-			foreach ( $custom_fields as $custom_field ) {
5277
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5278
+		if (!empty($custom_fields)) {
5279
+			foreach ($custom_fields as $custom_field) {
5280 5280
 				$csv_row[] = $custom_field->htmlvar_name;
5281 5281
 			}
5282 5282
 		}
5283 5283
 
5284 5284
 		// Export franchise fields
5285
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5285
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5286 5286
 		if ($is_franchise_active) {
5287 5287
 			$csv_row[] = 'gd_is_franchise';
5288 5288
 			$csv_row[] = 'gd_franchise_lock';
@@ -5292,12 +5292,12 @@  discard block
 block discarded – undo
5292 5292
 		$csv_rows[] = $csv_row;
5293 5293
 
5294 5294
 		$images_count = 5;
5295
-        $xx=0;
5296
-		foreach ( $posts as $post ) {$xx++;
5295
+        $xx = 0;
5296
+		foreach ($posts as $post) {$xx++;
5297 5297
 			$post_id = $post['ID'];
5298 5298
 			
5299
-			$gd_post_info = geodir_get_post_info( $post_id );
5300
-			$post_info = (array)$gd_post_info;
5299
+			$gd_post_info = geodir_get_post_info($post_id);
5300
+			$post_info = (array) $gd_post_info;
5301 5301
 						
5302 5302
 			$taxonomy_category = $post_type . 'category';
5303 5303
 			$taxonomy_tags = $post_type . '_tags';
@@ -5306,14 +5306,14 @@  discard block
 block discarded – undo
5306 5306
 			$default_category_id = $gd_post_info->default_category;
5307 5307
 			$default_category = '';
5308 5308
 			$post_tags = '';
5309
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5309
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5310 5310
 			
5311
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5311
+			if (!empty($terms) && !is_wp_error($terms)) {
5312 5312
 				$post_category = array();
5313 5313
 				$post_tags = array();
5314 5314
 			
5315
-				foreach ( $terms as $term ) {
5316
-					if ( $term->taxonomy == $taxonomy_category ) {
5315
+				foreach ($terms as $term) {
5316
+					if ($term->taxonomy == $taxonomy_category) {
5317 5317
 						$post_category[] = $term->name;
5318 5318
 						
5319 5319
 						if ($default_category_id == $term->term_id) {
@@ -5321,7 +5321,7 @@  discard block
 block discarded – undo
5321 5321
 						}
5322 5322
 					}
5323 5323
 					
5324
-					if ( $term->taxonomy == $taxonomy_tags ) {
5324
+					if ($term->taxonomy == $taxonomy_tags) {
5325 5325
 						$post_tags[] = $term->name;
5326 5326
 					}
5327 5327
 				}
@@ -5329,47 +5329,47 @@  discard block
 block discarded – undo
5329 5329
 				if (empty($default_category) && !empty($post_category)) {
5330 5330
 					$default_category = $post_category[0]; // Set first one as default category.
5331 5331
 				}
5332
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5333
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5332
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5333
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5334 5334
 			}
5335 5335
 
5336 5336
 			// Franchise data
5337
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5337
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5338 5338
 				$franchise_id = $post_info['franchise'];
5339 5339
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5340 5340
 
5341 5341
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5342
-					$franchise_info = (array)$gd_franchise_info;
5342
+					$franchise_info = (array) $gd_franchise_info;
5343 5343
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5344 5344
 					
5345 5345
 					if (!empty($locked_fields)) {
5346
-						foreach( $locked_fields as $locked_field) {
5346
+						foreach ($locked_fields as $locked_field) {
5347 5347
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5348 5348
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5349 5349
 							}
5350 5350
 							
5351 5351
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5352
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5352
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5353 5353
 			
5354
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5354
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5355 5355
 									$franchise_post_category = array();
5356 5356
 									$franchise_post_tags = array();
5357 5357
 								
5358
-									foreach ( $franchise_terms as $franchise_term ) {
5359
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5358
+									foreach ($franchise_terms as $franchise_term) {
5359
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5360 5360
 											$franchise_post_category[] = $franchise_term->name;
5361 5361
 										}
5362 5362
 										
5363
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5363
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5364 5364
 											$franchise_post_tags[] = $franchise_term->name;
5365 5365
 										}
5366 5366
 									}
5367 5367
 									
5368 5368
 									if (in_array($taxonomy_category, $locked_fields)) {
5369
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5369
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5370 5370
 									}
5371 5371
 									if (in_array('post_tags', $locked_fields)) {
5372
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5372
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5373 5373
 									}
5374 5374
 								}
5375 5375
 							}
@@ -5378,18 +5378,18 @@  discard block
 block discarded – undo
5378 5378
 				}
5379 5379
 			}
5380 5380
 						
5381
-			$post_images = geodir_get_images( $post_id );
5381
+			$post_images = geodir_get_images($post_id);
5382 5382
 			$current_images = array();
5383
-			if ( !empty( $post_images ) ) {
5384
-				foreach ( $post_images as $post_image ) {
5385
-					$post_image = (array)$post_image;
5386
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5387
-					if ( $image ) {
5383
+			if (!empty($post_images)) {
5384
+				foreach ($post_images as $post_image) {
5385
+					$post_image = (array) $post_image;
5386
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5387
+					if ($image) {
5388 5388
 						$current_images[] = $image;
5389 5389
 					}
5390 5390
 				}
5391 5391
 				
5392
-				$images_count = max( $images_count, count( $current_images ) );
5392
+				$images_count = max($images_count, count($current_images));
5393 5393
 			}
5394 5394
 
5395 5395
 			$csv_row = array();
@@ -5401,7 +5401,7 @@  discard block
 block discarded – undo
5401 5401
 			$csv_row[] = $default_category; // default_category
5402 5402
 			$csv_row[] = $post_tags; // post_tags
5403 5403
 			$csv_row[] = $post_type; // post_type
5404
-			if ( $post_type == 'gd_event' ) {
5404
+			if ($post_type == 'gd_event') {
5405 5405
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5406 5406
 				$csv_row[] = $event_data['event_date']; // event_date
5407 5407
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5422,9 +5422,9 @@  discard block
 block discarded – undo
5422 5422
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5423 5423
 			}
5424 5424
 			$csv_row[] = $post_info['post_status']; // post_status
5425
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5425
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5426 5426
 			if ($is_payment_plugin) {
5427
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5427
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5428 5428
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5429 5429
 			}
5430 5430
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
@@ -5460,14 +5460,14 @@  discard block
 block discarded – undo
5460 5460
 			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
5461 5461
 			// WPML
5462 5462
 			if ($is_wpml) {
5463
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5464
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5463
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_' . $post_type);
5464
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_' . $post_type);
5465 5465
 			}
5466 5466
 			// WPML
5467 5467
 			
5468
-			if ( !empty( $custom_fields ) ) {
5469
-				foreach ( $custom_fields as $custom_field ) {
5470
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5468
+			if (!empty($custom_fields)) {
5469
+				foreach ($custom_fields as $custom_field) {
5470
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5471 5471
 				}
5472 5472
 			}
5473 5473
 			
@@ -5478,26 +5478,26 @@  discard block
 block discarded – undo
5478 5478
 				$franchise = '';
5479 5479
 					
5480 5480
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5481
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5482
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5481
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5482
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5483 5483
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5484
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5484
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5485 5485
 				}
5486 5486
 				
5487
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5487
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5488 5488
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5489
-				$csv_row[] = (int)$franchise; // franchise id
5489
+				$csv_row[] = (int) $franchise; // franchise id
5490 5490
 			}
5491 5491
 			
5492
-			for ( $c = 0; $c < $images_count; $c++ ) {
5493
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5492
+			for ($c = 0; $c < $images_count; $c++) {
5493
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5494 5494
 			}
5495 5495
 			
5496 5496
 			$csv_rows[] = $csv_row;
5497 5497
 
5498 5498
 		}
5499 5499
 
5500
-		for ( $c = 0; $c < $images_count; $c++ ) {
5500
+		for ($c = 0; $c < $images_count; $c++) {
5501 5501
 			$csv_rows[0][] = 'IMAGE';
5502 5502
 		}
5503 5503
 	}
@@ -5519,19 +5519,19 @@  discard block
 block discarded – undo
5519 5519
  * @param int $page_no Page number. Default 0.
5520 5520
  * @return array Array of posts data.
5521 5521
  */
5522
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5522
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5523 5523
     global $wpdb, $plugin_prefix;
5524 5524
 
5525
-    if ( ! post_type_exists( $post_type ) )
5525
+    if (!post_type_exists($post_type))
5526 5526
         return new stdClass;
5527 5527
         
5528 5528
     $table = $plugin_prefix . $post_type . '_detail';
5529 5529
 
5530 5530
     $limit = '';
5531
-    if ( $per_page > 0 && $page_no > 0 ) {
5532
-        $offset = ( $page_no - 1 ) * $per_page;
5531
+    if ($per_page > 0 && $page_no > 0) {
5532
+        $offset = ($page_no - 1) * $per_page;
5533 5533
         
5534
-        if ( $offset > 0 ) {
5534
+        if ($offset > 0) {
5535 5535
             $limit = " LIMIT " . $offset . "," . $per_page;
5536 5536
         } else {
5537 5537
             $limit = " LIMIT " . $per_page;
@@ -5541,8 +5541,8 @@  discard block
 block discarded – undo
5541 5541
     // Skip listing with statuses trash, auto-draft etc...
5542 5542
     $skip_statuses = geodir_imex_export_skip_statuses();
5543 5543
     $where_statuses = '';
5544
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5545
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5544
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5545
+        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode("','", $skip_statuses) . "')";
5546 5546
     }
5547 5547
 
5548 5548
     $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit;
@@ -5555,9 +5555,9 @@  discard block
 block discarded – undo
5555 5555
      * @param int $query The SQL query.
5556 5556
      * @param string $post_type Post type.
5557 5557
      */
5558
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5558
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5559 5559
 
5560
-    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
5560
+    $results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
5561 5561
 
5562 5562
     /**
5563 5563
      * Modify returned post results for the current post type.
@@ -5568,7 +5568,7 @@  discard block
 block discarded – undo
5568 5568
      * @param object $results An object containing all post ids.
5569 5569
      * @param string $post_type Post type.
5570 5570
      */
5571
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5571
+    return apply_filters('geodir_export_posts', $results, $post_type);
5572 5572
 }
5573 5573
 
5574 5574
 /**
@@ -5585,8 +5585,8 @@  discard block
 block discarded – undo
5585 5585
  * @param string $post_type Post type.
5586 5586
  * @return string The SQL query.
5587 5587
  */
5588
-function geodir_imex_get_events_query( $query, $post_type ) {
5589
-    if ( $post_type == 'gd_event' ) {
5588
+function geodir_imex_get_events_query($query, $post_type) {
5589
+    if ($post_type == 'gd_event') {
5590 5590
         global $wpdb, $plugin_prefix;
5591 5591
         
5592 5592
         $table = $plugin_prefix . $post_type . '_detail';
@@ -5595,8 +5595,8 @@  discard block
 block discarded – undo
5595 5595
         // Skip listing with statuses trash, auto-draft etc...
5596 5596
         $skip_statuses = geodir_imex_export_skip_statuses();
5597 5597
         $where_statuses = '';
5598
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5599
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5598
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5599
+            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode("','", $skip_statuses) . "')";
5600 5600
         }
5601 5601
 
5602 5602
         $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
@@ -5614,15 +5614,15 @@  discard block
 block discarded – undo
5614 5614
  * @param  string $post_type Post type.
5615 5615
  * @return int Total terms count.
5616 5616
  */
5617
-function geodir_get_terms_count( $post_type ) {
5618
-	$args = array( 'hide_empty' => 0 );
5617
+function geodir_get_terms_count($post_type) {
5618
+	$args = array('hide_empty' => 0);
5619 5619
 	
5620
-	remove_all_filters( 'get_terms' );
5620
+	remove_all_filters('get_terms');
5621 5621
 	
5622 5622
 	$taxonomy = $post_type . 'category';
5623 5623
 
5624
-	$count_terms = wp_count_terms( $taxonomy, $args );
5625
-	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5624
+	$count_terms = wp_count_terms($taxonomy, $args);
5625
+	$count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5626 5626
 	 
5627 5627
 	return $count_terms;
5628 5628
 }
@@ -5639,23 +5639,23 @@  discard block
 block discarded – undo
5639 5639
  * @param int $page_no Page number. Default 0.
5640 5640
  * @return array Array of terms data.
5641 5641
  */
5642
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5643
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5642
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5643
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5644 5644
 	
5645
-	remove_all_filters( 'get_terms' );
5645
+	remove_all_filters('get_terms');
5646 5646
 	
5647 5647
 	$taxonomy = $post_type . 'category';
5648 5648
 	
5649
-	if ( $per_page > 0 && $page_no > 0 ) {
5650
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5649
+	if ($per_page > 0 && $page_no > 0) {
5650
+		$args['offset'] = ($page_no - 1) * $per_page;
5651 5651
 		$args['number'] = $per_page;
5652 5652
 	}
5653 5653
 	
5654
-	$terms = get_terms( $taxonomy, $args );
5654
+	$terms = get_terms($taxonomy, $args);
5655 5655
 
5656 5656
 	$csv_rows = array();
5657 5657
 	
5658
-	if ( !empty( $terms ) ) {
5658
+	if (!empty($terms)) {
5659 5659
 		$csv_row = array();
5660 5660
 		$csv_row[] = 'cat_id';
5661 5661
 		$csv_row[] = 'cat_name';
@@ -5676,16 +5676,16 @@  discard block
 block discarded – undo
5676 5676
 		
5677 5677
 		$csv_rows[] = $csv_row;
5678 5678
 		
5679
-		foreach ( $terms as $term ) {			
5680
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5681
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5679
+		foreach ($terms as $term) {			
5680
+			$cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5681
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5682 5682
 			
5683
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5684
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5683
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5684
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5685 5685
 			
5686 5686
 			$cat_parent = '';
5687
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5688
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5687
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5688
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5689 5689
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5690 5690
 			}
5691 5691
 			
@@ -5695,14 +5695,14 @@  discard block
 block discarded – undo
5695 5695
 			$csv_row[] = $term->slug;
5696 5696
 			$csv_row[] = $post_type;
5697 5697
 			$csv_row[] = $cat_parent;
5698
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5698
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5699 5699
 			$csv_row[] = $term->description;
5700
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5700
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5701 5701
 			$csv_row[] = $cat_image;
5702 5702
 			$csv_row[] = $cat_icon;
5703 5703
 			// WPML
5704 5704
 			if ($is_wpml) {
5705
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5705
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_' . $taxonomy);
5706 5706
 			}
5707 5707
 			// WPML
5708 5708
 			
@@ -5721,7 +5721,7 @@  discard block
 block discarded – undo
5721 5721
  * @param  bool $relative True for relative path & False for absolute path.
5722 5722
  * @return string Path to the cache directory.
5723 5723
  */
5724
-function geodir_path_import_export( $relative = true ) {
5724
+function geodir_path_import_export($relative = true) {
5725 5725
 	$upload_dir = wp_upload_dir();
5726 5726
 	
5727 5727
 	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
@@ -5740,8 +5740,8 @@  discard block
 block discarded – undo
5740 5740
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5741 5741
  * @return bool true if success otherwise false.
5742 5742
  */
5743
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5744
-	if ( empty( $csv_data ) ) {
5743
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5744
+	if (empty($csv_data)) {
5745 5745
 		return false;
5746 5746
 	}
5747 5747
 	
@@ -5749,17 +5749,17 @@  discard block
 block discarded – undo
5749 5749
 	
5750 5750
 	$mode = $clear ? 'w+' : 'a+';
5751 5751
 	
5752
-	if ( function_exists( 'fputcsv' ) ) {
5753
-		$file = fopen( $file_path, $mode );
5754
-		foreach( $csv_data as $csv_row ) {
5752
+	if (function_exists('fputcsv')) {
5753
+		$file = fopen($file_path, $mode);
5754
+		foreach ($csv_data as $csv_row) {
5755 5755
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5756
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5756
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5757 5757
 		}
5758
-		fclose( $file );
5758
+		fclose($file);
5759 5759
 	} else {
5760
-		foreach( $csv_data as $csv_row ) {
5760
+		foreach ($csv_data as $csv_row) {
5761 5761
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5762
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5762
+			$wp_filesystem->put_contents($file_path, $csv_row);
5763 5763
 		}
5764 5764
 	}
5765 5765
 		
@@ -5777,14 +5777,14 @@  discard block
 block discarded – undo
5777 5777
  * @param  string $file Full path to file.
5778 5778
  * @return int No of file rows.
5779 5779
  */
5780
-function geodir_import_export_line_count( $file ) {
5780
+function geodir_import_export_line_count($file) {
5781 5781
 	global $wp_filesystem;
5782 5782
 	
5783
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5784
-		$contents = $wp_filesystem->get_contents_array( $file );
5783
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5784
+		$contents = $wp_filesystem->get_contents_array($file);
5785 5785
 		
5786
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5787
-			return count( $contents ) - 1;
5786
+		if (!empty($contents) && is_array($contents)) {
5787
+			return count($contents) - 1;
5788 5788
 		}
5789 5789
 	}
5790 5790
 	
@@ -5801,11 +5801,11 @@  discard block
 block discarded – undo
5801 5801
  * @param string $post_type The post type.
5802 5802
  * @return object Queried object.
5803 5803
  */
5804
-function geodir_imex_get_custom_fields( $post_type ) {
5804
+function geodir_imex_get_custom_fields($post_type) {
5805 5805
 	global $wpdb;
5806 5806
 	 
5807
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
5808
-	$rows = $wpdb->get_results( $sql );
5807
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
5808
+	$rows = $wpdb->get_results($sql);
5809 5809
 	 
5810 5810
 	return $rows;
5811 5811
 }
@@ -5887,9 +5887,9 @@  discard block
 block discarded – undo
5887 5887
 	$post_table = $plugin_prefix . $post_type . '_detail';
5888 5888
 	
5889 5889
 	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
5890
-	$data = (array)$wpdb->get_row($query);
5890
+	$data = (array) $wpdb->get_row($query);
5891 5891
 	
5892
-	if ( !empty( $data ) ) {
5892
+	if (!empty($data)) {
5893 5893
 		$data['post_id'] = $tr_post_id;
5894 5894
 		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
5895 5895
 		
@@ -5917,7 +5917,7 @@  discard block
 block discarded – undo
5917 5917
 	global $sitepress, $wpdb;
5918 5918
 	$post_type = get_post_type($master_post_id);
5919 5919
 	
5920
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
5920
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
5921 5921
 
5922 5922
 	$taxonomies = get_object_taxonomies($post_type);
5923 5923
 	foreach ($taxonomies as $taxonomy) {
@@ -5926,9 +5926,9 @@  discard block
 block discarded – undo
5926 5926
 		
5927 5927
 		if ($terms) {
5928 5928
 			foreach ($terms as $term) {
5929
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
5929
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
5930 5930
 				
5931
-				if (!is_null($tr_id)){
5931
+				if (!is_null($tr_id)) {
5932 5932
 					// not using get_term - unfiltered get_term
5933 5933
 					$translated_term = $wpdb->get_row($wpdb->prepare("
5934 5934
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -5937,8 +5937,8 @@  discard block
 block discarded – undo
5937 5937
 				}
5938 5938
 			}
5939 5939
 
5940
-			if (!is_taxonomy_hierarchical($taxonomy)){
5941
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
5940
+			if (!is_taxonomy_hierarchical($taxonomy)) {
5941
+				$terms_array = array_unique(array_map('intval', $terms_array));
5942 5942
 			}
5943 5943
 
5944 5944
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
@@ -5971,9 +5971,9 @@  discard block
 block discarded – undo
5971 5971
 	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
5972 5972
 	$post_images = $wpdb->get_results($query);
5973 5973
 	
5974
-	if ( !empty( $post_images ) ) {
5975
-		foreach ( $post_images as $post_image) {
5976
-			$image_data = (array)$post_image;
5974
+	if (!empty($post_images)) {
5975
+		foreach ($post_images as $post_image) {
5976
+			$image_data = (array) $post_image;
5977 5977
 			unset($image_data['ID']);
5978 5978
 			$image_data['post_id'] = $tr_post_id;
5979 5979
 			
@@ -5999,10 +5999,10 @@  discard block
 block discarded – undo
5999 5999
  * @return array Event data array.
6000 6000
  */
6001 6001
 function geodir_imex_get_event_data($post, $gd_post_info) {
6002
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6002
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
6003 6003
 	$event_enddate = $event_date;
6004
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6005
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6004
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
6005
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
6006 6006
 	
6007 6007
 	$is_recurring_event = '';
6008 6008
 	$event_duration_days = '';
@@ -6019,15 +6019,15 @@  discard block
 block discarded – undo
6019 6019
 		
6020 6020
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6021 6021
 	if (!empty($recurring_data)) {
6022
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6023
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6024
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6025
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6022
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
6023
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
6024
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
6025
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
6026 6026
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6027 6027
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
6028 6028
 	
6029
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6030
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6029
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
6030
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
6031 6031
 			
6032 6032
 		if ($recurring_pkg && $is_recurring) {
6033 6033
 			$recurring_dates = $event_date;
@@ -6037,13 +6037,13 @@  discard block
 block discarded – undo
6037 6037
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6038 6038
 			
6039 6039
 			if (!empty($recurring_data['event_recurring_dates'])) {
6040
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6040
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
6041 6041
 				
6042 6042
 				if (!empty($event_recurring_dates)) {
6043 6043
 					$recurring_dates = array();
6044 6044
 					
6045 6045
 					foreach ($event_recurring_dates as $date) {
6046
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6046
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
6047 6047
 					}
6048 6048
 					
6049 6049
 					$recurring_dates = implode(",", $recurring_dates);
@@ -6059,7 +6059,7 @@  discard block
 block discarded – undo
6059 6059
 						$times = array();
6060 6060
 						
6061 6061
 						foreach ($recurring_data['starttimes'] as $time) {
6062
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6062
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6063 6063
 						}
6064 6064
 						
6065 6065
 						$event_starttimes = implode(",", $times);
@@ -6069,7 +6069,7 @@  discard block
 block discarded – undo
6069 6069
 						$times = array();
6070 6070
 						
6071 6071
 						foreach ($recurring_data['endtimes'] as $time) {
6072
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6072
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6073 6073
 						}
6074 6074
 						
6075 6075
 						$event_endtimes = implode(",", $times);
@@ -6081,8 +6081,8 @@  discard block
 block discarded – undo
6081 6081
 					}
6082 6082
 				}
6083 6083
 			} else {
6084
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6085
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6084
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
6085
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6086 6086
 				
6087 6087
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6088 6088
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -6098,11 +6098,11 @@  discard block
 block discarded – undo
6098 6098
 				}
6099 6099
 				
6100 6100
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6101
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6102
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6101
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
6102
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
6103 6103
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6104 6104
 				} else {
6105
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6105
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
6106 6106
 				}
6107 6107
 			}
6108 6108
 		}
@@ -6166,9 +6166,9 @@  discard block
 block discarded – undo
6166 6166
  * @return array Event data array.
6167 6167
  */
6168 6168
 function geodir_imex_process_event_data($gd_post) {
6169
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6169
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
6170 6170
 
6171
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6171
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
6172 6172
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6173 6173
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6174 6174
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6215,17 +6215,17 @@  discard block
 block discarded – undo
6215 6215
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6216 6216
 			}
6217 6217
 		} else {
6218
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6219
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6220
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6221
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6218
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6219
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6220
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6221
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6222 6222
 			
6223 6223
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6224 6224
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6225 6225
 			
6226 6226
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6227 6227
 			
6228
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6228
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6229 6229
 			$repeat_days = array();
6230 6230
 			if (!empty($a_repeat_days)) {
6231 6231
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6243,7 +6243,7 @@  discard block
 block discarded – undo
6243 6243
 			$repeat_weeks = array();
6244 6244
 			if (!empty($a_repeat_weeks)) {
6245 6245
 				foreach ($a_repeat_weeks as $repeat_week) {
6246
-					$repeat_weeks[] = (int)$repeat_week;
6246
+					$repeat_weeks[] = (int) $repeat_week;
6247 6247
 				}
6248 6248
 				
6249 6249
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6362,7 +6362,7 @@  discard block
 block discarded – undo
6362 6362
  */
6363 6363
 function geodir_admin_upgrade_notice() {
6364 6364
     $class = "error";
6365
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6365
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6366 6366
     echo"<div class=\"$class\"> <p>$message</p></div>";
6367 6367
 }
6368 6368
 
@@ -6374,7 +6374,7 @@  discard block
 block discarded – undo
6374 6374
  * @param (object) $r
6375 6375
  * @return (string) $output
6376 6376
  */
6377
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6377
+function geodire_admin_upgrade_notice($plugin_data, $r)
6378 6378
 {
6379 6379
     // readme contents
6380 6380
     $args = array(
@@ -6382,7 +6382,7 @@  discard block
 block discarded – undo
6382 6382
         'redirection' => 5
6383 6383
     );
6384 6384
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6385
-    $data       = wp_remote_get( $url, $args );
6385
+    $data = wp_remote_get($url, $args);
6386 6386
 
6387 6387
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6388 6388
 
@@ -6397,20 +6397,20 @@  discard block
 block discarded – undo
6397 6397
 function geodir_in_plugin_update_message($content) {
6398 6398
     // Output Upgrade Notice
6399 6399
     $matches        = null;
6400
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6400
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote(GEODIRECTORY_VERSION) . '\s*=|$)~Uis';
6401 6401
     $upgrade_notice = '';
6402
-    if ( preg_match( $regexp, $content, $matches ) ) {
6403
-        if(empty($matches)){return;}
6402
+    if (preg_match($regexp, $content, $matches)) {
6403
+        if (empty($matches)) {return; }
6404 6404
 
6405
-        $version = trim( $matches[1] );
6406
-        if($version && $version>GEODIRECTORY_VERSION){
6405
+        $version = trim($matches[1]);
6406
+        if ($version && $version > GEODIRECTORY_VERSION) {
6407 6407
 
6408 6408
 
6409
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6410
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6409
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6410
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6411 6411
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6412
-            foreach ( $notices as $index => $line ) {
6413
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6412
+            foreach ($notices as $index => $line) {
6413
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6414 6414
             }
6415 6415
             $upgrade_notice .= '</div> ';
6416 6416
         }
@@ -6434,7 +6434,7 @@  discard block
 block discarded – undo
6434 6434
 		$default_language = $sitepress->get_default_language();
6435 6435
 		if ($current_language != 'all' && $current_language != $default_language) {
6436 6436
 	?>
6437
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
6437
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
6438 6438
 	<?php
6439 6439
 		}
6440 6440
 	}
@@ -6449,7 +6449,7 @@  discard block
 block discarded – undo
6449 6449
  * @param array Listing statuses to be skipped.
6450 6450
  */
6451 6451
 function geodir_imex_export_skip_statuses() {
6452
-    $statuses = array( 'trash', 'auto-draft' );
6452
+    $statuses = array('trash', 'auto-draft');
6453 6453
     
6454 6454
     /**
6455 6455
      * Filter the statuses to skip during GD export listings.
@@ -6459,7 +6459,7 @@  discard block
 block discarded – undo
6459 6459
      *
6460 6460
      * @param array $statuses Listing statuses to be skipped.
6461 6461
      */
6462
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6462
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6463 6463
      
6464 6464
     return $statuses;
6465 6465
 }
Please login to merge, or discard this patch.
Braces   +231 added lines, -127 removed lines patch added patch discarded remove patch
@@ -183,8 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
         $thumb_img_arr = array();
185 185
 
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
186
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
187
+                    $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+        }
188 189
 
189 190
         $totImg = '';
190 191
         $image_limit = '';
@@ -235,7 +236,9 @@  discard block
 block discarded – undo
235 236
     {
236 237
         global $menu, $geodirectory;
237 238
 
238
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
239
+        if (current_user_can('manage_options')) {
240
+        	$menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
241
+        }
239 242
 
240 243
         add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
241 244
 
@@ -299,7 +302,9 @@  discard block
 block discarded – undo
299 302
      */
300 303
     function geodir_admin_custom_menu_order()
301 304
     {
302
-        if (!current_user_can('manage_options')) return false;
305
+        if (!current_user_can('manage_options')) {
306
+        	return false;
307
+        }
303 308
         return true;
304 309
     }
305 310
 }
@@ -330,10 +335,11 @@  discard block
 block discarded – undo
330 335
 			case 'fail':
331 336
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
332 337
 				
333
-				if ($gderr == 21)
334
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
335
-				else
336
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
338
+				if ($gderr == 21) {
339
+							    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
340
+				} else {
341
+									echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
342
+				}
337 343
                 break;
338 344
         }
339 345
     }
@@ -370,8 +376,12 @@  discard block
 block discarded – undo
370 376
         include_once('option-pages/' . $current_tab . '_array.php');
371 377
     }
372 378
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
373
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
374
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
379
+        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) {
380
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
381
+        }
382
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) {
383
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
+        }
375 385
 		
376 386
 		/**
377 387
 		 * Fires before updating geodirectory admin settings.
@@ -383,8 +393,9 @@  discard block
 block discarded – undo
383 393
 		 */
384 394
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
385 395
 		
386
-        if (!empty($geodir_settings[$current_tab]))
387
-            geodir_update_options($geodir_settings[$current_tab]);
396
+        if (!empty($geodir_settings[$current_tab])) {
397
+                    geodir_update_options($geodir_settings[$current_tab]);
398
+        }
388 399
 
389 400
         /**
390 401
          * Called after GeoDirectory options settings are updated.
@@ -452,8 +463,9 @@  discard block
 block discarded – undo
452 463
                 $options_list = '';
453 464
                 for ($option = 1; $option <= 30; $option++) {
454 465
                     $selected = '';
455
-                    if ($option == 10)
456
-                        $selected = 'selected="selected"';
466
+                    if ($option == 10) {
467
+                                            $selected = 'selected="selected"';
468
+                    }
457 469
 
458 470
                     $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
459 471
                 }
@@ -649,10 +661,11 @@  discard block
 block discarded – undo
649 661
                     }
650 662
 
651 663
 
652
-                    if (geodir_dummy_folder_exists())
653
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
654
-                    else
655
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
664
+                    if (geodir_dummy_folder_exists()) {
665
+                                            $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
+                    } else {
667
+                                            $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
668
+                    }
656 669
 
657 670
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
658 671
 
@@ -693,10 +706,11 @@  discard block
 block discarded – undo
693 706
             if (!term_exists($catname, 'gd_placecategory')) {
694 707
                 $last_catid = wp_insert_term($catname, 'gd_placecategory');
695 708
 
696
-                if (geodir_dummy_folder_exists())
697
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
698
-                else
699
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
709
+                if (geodir_dummy_folder_exists()) {
710
+                                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
711
+                } else {
712
+                                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
713
+                }
700 714
 
701 715
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
702 716
 
@@ -748,11 +762,14 @@  discard block
 block discarded – undo
748 762
  * @return bool Returns true if saved.
749 763
  */
750 764
 function geodir_update_options($options, $dummy = false) {
751
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
765
+    if ((!isset($_POST) || !$_POST) && !$dummy) {
766
+    	return false;
767
+    }
752 768
 
753 769
     foreach ($options as $value) {
754
-        if ($dummy && isset($value['std']))
755
-            $_POST[$value['id']] = $value['std'];
770
+        if ($dummy && isset($value['std'])) {
771
+                    $_POST[$value['id']] = $value['std'];
772
+        }
756 773
 
757 774
 
758 775
         if (isset($value['type']) && $value['type'] == 'checkbox') :
@@ -761,25 +778,23 @@  discard block
 block discarded – undo
761 778
                 update_option($value['id'], $_POST[$value['id']]);
762 779
             } else {
763 780
                 update_option($value['id'], 0);
764
-            }
765
-
766
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
781
+            } elseif (isset($value['type']) && $value['type'] == 'image_width') :
767 782
 
768 783
             if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
769 784
                 update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
770 785
                 update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
771 786
                 if (isset($_POST[$value['id'] . '_crop'])) :
772 787
                     update_option($value['id'] . '_crop', 1);
773
-                else :
774
-                    update_option($value['id'] . '_crop', 0);
788
+                else {
789
+                	:
790
+                    update_option($value['id'] . '_crop', 0);
791
+                }
775 792
                 endif;
776 793
             } else {
777 794
                 update_option($value['id'] . '_width', $value['std']);
778 795
                 update_option($value['id'] . '_height', $value['std']);
779 796
                 update_option($value['id'] . '_crop', 1);
780
-            }
781
-
782
-        elseif (isset($value['type']) && $value['type'] == 'map') :
797
+            } elseif (isset($value['type']) && $value['type'] == 'map') :
783 798
             $post_types = array();
784 799
             $categories = array();
785 800
 
@@ -824,8 +839,9 @@  discard block
 block discarded – undo
824 839
                     $image_name_arr = explode('/', get_option($value['id']));
825 840
                     $noimg_name = end($image_name_arr);
826 841
                     $img_path = $uploads['path'] . '/' . $noimg_name;
827
-                    if (file_exists($img_path))
828
-                        unlink($img_path);
842
+                    if (file_exists($img_path)) {
843
+                                            unlink($img_path);
844
+                    }
829 845
                 }
830 846
 
831 847
                 update_option($value['id'], '');
@@ -841,8 +857,10 @@  discard block
 block discarded – undo
841 857
                 foreach ($uploadedfile as $key => $uplaod):
842 858
                     if ($key == 'name'):
843 859
                         $uplaods[$key] = $filename;
844
-                    else :
845
-                        $uplaods[$key] = $uplaod;
860
+                    else {
861
+                    	:
862
+                        $uplaods[$key] = $uplaod;
863
+                    }
846 864
                     endif;
847 865
                 endforeach;
848 866
 
@@ -852,8 +870,9 @@  discard block
 block discarded – undo
852 870
                     $image_name_arr = explode('/', get_option($value['id']));
853 871
                     $noimg_name = end($image_name_arr);
854 872
                     $img_path = $uploads['path'] . '/' . $noimg_name;
855
-                    if (file_exists($img_path))
856
-                        unlink($img_path);
873
+                    if (file_exists($img_path)) {
874
+                                            unlink($img_path);
875
+                    }
857 876
                 }
858 877
 
859 878
                 $upload_overrides = array('test_form' => false);
@@ -868,10 +887,12 @@  discard block
 block discarded – undo
868 887
             endif;
869 888
 
870 889
 
871
-        else :
890
+        else {
891
+        	:
872 892
             // same menu setting per theme.
873 893
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
874
-                $theme = wp_get_theme();
894
+                $theme = wp_get_theme();
895
+        }
875 896
                 update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
876 897
             }
877 898
 
@@ -883,8 +904,9 @@  discard block
 block discarded – undo
883 904
 
884 905
         endif;
885 906
     }
886
-    if ($dummy)
887
-        $_POST = array();
907
+    if ($dummy) {
908
+            $_POST = array();
909
+    }
888 910
     return true;
889 911
 
890 912
 }
@@ -1029,9 +1051,12 @@  discard block
 block discarded – undo
1029 1051
         $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1030 1052
             'categorys' => __('Categories', 'geodirectory'));
1031 1053
 
1032
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1054
+        if (($offset = array_search('author', array_keys($columns))) === false) {
1055
+        	// if the key doesn't exist
1033 1056
         {
1034
-            $offset = 0; // should we prepend $array with $data?
1057
+            $offset = 0;
1058
+        }
1059
+        // should we prepend $array with $data?
1035 1060
             $offset = count($columns); // or should we append $array with $data? lets pick this one...
1036 1061
         }
1037 1062
 
@@ -1091,11 +1116,13 @@  discard block
 block discarded – undo
1091 1116
                     $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1092 1117
                 }
1093 1118
                 /* If no expire_date is found, output a default message. */
1094
-                if (empty($expire_date))
1095
-                    echo __('Unknown', 'geodirectory');
1119
+                if (empty($expire_date)) {
1120
+                                    echo __('Unknown', 'geodirectory');
1121
+                }
1096 1122
                 /* If there is a expire_date, append 'days left' to the text string. */
1097
-                else
1098
-                    echo $expire_date . $date_diff_text;
1123
+                else {
1124
+                                    echo $expire_date . $date_diff_text;
1125
+                }
1099 1126
                 break;
1100 1127
 
1101 1128
             /* If displaying the 'categorys' column. */
@@ -1168,21 +1195,26 @@  discard block
 block discarded – undo
1168 1195
 
1169 1196
     $geodir_posttypes = geodir_get_posttypes();
1170 1197
 
1171
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1172
-        return;
1198
+    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
1199
+            return;
1200
+    }
1173 1201
 
1174 1202
     if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1175
-        if (isset($_REQUEST['_status']))
1176
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1203
+        if (isset($_REQUEST['_status'])) {
1204
+                    geodir_change_post_status($post_id, $_REQUEST['_status']);
1205
+        }
1177 1206
 
1178
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1179
-            return;
1207
+        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) {
1208
+                    return;
1209
+        }
1180 1210
 
1181
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1182
-            return;
1211
+        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) {
1212
+                    return;
1213
+        }
1183 1214
 
1184
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1185
-            return;
1215
+        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) {
1216
+                    return;
1217
+        }
1186 1218
 
1187 1219
         geodir_save_listing($_REQUEST);
1188 1220
     }
@@ -1207,10 +1239,18 @@  discard block
 block discarded – undo
1207 1239
     $tab_id = '';
1208 1240
     $i = 0;
1209 1241
     foreach ($options as $value) :
1210
-        if (!isset($value['name'])) $value['name'] = '';
1211
-        if (!isset($value['class'])) $value['class'] = '';
1212
-        if (!isset($value['css'])) $value['css'] = '';
1213
-        if (!isset($value['std'])) $value['std'] = '';
1242
+        if (!isset($value['name'])) {
1243
+        	$value['name'] = '';
1244
+        }
1245
+        if (!isset($value['class'])) {
1246
+        	$value['class'] = '';
1247
+        }
1248
+        if (!isset($value['css'])) {
1249
+        	$value['css'] = '';
1250
+        }
1251
+        if (!isset($value['std'])) {
1252
+        	$value['std'] = '';
1253
+        }
1214 1254
         $desc = '';
1215 1255
         switch ($value['type']) :
1216 1256
             case 'dummy_installer':
@@ -1226,11 +1266,13 @@  discard block
 block discarded – undo
1226 1266
 
1227 1267
                 $i++;
1228 1268
 
1229
-                if (isset($value['id']) && $value['id'])
1230
-                    $tab_id = $value['id'];
1269
+                if (isset($value['id']) && $value['id']) {
1270
+                                    $tab_id = $value['id'];
1271
+                }
1231 1272
 
1232
-                if (isset($value['desc']) && $value['desc'])
1233
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1273
+                if (isset($value['desc']) && $value['desc']) {
1274
+                                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1275
+                }
1234 1276
 
1235 1277
                 if (isset($value['name']) && $value['name']) {
1236 1278
                     if ($first_title === true) {
@@ -1261,10 +1303,12 @@  discard block
 block discarded – undo
1261 1303
                 break;
1262 1304
 
1263 1305
             case 'sectionstart':
1264
-                if (isset($value['desc']) && $value['desc'])
1265
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1266
-                if (isset($value['name']) && $value['name'])
1267
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1306
+                if (isset($value['desc']) && $value['desc']) {
1307
+                                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1308
+                }
1309
+                if (isset($value['name']) && $value['name']) {
1310
+                                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1311
+                }
1268 1312
                 /**
1269 1313
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1270 1314
                  *
@@ -1272,7 +1316,9 @@  discard block
 block discarded – undo
1272 1316
                  *
1273 1317
                  * @since 1.0.0
1274 1318
                  */
1275
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1319
+                if (isset($value['id']) && $value['id']) {
1320
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1321
+                }
1276 1322
                 echo '<table class="form-table">' . "\n\n";
1277 1323
 
1278 1324
                 break;
@@ -1284,7 +1330,9 @@  discard block
 block discarded – undo
1284 1330
                  *
1285 1331
                  * @since 1.0.0
1286 1332
                  */
1287
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1333
+                if (isset($value['id']) && $value['id']) {
1334
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1335
+                }
1288 1336
                 echo '</table>';
1289 1337
                 /**
1290 1338
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1293,7 +1341,9 @@  discard block
 block discarded – undo
1293 1341
                  *
1294 1342
                  * @since 1.0.0
1295 1343
                  */
1296
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1344
+                if (isset($value['id']) && $value['id']) {
1345
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1346
+                }
1297 1347
                 break;
1298 1348
             case 'text':
1299 1349
                 ?>
@@ -1365,17 +1415,32 @@  discard block
 block discarded – undo
1365 1415
                     <?php _e('Width', 'geodirectory'); ?> <input
1366 1416
                         name="<?php echo esc_attr($value['id']); ?>_width"
1367 1417
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1368
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1418
+                        value="<?php if ($size = get_option($value['id'] . '_width')) {
1419
+	echo stripslashes($size);
1420
+} else {
1421
+	echo $value['std'];
1422
+}
1423
+?>"/>
1369 1424
 
1370 1425
                     <?php _e('Height', 'geodirectory'); ?> <input
1371 1426
                         name="<?php echo esc_attr($value['id']); ?>_height"
1372 1427
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1373
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1428
+                        value="<?php if ($size = get_option($value['id'] . '_height')) {
1429
+	echo stripslashes($size);
1430
+} else {
1431
+	echo $value['std'];
1432
+}
1433
+?>"/>
1374 1434
 
1375 1435
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1376 1436
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1377 1437
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1378
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1438
+                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') {
1439
+	checked(get_option($value['id'] . '_crop'), 1);
1440
+} else {
1441
+	checked(1);
1442
+}
1443
+?> /></label>
1379 1444
 
1380 1445
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1381 1446
                 </tr><?php
@@ -1389,17 +1454,22 @@  discard block
 block discarded – undo
1389 1454
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
1390 1455
                                             id="<?php echo esc_attr($value['id']); ?>"
1391 1456
                                             style="<?php echo esc_attr($value['css']); ?>"
1392
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1457
+                                            class="<?php if (isset($value['class'])) {
1458
+	echo $value['class'];
1459
+}
1460
+?>"
1393 1461
                                             option-ajaxchosen="false">
1394 1462
                         <?php
1395 1463
                         foreach ($value['options'] as $key => $val) {
1396 1464
                             $geodir_select_value = '';
1397 1465
                             if ($option_value != '') {
1398
-                                if ($option_value != '' && $option_value == $key)
1399
-                                    $geodir_select_value = ' selected="selected" ';
1466
+                                if ($option_value != '' && $option_value == $key) {
1467
+                                                                    $geodir_select_value = ' selected="selected" ';
1468
+                                }
1400 1469
                             } else {
1401
-                                if ($value['std'] == $key)
1402
-                                    $geodir_select_value = ' selected="selected" ';
1470
+                                if ($value['std'] == $key) {
1471
+                                                                    $geodir_select_value = ' selected="selected" ';
1472
+                                }
1403 1473
                             }
1404 1474
                             ?>
1405 1475
                             <option
@@ -1424,8 +1494,14 @@  discard block
 block discarded – undo
1424 1494
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
1425 1495
                                             id="<?php echo esc_attr($value['id']); ?>"
1426 1496
                                             style="<?php echo esc_attr($value['css']); ?>"
1427
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1428
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1497
+                                            class="<?php if (isset($value['class'])) {
1498
+	echo $value['class'];
1499
+}
1500
+?>"
1501
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) {
1502
+	echo $value['placeholder_text'];
1503
+}
1504
+?>"
1429 1505
                                             option-ajaxchosen="false">
1430 1506
                         <?php
1431 1507
                         foreach ($value['options'] as $key => $val) {
@@ -1452,7 +1528,10 @@  discard block
 block discarded – undo
1452 1528
                 <td class="forminp">
1453 1529
                     <input type="file" name="<?php echo esc_attr($value['id']); ?>"
1454 1530
                            id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>"
1455
-                           class="<?php if (isset($value['class'])) echo $value['class']; ?>"/>
1531
+                           class="<?php if (isset($value['class'])) {
1532
+	echo $value['class'];
1533
+}
1534
+?>"/>
1456 1535
                     <?php if (get_option($value['id'])) { ?>
1457 1536
                         <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove"
1458 1537
                                id="<?php echo esc_attr($value['id']); ?>_remove" value="0">
@@ -1533,13 +1612,15 @@  discard block
 block discarded – undo
1533 1612
                                 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1534 1613
                             );
1535 1614
                             $geodir_default_map_language = get_option('geodir_default_map_language');
1536
-                            if (empty($geodir_default_map_language))
1537
-                                $geodir_default_map_language = 'en';
1615
+                            if (empty($geodir_default_map_language)) {
1616
+                                                            $geodir_default_map_language = 'en';
1617
+                            }
1538 1618
                             foreach ($arr_map_langages as $language_key => $language_txt) {
1539
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1540
-                                    $geodir_default_language_selected = "selected='selected'";
1541
-                                else
1542
-                                    $geodir_default_language_selected = '';
1619
+                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) {
1620
+                                                                    $geodir_default_language_selected = "selected='selected'";
1621
+                                } else {
1622
+                                                                    $geodir_default_language_selected = '';
1623
+                                }
1543 1624
 
1544 1625
                                 ?>
1545 1626
                                 <option
@@ -1559,14 +1640,16 @@  discard block
 block discarded – undo
1559 1640
                             <?php
1560 1641
                             $post_types = geodir_get_posttypes('array');
1561 1642
                             $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1562
-                            if (empty($geodir_default_map_search_pt))
1563
-                                $geodir_default_map_search_pt = 'gd_place';
1643
+                            if (empty($geodir_default_map_search_pt)) {
1644
+                                                            $geodir_default_map_search_pt = 'gd_place';
1645
+                            }
1564 1646
                             if (is_array($post_types)) {
1565 1647
                                 foreach ($post_types as $key => $post_types_obj) {
1566
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1567
-                                        $geodir_search_pt_selected = "selected='selected'";
1568
-                                    else
1569
-                                        $geodir_search_pt_selected = '';
1648
+                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) {
1649
+                                                                            $geodir_search_pt_selected = "selected='selected'";
1650
+                                    } else {
1651
+                                                                            $geodir_search_pt_selected = '';
1652
+                                    }
1570 1653
 
1571 1654
                                     ?>
1572 1655
                                     <option
@@ -1686,7 +1769,7 @@  discard block
 block discarded – undo
1686 1769
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1687 1770
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1688 1771
                             echo 'checked="checked"';
1689
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1772
+                        } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1690 1773
                         <?php echo $value['desc']; ?></label><br>
1691 1774
                 </fieldset>
1692 1775
                 <?php
@@ -1706,10 +1789,18 @@  discard block
 block discarded – undo
1706 1789
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1707 1790
                 <td class="forminp">
1708 1791
                     <textarea
1709
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1792
+                        <?php if (isset($value['args'])) {
1793
+	echo $value['args'] . ' ';
1794
+}
1795
+?>name="<?php echo esc_attr($value['id']); ?>"
1710 1796
                         id="<?php echo esc_attr($value['id']); ?>"
1711 1797
                         <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1712
-                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1798
+                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) {
1799
+	echo esc_textarea(stripslashes(get_option($value['id'])));
1800
+} else {
1801
+	echo esc_textarea($value['std']);
1802
+}
1803
+?></textarea><span
1713 1804
                         class="description"><?php echo $value['desc'] ?></span>
1714 1805
 
1715 1806
                 </td>
@@ -1721,10 +1812,11 @@  discard block
 block discarded – undo
1721 1812
                 <tr valign="top">
1722 1813
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1723 1814
                 <td class="forminp"><?php
1724
-                    if (get_option($value['id']))
1725
-                        $content = stripslashes(get_option($value['id']));
1726
-                    else
1727
-                        $content = $value['std'];
1815
+                    if (get_option($value['id'])) {
1816
+                                            $content = stripslashes(get_option($value['id']));
1817
+                    } else {
1818
+                                            $content = $value['std'];
1819
+                    }
1728 1820
 
1729 1821
                     $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1730 1822
 
@@ -1764,7 +1856,9 @@  discard block
 block discarded – undo
1764 1856
                     'echo' => false,
1765 1857
                     'selected' => $page_setting);
1766 1858
 
1767
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1859
+                if (isset($value['args'])) {
1860
+                	$args = wp_parse_args($value['args'], $args);
1861
+                }
1768 1862
 
1769 1863
                 ?>
1770 1864
                 <tr valign="top" class="single_select_page">
@@ -1783,8 +1877,10 @@  discard block
 block discarded – undo
1783 1877
                 if (strstr($country_setting, ':')) :
1784 1878
                     $country = current(explode(':', $country_setting));
1785 1879
                     $state = end(explode(':', $country_setting));
1786
-                else :
1787
-                    $country = $country_setting;
1880
+                else {
1881
+                	:
1882
+                    $country = $country_setting;
1883
+                }
1788 1884
                     $state = '*';
1789 1885
                 endif;
1790 1886
                 ?>
@@ -1811,8 +1907,10 @@  discard block
 block discarded – undo
1811 1907
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1812 1908
                             title="Country" class="chosen_select">
1813 1909
                         <?php
1814
-                        if ($countries) foreach ($countries as $key => $val) :
1815
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1910
+                        if ($countries) {
1911
+                        	foreach ($countries as $key => $val) :
1912
+                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1913
+                        }
1816 1914
                         endforeach;
1817 1915
                         ?>
1818 1916
                     </select>
@@ -2063,8 +2161,9 @@  discard block
 block discarded – undo
2063 2161
         endforeach;
2064 2162
     endif;
2065 2163
 
2066
-    if (!empty($place_img_array))
2067
-        $curImages = implode(',', $place_img_array);
2164
+    if (!empty($place_img_array)) {
2165
+            $curImages = implode(',', $place_img_array);
2166
+    }
2068 2167
 
2069 2168
 
2070 2169
     // adjust values here
@@ -2411,16 +2510,17 @@  discard block
 block discarded – undo
2411 2510
 	
2412 2511
 	$post_type = NULL;
2413 2512
 	
2414
-	if ($post && isset($post->post_type))
2415
-		$post_type = $post->post_type;
2416
-	elseif ($typenow)
2417
-		$post_type = $typenow;
2418
-	elseif ($current_screen && isset($current_screen->post_type))
2419
-		$post_type = $current_screen->post_type;
2420
-	elseif (isset($_REQUEST['post_type']))
2421
-		$post_type = sanitize_key($_REQUEST['post_type']);
2422
-	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2423
-		$post_type = get_post_type($_REQUEST['post']);
2513
+	if ($post && isset($post->post_type)) {
2514
+			$post_type = $post->post_type;
2515
+	} elseif ($typenow) {
2516
+			$post_type = $typenow;
2517
+	} elseif ($current_screen && isset($current_screen->post_type)) {
2518
+			$post_type = $current_screen->post_type;
2519
+	} elseif (isset($_REQUEST['post_type'])) {
2520
+			$post_type = sanitize_key($_REQUEST['post_type']);
2521
+	} elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) {
2522
+			$post_type = get_post_type($_REQUEST['post']);
2523
+	}
2424 2524
 
2425 2525
 	return $post_type;
2426 2526
 }
@@ -2479,9 +2579,10 @@  discard block
 block discarded – undo
2479 2579
 function geodir_hide_admin_preview_button() {
2480 2580
     global $post_type;
2481 2581
     $post_types = geodir_get_posttypes();
2482
-    if(in_array($post_type, $post_types))
2483
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2484
-}
2582
+    if(in_array($post_type, $post_types)) {
2583
+            echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2584
+    }
2585
+    }
2485 2586
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2486 2587
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2487 2588
 
@@ -5522,8 +5623,9 @@  discard block
 block discarded – undo
5522 5623
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5523 5624
     global $wpdb, $plugin_prefix;
5524 5625
 
5525
-    if ( ! post_type_exists( $post_type ) )
5526
-        return new stdClass;
5626
+    if ( ! post_type_exists( $post_type ) ) {
5627
+            return new stdClass;
5628
+    }
5527 5629
         
5528 5630
     $table = $plugin_prefix . $post_type . '_detail';
5529 5631
 
@@ -6314,7 +6416,9 @@  discard block
 block discarded – undo
6314 6416
 
6315 6417
     if ($page_found) :
6316 6418
         // Page exists
6317
-        if (!$option_value) update_option($option, $page_found);
6419
+        if (!$option_value) {
6420
+        	update_option($option, $page_found);
6421
+        }
6318 6422
         return;
6319 6423
     endif;
6320 6424
 
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 3 patches
Indentation   +3089 added lines, -3089 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Plugin general functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Plugin general functions
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 
10 10
 /**
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 function geodir_plugin_url()
29 29
 {
30 30
 
31
-    if (is_ssl()) :
32
-        return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
-    else :
34
-        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
35
-    endif;
31
+	if (is_ssl()) :
32
+		return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
+	else :
34
+		return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
35
+	endif;
36 36
 }
37 37
 
38 38
 
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
-        return dirname(dirname(__FILE__));
52
-    } else {
53
-        return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
54
-    }
50
+	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
51
+		return dirname(dirname(__FILE__));
52
+	} else {
53
+		return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
54
+	}
55 55
 }
56 56
 
57 57
 /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function geodir_is_plugin_active($plugin)
67 67
 {
68
-    $active_plugins = get_option('active_plugins');
69
-    foreach ($active_plugins as $key => $active_plugin) {
70
-        if (strstr($active_plugin, $plugin)) return true;
71
-    }
72
-    return false;
68
+	$active_plugins = get_option('active_plugins');
69
+	foreach ($active_plugins as $key => $active_plugin) {
70
+		if (strstr($active_plugin, $plugin)) return true;
71
+	}
72
+	return false;
73 73
 }
74 74
 
75 75
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function geodir_get_formated_date($date)
87 87
 {
88
-    return mysql2date(get_option('date_format'), $date);
88
+	return mysql2date(get_option('date_format'), $date);
89 89
 }
90 90
 
91 91
 /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_formated_time($time)
102 102
 {
103
-    return mysql2date(get_option('time_format'), $time, $translate = true);
103
+	return mysql2date(get_option('time_format'), $time, $translate = true);
104 104
 }
105 105
 
106 106
 
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
120 120
 {
121
-    if ($use_existing_arguments) $params = $params + $_GET;
122
-    if (!$params) return $url;
123
-    $link = $url;
124
-    if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
-    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&amp;'; //If there is no '&' at the END, add one.
126
-    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
127
-
128
-    $params_arr = array();
129
-    foreach ($params as $key => $value) {
130
-        if (gettype($value) == 'array') { //Handle array data properly
131
-            foreach ($value as $val) {
132
-                $params_arr[] = $key . '[]=' . urlencode($val);
133
-            }
134
-        } else {
135
-            $params_arr[] = $key . '=' . urlencode($value);
136
-        }
137
-    }
138
-    $link .= implode('&', $params_arr);
139
-
140
-    return $link;
121
+	if ($use_existing_arguments) $params = $params + $_GET;
122
+	if (!$params) return $url;
123
+	$link = $url;
124
+	if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&amp;'; //If there is no '&' at the END, add one.
126
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
127
+
128
+	$params_arr = array();
129
+	foreach ($params as $key => $value) {
130
+		if (gettype($value) == 'array') { //Handle array data properly
131
+			foreach ($value as $val) {
132
+				$params_arr[] = $key . '[]=' . urlencode($val);
133
+			}
134
+		} else {
135
+			$params_arr[] = $key . '=' . urlencode($value);
136
+		}
137
+	}
138
+	$link .= implode('&', $params_arr);
139
+
140
+	return $link;
141 141
 }
142 142
 
143 143
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function geodir_get_addlisting_link($post_type = '')
154 154
 {
155
-    global $wpdb;
155
+	global $wpdb;
156 156
 
157
-    //$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
158
-    $check_pkg = 1;
159
-    if (post_type_exists($post_type) && $check_pkg) {
157
+	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
158
+	$check_pkg = 1;
159
+	if (post_type_exists($post_type) && $check_pkg) {
160 160
 
161
-        $add_listing_link = get_page_link(geodir_add_listing_page_id());
161
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
-    } else
165
-        return get_bloginfo('url');
163
+		return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
+	} else
165
+		return get_bloginfo('url');
166 166
 }
167 167
 
168 168
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function geodir_curPageURL()
177 177
 {
178
-    $pageURL = 'http';
179
-    if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
180
-        $pageURL .= "s";
181
-    }
182
-    $pageURL .= "://";
183
-    $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
184
-    /**
185
-     * Filter the current page URL returned by function geodir_curPageURL().
186
-     *
187
-     * @since 1.4.1
188
-     * @param string $pageURL The URL of the current page.
189
-     */
190
-    return apply_filters('geodir_curPageURL', $pageURL);
178
+	$pageURL = 'http';
179
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
180
+		$pageURL .= "s";
181
+	}
182
+	$pageURL .= "://";
183
+	$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
184
+	/**
185
+	 * Filter the current page URL returned by function geodir_curPageURL().
186
+	 *
187
+	 * @since 1.4.1
188
+	 * @param string $pageURL The URL of the current page.
189
+	 */
190
+	return apply_filters('geodir_curPageURL', $pageURL);
191 191
 }
192 192
 
193 193
 
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 function geodir_clean($string)
205 205
 {
206 206
 
207
-    $string = trim(strip_tags(stripslashes($string)));
208
-    $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
209
-    $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
210
-    $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
207
+	$string = trim(strip_tags(stripslashes($string)));
208
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
209
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
210
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
211 211
 
212
-    return $string;
212
+	return $string;
213 213
 }
214 214
 
215 215
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_get_weekday()
223 223
 {
224
-    return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
224
+	return array(__('Sunday', 'geodirectory'), __('Monday', 'geodirectory'), __('Tuesday', 'geodirectory'), __('Wednesday', 'geodirectory'), __('Thursday', 'geodirectory'), __('Friday', 'geodirectory'), __('Saturday', 'geodirectory'));
225 225
 }
226 226
 
227 227
 /**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function geodir_get_weeks()
235 235
 {
236
-    return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
236
+	return array(__('First', 'geodirectory'), __('Second', 'geodirectory'), __('Third', 'geodirectory'), __('Fourth', 'geodirectory'), __('Last', 'geodirectory'));
237 237
 }
238 238
 
239 239
 
@@ -252,103 +252,103 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
256
-    //if(!is_admin()):
257
-
258
-    switch ($gdpage):
259
-        case 'add-listing':
260
-
261
-            if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
262
-                return true;
263
-            } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
264
-                return true;
265
-            }
266
-
267
-            break;
268
-        case 'preview':
269
-            if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
-            )
272
-                return true;
273
-            break;
274
-        case 'listing-success':
275
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
-                return true;
277
-            break;
278
-        case 'detail':
279
-            $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
281
-            if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
-                return true;
283
-            break;
284
-        case 'pt':
285
-            $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
-                return true;
289
-
290
-            break;
291
-        case 'listing':
292
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
293
-                global $current_term, $taxonomy, $term;
294
-
295
-                return true;
296
-            }
297
-            $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
299
-            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
-                return true;
301
-
302
-            break;
303
-        case 'home':
304
-
305
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
-                return true;
307
-
308
-            break;
309
-        case 'location':
310
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
-                return true;
312
-            break;
313
-        case 'author':
314
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
-                return true;
255
+	global $wp_query, $post,$wp;
256
+	//if(!is_admin()):
257
+
258
+	switch ($gdpage):
259
+		case 'add-listing':
260
+
261
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
262
+				return true;
263
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
264
+				return true;
265
+			}
266
+
267
+			break;
268
+		case 'preview':
269
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
+			)
272
+				return true;
273
+			break;
274
+		case 'listing-success':
275
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
+				return true;
277
+			break;
278
+		case 'detail':
279
+			$post_type = get_query_var('post_type');
280
+			if(is_array($post_type)){$post_type = reset($post_type);}
281
+			if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
+				return true;
283
+			break;
284
+		case 'pt':
285
+			$post_type = get_query_var('post_type');
286
+			if(is_array($post_type)){$post_type = reset($post_type);}
287
+			if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
+				return true;
289
+
290
+			break;
291
+		case 'listing':
292
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
293
+				global $current_term, $taxonomy, $term;
294
+
295
+				return true;
296
+			}
297
+			$post_type = get_query_var('post_type');
298
+			if(is_array($post_type)){$post_type = reset($post_type);}
299
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
+				return true;
301
+
302
+			break;
303
+		case 'home':
304
+
305
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
+				return true;
307
+
308
+			break;
309
+		case 'location':
310
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
+				return true;
312
+			break;
313
+		case 'author':
314
+			if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
+				return true;
316 316
 			
317 317
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318 318
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
322
-            break;
323
-        case 'search':
324
-            if (is_search() && isset($_REQUEST['geodir_search']))
325
-                return true;
326
-            break;
327
-        case 'info':
328
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
-                return true;
330
-            break;
331
-        case 'login':
332
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
-                return true;
334
-            break;
335
-        case 'checkout':
336
-            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
-                return true;
338
-            break;
339
-        case 'invoices':
340
-            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
-                return true;
342
-            break;
343
-        default:
344
-            return false;
345
-            break;
346
-
347
-    endswitch;
348
-
349
-    //endif;
350
-
351
-    return false;
322
+			break;
323
+		case 'search':
324
+			if (is_search() && isset($_REQUEST['geodir_search']))
325
+				return true;
326
+			break;
327
+		case 'info':
328
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
+				return true;
330
+			break;
331
+		case 'login':
332
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
+				return true;
334
+			break;
335
+		case 'checkout':
336
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
+				return true;
338
+			break;
339
+		case 'invoices':
340
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
+				return true;
342
+			break;
343
+		default:
344
+			return false;
345
+			break;
346
+
347
+	endswitch;
348
+
349
+	//endif;
350
+
351
+	return false;
352 352
 }
353 353
 
354 354
 /**
@@ -362,97 +362,97 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function geodir_set_is_geodir_page($wp)
364 364
 {
365
-    if (!is_admin()) {
366
-        //$wp->query_vars['gd_is_geodir_page'] = false;
367
-        //print_r()
368
-        if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
-            if (get_option('geodir_set_as_home'))
370
-                $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
372
-                $wp->query_vars['gd_is_geodir_page'] = true;
373
-            }
374
-
375
-
376
-        }
377
-
378
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
379
-            if (
380
-                $wp->query_vars['page_id'] == geodir_add_listing_page_id()
381
-                || $wp->query_vars['page_id'] == geodir_preview_page_id()
382
-                || $wp->query_vars['page_id'] == geodir_success_page_id()
383
-                || $wp->query_vars['page_id'] == geodir_location_page_id()
384
-                || $wp->query_vars['page_id'] == geodir_home_page_id()
385
-                || $wp->query_vars['page_id'] == geodir_info_page_id()
386
-                || $wp->query_vars['page_id'] == geodir_login_page_id()
387
-                || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388
-                || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
-            )
390
-                $wp->query_vars['gd_is_geodir_page'] = true;
391
-        }
392
-
393
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
394
-            $page = get_page_by_path($wp->query_vars['pagename']);
395
-
396
-            if (!empty($page) && (
397
-                    $page->ID == geodir_add_listing_page_id()
398
-                    || $page->ID == geodir_preview_page_id()
399
-                    || $page->ID == geodir_success_page_id()
400
-                    || $page->ID == geodir_location_page_id()
401
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
402
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
403
-                    || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
404
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405
-                    || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406
-                )
407
-            )
408
-                $wp->query_vars['gd_is_geodir_page'] = true;
409
-        }
410
-
411
-
412
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
413
-            $requested_post_type = $wp->query_vars['post_type'];
414
-            // check if this post type is geodirectory post types 
415
-            $post_type_array = geodir_get_posttypes();
416
-            if (in_array($requested_post_type, $post_type_array)) {
417
-                $wp->query_vars['gd_is_geodir_page'] = true;
418
-            }
419
-        }
420
-
421
-        if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422
-            $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
424
-                foreach ($geodir_taxonomis as $taxonomy) {
425
-                    if (array_key_exists($taxonomy, $wp->query_vars)) {
426
-                        $wp->query_vars['gd_is_geodir_page'] = true;
427
-                        break;
428
-                    }
429
-                }
430
-            }
431
-
432
-        }
433
-
434
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
-            $wp->query_vars['gd_is_geodir_page'] = true;
436
-
437
-
438
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
-            $wp->query_vars['gd_is_geodir_page'] = true;
365
+	if (!is_admin()) {
366
+		//$wp->query_vars['gd_is_geodir_page'] = false;
367
+		//print_r()
368
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
+			if (get_option('geodir_set_as_home'))
370
+				$wp->query_vars['gd_is_geodir_page'] = true;
371
+			if(geodir_is_page('home')){
372
+				$wp->query_vars['gd_is_geodir_page'] = true;
373
+			}
374
+
375
+
376
+		}
377
+
378
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
379
+			if (
380
+				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
381
+				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
382
+				|| $wp->query_vars['page_id'] == geodir_success_page_id()
383
+				|| $wp->query_vars['page_id'] == geodir_location_page_id()
384
+				|| $wp->query_vars['page_id'] == geodir_home_page_id()
385
+				|| $wp->query_vars['page_id'] == geodir_info_page_id()
386
+				|| $wp->query_vars['page_id'] == geodir_login_page_id()
387
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
+			)
390
+				$wp->query_vars['gd_is_geodir_page'] = true;
391
+		}
392
+
393
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
394
+			$page = get_page_by_path($wp->query_vars['pagename']);
395
+
396
+			if (!empty($page) && (
397
+					$page->ID == geodir_add_listing_page_id()
398
+					|| $page->ID == geodir_preview_page_id()
399
+					|| $page->ID == geodir_success_page_id()
400
+					|| $page->ID == geodir_location_page_id()
401
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
402
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
403
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
404
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406
+				)
407
+			)
408
+				$wp->query_vars['gd_is_geodir_page'] = true;
409
+		}
410
+
411
+
412
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
413
+			$requested_post_type = $wp->query_vars['post_type'];
414
+			// check if this post type is geodirectory post types 
415
+			$post_type_array = geodir_get_posttypes();
416
+			if (in_array($requested_post_type, $post_type_array)) {
417
+				$wp->query_vars['gd_is_geodir_page'] = true;
418
+			}
419
+		}
420
+
421
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
423
+			if(!empty($geodir_taxonomis)){
424
+				foreach ($geodir_taxonomis as $taxonomy) {
425
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
426
+						$wp->query_vars['gd_is_geodir_page'] = true;
427
+						break;
428
+					}
429
+				}
430
+			}
431
+
432
+		}
433
+
434
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
+			$wp->query_vars['gd_is_geodir_page'] = true;
436
+
437
+
438
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
+			$wp->query_vars['gd_is_geodir_page'] = true;
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
444
-            && !isset($wp->query_vars['page_id'])
445
-            && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
447
-            $wp->query_vars['gd_is_geodir_page'] = true;
448
-        }
449
-        //echo $wp->query_vars['gd_is_geodir_page'] ;
450
-        /*echo "<pre>" ;
443
+		if(!isset($wp->query_vars['gd_is_geodir_page'])
444
+			&& !isset($wp->query_vars['page_id'])
445
+			&& !isset($wp->query_vars['pagename'])
446
+			&& is_page_geodir_home()){
447
+			$wp->query_vars['gd_is_geodir_page'] = true;
448
+		}
449
+		//echo $wp->query_vars['gd_is_geodir_page'] ;
450
+		/*echo "<pre>" ;
451 451
 		print_r($wp) ;
452 452
 		echo "</pre>" ;
453 453
 	//	exit();
454 454
 			*/
455
-    } // end of is admin
455
+	} // end of is admin
456 456
 }
457 457
 
458 458
 /**
@@ -465,56 +465,56 @@  discard block
 block discarded – undo
465 465
  */
466 466
 function geodir_is_geodir_page()
467 467
 {
468
-    global $wp;
469
-    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
-        return true;
471
-    else
472
-        return false;
468
+	global $wp;
469
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
+		return true;
471
+	else
472
+		return false;
473 473
 }
474 474
 
475 475
 if (!function_exists('geodir_get_imagesize')) {
476
-    /**
477
-     * Get image size using the size key .
478
-     *
479
-     * @since 1.0.0
480
-     * @package GeoDirectory
481
-     * @param string $size The image size key.
482
-     * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
483
-     */
484
-    function geodir_get_imagesize($size = '')
485
-    {
486
-
487
-        $imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
488
-            'thumbnail' => array('w' => 125, 'h' => 125),
489
-            'widget-thumb' => array('w' => 50, 'h' => 50),
490
-            'slider-thumb' => array('w' => 100, 'h' => 100)
491
-        );
492
-
493
-        /**
494
-         * Filter the image sizes array.
495
-         *
496
-         * @since 1.0.0
497
-         * @param array $imagesizes Image size array.
498
-         */
499
-        $imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
500
-
501
-        if (!empty($size) && array_key_exists($size, $imagesizes)) {
502
-            /**
503
-             * Filters image size of the passed key.
504
-             *
505
-             * @since 1.0.0
506
-             * @param array $imagesizes[$size] Image size array of the passed key.
507
-             */
508
-            return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
509
-
510
-        } elseif (!empty($size)) {
511
-
512
-            return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
513
-
514
-        }
515
-
516
-        return $imagesizes;
517
-    }
476
+	/**
477
+	 * Get image size using the size key .
478
+	 *
479
+	 * @since 1.0.0
480
+	 * @package GeoDirectory
481
+	 * @param string $size The image size key.
482
+	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
483
+	 */
484
+	function geodir_get_imagesize($size = '')
485
+	{
486
+
487
+		$imagesizes = array('list-thumb' => array('w' => 283, 'h' => 188),
488
+			'thumbnail' => array('w' => 125, 'h' => 125),
489
+			'widget-thumb' => array('w' => 50, 'h' => 50),
490
+			'slider-thumb' => array('w' => 100, 'h' => 100)
491
+		);
492
+
493
+		/**
494
+		 * Filter the image sizes array.
495
+		 *
496
+		 * @since 1.0.0
497
+		 * @param array $imagesizes Image size array.
498
+		 */
499
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
500
+
501
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
502
+			/**
503
+			 * Filters image size of the passed key.
504
+			 *
505
+			 * @since 1.0.0
506
+			 * @param array $imagesizes[$size] Image size array of the passed key.
507
+			 */
508
+			return apply_filters('geodir_get_imagesize_' . $size, $imagesizes[$size]);
509
+
510
+		} elseif (!empty($size)) {
511
+
512
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
513
+
514
+		}
515
+
516
+		return $imagesizes;
517
+	}
518 518
 }
519 519
 
520 520
 /**
@@ -534,151 +534,151 @@  discard block
 block discarded – undo
534 534
 
535 535
 
536 536
 if (!function_exists('createRandomString')) {
537
-    /**
538
-     * Creates random string.
539
-     *
540
-     * @since 1.0.0
541
-     * @package GeoDirectory
542
-     * @return string Random string.
543
-     */
544
-    function createRandomString()
545
-    {
546
-        $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
548
-        $i = 0;
549
-        $rstring = '';
550
-        while ($i <= 25) {
551
-            $num = rand() % 33;
552
-            $tmp = substr($chars, $num, 1);
553
-            $rstring = $rstring . $tmp;
554
-            $i++;
555
-        }
556
-        return $rstring;
557
-    }
537
+	/**
538
+	 * Creates random string.
539
+	 *
540
+	 * @since 1.0.0
541
+	 * @package GeoDirectory
542
+	 * @return string Random string.
543
+	 */
544
+	function createRandomString()
545
+	{
546
+		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
+		srand((double)microtime() * 1000000);
548
+		$i = 0;
549
+		$rstring = '';
550
+		while ($i <= 25) {
551
+			$num = rand() % 33;
552
+			$tmp = substr($chars, $num, 1);
553
+			$rstring = $rstring . $tmp;
554
+			$i++;
555
+		}
556
+		return $rstring;
557
+	}
558 558
 }
559 559
 
560 560
 if (!function_exists('geodir_getDistanceRadius')) {
561
-    /**
562
-     * Calculates the distance radius.
563
-     *
564
-     * @since 1.0.0
565
-     * @package GeoDirectory
566
-     * @param string $uom Measurement unit type.
567
-     * @return float The mean radius.
568
-     */
569
-    function geodir_getDistanceRadius($uom = 'km')
570
-    {
561
+	/**
562
+	 * Calculates the distance radius.
563
+	 *
564
+	 * @since 1.0.0
565
+	 * @package GeoDirectory
566
+	 * @param string $uom Measurement unit type.
567
+	 * @return float The mean radius.
568
+	 */
569
+	function geodir_getDistanceRadius($uom = 'km')
570
+	{
571 571
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
572
-        switch (geodir_strtolower($uom)):
573
-            case 'km'    :
574
-                $earthMeanRadius = 6371.009; // km
575
-                break;
576
-            case 'm'    :
577
-            case 'meters'    :
578
-                $earthMeanRadius = 6371.009 * 1000; // km
579
-                break;
580
-            case 'miles'    :
581
-                $earthMeanRadius = 3958.761; // miles
582
-                break;
583
-            case 'yards'    :
584
-            case 'yds'    :
585
-                $earthMeanRadius = 3958.761 * 1760; // yards
586
-                break;
587
-            case 'feet'    :
588
-            case 'ft'    :
589
-                $earthMeanRadius = 3958.761 * 1760 * 3; // feet
590
-                break;
591
-            case 'nm'    :
592
-                $earthMeanRadius = 3440.069; //  miles
593
-                break;
594
-            default:
595
-                $earthMeanRadius = 3958.761; // miles
596
-                break;
597
-        endswitch;
598
-        return $earthMeanRadius;
599
-    }
572
+		switch (geodir_strtolower($uom)):
573
+			case 'km'    :
574
+				$earthMeanRadius = 6371.009; // km
575
+				break;
576
+			case 'm'    :
577
+			case 'meters'    :
578
+				$earthMeanRadius = 6371.009 * 1000; // km
579
+				break;
580
+			case 'miles'    :
581
+				$earthMeanRadius = 3958.761; // miles
582
+				break;
583
+			case 'yards'    :
584
+			case 'yds'    :
585
+				$earthMeanRadius = 3958.761 * 1760; // yards
586
+				break;
587
+			case 'feet'    :
588
+			case 'ft'    :
589
+				$earthMeanRadius = 3958.761 * 1760 * 3; // feet
590
+				break;
591
+			case 'nm'    :
592
+				$earthMeanRadius = 3440.069; //  miles
593
+				break;
594
+			default:
595
+				$earthMeanRadius = 3958.761; // miles
596
+				break;
597
+		endswitch;
598
+		return $earthMeanRadius;
599
+	}
600 600
 }
601 601
 
602 602
 
603 603
 if (!function_exists('geodir_calculateDistanceFromLatLong')) {
604
-    /**
605
-     * Calculate the great circle distance between two points identified by longitude and latitude.
606
-     *
607
-     * @since 1.0.0
608
-     * @package GeoDirectory
609
-     * @param array $point1 Latitude and Longitude of point 1.
610
-     * @param array $point2 Latitude and Longitude of point 2.
611
-     * @param string $uom Unit of measurement.
612
-     * @return float The distance.
613
-     */
614
-    function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
615
-    {
604
+	/**
605
+	 * Calculate the great circle distance between two points identified by longitude and latitude.
606
+	 *
607
+	 * @since 1.0.0
608
+	 * @package GeoDirectory
609
+	 * @param array $point1 Latitude and Longitude of point 1.
610
+	 * @param array $point2 Latitude and Longitude of point 2.
611
+	 * @param string $uom Unit of measurement.
612
+	 * @return float The distance.
613
+	 */
614
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km')
615
+	{
616 616
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
617 617
 
618
-        $earthMeanRadius = geodir_getDistanceRadius($uom);
618
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
619 619
 
620
-        $deltaLatitude = deg2rad($point2['latitude'] - $point1['latitude']);
621
-        $deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']);
622
-        $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
-            cos(deg2rad($point1['latitude'])) * cos(deg2rad($point2['latitude'])) *
624
-            sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
625
-        $c = 2 * atan2(sqrt($a), sqrt(1 - $a));
626
-        $distance = $earthMeanRadius * $c;
627
-        return $distance;
620
+		$deltaLatitude = deg2rad($point2['latitude'] - $point1['latitude']);
621
+		$deltaLongitude = deg2rad($point2['longitude'] - $point1['longitude']);
622
+		$a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
623
+			cos(deg2rad($point1['latitude'])) * cos(deg2rad($point2['latitude'])) *
624
+			sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
625
+		$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
626
+		$distance = $earthMeanRadius * $c;
627
+		return $distance;
628 628
 
629
-    }
629
+	}
630 630
 }
631 631
 
632 632
 
633 633
 if (!function_exists('geodir_sendEmail')) {
634
-    /**
635
-     * The main function that send transactional emails using the args provided.
636
-     *
637
-     * @since 1.0.0
638
-     * @since 1.5.7 Added db translations for notifications subject and content.
639
-     * @package GeoDirectory
640
-     * @param string $fromEmail Sender email address.
641
-     * @param string $fromEmailName Sender name.
642
-     * @param string $toEmail Receiver email address.
643
-     * @param string $toEmailName Receiver name.
644
-     * @param string $to_subject Email subject.
645
-     * @param string $to_message Email content.
646
-     * @param string $extra Not being used.
647
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
648
-     * @param string $post_id The post ID.
649
-     * @param string $user_id The user ID.
650
-     */
651
-    function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
652
-        $login_details = '';
653
-
654
-        // strip slashes from subject & message text
655
-        $to_subject = stripslashes_deep($to_subject);
656
-        $to_message = stripslashes_deep($to_message);
657
-
658
-        if ($message_type == 'send_friend') {
659
-            $subject = get_option('geodir_email_friend_subject');
660
-            $message = get_option('geodir_email_friend_content');
661
-        } elseif ($message_type == 'send_enquiry') {
662
-            $subject = get_option('geodir_email_enquiry_subject');
663
-            $message = get_option('geodir_email_enquiry_content');
664
-        } elseif ($message_type == 'forgot_password') {
665
-            $subject = get_option('geodir_forgot_password_subject');
666
-            $message = get_option('geodir_forgot_password_content');
667
-            $login_details = $to_message;
668
-        } elseif ($message_type == 'registration') {
669
-            $subject = get_option('geodir_registration_success_email_subject');
670
-            $message = get_option('geodir_registration_success_email_content');
671
-            $login_details = $to_message;
672
-        } elseif ($message_type == 'post_submit') {
673
-            $subject = get_option('geodir_post_submited_success_email_subject');
674
-            $message = get_option('geodir_post_submited_success_email_content');
675
-        } elseif ($message_type == 'listing_published') {
676
-            $subject = get_option('geodir_post_published_email_subject');
677
-            $message = get_option('geodir_post_published_email_content');
678
-        } elseif ($message_type == 'listing_edited') {
679
-            $subject = get_option('geodir_post_edited_email_subject_admin');
680
-            $message = get_option('geodir_post_edited_email_content_admin');
681
-        }
634
+	/**
635
+	 * The main function that send transactional emails using the args provided.
636
+	 *
637
+	 * @since 1.0.0
638
+	 * @since 1.5.7 Added db translations for notifications subject and content.
639
+	 * @package GeoDirectory
640
+	 * @param string $fromEmail Sender email address.
641
+	 * @param string $fromEmailName Sender name.
642
+	 * @param string $toEmail Receiver email address.
643
+	 * @param string $toEmailName Receiver name.
644
+	 * @param string $to_subject Email subject.
645
+	 * @param string $to_message Email content.
646
+	 * @param string $extra Not being used.
647
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration, post_submit, listing_published.
648
+	 * @param string $post_id The post ID.
649
+	 * @param string $user_id The user ID.
650
+	 */
651
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
652
+		$login_details = '';
653
+
654
+		// strip slashes from subject & message text
655
+		$to_subject = stripslashes_deep($to_subject);
656
+		$to_message = stripslashes_deep($to_message);
657
+
658
+		if ($message_type == 'send_friend') {
659
+			$subject = get_option('geodir_email_friend_subject');
660
+			$message = get_option('geodir_email_friend_content');
661
+		} elseif ($message_type == 'send_enquiry') {
662
+			$subject = get_option('geodir_email_enquiry_subject');
663
+			$message = get_option('geodir_email_enquiry_content');
664
+		} elseif ($message_type == 'forgot_password') {
665
+			$subject = get_option('geodir_forgot_password_subject');
666
+			$message = get_option('geodir_forgot_password_content');
667
+			$login_details = $to_message;
668
+		} elseif ($message_type == 'registration') {
669
+			$subject = get_option('geodir_registration_success_email_subject');
670
+			$message = get_option('geodir_registration_success_email_content');
671
+			$login_details = $to_message;
672
+		} elseif ($message_type == 'post_submit') {
673
+			$subject = get_option('geodir_post_submited_success_email_subject');
674
+			$message = get_option('geodir_post_submited_success_email_content');
675
+		} elseif ($message_type == 'listing_published') {
676
+			$subject = get_option('geodir_post_published_email_subject');
677
+			$message = get_option('geodir_post_published_email_content');
678
+		} elseif ($message_type == 'listing_edited') {
679
+			$subject = get_option('geodir_post_edited_email_subject_admin');
680
+			$message = get_option('geodir_post_edited_email_content_admin');
681
+		}
682 682
 		
683 683
 		if (!empty($subject)) {
684 684
 			$subject = __(stripslashes_deep($subject),'geodirectory');
@@ -688,129 +688,129 @@  discard block
 block discarded – undo
688 688
 			$message = __(stripslashes_deep($message),'geodirectory');
689 689
 		}
690 690
 
691
-        $to_message = nl2br($to_message);
692
-        $sitefromEmail = get_option('site_email');
693
-        $sitefromEmailName = get_site_emailName();
694
-        $productlink = get_permalink($post_id);
695
-
696
-        $user_login = '';
697
-        if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
-            $user_login = $user_info->user_login;
699
-        }
700
-
701
-        $posted_date = '';
702
-        $listingLink = '';
703
-
704
-        $post_info = get_post($post_id);
705
-
706
-        if ($post_info) {
707
-            $posted_date = $post_info->post_date;
708
-            $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
709
-        }
710
-        $siteurl = home_url();
711
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
712
-        $loginurl = geodir_login_url();
713
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
691
+		$to_message = nl2br($to_message);
692
+		$sitefromEmail = get_option('site_email');
693
+		$sitefromEmailName = get_site_emailName();
694
+		$productlink = get_permalink($post_id);
695
+
696
+		$user_login = '';
697
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
698
+			$user_login = $user_info->user_login;
699
+		}
700
+
701
+		$posted_date = '';
702
+		$listingLink = '';
703
+
704
+		$post_info = get_post($post_id);
705
+
706
+		if ($post_info) {
707
+			$posted_date = $post_info->post_date;
708
+			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
709
+		}
710
+		$siteurl = home_url();
711
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
712
+		$loginurl = geodir_login_url();
713
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
714 714
         
715
-        $post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716
-        $post_author_name = geodir_get_client_name($post_author_id);
717
-        $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
718
-
719
-        if ($fromEmail == '') {
720
-            $fromEmail = get_option('site_email');
721
-        }
722
-
723
-        if ($fromEmailName == '') {
724
-            $fromEmailName = get_option('site_email_name');
725
-        }
726
-
727
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729
-        $message = str_replace($search_array, $replace_array, $message);
730
-
731
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733
-        $subject = str_replace($search_array, $replace_array, $subject);
734
-
735
-        $headers = 'MIME-Version: 1.0' . "\r\n";
736
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
738
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
739
-
740
-        $to = $toEmail;
741
-        $sent = wp_mail($to, $subject, $message, $headers);
742
-
743
-        if( ! $sent ) {
744
-            if ( is_array( $to ) ) {
745
-                $to = implode( ',', $to );
746
-            }
747
-            $log_message = sprintf(
748
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
749
-                $message_type,
750
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
751
-                $to,
752
-                $subject
753
-            );
754
-            geodir_error_log( $log_message );
755
-        }
756
-
757
-        ///////// ADMIN BCC EMIALS
758
-        $adminEmail = get_bloginfo('admin_email');
759
-        $to = $adminEmail;
760
-
761
-        $admin_bcc = false;
762
-        if ($message_type == 'post_submit') {
763
-            $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764
-            $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
765
-
766
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
767
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
768
-            $message = str_replace($search_array, $replace_array, $message);
769
-
770
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
771
-            $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772
-            $subject = str_replace($search_array, $replace_array, $subject);
773
-
774
-            $subject .= ' - ADMIN BCC COPY';
775
-            $admin_bcc = true;
776
-
777
-        }
778
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
779
-            $subject .= ' - ADMIN BCC COPY';
780
-            $admin_bcc = true;
781
-        }
782
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
783
-            $subject .= ' - ADMIN BCC COPY';
784
-            $admin_bcc = true;
785
-        }
786
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
787
-            $subject .= ' - ADMIN BCC COPY';
788
-            $admin_bcc = true;
789
-        }
790
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
791
-            $subject .= ' - ADMIN BCC COPY';
792
-            $admin_bcc = true;
793
-        }
794
-
795
-        if($admin_bcc===true){
796
-            $sent = wp_mail($to, $subject, $message, $headers);
797
-
798
-            if( ! $sent ) {
799
-                if ( is_array( $to ) ) {
800
-                    $to = implode( ',', $to );
801
-                }
802
-                $log_message = sprintf(
803
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
804
-                    $message_type,
805
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
806
-                    $to,
807
-                    $subject
808
-                );
809
-                geodir_error_log( $log_message );
810
-            }
811
-        }
812
-
813
-    }
715
+		$post_author_id = !empty($post_info) ? $post_info->post_author : 0;
716
+		$post_author_name = geodir_get_client_name($post_author_id);
717
+		$current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
718
+
719
+		if ($fromEmail == '') {
720
+			$fromEmail = get_option('site_email');
721
+		}
722
+
723
+		if ($fromEmailName == '') {
724
+			$fromEmailName = get_option('site_email_name');
725
+		}
726
+
727
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729
+		$message = str_replace($search_array, $replace_array, $message);
730
+
731
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733
+		$subject = str_replace($search_array, $replace_array, $subject);
734
+
735
+		$headers = 'MIME-Version: 1.0' . "\r\n";
736
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
737
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
738
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
739
+
740
+		$to = $toEmail;
741
+		$sent = wp_mail($to, $subject, $message, $headers);
742
+
743
+		if( ! $sent ) {
744
+			if ( is_array( $to ) ) {
745
+				$to = implode( ',', $to );
746
+			}
747
+			$log_message = sprintf(
748
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
749
+				$message_type,
750
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
751
+				$to,
752
+				$subject
753
+			);
754
+			geodir_error_log( $log_message );
755
+		}
756
+
757
+		///////// ADMIN BCC EMIALS
758
+		$adminEmail = get_bloginfo('admin_email');
759
+		$to = $adminEmail;
760
+
761
+		$admin_bcc = false;
762
+		if ($message_type == 'post_submit') {
763
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
765
+
766
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
767
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
768
+			$message = str_replace($search_array, $replace_array, $message);
769
+
770
+			$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
771
+			$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772
+			$subject = str_replace($search_array, $replace_array, $subject);
773
+
774
+			$subject .= ' - ADMIN BCC COPY';
775
+			$admin_bcc = true;
776
+
777
+		}
778
+		elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
779
+			$subject .= ' - ADMIN BCC COPY';
780
+			$admin_bcc = true;
781
+		}
782
+		elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
783
+			$subject .= ' - ADMIN BCC COPY';
784
+			$admin_bcc = true;
785
+		}
786
+		elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
787
+			$subject .= ' - ADMIN BCC COPY';
788
+			$admin_bcc = true;
789
+		}
790
+		elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
791
+			$subject .= ' - ADMIN BCC COPY';
792
+			$admin_bcc = true;
793
+		}
794
+
795
+		if($admin_bcc===true){
796
+			$sent = wp_mail($to, $subject, $message, $headers);
797
+
798
+			if( ! $sent ) {
799
+				if ( is_array( $to ) ) {
800
+					$to = implode( ',', $to );
801
+				}
802
+				$log_message = sprintf(
803
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
804
+					$message_type,
805
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
806
+					$to,
807
+					$subject
808
+				);
809
+				geodir_error_log( $log_message );
810
+			}
811
+		}
812
+
813
+	}
814 814
 }
815 815
 
816 816
 
@@ -823,27 +823,27 @@  discard block
 block discarded – undo
823 823
 function geodir_taxonomy_breadcrumb()
824 824
 {
825 825
 
826
-    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
827
-    $parent = $term->parent;
826
+	$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
827
+	$parent = $term->parent;
828 828
 
829
-    while ($parent):
830
-        $parents[] = $parent;
831
-        $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
832
-        $parent = $new_parent->parent;
833
-    endwhile;
829
+	while ($parent):
830
+		$parents[] = $parent;
831
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
832
+		$parent = $new_parent->parent;
833
+	endwhile;
834 834
 
835
-    if (!empty($parents)):
836
-        $parents = array_reverse($parents);
835
+	if (!empty($parents)):
836
+		$parents = array_reverse($parents);
837 837
 
838
-        foreach ($parents as $parent):
839
-            $item = get_term_by('id', $parent, get_query_var('taxonomy'));
840
-            $url = get_term_link($item, get_query_var('taxonomy'));
841
-            echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
842
-        endforeach;
838
+		foreach ($parents as $parent):
839
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
840
+			$url = get_term_link($item, get_query_var('taxonomy'));
841
+			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
842
+		endforeach;
843 843
 
844
-    endif;
844
+	endif;
845 845
 
846
-    echo '<li> > ' . $term->name . '</li>';
846
+	echo '<li> > ' . $term->name . '</li>';
847 847
 }
848 848
 
849 849
 
@@ -859,365 +859,365 @@  discard block
 block discarded – undo
859 859
  */
860 860
 function geodir_breadcrumb()
861 861
 {
862
-    global $wp_query, $geodir_add_location_url;
863
-
864
-    /**
865
-     * Filter breadcrumb separator.
866
-     *
867
-     * @since 1.0.0
868
-     */
869
-    $separator = apply_filters('geodir_breadcrumb_separator', ' > ');
870
-
871
-    if (!geodir_is_page('home')) {
872
-        $breadcrumb = '';
873
-        $url_categoris = '';
874
-        $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
875
-        /**
876
-         * Filter breadcrumb's first link.
877
-         *
878
-         * @since 1.0.0
879
-         */
880
-        $breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
862
+	global $wp_query, $geodir_add_location_url;
863
+
864
+	/**
865
+	 * Filter breadcrumb separator.
866
+	 *
867
+	 * @since 1.0.0
868
+	 */
869
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
870
+
871
+	if (!geodir_is_page('home')) {
872
+		$breadcrumb = '';
873
+		$url_categoris = '';
874
+		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
875
+		/**
876
+		 * Filter breadcrumb's first link.
877
+		 *
878
+		 * @since 1.0.0
879
+		 */
880
+		$breadcrumb .= '<li>' . apply_filters('geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __('Home', 'geodirectory') . '</a>') . '</li>';
881
+
882
+		$gd_post_type = geodir_get_current_posttype();
883
+		$post_type_info = get_post_type_object($gd_post_type);
884
+
885
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
886
+
887
+		$listing_link = get_post_type_archive_link($gd_post_type);
888
+
889
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
890
+		$listing_link = rtrim($listing_link, '/');
891
+		$listing_link .= '/';
892
+
893
+		$post_type_for_location_link = $listing_link;
894
+		$location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
895
+
896
+		global $wp, $gd_session;
897
+		$location_link = $post_type_for_location_link;
898
+
899
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
900
+			global $post;
901
+			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903
+				
904
+			if(geodir_is_page('detail') && isset($post->country_slug)){
905
+				$location_terms = array(
906
+					'gd_country' => $post->country_slug,
907
+					'gd_region' => $post->region_slug,
908
+					'gd_city' => $post->city_slug
909
+				);
910
+				
911
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
912
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
913
+				}
914
+			}
881 915
 
882
-        $gd_post_type = geodir_get_current_posttype();
883
-        $post_type_info = get_post_type_object($gd_post_type);
916
+			$geodir_show_location_url = get_option('geodir_show_location_url');
884 917
 
885
-        remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
918
+			$hide_url_part = array();
919
+			if ($location_manager) {
920
+				$hide_country_part = get_option('geodir_location_hide_country_part');
921
+				$hide_region_part = get_option('geodir_location_hide_region_part');
886 922
 
887
-        $listing_link = get_post_type_archive_link($gd_post_type);
923
+				if ($hide_region_part && $hide_country_part) {
924
+					$hide_url_part = array('gd_country', 'gd_region');
925
+				} else if ($hide_region_part && !$hide_country_part) {
926
+					$hide_url_part = array('gd_region');
927
+				} else if (!$hide_region_part && $hide_country_part) {
928
+					$hide_url_part = array('gd_country');
929
+				}
930
+			}
888 931
 
889
-        add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
890
-        $listing_link = rtrim($listing_link, '/');
891
-        $listing_link .= '/';
932
+			$hide_text_part = array();
933
+			if ($geodir_show_location_url == 'country_city') {
934
+				$hide_text_part = array('gd_region');
892 935
 
893
-        $post_type_for_location_link = $listing_link;
894
-        $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
936
+				if (isset($location_terms['gd_region']) && !$location_manager) {
937
+					unset($location_terms['gd_region']);
938
+				}
939
+			} else if ($geodir_show_location_url == 'region_city') {
940
+				$hide_text_part = array('gd_country');
895 941
 
896
-        global $wp, $gd_session;
897
-        $location_link = $post_type_for_location_link;
942
+				if (isset($location_terms['gd_country']) && !$location_manager) {
943
+					unset($location_terms['gd_country']);
944
+				}
945
+			} else if ($geodir_show_location_url == 'city') {
946
+				$hide_text_part = array('gd_country', 'gd_region');
898 947
 
899
-        if (geodir_is_page('detail') || geodir_is_page('listing')) {
900
-            global $post;
901
-            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902
-			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903
-				
904
-			if(geodir_is_page('detail') && isset($post->country_slug)){
905
-                $location_terms = array(
906
-                    'gd_country' => $post->country_slug,
907
-                    'gd_region' => $post->region_slug,
908
-                    'gd_city' => $post->city_slug
909
-                );
910
-				
911
-				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
912
-					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
948
+				if (isset($location_terms['gd_country']) && !$location_manager) {
949
+					unset($location_terms['gd_country']);
913 950
 				}
914
-            }
915
-
916
-            $geodir_show_location_url = get_option('geodir_show_location_url');
917
-
918
-            $hide_url_part = array();
919
-            if ($location_manager) {
920
-                $hide_country_part = get_option('geodir_location_hide_country_part');
921
-                $hide_region_part = get_option('geodir_location_hide_region_part');
922
-
923
-                if ($hide_region_part && $hide_country_part) {
924
-                    $hide_url_part = array('gd_country', 'gd_region');
925
-                } else if ($hide_region_part && !$hide_country_part) {
926
-                    $hide_url_part = array('gd_region');
927
-                } else if (!$hide_region_part && $hide_country_part) {
928
-                    $hide_url_part = array('gd_country');
929
-                }
930
-            }
931
-
932
-            $hide_text_part = array();
933
-            if ($geodir_show_location_url == 'country_city') {
934
-                $hide_text_part = array('gd_region');
935
-
936
-                if (isset($location_terms['gd_region']) && !$location_manager) {
937
-                    unset($location_terms['gd_region']);
938
-                }
939
-            } else if ($geodir_show_location_url == 'region_city') {
940
-                $hide_text_part = array('gd_country');
941
-
942
-                if (isset($location_terms['gd_country']) && !$location_manager) {
943
-                    unset($location_terms['gd_country']);
944
-                }
945
-            } else if ($geodir_show_location_url == 'city') {
946
-                $hide_text_part = array('gd_country', 'gd_region');
947
-
948
-                if (isset($location_terms['gd_country']) && !$location_manager) {
949
-                    unset($location_terms['gd_country']);
950
-                }
951
-                if (isset($location_terms['gd_region']) && !$location_manager) {
952
-                    unset($location_terms['gd_region']);
953
-                }
954
-            }
955
-
956
-            $is_location_last = '';
957
-            $is_taxonomy_last = '';
958
-            $breadcrumb .= '<li>';
959
-            if (get_query_var($gd_post_type . 'category'))
960
-                $gd_taxonomy = $gd_post_type . 'category';
961
-            elseif (get_query_var($gd_post_type . '_tags'))
962
-                $gd_taxonomy = $gd_post_type . '_tags';
963
-
964
-            $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
965
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
966
-                $is_location_last = false;
967
-            else
968
-                $is_location_last = true;
969
-
970
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
971
-                $is_taxonomy_last = true;
972
-            else
973
-                $is_taxonomy_last = false;
974
-
975
-            if (!empty($location_terms)) {
976
-                $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
977
-
978
-                foreach ($location_terms as $key => $location_term) {
979
-                    if ($location_term != '') {
980
-                        if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
981
-                            continue;
982
-                        }
983
-
984
-                        $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
985
-                        $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
986
-                        $gd_location_link_text = ucfirst($gd_location_link_text);
987
-
988
-                        $location_term_actual_country = '';
989
-                        $location_term_actual_region = '';
990
-                        $location_term_actual_city = '';
991
-                        if ($geodir_get_locations) {
992
-                            if ($key == 'gd_country') {
993
-                                $location_term_actual_country = get_actual_location_name('country', $location_term, true);
994
-                            } else if ($key == 'gd_region') {
995
-                                $location_term_actual_region = get_actual_location_name('region', $location_term, true);
996
-                            } else if ($key == 'gd_city') {
997
-                                $location_term_actual_city = get_actual_location_name('city', $location_term, true);
998
-                            }
999
-                        } else {
1000
-                            $location_info = geodir_get_location();
1001
-
1002
-                            if (!empty($location_info) && isset($location_info->location_id)) {
1003
-                                if ($key == 'gd_country') {
1004
-                                    $location_term_actual_country = __($location_info->country, 'geodirectory');
1005
-                                } else if ($key == 'gd_region') {
1006
-                                    $location_term_actual_region = __($location_info->region, 'geodirectory');
1007
-                                } else if ($key == 'gd_city') {
1008
-                                    $location_term_actual_city = __($location_info->city, 'geodirectory');
1009
-                                }
1010
-                            }
1011
-                        }
1012
-
1013
-                        if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1014
-                            $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1015
-                        } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1016
-                            $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1017
-                        } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1018
-                            $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1019
-                        } else if ($is_location_last && $key == 'gd_neighbourhood') {
1020
-                            $breadcrumb .= $separator . $gd_location_link_text;
1021
-                        } else {
1022
-                            if (get_option('permalink_structure') != '') {
1023
-                                $location_link .= $location_term . '/';
1024
-                            } else {
1025
-                                $location_link .= "&$key=" . $location_term;
1026
-                            }
951
+				if (isset($location_terms['gd_region']) && !$location_manager) {
952
+					unset($location_terms['gd_region']);
953
+				}
954
+			}
1027 955
 
1028
-                            if ($key == 'gd_country' && $location_term_actual_country != '') {
1029
-                                $gd_location_link_text = $location_term_actual_country;
1030
-                            } else if ($key == 'gd_region' && $location_term_actual_region != '') {
1031
-                                $gd_location_link_text = $location_term_actual_region;
1032
-                            } else if ($key == 'gd_city' && $location_term_actual_city != '') {
1033
-                                $gd_location_link_text = $location_term_actual_city;
1034
-                            }
956
+			$is_location_last = '';
957
+			$is_taxonomy_last = '';
958
+			$breadcrumb .= '<li>';
959
+			if (get_query_var($gd_post_type . 'category'))
960
+				$gd_taxonomy = $gd_post_type . 'category';
961
+			elseif (get_query_var($gd_post_type . '_tags'))
962
+				$gd_taxonomy = $gd_post_type . '_tags';
963
+
964
+			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
965
+			if (!empty($gd_taxonomy) || geodir_is_page('detail'))
966
+				$is_location_last = false;
967
+			else
968
+				$is_location_last = true;
969
+
970
+			if (!empty($gd_taxonomy) && geodir_is_page('listing'))
971
+				$is_taxonomy_last = true;
972
+			else
973
+				$is_taxonomy_last = false;
974
+
975
+			if (!empty($location_terms)) {
976
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
977
+
978
+				foreach ($location_terms as $key => $location_term) {
979
+					if ($location_term != '') {
980
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
981
+							continue;
982
+						}
1035 983
 
1036
-                            /*
984
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
985
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
986
+						$gd_location_link_text = ucfirst($gd_location_link_text);
987
+
988
+						$location_term_actual_country = '';
989
+						$location_term_actual_region = '';
990
+						$location_term_actual_city = '';
991
+						if ($geodir_get_locations) {
992
+							if ($key == 'gd_country') {
993
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
994
+							} else if ($key == 'gd_region') {
995
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
996
+							} else if ($key == 'gd_city') {
997
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
998
+							}
999
+						} else {
1000
+							$location_info = geodir_get_location();
1001
+
1002
+							if (!empty($location_info) && isset($location_info->location_id)) {
1003
+								if ($key == 'gd_country') {
1004
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1005
+								} else if ($key == 'gd_region') {
1006
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1007
+								} else if ($key == 'gd_city') {
1008
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1009
+								}
1010
+							}
1011
+						}
1012
+
1013
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1014
+							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1015
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1016
+							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1017
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1018
+							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1019
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1020
+							$breadcrumb .= $separator . $gd_location_link_text;
1021
+						} else {
1022
+							if (get_option('permalink_structure') != '') {
1023
+								$location_link .= $location_term . '/';
1024
+							} else {
1025
+								$location_link .= "&$key=" . $location_term;
1026
+							}
1027
+
1028
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1029
+								$gd_location_link_text = $location_term_actual_country;
1030
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1031
+								$gd_location_link_text = $location_term_actual_region;
1032
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1033
+								$gd_location_link_text = $location_term_actual_city;
1034
+							}
1035
+
1036
+							/*
1037 1037
                             if (geodir_is_page('detail') && !empty($hide_text_part) && in_array($key, $hide_text_part)) {
1038 1038
                                 continue;
1039 1039
                             }
1040 1040
                             */
1041 1041
 
1042
-                            $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1043
-                        }
1044
-                    }
1045
-                }
1046
-            }
1047
-
1048
-            if (!empty($gd_taxonomy)) {
1049
-                $term_index = 1;
1050
-
1051
-                //if(get_option('geodir_add_categories_url'))
1052
-                {
1053
-                    if (get_query_var($gd_post_type . '_tags')) {
1054
-                        $cat_link = $listing_link . 'tags/';
1055
-                    } else
1056
-                        $cat_link = $listing_link;
1057
-
1058
-                    foreach ($location_terms as $key => $location_term) {
1059
-                        if ($location_manager && in_array($key, $hide_url_part)) {
1060
-                            continue;
1061
-                        }
1062
-
1063
-                        if ($location_term != '') {
1064
-                            if (get_option('permalink_structure') != '') {
1065
-                                $cat_link .= $location_term . '/';
1066
-                            }
1067
-                        }
1068
-                    }
1069
-
1070
-                    $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1071
-                    foreach ($term_array as $term) {
1072
-                        $term_link_text = preg_replace('/-(\d+)$/', '', $term);
1073
-                        $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1074
-
1075
-                        // get term actual name
1076
-                        $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1077
-                        if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1078
-                            $term_link_text = urldecode($term_info['name']);
1079
-                        } else {
1080
-                            $term_link_text = geodir_ucwords(urldecode($term_link_text));
1081
-                        }
1082
-
1083
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1084
-                            $breadcrumb .= $separator . $term_link_text;
1085
-                        else {
1086
-                            $cat_link .= $term . '/';
1087
-                            $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1088
-                        }
1089
-                        $term_index++;
1090
-                    }
1091
-                }
1092
-
1093
-
1094
-            }
1095
-
1096
-            if (geodir_is_page('detail'))
1097
-                $breadcrumb .= $separator . get_the_title();
1098
-
1099
-            $breadcrumb .= '</li>';
1100
-
1101
-
1102
-        } elseif (geodir_is_page('author')) {
1103
-            $user_id = get_current_user_id();
1104
-            $author_link = get_author_posts_url($user_id);
1105
-            $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1106
-
1107
-            /**
1108
-             * Filter author page link.
1109
-             *
1110
-             * @since 1.0.0
1111
-             * @param string $default_author_link Default author link.
1112
-             * @param int $user_id Author ID.
1113
-             */
1114
-            $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1115
-
1116
-            $breadcrumb .= '<li>';
1117
-            $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1118
-
1119
-            if (isset($_REQUEST['list'])) {
1120
-                $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1121
-
1122
-                /**
1123
-                 * Filter author page link.
1124
-                 *
1125
-                 * @since 1.0.0
1126
-                 * @param string $author_link Author page link.
1127
-                 * @param int $user_id Author ID.
1128
-                 * @param string $_REQUEST['stype'] Post type.
1129
-                 */
1130
-                $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1131
-
1132
-                $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1133
-                $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1134
-            } else
1135
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1136
-
1137
-            $breadcrumb .= '</li>';
1138
-        } elseif (is_category() || is_single()) {
1139
-            $category = get_the_category();
1140
-            if (is_category()) {
1141
-                $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1142
-            }
1143
-            if (is_single()) {
1144
-                $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1145
-                $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1146
-            }
1147
-            /* End of my version ##################################################### */
1148
-        } else if (is_page()) {
1149
-            $page_title = get_the_title();
1150
-
1151
-            if (geodir_is_page('location')) {
1152
-                $page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1153
-            }
1154
-
1155
-            $breadcrumb .= '<li>' . $separator;
1156
-            $breadcrumb .= stripslashes_deep($page_title);
1157
-            $breadcrumb .= '</li>';
1158
-        } else if (is_tag()) {
1159
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1160
-        } else if (is_day()) {
1161
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162
-            the_time('F jS, Y');
1163
-            $breadcrumb .= '</li>';
1164
-        } else if (is_month()) {
1165
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1166
-            the_time('F, Y');
1167
-            $breadcrumb .= '</li>';
1168
-        } else if (is_year()) {
1169
-            $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1170
-            the_time('Y');
1171
-            $breadcrumb .= '</li>';
1172
-        } else if (is_author()) {
1173
-            $breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1174
-            $breadcrumb .= '</li>';
1175
-        } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1176
-            $breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1177
-            $breadcrumb .= '</li>';
1178
-        } else if (is_search()) {
1179
-            $breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1180
-            $breadcrumb .= '</li>';
1181
-        }
1182
-        $breadcrumb .= '</ul></div>';
1183
-
1184
-        /**
1185
-         * Filter breadcrumb html output.
1186
-         *
1187
-         * @since 1.0.0
1188
-         * @param string $breadcrumb Breadcrumb HTML.
1189
-         * @param string $separator Breadcrumb separator.
1190
-         */
1191
-        echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1192
-    }
1042
+							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1043
+						}
1044
+					}
1045
+				}
1046
+			}
1047
+
1048
+			if (!empty($gd_taxonomy)) {
1049
+				$term_index = 1;
1050
+
1051
+				//if(get_option('geodir_add_categories_url'))
1052
+				{
1053
+					if (get_query_var($gd_post_type . '_tags')) {
1054
+						$cat_link = $listing_link . 'tags/';
1055
+					} else
1056
+						$cat_link = $listing_link;
1057
+
1058
+					foreach ($location_terms as $key => $location_term) {
1059
+						if ($location_manager && in_array($key, $hide_url_part)) {
1060
+							continue;
1061
+						}
1062
+
1063
+						if ($location_term != '') {
1064
+							if (get_option('permalink_structure') != '') {
1065
+								$cat_link .= $location_term . '/';
1066
+							}
1067
+						}
1068
+					}
1069
+
1070
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1071
+					foreach ($term_array as $term) {
1072
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1073
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1074
+
1075
+						// get term actual name
1076
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1077
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1078
+							$term_link_text = urldecode($term_info['name']);
1079
+						} else {
1080
+							$term_link_text = geodir_ucwords(urldecode($term_link_text));
1081
+						}
1082
+
1083
+						if ($term_index == count($term_array) && $is_taxonomy_last)
1084
+							$breadcrumb .= $separator . $term_link_text;
1085
+						else {
1086
+							$cat_link .= $term . '/';
1087
+							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1088
+						}
1089
+						$term_index++;
1090
+					}
1091
+				}
1092
+
1093
+
1094
+			}
1095
+
1096
+			if (geodir_is_page('detail'))
1097
+				$breadcrumb .= $separator . get_the_title();
1098
+
1099
+			$breadcrumb .= '</li>';
1100
+
1101
+
1102
+		} elseif (geodir_is_page('author')) {
1103
+			$user_id = get_current_user_id();
1104
+			$author_link = get_author_posts_url($user_id);
1105
+			$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
1106
+
1107
+			/**
1108
+			 * Filter author page link.
1109
+			 *
1110
+			 * @since 1.0.0
1111
+			 * @param string $default_author_link Default author link.
1112
+			 * @param int $user_id Author ID.
1113
+			 */
1114
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1115
+
1116
+			$breadcrumb .= '<li>';
1117
+			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __('My Dashboard', 'geodirectory') . '</a>';
1118
+
1119
+			if (isset($_REQUEST['list'])) {
1120
+				$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $_REQUEST['stype']), false);
1121
+
1122
+				/**
1123
+				 * Filter author page link.
1124
+				 *
1125
+				 * @since 1.0.0
1126
+				 * @param string $author_link Author page link.
1127
+				 * @param int $user_id Author ID.
1128
+				 * @param string $_REQUEST['stype'] Post type.
1129
+				 */
1130
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1131
+
1132
+				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1133
+				$breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1134
+			} else
1135
+				$breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1136
+
1137
+			$breadcrumb .= '</li>';
1138
+		} elseif (is_category() || is_single()) {
1139
+			$category = get_the_category();
1140
+			if (is_category()) {
1141
+				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1142
+			}
1143
+			if (is_single()) {
1144
+				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a></li>';
1145
+				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1146
+			}
1147
+			/* End of my version ##################################################### */
1148
+		} else if (is_page()) {
1149
+			$page_title = get_the_title();
1150
+
1151
+			if (geodir_is_page('location')) {
1152
+				$page_title = defined('GD_LOCATION') ? GD_LOCATION : __('Location', 'geodirectory');
1153
+			}
1154
+
1155
+			$breadcrumb .= '<li>' . $separator;
1156
+			$breadcrumb .= stripslashes_deep($page_title);
1157
+			$breadcrumb .= '</li>';
1158
+		} else if (is_tag()) {
1159
+			$breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1160
+		} else if (is_day()) {
1161
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162
+			the_time('F jS, Y');
1163
+			$breadcrumb .= '</li>';
1164
+		} else if (is_month()) {
1165
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1166
+			the_time('F, Y');
1167
+			$breadcrumb .= '</li>';
1168
+		} else if (is_year()) {
1169
+			$breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1170
+			the_time('Y');
1171
+			$breadcrumb .= '</li>';
1172
+		} else if (is_author()) {
1173
+			$breadcrumb .= "<li> " . $separator . __(" Author Archive", 'geodirectory');
1174
+			$breadcrumb .= '</li>';
1175
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1176
+			$breadcrumb .= "<li>" . $separator . __("Blog Archives", 'geodirectory');
1177
+			$breadcrumb .= '</li>';
1178
+		} else if (is_search()) {
1179
+			$breadcrumb .= "<li> " . $separator . __(" Search Results", 'geodirectory');
1180
+			$breadcrumb .= '</li>';
1181
+		}
1182
+		$breadcrumb .= '</ul></div>';
1183
+
1184
+		/**
1185
+		 * Filter breadcrumb html output.
1186
+		 *
1187
+		 * @since 1.0.0
1188
+		 * @param string $breadcrumb Breadcrumb HTML.
1189
+		 * @param string $separator Breadcrumb separator.
1190
+		 */
1191
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1192
+	}
1193 1193
 }
1194 1194
 
1195 1195
 
1196 1196
 add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1197 1197
 if (!function_exists('geodir_allow_wpadmin')) {
1198
-    /**
1199
-     * Allow only admins to access wp-admin.
1200
-     *
1201
-     * Normal users will be redirected to home page.
1202
-     *
1203
-     * @since 1.0.0
1204
-     * @package GeoDirectory
1205
-     * @global object $wpdb WordPress Database object.
1206
-     */
1207
-    function geodir_allow_wpadmin()
1208
-    {
1209
-        global $wpdb;
1210
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1211
-        {
1212
-            if (current_user_can('manage_options')) {
1213
-            } else {
1214
-
1215
-                wp_redirect(home_url());
1216
-                exit;
1217
-            }
1218
-
1219
-        }
1220
-    }
1198
+	/**
1199
+	 * Allow only admins to access wp-admin.
1200
+	 *
1201
+	 * Normal users will be redirected to home page.
1202
+	 *
1203
+	 * @since 1.0.0
1204
+	 * @package GeoDirectory
1205
+	 * @global object $wpdb WordPress Database object.
1206
+	 */
1207
+	function geodir_allow_wpadmin()
1208
+	{
1209
+		global $wpdb;
1210
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1211
+		{
1212
+			if (current_user_can('manage_options')) {
1213
+			} else {
1214
+
1215
+				wp_redirect(home_url());
1216
+				exit;
1217
+			}
1218
+
1219
+		}
1220
+	}
1221 1221
 }
1222 1222
 
1223 1223
 
@@ -1231,50 +1231,50 @@  discard block
 block discarded – undo
1231 1231
  */
1232 1232
 function fetch_remote_file($url)
1233 1233
 {
1234
-    // extract the file name and extension from the url
1235
-    require_once(ABSPATH . 'wp-includes/pluggable.php');
1236
-    $file_name = basename($url);
1237
-    if (strpos($file_name, '?') !== false) {
1238
-        list($file_name) = explode('?', $file_name);
1239
-    }
1240
-
1241
-
1242
-    // get placeholder file in the upload dir with a unique, sanitized filename
1243
-
1244
-    $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1245
-
1246
-    $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1247
-    if ($upload['error'])
1248
-        return new WP_Error('upload_dir_error', $upload['error']);
1249
-
1250
-    // fetch the remote url and write it to the placeholder file
1251
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1252
-
1253
-    $log_message = '';
1254
-    $filesize = filesize($upload['file']);
1255
-    // request failed
1256
-    if (!$headers) {
1257
-        $log_message = __('Remote server did not respond', 'geodirectory');
1258
-    }
1259
-    // make sure the fetch was successful
1260
-    elseif ($headers['response']['code'] != '200') {
1261
-        $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262
-    }
1263
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1265
-    }
1266
-    elseif (0 == $filesize) {
1267
-        $log_message = __('Zero size file downloaded', 'geodirectory');
1268
-    }
1269
-
1270
-    if($log_message){
1271
-        $del = unlink($upload['file']);
1272
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
-        return new WP_Error('import_file_error',$log_message );
1274
-    }
1275
-
1276
-
1277
-    return $upload;
1234
+	// extract the file name and extension from the url
1235
+	require_once(ABSPATH . 'wp-includes/pluggable.php');
1236
+	$file_name = basename($url);
1237
+	if (strpos($file_name, '?') !== false) {
1238
+		list($file_name) = explode('?', $file_name);
1239
+	}
1240
+
1241
+
1242
+	// get placeholder file in the upload dir with a unique, sanitized filename
1243
+
1244
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1245
+
1246
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1247
+	if ($upload['error'])
1248
+		return new WP_Error('upload_dir_error', $upload['error']);
1249
+
1250
+	// fetch the remote url and write it to the placeholder file
1251
+	$headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1252
+
1253
+	$log_message = '';
1254
+	$filesize = filesize($upload['file']);
1255
+	// request failed
1256
+	if (!$headers) {
1257
+		$log_message = __('Remote server did not respond', 'geodirectory');
1258
+	}
1259
+	// make sure the fetch was successful
1260
+	elseif ($headers['response']['code'] != '200') {
1261
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262
+	}
1263
+	elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
+		$log_message =  __('Remote file is incorrect size', 'geodirectory');
1265
+	}
1266
+	elseif (0 == $filesize) {
1267
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1268
+	}
1269
+
1270
+	if($log_message){
1271
+		$del = unlink($upload['file']);
1272
+		if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
+		return new WP_Error('import_file_error',$log_message );
1274
+	}
1275
+
1276
+
1277
+	return $upload;
1278 1278
 }
1279 1279
 
1280 1280
 /**
@@ -1286,21 +1286,21 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function geodir_max_upload_size()
1288 1288
 {
1289
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1290
-
1291
-    if ($max_filesize > 0 && $max_filesize < 1) {
1292
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1293
-    } else {
1294
-        $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295
-    }
1296
-
1297
-    /**
1298
-     * Filter default image upload size limit.
1299
-     *
1300
-     * @since 1.0.0
1301
-     * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1302
-     */
1303
-    return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1289
+	$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1290
+
1291
+	if ($max_filesize > 0 && $max_filesize < 1) {
1292
+		$max_filesize = (int)($max_filesize * 1024) . 'kb';
1293
+	} else {
1294
+		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295
+	}
1296
+
1297
+	/**
1298
+	 * Filter default image upload size limit.
1299
+	 *
1300
+	 * @since 1.0.0
1301
+	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1302
+	 */
1303
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
  */
1315 1315
 function geodir_dummy_folder_exists()
1316 1316
 {
1317
-    $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1318
-    if (!is_dir($path))
1319
-        return false;
1320
-    else
1321
-        return true;
1317
+	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1318
+	if (!is_dir($path))
1319
+		return false;
1320
+	else
1321
+		return true;
1322 1322
 
1323 1323
 }
1324 1324
 
@@ -1333,237 +1333,237 @@  discard block
 block discarded – undo
1333 1333
  */
1334 1334
 function  geodir_get_author_info($aid)
1335 1335
 {
1336
-    global $wpdb;
1337
-    /*$infosql = "select * from $wpdb->users where ID=$aid";*/
1338
-    $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1339
-    $info = $wpdb->get_results($infosql);
1340
-    if ($info) {
1341
-        return $info[0];
1342
-    }
1336
+	global $wpdb;
1337
+	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1338
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1339
+	$info = $wpdb->get_results($infosql);
1340
+	if ($info) {
1341
+		return $info[0];
1342
+	}
1343 1343
 }
1344 1344
 
1345 1345
 if (!function_exists('adminEmail')) {
1346
-    /**
1347
-     * Send emails to client on post submission, renew etc.
1348
-     *
1349
-     * @since 1.0.0
1350
-     * @package GeoDirectory
1351
-     * @global object $wpdb WordPress Database object.
1352
-     * @param int|string $page_id Page ID.
1353
-     * @param int|string $user_id User ID.
1354
-     * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1355
-     * @param string $custom_1 Custom data to be sent.
1356
-     */
1357
-    function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1358
-    {
1359
-        global $wpdb;
1360
-        if ($message_type == 'expiration') {
1361
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1363
-        } elseif ($message_type == 'post_submited') {
1364
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1366
-        } elseif ($message_type == 'renew') {
1367
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1369
-        } elseif ($message_type == 'upgrade') {
1370
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1372
-        } elseif ($message_type == 'claim_approved') {
1373
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1375
-        } elseif ($message_type == 'claim_rejected') {
1376
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1378
-        } elseif ($message_type == 'claim_requested') {
1379
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1381
-        } elseif ($message_type == 'auto_claim') {
1382
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1384
-        } elseif ($message_type == 'payment_success') {
1385
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1387
-        } elseif ($message_type == 'payment_fail') {
1388
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1390
-        }
1391
-        $transaction_details = $custom_1;
1392
-        $fromEmail = get_option('site_email');
1393
-        $fromEmailName = get_site_emailName();
1346
+	/**
1347
+	 * Send emails to client on post submission, renew etc.
1348
+	 *
1349
+	 * @since 1.0.0
1350
+	 * @package GeoDirectory
1351
+	 * @global object $wpdb WordPress Database object.
1352
+	 * @param int|string $page_id Page ID.
1353
+	 * @param int|string $user_id User ID.
1354
+	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1355
+	 * @param string $custom_1 Custom data to be sent.
1356
+	 */
1357
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '')
1358
+	{
1359
+		global $wpdb;
1360
+		if ($message_type == 'expiration') {
1361
+			$subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
+			$client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1363
+		} elseif ($message_type == 'post_submited') {
1364
+			$subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
+			$client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1366
+		} elseif ($message_type == 'renew') {
1367
+			$subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
+			$client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1369
+		} elseif ($message_type == 'upgrade') {
1370
+			$subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1372
+		} elseif ($message_type == 'claim_approved') {
1373
+			$subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
+			$client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1375
+		} elseif ($message_type == 'claim_rejected') {
1376
+			$subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
+			$client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1378
+		} elseif ($message_type == 'claim_requested') {
1379
+			$subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
+			$client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1381
+		} elseif ($message_type == 'auto_claim') {
1382
+			$subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
+			$client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1384
+		} elseif ($message_type == 'payment_success') {
1385
+			$subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
+			$client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1387
+		} elseif ($message_type == 'payment_fail') {
1388
+			$subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
+			$client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1390
+		}
1391
+		$transaction_details = $custom_1;
1392
+		$fromEmail = get_option('site_email');
1393
+		$fromEmailName = get_site_emailName();
1394 1394
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1395
-        $pkg_limit = get_property_price_info_listing($page_id);
1396
-        $alivedays = $pkg_limit['days'];
1397
-        $productlink = get_permalink($page_id);
1398
-        $post_info = get_post($page_id);
1399
-        $post_date = date('dS F,Y', strtotime($post_info->post_date));
1400
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1401
-        $loginurl = geodir_login_url();
1402
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1403
-        $siteurl = home_url();
1404
-        $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1405
-        $user_info = get_userdata($user_id);
1406
-        $user_email = $user_info->user_email;
1407
-        $display_name = geodir_get_client_name($user_id);
1408
-        $user_login = $user_info->user_login;
1409
-        $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1410
-        if ($number_of_grace_days == '') {
1411
-            $number_of_grace_days = 1;
1412
-        }
1413
-        if ($post_info->post_type == 'event') {
1414
-            $post_type = 'event';
1415
-        } else {
1416
-            $post_type = 'listing';
1417
-        }
1418
-        $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1419
-        $search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]');
1420
-        $replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details);
1421
-        $client_message = str_replace($search_array, $replace_array, $client_message);
1422
-        $subject = str_replace($search_array, $replace_array, $subject);
1423
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1424
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1425
-        $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1426
-
1427
-        $to = $fromEmail;
1428
-        $message = $client_message;
1429
-        $sent = wp_mail($to, $subject, $message, $headers);
1430
-        if( ! $sent ) {
1431
-            if ( is_array( $to ) ) {
1432
-                $to = implode( ',', $to );
1433
-            }
1434
-            $log_message = sprintf(
1435
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1436
-                $message_type,
1437
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1438
-                $to,
1439
-                $subject
1440
-            );
1441
-            geodir_error_log( $log_message );
1442
-        }
1443
-    }
1395
+		$pkg_limit = get_property_price_info_listing($page_id);
1396
+		$alivedays = $pkg_limit['days'];
1397
+		$productlink = get_permalink($page_id);
1398
+		$post_info = get_post($page_id);
1399
+		$post_date = date('dS F,Y', strtotime($post_info->post_date));
1400
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1401
+		$loginurl = geodir_login_url();
1402
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1403
+		$siteurl = home_url();
1404
+		$siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1405
+		$user_info = get_userdata($user_id);
1406
+		$user_email = $user_info->user_email;
1407
+		$display_name = geodir_get_client_name($user_id);
1408
+		$user_login = $user_info->user_login;
1409
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1410
+		if ($number_of_grace_days == '') {
1411
+			$number_of_grace_days = 1;
1412
+		}
1413
+		if ($post_info->post_type == 'event') {
1414
+			$post_type = 'event';
1415
+		} else {
1416
+			$post_type = 'listing';
1417
+		}
1418
+		$renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1419
+		$search_array = array('[#client_name#]', '[#listing_link#]', '[#posted_date#]', '[#number_of_days#]', '[#number_of_grace_days#]', '[#login_url#]', '[#username#]', '[#user_email#]', '[#site_name_url#]', '[#renew_link#]', '[#post_id#]', '[#site_name#]', '[#transaction_details#]');
1420
+		$replace_array = array($display_name, $listingLink, $post_date, $alivedays, $number_of_grace_days, $loginurl_link, $user_login, $user_email, $siteurl_link, $renew_link, $page_id, $fromEmailName, $transaction_details);
1421
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1422
+		$subject = str_replace($search_array, $replace_array, $subject);
1423
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1424
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1425
+		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1426
+
1427
+		$to = $fromEmail;
1428
+		$message = $client_message;
1429
+		$sent = wp_mail($to, $subject, $message, $headers);
1430
+		if( ! $sent ) {
1431
+			if ( is_array( $to ) ) {
1432
+				$to = implode( ',', $to );
1433
+			}
1434
+			$log_message = sprintf(
1435
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1436
+				$message_type,
1437
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1438
+				$to,
1439
+				$subject
1440
+			);
1441
+			geodir_error_log( $log_message );
1442
+		}
1443
+	}
1444 1444
 }
1445 1445
 
1446 1446
 if (!function_exists('sendEmail')) {
1447
-    /**
1448
-     * @todo could be a duplicate of geodir_sendEmail.
1449
-     *
1450
-     * @since 1.0.0
1451
-     * @package GeoDirectory
1452
-     * @param string $fromEmail Sender email address.
1453
-     * @param string $fromEmailName Sender name.
1454
-     * @param string $toEmail Receiver email address.
1455
-     * @param string $toEmailName Receiver name.
1456
-     * @param string $to_subject Email subject.
1457
-     * @param string $to_message Email content.
1458
-     * @param string $extra Not being used.
1459
-     * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1460
-     * @param string $post_id The post ID.
1461
-     * @param string $user_id The user ID.
1462
-     */
1463
-    function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1464
-    {
1465
-        $login_details = '';
1466
-        if ($message_type == 'send_friend') {
1467
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1469
-        } elseif ($message_type == 'send_enquiry') {
1470
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1472
-        } elseif ($message_type == 'forgot_password') {
1473
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1475
-            $login_details = $to_message;
1476
-        } elseif ($message_type == 'registration') {
1477
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1479
-            $login_details = $to_message;
1480
-        }
1481
-        $to_message = nl2br($to_message);
1482
-        $sitefromEmail = get_option('site_email');
1483
-        $sitefromEmailName = get_site_emailName();
1484
-        $productlink = get_permalink($post_id);
1485
-        $post_info = get_post($post_id);
1486
-        $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1487
-        $siteurl = home_url();
1488
-        $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1489
-        $loginurl = geodir_login_url();
1490
-        $loginurl_link = '<a href="' . $loginurl . '">login</a>';
1491
-        if ($fromEmail == '') {
1492
-            $fromEmail = get_option('site_email');
1493
-        }
1494
-        if ($fromEmailName == '') {
1495
-            $fromEmailName = get_option('site_email_name');
1496
-        }
1497
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1498
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1499
-        $message = str_replace($search_array, $replace_array, $message);
1500
-
1501
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1502
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1503
-        $subject = str_replace($search_array, $replace_array, $subject);
1504
-        $headers = 'MIME-Version: 1.0' . "\r\n";
1505
-        $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1506
-        $headers .= "Reply-To: " . $fromEmail . "\r\n";
1507
-        $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1508
-
1509
-        $to = $toEmail;
1510
-
1511
-        $sent = wp_mail($to, $subject, $message, $headers);
1512
-        if( ! $sent ) {
1513
-            if ( is_array( $to ) ) {
1514
-                $to = implode( ',', $to );
1515
-            }
1516
-            $log_message = sprintf(
1517
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1518
-                $message_type,
1519
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1520
-                $to,
1521
-                $subject
1522
-            );
1523
-            geodir_error_log( $log_message );
1524
-        }
1525
-
1526
-        ///////// ADMIN BCC EMIALS
1527
-        $admin_bcc = false;
1528
-        if ($message_type == 'registration') {
1529
-            $message_raw = explode(__("Password:", 'geodirectory'), $message);
1530
-            $message_raw2 = explode("</p>", $message_raw[1], 2);
1531
-            $message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1532
-        }
1533
-        $adminEmail = get_bloginfo('admin_email');
1534
-        $to = $adminEmail;
1535
-
1536
-        if ($message_type == 'registration' && get_option('bcc_new_user')) {
1537
-            $subject .= ' - ADMIN BCC COPY';
1538
-            $admin_bcc = true;
1539
-        }
1540
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1541
-            $subject .= ' - ADMIN BCC COPY';
1542
-            $admin_bcc = true;
1543
-        }
1544
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1545
-            $subject .= ' - ADMIN BCC COPY';
1546
-            $admin_bcc = true;
1547
-        }
1548
-
1549
-        if($admin_bcc === true){
1550
-            $sent = wp_mail($to, $subject, $message, $headers);
1551
-            if( ! $sent ) {
1552
-                if ( is_array( $to ) ) {
1553
-                    $to = implode( ',', $to );
1554
-                }
1555
-                $log_message = sprintf(
1556
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1557
-                    $message_type,
1558
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1559
-                    $to,
1560
-                    $subject
1561
-                );
1562
-                geodir_error_log( $log_message );
1563
-            }
1564
-        }
1565
-
1566
-    }
1447
+	/**
1448
+	 * @todo could be a duplicate of geodir_sendEmail.
1449
+	 *
1450
+	 * @since 1.0.0
1451
+	 * @package GeoDirectory
1452
+	 * @param string $fromEmail Sender email address.
1453
+	 * @param string $fromEmailName Sender name.
1454
+	 * @param string $toEmail Receiver email address.
1455
+	 * @param string $toEmailName Receiver name.
1456
+	 * @param string $to_subject Email subject.
1457
+	 * @param string $to_message Email content.
1458
+	 * @param string $extra Not being used.
1459
+	 * @param string $message_type The message type. Can be send_friend, send_enquiry, forgot_password, registration.
1460
+	 * @param string $post_id The post ID.
1461
+	 * @param string $user_id The user ID.
1462
+	 */
1463
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '')
1464
+	{
1465
+		$login_details = '';
1466
+		if ($message_type == 'send_friend') {
1467
+			$subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
+			$message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1469
+		} elseif ($message_type == 'send_enquiry') {
1470
+			$subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
+			$message = __(get_option('email_enquiry_content'),'geodirectory');
1472
+		} elseif ($message_type == 'forgot_password') {
1473
+			$subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
+			$message = __(get_option('forgot_password_content'),'geodirectory');
1475
+			$login_details = $to_message;
1476
+		} elseif ($message_type == 'registration') {
1477
+			$subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
+			$message = __(get_option('registration_success_email_content'),'geodirectory');
1479
+			$login_details = $to_message;
1480
+		}
1481
+		$to_message = nl2br($to_message);
1482
+		$sitefromEmail = get_option('site_email');
1483
+		$sitefromEmailName = get_site_emailName();
1484
+		$productlink = get_permalink($post_id);
1485
+		$post_info = get_post($post_id);
1486
+		$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1487
+		$siteurl = home_url();
1488
+		$siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1489
+		$loginurl = geodir_login_url();
1490
+		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
1491
+		if ($fromEmail == '') {
1492
+			$fromEmail = get_option('site_email');
1493
+		}
1494
+		if ($fromEmailName == '') {
1495
+			$fromEmailName = get_option('site_email_name');
1496
+		}
1497
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]');
1498
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName);
1499
+		$message = str_replace($search_array, $replace_array, $message);
1500
+
1501
+		$search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]');
1502
+		$replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName);
1503
+		$subject = str_replace($search_array, $replace_array, $subject);
1504
+		$headers = 'MIME-Version: 1.0' . "\r\n";
1505
+		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1506
+		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1507
+		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1508
+
1509
+		$to = $toEmail;
1510
+
1511
+		$sent = wp_mail($to, $subject, $message, $headers);
1512
+		if( ! $sent ) {
1513
+			if ( is_array( $to ) ) {
1514
+				$to = implode( ',', $to );
1515
+			}
1516
+			$log_message = sprintf(
1517
+				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1518
+				$message_type,
1519
+				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1520
+				$to,
1521
+				$subject
1522
+			);
1523
+			geodir_error_log( $log_message );
1524
+		}
1525
+
1526
+		///////// ADMIN BCC EMIALS
1527
+		$admin_bcc = false;
1528
+		if ($message_type == 'registration') {
1529
+			$message_raw = explode(__("Password:", 'geodirectory'), $message);
1530
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1531
+			$message = $message_raw[0] . __('Password:', 'geodirectory') . ' **********</p>' . $message_raw2[1];
1532
+		}
1533
+		$adminEmail = get_bloginfo('admin_email');
1534
+		$to = $adminEmail;
1535
+
1536
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1537
+			$subject .= ' - ADMIN BCC COPY';
1538
+			$admin_bcc = true;
1539
+		}
1540
+		elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1541
+			$subject .= ' - ADMIN BCC COPY';
1542
+			$admin_bcc = true;
1543
+		}
1544
+		elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1545
+			$subject .= ' - ADMIN BCC COPY';
1546
+			$admin_bcc = true;
1547
+		}
1548
+
1549
+		if($admin_bcc === true){
1550
+			$sent = wp_mail($to, $subject, $message, $headers);
1551
+			if( ! $sent ) {
1552
+				if ( is_array( $to ) ) {
1553
+					$to = implode( ',', $to );
1554
+				}
1555
+				$log_message = sprintf(
1556
+					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1557
+					$message_type,
1558
+					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1559
+					$to,
1560
+					$subject
1561
+				);
1562
+				geodir_error_log( $log_message );
1563
+			}
1564
+		}
1565
+
1566
+	}
1567 1567
 }
1568 1568
 
1569 1569
 /*
@@ -1581,16 +1581,16 @@  discard block
 block discarded – undo
1581 1581
  */
1582 1582
 function gd_lang_object_ids($ids_array, $type)
1583 1583
 {
1584
-    if (function_exists('icl_object_id')) {
1585
-        $res = array();
1586
-        foreach ($ids_array as $id) {
1587
-            $xlat = icl_object_id($id, $type, false);
1588
-            if (!is_null($xlat)) $res[] = $xlat;
1589
-        }
1590
-        return $res;
1591
-    } else {
1592
-        return $ids_array;
1593
-    }
1584
+	if (function_exists('icl_object_id')) {
1585
+		$res = array();
1586
+		foreach ($ids_array as $id) {
1587
+			$xlat = icl_object_id($id, $type, false);
1588
+			if (!is_null($xlat)) $res[] = $xlat;
1589
+		}
1590
+		return $res;
1591
+	} else {
1592
+		return $ids_array;
1593
+	}
1594 1594
 }
1595 1595
 
1596 1596
 
@@ -1605,31 +1605,31 @@  discard block
 block discarded – undo
1605 1605
  * @return array Modified Body CSS classes.
1606 1606
  */
1607 1607
 function geodir_custom_posts_body_class($classes) {
1608
-    global $wpdb, $wp;
1609
-    $post_types = geodir_get_posttypes('object');
1610
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1611
-        $classes[] = 'geodir_custom_posts';
1612
-    }
1613
-
1614
-    // fix body class for signup page
1615
-    if (geodir_is_page('login')) {
1616
-        $new_classes = array();
1617
-        $new_classes[] = 'signup page-geodir-signup';
1618
-        if (!empty($classes)) {
1619
-            foreach ($classes as $class) {
1620
-                if ($class && $class != 'home' && $class != 'blog') {
1621
-                    $new_classes[] = $class;
1622
-                }
1623
-            }
1624
-        }
1625
-        $classes = $new_classes;
1626
-    }
1627
-
1628
-    if (geodir_is_geodir_page()) {
1629
-        $classes[] = 'geodir-page';
1630
-    }
1631
-
1632
-    return $classes;
1608
+	global $wpdb, $wp;
1609
+	$post_types = geodir_get_posttypes('object');
1610
+	if (!empty($post_types) && count((array)$post_types) > 1) {
1611
+		$classes[] = 'geodir_custom_posts';
1612
+	}
1613
+
1614
+	// fix body class for signup page
1615
+	if (geodir_is_page('login')) {
1616
+		$new_classes = array();
1617
+		$new_classes[] = 'signup page-geodir-signup';
1618
+		if (!empty($classes)) {
1619
+			foreach ($classes as $class) {
1620
+				if ($class && $class != 'home' && $class != 'blog') {
1621
+					$new_classes[] = $class;
1622
+				}
1623
+			}
1624
+		}
1625
+		$classes = $new_classes;
1626
+	}
1627
+
1628
+	if (geodir_is_geodir_page()) {
1629
+		$classes[] = 'geodir-page';
1630
+	}
1631
+
1632
+	return $classes;
1633 1633
 }
1634 1634
 
1635 1635
 add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
@@ -1644,12 +1644,12 @@  discard block
 block discarded – undo
1644 1644
  */
1645 1645
 function geodir_map_zoom_level()
1646 1646
 {
1647
-    /**
1648
-     * Filter GD map zoom level.
1649
-     *
1650
-     * @since 1.0.0
1651
-     */
1652
-    return apply_filters('geodir_map_zoom_level', array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19));
1647
+	/**
1648
+	 * Filter GD map zoom level.
1649
+	 *
1650
+	 * @since 1.0.0
1651
+	 */
1652
+	return apply_filters('geodir_map_zoom_level', array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19));
1653 1653
 
1654 1654
 }
1655 1655
 
@@ -1663,12 +1663,12 @@  discard block
 block discarded – undo
1663 1663
  */
1664 1664
 function geodir_option_version_backup($geodir_option_name)
1665 1665
 {
1666
-    $version_date = time();
1667
-    $geodir_option = get_option($geodir_option_name);
1666
+	$version_date = time();
1667
+	$geodir_option = get_option($geodir_option_name);
1668 1668
 
1669
-    if (!empty($geodir_option)) {
1670
-        add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1671
-    }
1669
+	if (!empty($geodir_option)) {
1670
+		add_option($geodir_option_name . '_' . $version_date, $geodir_option);
1671
+	}
1672 1672
 }
1673 1673
 
1674 1674
 /**
@@ -1681,11 +1681,11 @@  discard block
 block discarded – undo
1681 1681
  */
1682 1682
 function get_page_id_geodir_add_listing_page($page_id)
1683 1683
 {
1684
-    if (geodir_wpml_multilingual_status()) {
1685
-        $post_type = 'post_page';
1686
-        $page_id = geodir_get_wpml_element_id($page_id, $post_type);
1687
-    }
1688
-    return $page_id;
1684
+	if (geodir_wpml_multilingual_status()) {
1685
+		$post_type = 'post_page';
1686
+		$page_id = geodir_get_wpml_element_id($page_id, $post_type);
1687
+	}
1688
+	return $page_id;
1689 1689
 }
1690 1690
 
1691 1691
 /**
@@ -1697,10 +1697,10 @@  discard block
 block discarded – undo
1697 1697
  */
1698 1698
 function geodir_wpml_multilingual_status()
1699 1699
 {
1700
-    if (function_exists('icl_object_id')) {
1701
-        return true;
1702
-    }
1703
-    return false;
1700
+	if (function_exists('icl_object_id')) {
1701
+		return true;
1702
+	}
1703
+	return false;
1704 1704
 }
1705 1705
 
1706 1706
 /**
@@ -1714,22 +1714,22 @@  discard block
 block discarded – undo
1714 1714
  */
1715 1715
 function geodir_get_wpml_element_id($page_id, $post_type)
1716 1716
 {
1717
-    global $sitepress;
1718
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1719
-        $trid = $sitepress->get_element_trid($page_id, $post_type);
1720
-
1721
-        if ($trid > 0) {
1722
-            $translations = $sitepress->get_element_translations($trid, $post_type);
1723
-
1724
-            $lang = $sitepress->get_current_language();
1725
-            $lang = $lang ? $lang : $sitepress->get_default_language();
1726
-
1727
-            if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1728
-                $page_id = $translations[$lang]->element_id;
1729
-            }
1730
-        }
1731
-    }
1732
-    return $page_id;
1717
+	global $sitepress;
1718
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1719
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
1720
+
1721
+		if ($trid > 0) {
1722
+			$translations = $sitepress->get_element_translations($trid, $post_type);
1723
+
1724
+			$lang = $sitepress->get_current_language();
1725
+			$lang = $lang ? $lang : $sitepress->get_default_language();
1726
+
1727
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
1728
+				$page_id = $translations[$lang]->element_id;
1729
+			}
1730
+		}
1731
+	}
1732
+	return $page_id;
1733 1733
 }
1734 1734
 
1735 1735
 /**
@@ -1741,20 +1741,20 @@  discard block
 block discarded – undo
1741 1741
  */
1742 1742
 function geodir_wpml_check_element_id()
1743 1743
 {
1744
-    global $sitepress;
1745
-    if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1746
-        $el_type = 'post_page';
1747
-        $el_id = get_option('geodir_add_listing_page');
1748
-        $default_lang = $sitepress->get_default_language();
1749
-        $el_details = $sitepress->get_element_language_details($el_id, $el_type);
1750
-
1751
-        if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1752
-            if (!$el_details->source_language_code) {
1753
-                $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1754
-                $sitepress->icl_translations_cache->clear();
1755
-            }
1756
-        }
1757
-    }
1744
+	global $sitepress;
1745
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
1746
+		$el_type = 'post_page';
1747
+		$el_id = get_option('geodir_add_listing_page');
1748
+		$default_lang = $sitepress->get_default_language();
1749
+		$el_details = $sitepress->get_element_language_details($el_id, $el_type);
1750
+
1751
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
1752
+			if (!$el_details->source_language_code) {
1753
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
1754
+				$sitepress->icl_translations_cache->clear();
1755
+			}
1756
+		}
1757
+	}
1758 1758
 }
1759 1759
 
1760 1760
 /**
@@ -1769,44 +1769,44 @@  discard block
 block discarded – undo
1769 1769
  */
1770 1770
 function geodir_widget_listings_get_order($query_args)
1771 1771
 {
1772
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1773
-
1774
-    $query_args = $gd_query_args_widgets;
1775
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1776
-        return $wpdb->posts . ".post_date DESC, ";
1777
-    }
1778
-
1779
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1780
-    $table = $plugin_prefix . $post_type . '_detail';
1781
-
1782
-    $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1783
-
1784
-    switch ($sort_by) {
1785
-        case 'latest':
1786
-        case 'newest':
1787
-            $orderby = $wpdb->posts . ".post_date DESC, ";
1788
-            break;
1789
-        case 'featured':
1790
-            $orderby = $table . ".is_featured ASC, ";
1791
-            break;
1792
-        case 'az':
1793
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1794
-            break;
1795
-        case 'high_review':
1796
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1797
-            break;
1798
-        case 'high_rating':
1799
-            $orderby = "( " . $table . ".overall_rating  ) DESC, ";
1800
-            break;
1801
-        case 'random':
1802
-            $orderby = "RAND(), ";
1803
-            break;
1804
-        default:
1805
-            $orderby = $wpdb->posts . ".post_title ASC, ";
1806
-            break;
1807
-    }
1808
-
1809
-    return $orderby;
1772
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1773
+
1774
+	$query_args = $gd_query_args_widgets;
1775
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1776
+		return $wpdb->posts . ".post_date DESC, ";
1777
+	}
1778
+
1779
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1780
+	$table = $plugin_prefix . $post_type . '_detail';
1781
+
1782
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
1783
+
1784
+	switch ($sort_by) {
1785
+		case 'latest':
1786
+		case 'newest':
1787
+			$orderby = $wpdb->posts . ".post_date DESC, ";
1788
+			break;
1789
+		case 'featured':
1790
+			$orderby = $table . ".is_featured ASC, ";
1791
+			break;
1792
+		case 'az':
1793
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1794
+			break;
1795
+		case 'high_review':
1796
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
1797
+			break;
1798
+		case 'high_rating':
1799
+			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
1800
+			break;
1801
+		case 'random':
1802
+			$orderby = "RAND(), ";
1803
+			break;
1804
+		default:
1805
+			$orderby = $wpdb->posts . ".post_title ASC, ";
1806
+			break;
1807
+	}
1808
+
1809
+	return $orderby;
1810 1810
 }
1811 1811
 
1812 1812
 /**
@@ -1824,126 +1824,126 @@  discard block
 block discarded – undo
1824 1824
  */
1825 1825
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
1826 1826
 {
1827
-    global $wpdb, $plugin_prefix, $table_prefix;
1828
-    $GLOBALS['gd_query_args_widgets'] = $query_args;
1829
-    $gd_query_args_widgets = $query_args;
1830
-
1831
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1832
-    $table = $plugin_prefix . $post_type . '_detail';
1833
-
1834
-    $fields = $wpdb->posts . ".*, " . $table . ".*";
1835
-    /**
1836
-     * Filter widget listing fields string part that is being used for query.
1837
-     *
1838
-     * @since 1.0.0
1839
-     * @param string $fields Fields string.
1840
-     * @param string $table Table name.
1841
-     * @param string $post_type Post type.
1842
-     */
1843
-    $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1844
-
1845
-    $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1827
+	global $wpdb, $plugin_prefix, $table_prefix;
1828
+	$GLOBALS['gd_query_args_widgets'] = $query_args;
1829
+	$gd_query_args_widgets = $query_args;
1830
+
1831
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1832
+	$table = $plugin_prefix . $post_type . '_detail';
1833
+
1834
+	$fields = $wpdb->posts . ".*, " . $table . ".*";
1835
+	/**
1836
+	 * Filter widget listing fields string part that is being used for query.
1837
+	 *
1838
+	 * @since 1.0.0
1839
+	 * @param string $fields Fields string.
1840
+	 * @param string $table Table name.
1841
+	 * @param string $post_type Post type.
1842
+	 */
1843
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
1844
+
1845
+	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
1846
+
1847
+	########### WPML ###########
1848
+
1849
+	if (function_exists('icl_object_id')) {
1850
+		global $sitepress;
1851
+		$lang_code = ICL_LANGUAGE_CODE;
1852
+		if ($lang_code) {
1853
+			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1854
+		}
1855
+	}
1846 1856
 
1847
-    ########### WPML ###########
1857
+	########### WPML ###########
1848 1858
 
1849
-    if (function_exists('icl_object_id')) {
1850
-        global $sitepress;
1851
-        $lang_code = ICL_LANGUAGE_CODE;
1852
-        if ($lang_code) {
1853
-            $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
1854
-        }
1855
-    }
1859
+	/**
1860
+	 * Filter widget listing join clause string part that is being used for query.
1861
+	 *
1862
+	 * @since 1.0.0
1863
+	 * @param string $join Join clause string.
1864
+	 * @param string $post_type Post type.
1865
+	 */
1866
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1856 1867
 
1857
-    ########### WPML ###########
1868
+	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1858 1869
 
1859
-    /**
1860
-     * Filter widget listing join clause string part that is being used for query.
1861
-     *
1862
-     * @since 1.0.0
1863
-     * @param string $join Join clause string.
1864
-     * @param string $post_type Post type.
1865
-     */
1866
-    $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
1867
-
1868
-    $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
1869
-
1870
-    $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1871
-
1872
-    ########### WPML ###########
1873
-    if (function_exists('icl_object_id')) {
1874
-        if ($lang_code) {
1875
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
1876
-        }
1877
-    }
1878
-    ########### WPML ###########
1879
-    /**
1880
-     * Filter widget listing where clause string part that is being used for query.
1881
-     *
1882
-     * @since 1.0.0
1883
-     * @param string $where Where clause string.
1884
-     * @param string $post_type Post type.
1885
-     */
1886
-    $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
1887
-    $where = $where != '' ? " WHERE 1=1 " . $where : '';
1888
-
1889
-    $groupby = " GROUP BY $wpdb->posts.ID ";
1890
-    /**
1891
-     * Filter widget listing groupby clause string part that is being used for query.
1892
-     *
1893
-     * @since 1.0.0
1894
-     * @param string $groupby Group by clause string.
1895
-     * @param string $post_type Post type.
1896
-     */
1897
-    $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1870
+	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
1898 1871
 
1899
-    if ($count_only) {
1900
-        $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1872
+	########### WPML ###########
1873
+	if (function_exists('icl_object_id')) {
1874
+		if ($lang_code) {
1875
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
1876
+		}
1877
+	}
1878
+	########### WPML ###########
1879
+	/**
1880
+	 * Filter widget listing where clause string part that is being used for query.
1881
+	 *
1882
+	 * @since 1.0.0
1883
+	 * @param string $where Where clause string.
1884
+	 * @param string $post_type Post type.
1885
+	 */
1886
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
1887
+	$where = $where != '' ? " WHERE 1=1 " . $where : '';
1888
+
1889
+	$groupby = " GROUP BY $wpdb->posts.ID ";
1890
+	/**
1891
+	 * Filter widget listing groupby clause string part that is being used for query.
1892
+	 *
1893
+	 * @since 1.0.0
1894
+	 * @param string $groupby Group by clause string.
1895
+	 * @param string $post_type Post type.
1896
+	 */
1897
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
1898
+
1899
+	if ($count_only) {
1900
+		$sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1901 1901
 			" . $join . "
1902 1902
 			" . $where;
1903
-        $rows = (int)$wpdb->get_var($sql);
1904
-    } else {
1905
-        $orderby = geodir_widget_listings_get_order($query_args);
1906
-        /**
1907
-         * Filter widget listing orderby clause string part that is being used for query.
1908
-         *
1909
-         * @since 1.0.0
1910
-         * @param string $orderby Order by clause string.
1911
-         * @param string $table Table name.
1912
-         * @param string $post_type Post type.
1913
-         */
1914
-        $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
1915
-        $orderby .= $wpdb->posts . ".post_title ASC";
1916
-        $orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
1917
-
1918
-        $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
1919
-        /**
1920
-         * Filter widget listing limit that is being used for query.
1921
-         *
1922
-         * @since 1.0.0
1923
-         * @param int $limit Query results limit.
1924
-         * @param string $post_type Post type.
1925
-         */
1926
-        $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1927
-
1928
-        $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1929
-        if ( !$page )
1930
-            $page = 1;
1931
-
1932
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1933
-
1934
-        $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1903
+		$rows = (int)$wpdb->get_var($sql);
1904
+	} else {
1905
+		$orderby = geodir_widget_listings_get_order($query_args);
1906
+		/**
1907
+		 * Filter widget listing orderby clause string part that is being used for query.
1908
+		 *
1909
+		 * @since 1.0.0
1910
+		 * @param string $orderby Order by clause string.
1911
+		 * @param string $table Table name.
1912
+		 * @param string $post_type Post type.
1913
+		 */
1914
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
1915
+		$orderby .= $wpdb->posts . ".post_title ASC";
1916
+		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
1917
+
1918
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
1919
+		/**
1920
+		 * Filter widget listing limit that is being used for query.
1921
+		 *
1922
+		 * @since 1.0.0
1923
+		 * @param int $limit Query results limit.
1924
+		 * @param string $post_type Post type.
1925
+		 */
1926
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1927
+
1928
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1929
+		if ( !$page )
1930
+			$page = 1;
1931
+
1932
+		$limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1933
+
1934
+		$sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1935 1935
 			" . $join . "
1936 1936
 			" . $where . "
1937 1937
 			" . $groupby . "
1938 1938
 			" . $orderby . "
1939 1939
 			" . $limit;
1940
-        $rows = $wpdb->get_results($sql);
1941
-    }
1940
+		$rows = $wpdb->get_results($sql);
1941
+	}
1942 1942
 
1943
-    unset($GLOBALS['gd_query_args_widgets']);
1944
-    unset($gd_query_args_widgets);
1943
+	unset($GLOBALS['gd_query_args_widgets']);
1944
+	unset($gd_query_args_widgets);
1945 1945
 
1946
-    return $rows;
1946
+	return $rows;
1947 1947
 }
1948 1948
 
1949 1949
 /**
@@ -1958,14 +1958,14 @@  discard block
 block discarded – undo
1958 1958
  */
1959 1959
 function geodir_function_widget_listings_fields($fields)
1960 1960
 {
1961
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1961
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1962 1962
 
1963
-    $query_args = $gd_query_args_widgets;
1964
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1965
-        return $fields;
1966
-    }
1963
+	$query_args = $gd_query_args_widgets;
1964
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1965
+		return $fields;
1966
+	}
1967 1967
     
1968
-    return $fields;
1968
+	return $fields;
1969 1969
 }
1970 1970
 
1971 1971
 /**
@@ -1980,28 +1980,28 @@  discard block
 block discarded – undo
1980 1980
  */
1981 1981
 function geodir_function_widget_listings_join($join)
1982 1982
 {
1983
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1983
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
1984 1984
 
1985
-    $query_args = $gd_query_args_widgets;
1986
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1987
-        return $join;
1988
-    }
1985
+	$query_args = $gd_query_args_widgets;
1986
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
1987
+		return $join;
1988
+	}
1989 1989
 
1990
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1991
-    $table = $plugin_prefix . $post_type . '_detail';
1990
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
1991
+	$table = $plugin_prefix . $post_type . '_detail';
1992 1992
 
1993
-    if (!empty($query_args['with_pics_only'])) {
1994
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
1995
-    }
1993
+	if (!empty($query_args['with_pics_only'])) {
1994
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
1995
+	}
1996 1996
 
1997
-    if (!empty($query_args['tax_query'])) {
1998
-        $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
1999
-        if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2000
-            $join .= $tax_queries['join'];
2001
-        }
2002
-    }
1997
+	if (!empty($query_args['tax_query'])) {
1998
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
1999
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2000
+			$join .= $tax_queries['join'];
2001
+		}
2002
+	}
2003 2003
 
2004
-    return $join;
2004
+	return $join;
2005 2005
 }
2006 2006
 
2007 2007
 /**
@@ -2016,55 +2016,55 @@  discard block
 block discarded – undo
2016 2016
  */
2017 2017
 function geodir_function_widget_listings_where($where)
2018 2018
 {
2019
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2020
-
2021
-    $query_args = $gd_query_args_widgets;
2022
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2023
-        return $where;
2024
-    }
2025
-    $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2026
-    $table = $plugin_prefix . $post_type . '_detail';
2027
-
2028
-    if (!empty($query_args)) {
2029
-        if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2030
-            $where = geodir_default_location_where($where, $table);
2031
-        }
2032
-
2033
-        if (!empty($query_args['post_author'])) {
2034
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2035
-        }
2036
-        
2037
-        if (!empty($query_args['show_featured_only'])) {
2038
-            $where .= " AND " . $table . ".is_featured = '1'";
2039
-        }
2019
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2040 2020
 
2041
-        if (!empty($query_args['show_special_only'])) {
2042
-            $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2043
-        }
2021
+	$query_args = $gd_query_args_widgets;
2022
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2023
+		return $where;
2024
+	}
2025
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2026
+	$table = $plugin_prefix . $post_type . '_detail';
2044 2027
 
2045
-        if (!empty($query_args['with_pics_only'])) {
2046
-            $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2047
-        }
2028
+	if (!empty($query_args)) {
2029
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2030
+			$where = geodir_default_location_where($where, $table);
2031
+		}
2048 2032
 
2049
-        if (!empty($query_args['featured_image_only'])) {
2050
-            $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2051
-        }
2033
+		if (!empty($query_args['post_author'])) {
2034
+			$where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2035
+		}
2036
+        
2037
+		if (!empty($query_args['show_featured_only'])) {
2038
+			$where .= " AND " . $table . ".is_featured = '1'";
2039
+		}
2052 2040
 
2053
-        if (!empty($query_args['with_videos_only'])) {
2054
-            $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2055
-        }
2041
+		if (!empty($query_args['show_special_only'])) {
2042
+			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2043
+		}
2056 2044
 
2057
-        if (!empty($query_args['tax_query'])) {
2058
-            $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2045
+		if (!empty($query_args['with_pics_only'])) {
2046
+			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2047
+		}
2059 2048
 
2060
-            if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2061
-                $where .= $tax_queries['where'];
2062
-            }
2063
-        }
2064
-    }
2049
+		if (!empty($query_args['featured_image_only'])) {
2050
+			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2051
+		}
2065 2052
 
2066
-    return $where;
2067
-}
2053
+		if (!empty($query_args['with_videos_only'])) {
2054
+			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2055
+		}
2056
+
2057
+		if (!empty($query_args['tax_query'])) {
2058
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2059
+
2060
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2061
+				$where .= $tax_queries['where'];
2062
+			}
2063
+		}
2064
+	}
2065
+
2066
+	return $where;
2067
+}
2068 2068
 
2069 2069
 /**
2070 2070
  * Listing query orderby clause SQL part for widgets.
@@ -2078,14 +2078,14 @@  discard block
 block discarded – undo
2078 2078
  */
2079 2079
 function geodir_function_widget_listings_orderby($orderby)
2080 2080
 {
2081
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2081
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2082 2082
 
2083
-    $query_args = $gd_query_args_widgets;
2084
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2085
-        return $orderby;
2086
-    }
2083
+	$query_args = $gd_query_args_widgets;
2084
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2085
+		return $orderby;
2086
+	}
2087 2087
 
2088
-    return $orderby;
2088
+	return $orderby;
2089 2089
 }
2090 2090
 
2091 2091
 /**
@@ -2100,18 +2100,18 @@  discard block
 block discarded – undo
2100 2100
  */
2101 2101
 function geodir_function_widget_listings_limit($limit)
2102 2102
 {
2103
-    global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2103
+	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2104 2104
 
2105
-    $query_args = $gd_query_args_widgets;
2106
-    if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2107
-        return $limit;
2108
-    }
2105
+	$query_args = $gd_query_args_widgets;
2106
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2107
+		return $limit;
2108
+	}
2109 2109
 
2110
-    if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2111
-        $limit = (int)$query_args['posts_per_page'];
2112
-    }
2110
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2111
+		$limit = (int)$query_args['posts_per_page'];
2112
+	}
2113 2113
 
2114
-    return $limit;
2114
+	return $limit;
2115 2115
 }
2116 2116
 
2117 2117
 /**
@@ -2125,24 +2125,24 @@  discard block
 block discarded – undo
2125 2125
  */
2126 2126
 function geodir_media_image_large_width($default = 800, $params = '')
2127 2127
 {
2128
-    $large_size_w = get_option('large_size_w');
2129
-    $large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2130
-    $large_size_w = absint($large_size_w);
2131
-
2132
-    if (!get_option('geodir_use_wp_media_large_size')) {
2133
-        $large_size_w = 800;
2134
-    }
2135
-
2136
-    /**
2137
-     * Filter large image width.
2138
-     *
2139
-     * @since 1.0.0
2140
-     * @param int $large_size_w Large image width.
2141
-     * @param int $default Default width.
2142
-     * @param string|array $params Image parameters.
2143
-     */
2144
-    $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2145
-    return $large_size_w;
2128
+	$large_size_w = get_option('large_size_w');
2129
+	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2130
+	$large_size_w = absint($large_size_w);
2131
+
2132
+	if (!get_option('geodir_use_wp_media_large_size')) {
2133
+		$large_size_w = 800;
2134
+	}
2135
+
2136
+	/**
2137
+	 * Filter large image width.
2138
+	 *
2139
+	 * @since 1.0.0
2140
+	 * @param int $large_size_w Large image width.
2141
+	 * @param int $default Default width.
2142
+	 * @param string|array $params Image parameters.
2143
+	 */
2144
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2145
+	return $large_size_w;
2146 2146
 }
2147 2147
 
2148 2148
 /**
@@ -2156,25 +2156,25 @@  discard block
 block discarded – undo
2156 2156
  */
2157 2157
 function geodir_media_image_large_height($default = 800, $params = '')
2158 2158
 {
2159
-    $large_size_h = get_option('large_size_h');
2160
-    $large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2161
-    $large_size_h = absint($large_size_h);
2162
-
2163
-    if (!get_option('geodir_use_wp_media_large_size')) {
2164
-        $large_size_h = 800;
2165
-    }
2166
-
2167
-    /**
2168
-     * Filter large image height.
2169
-     *
2170
-     * @since 1.0.0
2171
-     * @param int $large_size_h Large image height.
2172
-     * @param int $default Default height.
2173
-     * @param string|array $params Image parameters.
2174
-     */
2175
-    $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2159
+	$large_size_h = get_option('large_size_h');
2160
+	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2161
+	$large_size_h = absint($large_size_h);
2162
+
2163
+	if (!get_option('geodir_use_wp_media_large_size')) {
2164
+		$large_size_h = 800;
2165
+	}
2176 2166
 
2177
-    return $large_size_h;
2167
+	/**
2168
+	 * Filter large image height.
2169
+	 *
2170
+	 * @since 1.0.0
2171
+	 * @param int $large_size_h Large image height.
2172
+	 * @param int $default Default height.
2173
+	 * @param string|array $params Image parameters.
2174
+	 */
2175
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2176
+
2177
+	return $large_size_h;
2178 2178
 }
2179 2179
 
2180 2180
 /**
@@ -2189,25 +2189,25 @@  discard block
 block discarded – undo
2189 2189
  */
2190 2190
 function geodir_sanitize_location_name($type, $name, $translate = true)
2191 2191
 {
2192
-    if ($name == '') {
2193
-        return NULL;
2194
-    }
2195
-
2196
-    $type = $type == 'gd_country' ? 'country' : $type;
2197
-    $type = $type == 'gd_region' ? 'region' : $type;
2198
-    $type = $type == 'gd_city' ? 'city' : $type;
2199
-
2200
-    $return = $name;
2201
-    if (function_exists('get_actual_location_name')) {
2202
-        $return = get_actual_location_name($type, $name, $translate);
2203
-    } else {
2204
-        $return = preg_replace('/-(\d+)$/', '', $return);
2205
-        $return = preg_replace('/[_-]/', ' ', $return);
2206
-        $return = geodir_ucwords($return);
2207
-        $return = $translate ? __($return, 'geodirectory') : $return;
2208
-    }
2209
-
2210
-    return $return;
2192
+	if ($name == '') {
2193
+		return NULL;
2194
+	}
2195
+
2196
+	$type = $type == 'gd_country' ? 'country' : $type;
2197
+	$type = $type == 'gd_region' ? 'region' : $type;
2198
+	$type = $type == 'gd_city' ? 'city' : $type;
2199
+
2200
+	$return = $name;
2201
+	if (function_exists('get_actual_location_name')) {
2202
+		$return = get_actual_location_name($type, $name, $translate);
2203
+	} else {
2204
+		$return = preg_replace('/-(\d+)$/', '', $return);
2205
+		$return = preg_replace('/[_-]/', ' ', $return);
2206
+		$return = geodir_ucwords($return);
2207
+		$return = $translate ? __($return, 'geodirectory') : $return;
2208
+	}
2209
+
2210
+	return $return;
2211 2211
 }
2212 2212
 
2213 2213
 
@@ -2221,14 +2221,14 @@  discard block
 block discarded – undo
2221 2221
 function geodir_comments_number($number)
2222 2222
 {
2223 2223
 
2224
-    if ($number > 1) {
2225
-        $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2226
-    } elseif ($number == 0 || $number == '') {
2227
-        $output = __('No Reviews', 'geodirectory');
2228
-    } else { // must be one
2229
-        $output = __('1 Review', 'geodirectory');
2230
-    }
2231
-    echo $output;
2224
+	if ($number > 1) {
2225
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2226
+	} elseif ($number == 0 || $number == '') {
2227
+		$output = __('No Reviews', 'geodirectory');
2228
+	} else { // must be one
2229
+		$output = __('1 Review', 'geodirectory');
2230
+	}
2231
+	echo $output;
2232 2232
 }
2233 2233
 
2234 2234
 /**
@@ -2241,23 +2241,23 @@  discard block
 block discarded – undo
2241 2241
  */
2242 2242
 function is_page_geodir_home()
2243 2243
 {
2244
-    global $wpdb;
2245
-    $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2246
-    if (function_exists('geodir_location_geo_home_link')) {
2247
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2248
-    }
2249
-    $home_url = home_url('', 'http');
2250
-    if (function_exists('geodir_location_geo_home_link')) {
2251
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2252
-    }
2253
-    $home_url = str_replace("www.", "", $home_url);
2254
-    if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2255
-        return true;
2256
-    }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2257
-        return true;
2258
-    } else {
2259
-        return false;
2260
-    }
2244
+	global $wpdb;
2245
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2246
+	if (function_exists('geodir_location_geo_home_link')) {
2247
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2248
+	}
2249
+	$home_url = home_url('', 'http');
2250
+	if (function_exists('geodir_location_geo_home_link')) {
2251
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2252
+	}
2253
+	$home_url = str_replace("www.", "", $home_url);
2254
+	if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2255
+		return true;
2256
+	}elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2257
+		return true;
2258
+	} else {
2259
+		return false;
2260
+	}
2261 2261
 
2262 2262
 }
2263 2263
 
@@ -2273,13 +2273,13 @@  discard block
 block discarded – undo
2273 2273
  */
2274 2274
 function geodir_wpseo_homepage_canonical($url)
2275 2275
 {
2276
-    global $post;
2276
+	global $post;
2277 2277
 
2278
-    if (is_page_geodir_home()) {
2279
-        return home_url();
2280
-    }
2278
+	if (is_page_geodir_home()) {
2279
+		return home_url();
2280
+	}
2281 2281
 
2282
-    return $url;
2282
+	return $url;
2283 2283
 }
2284 2284
 
2285 2285
 add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
@@ -2296,16 +2296,16 @@  discard block
 block discarded – undo
2296 2296
  */
2297 2297
 function geodir_googlemap_script_extra_details_page($extra)
2298 2298
 {
2299
-    global $post;
2300
-    $add_google_places_api = false;
2301
-    if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2302
-        $add_google_places_api = true;
2303
-    }
2304
-    if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2305
-        $extra .= "&amp;libraries=places";
2306
-    }
2307
-
2308
-    return $extra;
2299
+	global $post;
2300
+	$add_google_places_api = false;
2301
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2302
+		$add_google_places_api = true;
2303
+	}
2304
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2305
+		$extra .= "&amp;libraries=places";
2306
+	}
2307
+
2308
+	return $extra;
2309 2309
 }
2310 2310
 
2311 2311
 add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
@@ -2325,91 +2325,91 @@  discard block
 block discarded – undo
2325 2325
  */
2326 2326
 function geodir_popular_post_category_output($args = '', $instance = '')
2327 2327
 {
2328
-    // prints the widget
2329
-    global $wpdb, $plugin_prefix, $geodir_post_category_str;
2330
-    extract($args, EXTR_SKIP);
2331
-
2332
-    echo $before_widget;
2333
-
2334
-    /** This filter is documented in geodirectory_widgets.php */
2335
-    $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2336
-
2337
-    $gd_post_type = geodir_get_current_posttype();
2338
-
2339
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2340
-    $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2341
-
2342
-    $taxonomy = array();
2343
-    if (!empty($gd_post_type)) {
2344
-        $taxonomy[] = $gd_post_type . "category";
2345
-    } else {
2346
-        $taxonomy = geodir_get_taxonomies($gd_post_type);
2347
-    }
2348
-
2349
-    $terms = get_terms($taxonomy);
2350
-    $a_terms = array();
2351
-    $b_terms = array();
2352
-
2353
-    foreach ($terms as $term) {
2354
-        if ($term->count > 0) {
2355
-            $a_terms[$term->taxonomy][] = $term;
2356
-        }
2357
-    }
2358
-
2359
-    if (!empty($a_terms)) {
2360
-        foreach ($a_terms as $b_key => $b_val) {
2361
-            $b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2362
-        }
2363
-
2364
-        $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2365
-
2366
-        $tax_change_output = '';
2367
-        if (count($b_terms) > 1) {
2368
-            $tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2369
-            foreach ($b_terms as $key => $val) {
2370
-                $ptype = get_post_type_object(str_replace("category", "", $key));
2371
-                $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2372
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2373
-            }
2374
-            $tax_change_output .= "</select>";
2375
-        }
2376
-
2377
-        if (!empty($b_terms)) {
2378
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2379
-            global $cat_count;//make global so we can change via function
2380
-            $cat_count = 0;
2381
-            ?>
2328
+	// prints the widget
2329
+	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2330
+	extract($args, EXTR_SKIP);
2331
+
2332
+	echo $before_widget;
2333
+
2334
+	/** This filter is documented in geodirectory_widgets.php */
2335
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2336
+
2337
+	$gd_post_type = geodir_get_current_posttype();
2338
+
2339
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2340
+	$default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2341
+
2342
+	$taxonomy = array();
2343
+	if (!empty($gd_post_type)) {
2344
+		$taxonomy[] = $gd_post_type . "category";
2345
+	} else {
2346
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2347
+	}
2348
+
2349
+	$terms = get_terms($taxonomy);
2350
+	$a_terms = array();
2351
+	$b_terms = array();
2352
+
2353
+	foreach ($terms as $term) {
2354
+		if ($term->count > 0) {
2355
+			$a_terms[$term->taxonomy][] = $term;
2356
+		}
2357
+	}
2358
+
2359
+	if (!empty($a_terms)) {
2360
+		foreach ($a_terms as $b_key => $b_val) {
2361
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2362
+		}
2363
+
2364
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type . 'category']) ? $default_post_type . 'category' : '';
2365
+
2366
+		$tax_change_output = '';
2367
+		if (count($b_terms) > 1) {
2368
+			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2369
+			foreach ($b_terms as $key => $val) {
2370
+				$ptype = get_post_type_object(str_replace("category", "", $key));
2371
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2372
+				$tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2373
+			}
2374
+			$tax_change_output .= "</select>";
2375
+		}
2376
+
2377
+		if (!empty($b_terms)) {
2378
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2379
+			global $cat_count;//make global so we can change via function
2380
+			$cat_count = 0;
2381
+			?>
2382 2382
             <div class="geodir-category-list-in clearfix">
2383 2383
                 <div class="geodir-cat-list clearfix">
2384 2384
                     <?php
2385
-                    echo $before_title . __($title) . $after_title;
2385
+					echo $before_title . __($title) . $after_title;
2386 2386
 
2387
-                    echo $tax_change_output;
2387
+					echo $tax_change_output;
2388 2388
 
2389
-                    echo '<ul class="geodir-popular-cat-list">';
2389
+					echo '<ul class="geodir-popular-cat-list">';
2390 2390
 
2391
-                    geodir_helper_cat_list_output($terms, $category_limit);
2391
+					geodir_helper_cat_list_output($terms, $category_limit);
2392 2392
 
2393
-                    echo '</ul>';
2394
-                    ?>
2393
+					echo '</ul>';
2394
+					?>
2395 2395
                 </div>
2396 2396
                 <?php
2397
-                $hide = '';
2398
-                if ($cat_count < $category_limit) {
2399
-                    $hide = 'style="display:none;"';
2400
-                }
2401
-                echo "<div class='geodir-cat-list-more' $hide >";
2402
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2403
-                echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2404
-                echo "</div>";
2405
-                /* add scripts */
2406
-                add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2407
-                ?>
2397
+				$hide = '';
2398
+				if ($cat_count < $category_limit) {
2399
+					$hide = 'style="display:none;"';
2400
+				}
2401
+				echo "<div class='geodir-cat-list-more' $hide >";
2402
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __('More Categories', 'geodirectory') . '</a>';
2403
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __('Less Categories', 'geodirectory') . '</a>';
2404
+				echo "</div>";
2405
+				/* add scripts */
2406
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2407
+				?>
2408 2408
             </div>
2409 2409
         <?php
2410
-        }
2411
-    }
2412
-    echo $after_widget;
2410
+		}
2411
+	}
2412
+	echo $after_widget;
2413 2413
 }
2414 2414
 
2415 2415
 /**
@@ -2423,38 +2423,38 @@  discard block
 block discarded – undo
2423 2423
  */
2424 2424
 function geodir_helper_cat_list_output($terms, $category_limit)
2425 2425
 {
2426
-    global $geodir_post_category_str, $cat_count;
2427
-    $term_icons = geodir_get_term_icon();
2426
+	global $geodir_post_category_str, $cat_count;
2427
+	$term_icons = geodir_get_term_icon();
2428 2428
 
2429
-    $geodir_post_category_str = array();
2429
+	$geodir_post_category_str = array();
2430 2430
 
2431 2431
 
2432
-    foreach ($terms as $cat) {
2433
-        $post_type = str_replace("category", "", $cat->taxonomy);
2434
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2432
+	foreach ($terms as $cat) {
2433
+		$post_type = str_replace("category", "", $cat->taxonomy);
2434
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2435 2435
 
2436
-        $cat_count++;
2436
+		$cat_count++;
2437 2437
 
2438
-        $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2438
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2439 2439
 
2440
-        $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2441
-        $total_post = $cat->count;
2440
+		$class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2441
+		$total_post = $cat->count;
2442 2442
 
2443
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2444
-        /**
2445
-         * Filer the category term link.
2446
-         *
2447
-         * @since 1.4.5
2448
-         * @param string $term_link The term permalink.
2449
-         * @param int    $cat->term_id The term id.
2450
-         * @param string $post_type Wordpress post type.
2451
-         */
2452
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2443
+		$term_link = get_term_link( $cat, $cat->taxonomy );
2444
+		/**
2445
+		 * Filer the category term link.
2446
+		 *
2447
+		 * @since 1.4.5
2448
+		 * @param string $term_link The term permalink.
2449
+		 * @param int    $cat->term_id The term id.
2450
+		 * @param string $post_type Wordpress post type.
2451
+		 */
2452
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2453 2453
 
2454
-        echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2455
-        echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2456
-        echo '</a></li>';
2457
-    }
2454
+		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2455
+		echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2456
+		echo '</a></li>';
2457
+	}
2458 2458
 }
2459 2459
 
2460 2460
 /**
@@ -2468,108 +2468,108 @@  discard block
 block discarded – undo
2468 2468
  */
2469 2469
 function geodir_listing_slider_widget_output($args = '', $instance = '')
2470 2470
 {
2471
-    // prints the widget
2472
-    extract($args, EXTR_SKIP);
2473
-
2474
-    echo $before_widget;
2475
-
2476
-    /** This filter is documented in geodirectory_widgets.php */
2477
-    $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2478
-    /**
2479
-     * Filter the widget post type.
2480
-     *
2481
-     * @since 1.0.0
2482
-     * @param string $instance['post_type'] Post type of listing.
2483
-     */
2484
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2485
-    /**
2486
-     * Filter the widget's term.
2487
-     *
2488
-     * @since 1.0.0
2489
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2490
-     */
2491
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2492
-    /**
2493
-     * Filter the widget listings limit.
2494
-     *
2495
-     * @since 1.0.0
2496
-     * @param string $instance['post_number'] Number of listings to display.
2497
-     */
2498
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2499
-    /**
2500
-     * Filter the widget listings limit shown at one time.
2501
-     *
2502
-     * @since 1.5.0
2503
-     * @param string $instance['max_show'] Number of listings to display on screen.
2504
-     */
2505
-    $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2506
-    /**
2507
-     * Filter the widget slide width.
2508
-     *
2509
-     * @since 1.5.0
2510
-     * @param string $instance['slide_width'] Width of the slides shown.
2511
-     */
2512
-    $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2513
-    /**
2514
-     * Filter widget's "show title" value.
2515
-     *
2516
-     * @since 1.0.0
2517
-     * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2518
-     */
2519
-    $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2520
-    /**
2521
-     * Filter widget's "slideshow" value.
2522
-     *
2523
-     * @since 1.0.0
2524
-     * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2525
-     */
2526
-    $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2527
-    /**
2528
-     * Filter widget's "animationLoop" value.
2529
-     *
2530
-     * @since 1.0.0
2531
-     * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2532
-     */
2533
-    $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2534
-    /**
2535
-     * Filter widget's "directionNav" value.
2536
-     *
2537
-     * @since 1.0.0
2538
-     * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2539
-     */
2540
-    $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2541
-    /**
2542
-     * Filter widget's "slideshowSpeed" value.
2543
-     *
2544
-     * @since 1.0.0
2545
-     * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2546
-     */
2547
-    $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2548
-    /**
2549
-     * Filter widget's "animationSpeed" value.
2550
-     *
2551
-     * @since 1.0.0
2552
-     * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2553
-     */
2554
-    $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2555
-    /**
2556
-     * Filter widget's "animation" value.
2557
-     *
2558
-     * @since 1.0.0
2559
-     * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2560
-     */
2561
-    $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2562
-    /**
2563
-     * Filter widget's "list_sort" type.
2564
-     *
2565
-     * @since 1.0.0
2566
-     * @param string $instance['list_sort'] Listing sort by type.
2567
-     */
2568
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2569
-    $show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2570
-
2571
-    wp_enqueue_script('geodirectory-jquery-flexslider-js');
2572
-    ?>
2471
+	// prints the widget
2472
+	extract($args, EXTR_SKIP);
2473
+
2474
+	echo $before_widget;
2475
+
2476
+	/** This filter is documented in geodirectory_widgets.php */
2477
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2478
+	/**
2479
+	 * Filter the widget post type.
2480
+	 *
2481
+	 * @since 1.0.0
2482
+	 * @param string $instance['post_type'] Post type of listing.
2483
+	 */
2484
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2485
+	/**
2486
+	 * Filter the widget's term.
2487
+	 *
2488
+	 * @since 1.0.0
2489
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2490
+	 */
2491
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2492
+	/**
2493
+	 * Filter the widget listings limit.
2494
+	 *
2495
+	 * @since 1.0.0
2496
+	 * @param string $instance['post_number'] Number of listings to display.
2497
+	 */
2498
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2499
+	/**
2500
+	 * Filter the widget listings limit shown at one time.
2501
+	 *
2502
+	 * @since 1.5.0
2503
+	 * @param string $instance['max_show'] Number of listings to display on screen.
2504
+	 */
2505
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
2506
+	/**
2507
+	 * Filter the widget slide width.
2508
+	 *
2509
+	 * @since 1.5.0
2510
+	 * @param string $instance['slide_width'] Width of the slides shown.
2511
+	 */
2512
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
2513
+	/**
2514
+	 * Filter widget's "show title" value.
2515
+	 *
2516
+	 * @since 1.0.0
2517
+	 * @param string|bool $instance['show_title'] Do you want to display title? Can be 1 or 0.
2518
+	 */
2519
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
2520
+	/**
2521
+	 * Filter widget's "slideshow" value.
2522
+	 *
2523
+	 * @since 1.0.0
2524
+	 * @param int $instance['slideshow'] Setup a slideshow for the slider to animate automatically.
2525
+	 */
2526
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
2527
+	/**
2528
+	 * Filter widget's "animationLoop" value.
2529
+	 *
2530
+	 * @since 1.0.0
2531
+	 * @param int $instance['animationLoop'] Gives the slider a seamless infinite loop.
2532
+	 */
2533
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
2534
+	/**
2535
+	 * Filter widget's "directionNav" value.
2536
+	 *
2537
+	 * @since 1.0.0
2538
+	 * @param int $instance['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
2539
+	 */
2540
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
2541
+	/**
2542
+	 * Filter widget's "slideshowSpeed" value.
2543
+	 *
2544
+	 * @since 1.0.0
2545
+	 * @param int $instance['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
2546
+	 */
2547
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
2548
+	/**
2549
+	 * Filter widget's "animationSpeed" value.
2550
+	 *
2551
+	 * @since 1.0.0
2552
+	 * @param int $instance['animationSpeed'] Set the speed of animations, in milliseconds.
2553
+	 */
2554
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
2555
+	/**
2556
+	 * Filter widget's "animation" value.
2557
+	 *
2558
+	 * @since 1.0.0
2559
+	 * @param string $instance['animation'] Controls the animation type, "fade" or "slide".
2560
+	 */
2561
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
2562
+	/**
2563
+	 * Filter widget's "list_sort" type.
2564
+	 *
2565
+	 * @since 1.0.0
2566
+	 * @param string $instance['list_sort'] Listing sort by type.
2567
+	 */
2568
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
2569
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : NULL;
2570
+
2571
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
2572
+	?>
2573 2573
     <script type="text/javascript">
2574 2574
         jQuery(window).load(function () {
2575 2575
             jQuery('#geodir_widget_carousel').flexslider({
@@ -2610,73 +2610,73 @@  discard block
 block discarded – undo
2610 2610
         });
2611 2611
     </script>
2612 2612
     <?php
2613
-    $query_args = array(
2614
-        'posts_per_page' => $post_number,
2615
-        'is_geodir_loop' => true,
2616
-        'post_type' => $post_type,
2617
-        'order_by' => $list_sort
2618
-    );
2619
-    if ($show_featured_only) {
2620
-        $query_args['show_featured_only'] = 1;
2621
-    }
2622
-
2623
-    if ($category != 0 || $category != '') {
2624
-        $category_taxonomy = geodir_get_taxonomies($post_type);
2625
-        $tax_query = array(
2626
-            'taxonomy' => $category_taxonomy[0],
2627
-            'field' => 'id',
2628
-            'terms' => $category
2629
-        );
2630
-
2631
-        $query_args['tax_query'] = array($tax_query);
2632
-    }
2633
-
2634
-    // we want listings with featured image only
2635
-    $query_args['featured_image_only'] = 1;
2636
-
2637
-    if ($post_type == 'gd_event') {
2638
-        $query_args['gedir_event_listing_filter'] = 'upcoming';
2639
-    }// show only upcomming events
2640
-
2641
-    $widget_listings = geodir_get_widget_listings($query_args);
2642
-    if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2643
-        if ($title) {
2644
-            echo $before_title . $title . $after_title;
2645
-        }
2646
-
2647
-        global $post;
2648
-
2649
-        $current_post = $post;// keep current post info
2650
-
2651
-        $widget_main_slides = '';
2652
-        $nav_slides = '';
2653
-        $widget_slides = 0;
2654
-
2655
-        foreach ($widget_listings as $widget_listing) {
2656
-            global $gd_widget_listing_type;
2657
-            $post = $widget_listing;
2658
-            $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2659
-
2660
-            if (!empty($widget_image)) {
2661
-                if ($widget_image->height >= 200) {
2662
-                    $widget_spacer_height = 0;
2663
-                } else {
2664
-                    $widget_spacer_height = ((200 - $widget_image->height) / 2);
2665
-                }
2666
-
2667
-                $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
2668
-
2669
-                $title = '';
2670
-                if ($show_title) {
2671
-                    $title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2672
-                }
2673
-
2674
-                $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
2675
-                $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2676
-                $widget_slides++;
2677
-            }
2678
-        }
2679
-        ?>
2613
+	$query_args = array(
2614
+		'posts_per_page' => $post_number,
2615
+		'is_geodir_loop' => true,
2616
+		'post_type' => $post_type,
2617
+		'order_by' => $list_sort
2618
+	);
2619
+	if ($show_featured_only) {
2620
+		$query_args['show_featured_only'] = 1;
2621
+	}
2622
+
2623
+	if ($category != 0 || $category != '') {
2624
+		$category_taxonomy = geodir_get_taxonomies($post_type);
2625
+		$tax_query = array(
2626
+			'taxonomy' => $category_taxonomy[0],
2627
+			'field' => 'id',
2628
+			'terms' => $category
2629
+		);
2630
+
2631
+		$query_args['tax_query'] = array($tax_query);
2632
+	}
2633
+
2634
+	// we want listings with featured image only
2635
+	$query_args['featured_image_only'] = 1;
2636
+
2637
+	if ($post_type == 'gd_event') {
2638
+		$query_args['gedir_event_listing_filter'] = 'upcoming';
2639
+	}// show only upcomming events
2640
+
2641
+	$widget_listings = geodir_get_widget_listings($query_args);
2642
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
2643
+		if ($title) {
2644
+			echo $before_title . $title . $after_title;
2645
+		}
2646
+
2647
+		global $post;
2648
+
2649
+		$current_post = $post;// keep current post info
2650
+
2651
+		$widget_main_slides = '';
2652
+		$nav_slides = '';
2653
+		$widget_slides = 0;
2654
+
2655
+		foreach ($widget_listings as $widget_listing) {
2656
+			global $gd_widget_listing_type;
2657
+			$post = $widget_listing;
2658
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
2659
+
2660
+			if (!empty($widget_image)) {
2661
+				if ($widget_image->height >= 200) {
2662
+					$widget_spacer_height = 0;
2663
+				} else {
2664
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
2665
+				}
2666
+
2667
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
2668
+
2669
+				$title = '';
2670
+				if ($show_title) {
2671
+					$title = '<div class="geodir-slider-title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></div>';
2672
+				}
2673
+
2674
+				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
2675
+				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
2676
+				$widget_slides++;
2677
+			}
2678
+		}
2679
+		?>
2680 2680
         <div class="flex-container" style="min-height:200px;">
2681 2681
             <div class="geodir-listing-flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
2682 2682
             <div id="geodir_widget_slider" class="geodir_flexslider">
@@ -2689,10 +2689,10 @@  discard block
 block discarded – undo
2689 2689
             <?php } ?>
2690 2690
         </div>
2691 2691
         <?php
2692
-        $GLOBALS['post'] = $current_post;
2693
-        setup_postdata($current_post);
2694
-    }
2695
-    echo $after_widget;
2692
+		$GLOBALS['post'] = $current_post;
2693
+		setup_postdata($current_post);
2694
+	}
2695
+	echo $after_widget;
2696 2696
 }
2697 2697
 
2698 2698
 
@@ -2707,65 +2707,65 @@  discard block
 block discarded – undo
2707 2707
  */
2708 2708
 function geodir_loginwidget_output($args = '', $instance = '')
2709 2709
 {
2710
-    //print_r($args);
2711
-    //print_r($instance);
2712
-    // prints the widget
2713
-    extract($args, EXTR_SKIP);
2710
+	//print_r($args);
2711
+	//print_r($instance);
2712
+	// prints the widget
2713
+	extract($args, EXTR_SKIP);
2714 2714
 
2715
-    /** This filter is documented in geodirectory_widgets.php */
2716
-    $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2715
+	/** This filter is documented in geodirectory_widgets.php */
2716
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2717 2717
 
2718
-    echo $before_widget;
2719
-    echo $before_title . $title . $after_title;
2718
+	echo $before_widget;
2719
+	echo $before_title . $title . $after_title;
2720 2720
 
2721
-    if (is_user_logged_in()) {
2722
-        global $current_user;
2721
+	if (is_user_logged_in()) {
2722
+		global $current_user;
2723 2723
 
2724
-        $author_link = get_author_posts_url($current_user->data->ID);
2725
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2724
+		$author_link = get_author_posts_url($current_user->data->ID);
2725
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
2726 2726
 
2727
-        echo '<ul class="geodir-loginbox-list">';
2728
-        ob_start();
2729
-        ?>
2727
+		echo '<ul class="geodir-loginbox-list">';
2728
+		ob_start();
2729
+		?>
2730 2730
         <li><a class="signin"
2731 2731
                href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
2732 2732
         <?php
2733
-        $post_types = geodir_get_posttypes('object');
2734
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2735
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2733
+		$post_types = geodir_get_posttypes('object');
2734
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
2735
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2736 2736
 
2737
-        if (!empty($show_add_listing_post_types_main_nav)) {
2738
-            $addlisting_links = '';
2739
-            foreach ($post_types as $key => $postobj) {
2737
+		if (!empty($show_add_listing_post_types_main_nav)) {
2738
+			$addlisting_links = '';
2739
+			foreach ($post_types as $key => $postobj) {
2740 2740
 
2741
-                if (in_array($key, $show_add_listing_post_types_main_nav)) {
2741
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
2742 2742
 
2743
-                    if ($add_link = geodir_get_addlisting_link($key)) {
2743
+					if ($add_link = geodir_get_addlisting_link($key)) {
2744 2744
 
2745
-                        $name = $postobj->labels->name;
2745
+						$name = $postobj->labels->name;
2746 2746
 
2747
-                        $selected = '';
2748
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2749
-                            $selected = 'selected="selected"';
2747
+						$selected = '';
2748
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2749
+							$selected = 'selected="selected"';
2750 2750
 
2751
-                        /**
2752
-                         * Filter add listing link.
2753
-                         *
2754
-                         * @since 1.0.0
2755
-                         * @param string $add_link Add listing link.
2756
-                         * @param string $key Add listing array key.
2757
-                         * @param int $current_user->ID Current user ID.
2758
-                         */
2759
-                        $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2751
+						/**
2752
+						 * Filter add listing link.
2753
+						 *
2754
+						 * @since 1.0.0
2755
+						 * @param string $add_link Add listing link.
2756
+						 * @param string $key Add listing array key.
2757
+						 * @param int $current_user->ID Current user ID.
2758
+						 */
2759
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
2760 2760
 
2761
-                        $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2761
+						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2762 2762
 
2763
-                    }
2764
-                }
2763
+					}
2764
+				}
2765 2765
 
2766
-            }
2766
+			}
2767 2767
 
2768
-            if ($addlisting_links != '') { ?>
2768
+			if ($addlisting_links != '') { ?>
2769 2769
 
2770 2770
                 <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
2771 2771
                             option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
@@ -2774,42 +2774,42 @@  discard block
 block discarded – undo
2774 2774
                         <?php echo $addlisting_links; ?>
2775 2775
                     </select></li> <?php
2776 2776
 
2777
-            }
2778
-
2779
-        }
2780
-        // My Favourites in Dashboard
2781
-        $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2782
-        $user_favourite = geodir_user_favourite_listing_count();
2783
-
2784
-        if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2785
-            $favourite_links = '';
2786
-
2787
-            foreach ($post_types as $key => $postobj) {
2788
-                if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2789
-                    $name = $postobj->labels->name;
2790
-                    $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2791
-
2792
-                    $selected = '';
2793
-
2794
-                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2795
-                        $selected = 'selected="selected"';
2796
-                    }
2797
-                    /**
2798
-                     * Filter favorite listing link.
2799
-                     *
2800
-                     * @since 1.0.0
2801
-                     * @param string $post_type_link Favorite listing link.
2802
-                     * @param string $key Favorite listing array key.
2803
-                     * @param int $current_user->ID Current user ID.
2804
-                     */
2805
-                    $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2806
-
2807
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2808
-                }
2809
-            }
2810
-
2811
-            if ($favourite_links != '') {
2812
-                ?>
2777
+			}
2778
+
2779
+		}
2780
+		// My Favourites in Dashboard
2781
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
2782
+		$user_favourite = geodir_user_favourite_listing_count();
2783
+
2784
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
2785
+			$favourite_links = '';
2786
+
2787
+			foreach ($post_types as $key => $postobj) {
2788
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
2789
+					$name = $postobj->labels->name;
2790
+					$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
2791
+
2792
+					$selected = '';
2793
+
2794
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
2795
+						$selected = 'selected="selected"';
2796
+					}
2797
+					/**
2798
+					 * Filter favorite listing link.
2799
+					 *
2800
+					 * @since 1.0.0
2801
+					 * @param string $post_type_link Favorite listing link.
2802
+					 * @param string $key Favorite listing array key.
2803
+					 * @param int $current_user->ID Current user ID.
2804
+					 */
2805
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
2806
+
2807
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2808
+				}
2809
+			}
2810
+
2811
+			if ($favourite_links != '') {
2812
+				?>
2813 2813
                 <li>
2814 2814
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
2815 2815
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -2819,42 +2819,42 @@  discard block
 block discarded – undo
2819 2819
                     </select>
2820 2820
                 </li>
2821 2821
             <?php
2822
-            }
2823
-        }
2824
-
2825
-
2826
-        $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2827
-        $user_listing = geodir_user_post_listing_count();
2828
-
2829
-        if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2830
-            $listing_links = '';
2831
-
2832
-            foreach ($post_types as $key => $postobj) {
2833
-                if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2834
-                    $name = $postobj->labels->name;
2835
-                    $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2836
-
2837
-                    $selected = '';
2838
-                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2839
-                        $selected = 'selected="selected"';
2840
-                    }
2841
-
2842
-                    /**
2843
-                     * Filter my listing link.
2844
-                     *
2845
-                     * @since 1.0.0
2846
-                     * @param string $listing_link My listing link.
2847
-                     * @param string $key My listing array key.
2848
-                     * @param int $current_user->ID Current user ID.
2849
-                     */
2850
-                    $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2851
-
2852
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2853
-                }
2854
-            }
2855
-
2856
-            if ($listing_links != '') {
2857
-                ?>
2822
+			}
2823
+		}
2824
+
2825
+
2826
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
2827
+		$user_listing = geodir_user_post_listing_count();
2828
+
2829
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
2830
+			$listing_links = '';
2831
+
2832
+			foreach ($post_types as $key => $postobj) {
2833
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
2834
+					$name = $postobj->labels->name;
2835
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
2836
+
2837
+					$selected = '';
2838
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
2839
+						$selected = 'selected="selected"';
2840
+					}
2841
+
2842
+					/**
2843
+					 * Filter my listing link.
2844
+					 *
2845
+					 * @since 1.0.0
2846
+					 * @param string $listing_link My listing link.
2847
+					 * @param string $key My listing array key.
2848
+					 * @param int $current_user->ID Current user ID.
2849
+					 */
2850
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
2851
+
2852
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
2853
+				}
2854
+			}
2855
+
2856
+			if ($listing_links != '') {
2857
+				?>
2858 2858
                 <li>
2859 2859
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
2860 2860
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -2864,27 +2864,27 @@  discard block
 block discarded – undo
2864 2864
                     </select>
2865 2865
                 </li>
2866 2866
             <?php
2867
-            }
2868
-        }
2869
-
2870
-        $dashboard_link = ob_get_clean();
2871
-        /**
2872
-         * Filter dashboard links HTML.
2873
-         *
2874
-         * @since 1.0.0
2875
-         * @param string $dashboard_link Dashboard links HTML.
2876
-         */
2877
-        echo apply_filters('geodir_dashboard_links', $dashboard_link);
2878
-        echo '</ul>';
2879
-    } else {
2880
-        ?>
2867
+			}
2868
+		}
2869
+
2870
+		$dashboard_link = ob_get_clean();
2871
+		/**
2872
+		 * Filter dashboard links HTML.
2873
+		 *
2874
+		 * @since 1.0.0
2875
+		 * @param string $dashboard_link Dashboard links HTML.
2876
+		 */
2877
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
2878
+		echo '</ul>';
2879
+	} else {
2880
+		?>
2881 2881
         <?php
2882
-        /**
2883
-         * Filter signup form action link.
2884
-         *
2885
-         * @since 1.0.0
2886
-         */
2887
-        ?>
2882
+		/**
2883
+		 * Filter signup form action link.
2884
+		 *
2885
+		 * @since 1.0.0
2886
+		 */
2887
+		?>
2888 2888
         <form name="loginform" class="loginform1"
2889 2889
               action="<?php echo geodir_login_url(); ?>"
2890 2890
               method="post">
@@ -2904,28 +2904,28 @@  discard block
 block discarded – undo
2904 2904
 
2905 2905
                 <p class="geodir-new-forgot-link">
2906 2906
                     <?php
2907
-                    /**
2908
-                     * Filter signup page register form link.
2909
-                     *
2910
-                     * @since 1.0.0
2911
-                     */
2912
-                    ?>
2907
+					/**
2908
+					 * Filter signup page register form link.
2909
+					 *
2910
+					 * @since 1.0.0
2911
+					 */
2912
+					?>
2913 2913
                     <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
2914 2914
                        class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
2915 2915
 
2916 2916
                     <?php
2917
-                    /**
2918
-                     * Filter signup page forgot password form link.
2919
-                     *
2920
-                     * @since 1.0.0
2921
-                     */
2922
-                    ?>
2917
+					/**
2918
+					 * Filter signup page forgot password form link.
2919
+					 *
2920
+					 * @since 1.0.0
2921
+					 */
2922
+					?>
2923 2923
                     <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
2924 2924
                        class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
2925 2925
         </form>
2926 2926
     <?php }
2927 2927
 
2928
-    echo $after_widget;
2928
+	echo $after_widget;
2929 2929
 }
2930 2930
 
2931 2931
 
@@ -2944,284 +2944,284 @@  discard block
 block discarded – undo
2944 2944
  * @param array|string $instance The settings for the particular instance of the widget.
2945 2945
  */
2946 2946
 function geodir_popular_postview_output($args = '', $instance = '') {
2947
-    global $gd_session;
2947
+	global $gd_session;
2948 2948
 	
2949
-    // prints the widget
2950
-    extract($args, EXTR_SKIP);
2951
-
2952
-    echo $before_widget;
2953
-
2954
-    /** This filter is documented in geodirectory_widgets.php */
2955
-    $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2956
-    /**
2957
-     * Filter the widget post type.
2958
-     *
2959
-     * @since 1.0.0
2960
-     * @param string $instance['post_type'] Post type of listing.
2961
-     */
2962
-    $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2963
-    /**
2964
-     * Filter the widget's term.
2965
-     *
2966
-     * @since 1.0.0
2967
-     * @param string $instance['category'] Filter by term. Can be any valid term.
2968
-     */
2969
-    $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2970
-    /**
2971
-     * Filter the widget listings limit.
2972
-     *
2973
-     * @since 1.0.0
2974
-     * @param string $instance['post_number'] Number of listings to display.
2975
-     */
2976
-    $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2977
-    /**
2978
-     * Filter widget's "layout" type.
2979
-     *
2980
-     * @since 1.0.0
2981
-     * @param string $instance['layout'] Widget layout type.
2982
-     */
2983
-    $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
2984
-    /**
2985
-     * Filter widget's "add_location_filter" value.
2986
-     *
2987
-     * @since 1.0.0
2988
-     * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2989
-     */
2990
-    $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2991
-    /**
2992
-     * Filter widget's listing width.
2993
-     *
2994
-     * @since 1.0.0
2995
-     * @param string $instance['listing_width'] Listing width.
2996
-     */
2997
-    $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
2998
-    /**
2999
-     * Filter widget's "list_sort" type.
3000
-     *
3001
-     * @since 1.0.0
3002
-     * @param string $instance['list_sort'] Listing sort by type.
3003
-     */
3004
-    $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3005
-    $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3006
-
3007
-    // set post type to current viewing post type
3008
-    if ($use_viewing_post_type) {
3009
-        $current_post_type = geodir_get_current_posttype();
3010
-        if ($current_post_type != '' && $current_post_type != $post_type) {
3011
-            $post_type = $current_post_type;
3012
-            $category = array(); // old post type category will not work for current changed post type
3013
-        }
3014
-    }
3015
-    // replace widget title dynamically
3016
-    $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3017
-    $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3018
-
3019
-    $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3020
-    $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3021
-
3022
-    if (isset($instance['character_count'])) {
3023
-        /**
3024
-         * Filter the widget's excerpt character count.
3025
-         *
3026
-         * @since 1.0.0
3027
-         * @param int $instance['character_count'] Excerpt character count.
3028
-         */
3029
-        $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3030
-    } else {
3031
-        $character_count = '';
3032
-    }
3033
-
3034
-    if (empty($title) || $title == 'All') {
3035
-        $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3036
-    }
3037
-
3038
-    $location_url = array();
3039
-    $city = get_query_var('gd_city');
3040
-    if (!empty($city)) {
3041
-        $country = get_query_var('gd_country');
3042
-        $region = get_query_var('gd_region');
3043
-
3044
-        $geodir_show_location_url = get_option('geodir_show_location_url');
3045
-
3046
-        if ($geodir_show_location_url == 'all') {
3047
-            if ($country != '') {
3048
-                $location_url[] = $country;
3049
-            }
3050
-
3051
-            if ($region != '') {
3052
-                $location_url[] = $region;
3053
-            }
3054
-        } else if ($geodir_show_location_url == 'country_city') {
3055
-            if ($country != '') {
3056
-                $location_url[] = $country;
3057
-            }
3058
-        } else if ($geodir_show_location_url == 'region_city') {
3059
-            if ($region != '') {
3060
-                $location_url[] = $region;
3061
-            }
3062
-        }
3063
-
3064
-        $location_url[] = $city;
3065
-    }
3066
-
3067
-    $location_url = implode('/', $location_url);
3068
-    $skip_location = false;
3069
-    if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3070
-        $skip_location = true;
3071
-        $gd_session->un_set('gd_multi_location');
3072
-    }
3073
-
3074
-    if (get_option('permalink_structure')) {
3075
-        $viewall_url = get_post_type_archive_link($post_type);
3076
-    } else {
3077
-        $viewall_url = get_post_type_archive_link($post_type);
3078
-    }
3079
-
3080
-    if (!empty($category) && $category[0] != '0') {
3081
-        global $geodir_add_location_url;
3082
-
3083
-        $geodir_add_location_url = '0';
3084
-
3085
-        if ($add_location_filter != '0') {
3086
-            $geodir_add_location_url = '1';
3087
-        }
3088
-
3089
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3090
-
3091
-        $geodir_add_location_url = NULL;
3092
-    }
3093
-    if ($skip_location) {
3094
-        $gd_session->set('gd_multi_location', 1);
3095
-    }
3096
-
3097
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3098
-
3099
-    $query_args = array(
3100
-        'posts_per_page' => $post_number,
3101
-        'is_geodir_loop' => true,
3102
-        'gd_location' => $add_location_filter ? true : false,
3103
-        'post_type' => $post_type,
3104
-        'order_by' => $list_sort
3105
-    );
3106
-
3107
-    if ($character_count) {
3108
-        $query_args['excerpt_length'] = $character_count;
3109
-    }
3110
-
3111
-    if (!empty($instance['show_featured_only'])) {
3112
-        $query_args['show_featured_only'] = 1;
3113
-    }
3114
-
3115
-    if (!empty($instance['show_special_only'])) {
3116
-        $query_args['show_special_only'] = 1;
3117
-    }
3118
-
3119
-    if (!empty($instance['with_pics_only'])) {
3120
-        $query_args['with_pics_only'] = 0;
3121
-        $query_args['featured_image_only'] = 1;
3122
-    }
3123
-
3124
-    if (!empty($instance['with_videos_only'])) {
3125
-        $query_args['with_videos_only'] = 1;
3126
-    }
3127
-    $with_no_results = !empty($instance['without_no_results']) ? false : true;
3128
-
3129
-    if (!empty($category) && $category[0] != '0') {
3130
-        $category_taxonomy = geodir_get_taxonomies($post_type);
3131
-
3132
-        ######### WPML #########
3133
-        if (function_exists('icl_object_id')) {
3134
-            $category = gd_lang_object_ids($category, $category_taxonomy[0]);
3135
-        }
3136
-        ######### WPML #########
3137
-
3138
-        $tax_query = array(
3139
-            'taxonomy' => $category_taxonomy[0],
3140
-            'field' => 'id',
3141
-            'terms' => $category
3142
-        );
3143
-
3144
-        $query_args['tax_query'] = array($tax_query);
3145
-    }
3146
-
3147
-    global $gridview_columns_widget, $geodir_is_widget_listing;
3148
-
3149
-    $widget_listings = geodir_get_widget_listings($query_args);
3150
-
3151
-    if (!empty($widget_listings) || $with_no_results) {
3152
-        ?>
2949
+	// prints the widget
2950
+	extract($args, EXTR_SKIP);
2951
+
2952
+	echo $before_widget;
2953
+
2954
+	/** This filter is documented in geodirectory_widgets.php */
2955
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2956
+	/**
2957
+	 * Filter the widget post type.
2958
+	 *
2959
+	 * @since 1.0.0
2960
+	 * @param string $instance['post_type'] Post type of listing.
2961
+	 */
2962
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2963
+	/**
2964
+	 * Filter the widget's term.
2965
+	 *
2966
+	 * @since 1.0.0
2967
+	 * @param string $instance['category'] Filter by term. Can be any valid term.
2968
+	 */
2969
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
2970
+	/**
2971
+	 * Filter the widget listings limit.
2972
+	 *
2973
+	 * @since 1.0.0
2974
+	 * @param string $instance['post_number'] Number of listings to display.
2975
+	 */
2976
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
2977
+	/**
2978
+	 * Filter widget's "layout" type.
2979
+	 *
2980
+	 * @since 1.0.0
2981
+	 * @param string $instance['layout'] Widget layout type.
2982
+	 */
2983
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
2984
+	/**
2985
+	 * Filter widget's "add_location_filter" value.
2986
+	 *
2987
+	 * @since 1.0.0
2988
+	 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
2989
+	 */
2990
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
2991
+	/**
2992
+	 * Filter widget's listing width.
2993
+	 *
2994
+	 * @since 1.0.0
2995
+	 * @param string $instance['listing_width'] Listing width.
2996
+	 */
2997
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
2998
+	/**
2999
+	 * Filter widget's "list_sort" type.
3000
+	 *
3001
+	 * @since 1.0.0
3002
+	 * @param string $instance['list_sort'] Listing sort by type.
3003
+	 */
3004
+	$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3005
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3006
+
3007
+	// set post type to current viewing post type
3008
+	if ($use_viewing_post_type) {
3009
+		$current_post_type = geodir_get_current_posttype();
3010
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3011
+			$post_type = $current_post_type;
3012
+			$category = array(); // old post type category will not work for current changed post type
3013
+		}
3014
+	}
3015
+	// replace widget title dynamically
3016
+	$posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory');
3017
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3018
+
3019
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3020
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3021
+
3022
+	if (isset($instance['character_count'])) {
3023
+		/**
3024
+		 * Filter the widget's excerpt character count.
3025
+		 *
3026
+		 * @since 1.0.0
3027
+		 * @param int $instance['character_count'] Excerpt character count.
3028
+		 */
3029
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3030
+	} else {
3031
+		$character_count = '';
3032
+	}
3033
+
3034
+	if (empty($title) || $title == 'All') {
3035
+		$title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory');
3036
+	}
3037
+
3038
+	$location_url = array();
3039
+	$city = get_query_var('gd_city');
3040
+	if (!empty($city)) {
3041
+		$country = get_query_var('gd_country');
3042
+		$region = get_query_var('gd_region');
3043
+
3044
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3045
+
3046
+		if ($geodir_show_location_url == 'all') {
3047
+			if ($country != '') {
3048
+				$location_url[] = $country;
3049
+			}
3050
+
3051
+			if ($region != '') {
3052
+				$location_url[] = $region;
3053
+			}
3054
+		} else if ($geodir_show_location_url == 'country_city') {
3055
+			if ($country != '') {
3056
+				$location_url[] = $country;
3057
+			}
3058
+		} else if ($geodir_show_location_url == 'region_city') {
3059
+			if ($region != '') {
3060
+				$location_url[] = $region;
3061
+			}
3062
+		}
3063
+
3064
+		$location_url[] = $city;
3065
+	}
3066
+
3067
+	$location_url = implode('/', $location_url);
3068
+	$skip_location = false;
3069
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3070
+		$skip_location = true;
3071
+		$gd_session->un_set('gd_multi_location');
3072
+	}
3073
+
3074
+	if (get_option('permalink_structure')) {
3075
+		$viewall_url = get_post_type_archive_link($post_type);
3076
+	} else {
3077
+		$viewall_url = get_post_type_archive_link($post_type);
3078
+	}
3079
+
3080
+	if (!empty($category) && $category[0] != '0') {
3081
+		global $geodir_add_location_url;
3082
+
3083
+		$geodir_add_location_url = '0';
3084
+
3085
+		if ($add_location_filter != '0') {
3086
+			$geodir_add_location_url = '1';
3087
+		}
3088
+
3089
+		$viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3090
+
3091
+		$geodir_add_location_url = NULL;
3092
+	}
3093
+	if ($skip_location) {
3094
+		$gd_session->set('gd_multi_location', 1);
3095
+	}
3096
+
3097
+	if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3098
+
3099
+	$query_args = array(
3100
+		'posts_per_page' => $post_number,
3101
+		'is_geodir_loop' => true,
3102
+		'gd_location' => $add_location_filter ? true : false,
3103
+		'post_type' => $post_type,
3104
+		'order_by' => $list_sort
3105
+	);
3106
+
3107
+	if ($character_count) {
3108
+		$query_args['excerpt_length'] = $character_count;
3109
+	}
3110
+
3111
+	if (!empty($instance['show_featured_only'])) {
3112
+		$query_args['show_featured_only'] = 1;
3113
+	}
3114
+
3115
+	if (!empty($instance['show_special_only'])) {
3116
+		$query_args['show_special_only'] = 1;
3117
+	}
3118
+
3119
+	if (!empty($instance['with_pics_only'])) {
3120
+		$query_args['with_pics_only'] = 0;
3121
+		$query_args['featured_image_only'] = 1;
3122
+	}
3123
+
3124
+	if (!empty($instance['with_videos_only'])) {
3125
+		$query_args['with_videos_only'] = 1;
3126
+	}
3127
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3128
+
3129
+	if (!empty($category) && $category[0] != '0') {
3130
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3131
+
3132
+		######### WPML #########
3133
+		if (function_exists('icl_object_id')) {
3134
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3135
+		}
3136
+		######### WPML #########
3137
+
3138
+		$tax_query = array(
3139
+			'taxonomy' => $category_taxonomy[0],
3140
+			'field' => 'id',
3141
+			'terms' => $category
3142
+		);
3143
+
3144
+		$query_args['tax_query'] = array($tax_query);
3145
+	}
3146
+
3147
+	global $gridview_columns_widget, $geodir_is_widget_listing;
3148
+
3149
+	$widget_listings = geodir_get_widget_listings($query_args);
3150
+
3151
+	if (!empty($widget_listings) || $with_no_results) {
3152
+		?>
3153 3153
         <div class="geodir_locations geodir_location_listing">
3154 3154
 
3155 3155
             <?php
3156
-            /**
3157
-             * Called before the div containing the title and view all link in popular post view widget.
3158
-             *
3159
-             * @since 1.0.0
3160
-             */
3161
-            do_action('geodir_before_view_all_link_in_widget'); ?>
3156
+			/**
3157
+			 * Called before the div containing the title and view all link in popular post view widget.
3158
+			 *
3159
+			 * @since 1.0.0
3160
+			 */
3161
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3162 3162
             <div class="geodir_list_heading clearfix">
3163 3163
                 <?php echo $before_title . $title . $after_title; ?>
3164 3164
                 <a href="<?php echo $viewall_url; ?>"
3165 3165
                    class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3166 3166
             </div>
3167 3167
             <?php
3168
-            /**
3169
-             * Called after the div containing the title and view all link in popular post view widget.
3170
-             *
3171
-             * @since 1.0.0
3172
-             */
3173
-            do_action('geodir_after_view_all_link_in_widget'); ?>
3168
+			/**
3169
+			 * Called after the div containing the title and view all link in popular post view widget.
3170
+			 *
3171
+			 * @since 1.0.0
3172
+			 */
3173
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3174 3174
             <?php
3175
-            if (strstr($layout, 'gridview')) {
3176
-                $listing_view_exp = explode('_', $layout);
3177
-                $gridview_columns_widget = $layout;
3178
-                $layout = $listing_view_exp[0];
3179
-            } else {
3180
-                $gridview_columns_widget = '';
3181
-            }
3182
-
3183
-            /**
3184
-             * Filter the widget listing listview template path.
3185
-             *
3186
-             * @since 1.0.0
3187
-             */
3188
-            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3189
-            if (!isset($character_count)) {
3190
-                /**
3191
-                 * Filter the widget's excerpt character count.
3192
-                 *
3193
-                 * @since 1.0.0
3194
-                 * @param int $instance['character_count'] Excerpt character count.
3195
-                 */
3196
-                $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3197
-            }
3198
-
3199
-            global $post, $map_jason, $map_canvas_arr;
3200
-
3201
-            $current_post = $post;
3202
-            $current_map_jason = $map_jason;
3203
-            $current_map_canvas_arr = $map_canvas_arr;
3204
-            $geodir_is_widget_listing = true;
3205
-
3206
-            /**
3207
-             * Includes related listing listview template.
3208
-             *
3209
-             * @since 1.0.0
3210
-             */
3211
-            include($template);
3212
-
3213
-            $geodir_is_widget_listing = false;
3214
-
3215
-            $GLOBALS['post'] = $current_post;
3216
-            if (!empty($current_post))
3217
-                setup_postdata($current_post);
3218
-            $map_jason = $current_map_jason;
3219
-            $map_canvas_arr = $current_map_canvas_arr;
3220
-            ?>
3175
+			if (strstr($layout, 'gridview')) {
3176
+				$listing_view_exp = explode('_', $layout);
3177
+				$gridview_columns_widget = $layout;
3178
+				$layout = $listing_view_exp[0];
3179
+			} else {
3180
+				$gridview_columns_widget = '';
3181
+			}
3182
+
3183
+			/**
3184
+			 * Filter the widget listing listview template path.
3185
+			 *
3186
+			 * @since 1.0.0
3187
+			 */
3188
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3189
+			if (!isset($character_count)) {
3190
+				/**
3191
+				 * Filter the widget's excerpt character count.
3192
+				 *
3193
+				 * @since 1.0.0
3194
+				 * @param int $instance['character_count'] Excerpt character count.
3195
+				 */
3196
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3197
+			}
3198
+
3199
+			global $post, $map_jason, $map_canvas_arr;
3200
+
3201
+			$current_post = $post;
3202
+			$current_map_jason = $map_jason;
3203
+			$current_map_canvas_arr = $map_canvas_arr;
3204
+			$geodir_is_widget_listing = true;
3205
+
3206
+			/**
3207
+			 * Includes related listing listview template.
3208
+			 *
3209
+			 * @since 1.0.0
3210
+			 */
3211
+			include($template);
3212
+
3213
+			$geodir_is_widget_listing = false;
3214
+
3215
+			$GLOBALS['post'] = $current_post;
3216
+			if (!empty($current_post))
3217
+				setup_postdata($current_post);
3218
+			$map_jason = $current_map_jason;
3219
+			$map_canvas_arr = $current_map_canvas_arr;
3220
+			?>
3221 3221
         </div>
3222 3222
     <?php
3223
-    }
3224
-    echo $after_widget;
3223
+	}
3224
+	echo $after_widget;
3225 3225
 
3226 3226
 }
3227 3227
 
@@ -3244,26 +3244,26 @@  discard block
 block discarded – undo
3244 3244
  */
3245 3245
 function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type)
3246 3246
 {
3247
-    global $wpdb, $plugin_prefix;
3247
+	global $wpdb, $plugin_prefix;
3248 3248
 
3249
-    $detail_table = $plugin_prefix . $post_type . '_detail';
3249
+	$detail_table = $plugin_prefix . $post_type . '_detail';
3250 3250
 
3251
-    $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3251
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3252 3252
 
3253
-    /**
3254
-     * Filter count review sql query.
3255
-     *
3256
-     * @since 1.5.1
3257
-     * @param string $sql Database sql query..
3258
-     * @param int $term_id The term ID.
3259
-     * @param int $taxonomy The taxonomy Id.
3260
-     * @param string $post_type The post type.
3261
-     */
3262
-    $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3253
+	/**
3254
+	 * Filter count review sql query.
3255
+	 *
3256
+	 * @since 1.5.1
3257
+	 * @param string $sql Database sql query..
3258
+	 * @param int $term_id The term ID.
3259
+	 * @param int $taxonomy The taxonomy Id.
3260
+	 * @param string $post_type The post type.
3261
+	 */
3262
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3263 3263
 
3264
-    $count = $wpdb->get_var($sql);
3264
+	$count = $wpdb->get_var($sql);
3265 3265
 
3266
-    return $count;
3266
+	return $count;
3267 3267
 }
3268 3268
 
3269 3269
 /**
@@ -3276,53 +3276,53 @@  discard block
 block discarded – undo
3276 3276
  */
3277 3277
 function geodir_count_reviews_by_terms($force_update = false)
3278 3278
 {
3279
-    /**
3280
-     * Filter review count option data.
3281
-     *
3282
-     * @since 1.0.0
3283
-     * @param bool $force_update Force update option value?. Default.false.
3284
-     */
3285
-    $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
3286
-    if (!empty($option_data)) {
3287
-        return $option_data;
3288
-    }
3279
+	/**
3280
+	 * Filter review count option data.
3281
+	 *
3282
+	 * @since 1.0.0
3283
+	 * @param bool $force_update Force update option value?. Default.false.
3284
+	 */
3285
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update);
3286
+	if (!empty($option_data)) {
3287
+		return $option_data;
3288
+	}
3289 3289
 
3290
-    $option_data = get_option('geodir_global_review_count');
3290
+	$option_data = get_option('geodir_global_review_count');
3291 3291
 
3292
-    if (!$option_data OR $force_update) {
3293
-        $post_types = geodir_get_posttypes();
3294
-        $term_array = array();
3295
-        foreach ($post_types as $post_type) {
3292
+	if (!$option_data OR $force_update) {
3293
+		$post_types = geodir_get_posttypes();
3294
+		$term_array = array();
3295
+		foreach ($post_types as $post_type) {
3296 3296
 
3297
-            $taxonomy = geodir_get_taxonomies($post_type);
3298
-            $taxonomy = $taxonomy[0];
3297
+			$taxonomy = geodir_get_taxonomies($post_type);
3298
+			$taxonomy = $taxonomy[0];
3299 3299
 
3300
-            $args = array(
3301
-                'hide_empty' => false
3302
-            );
3300
+			$args = array(
3301
+				'hide_empty' => false
3302
+			);
3303 3303
 
3304
-            $terms = get_terms($taxonomy, $args);
3304
+			$terms = get_terms($taxonomy, $args);
3305 3305
 
3306
-            foreach ($terms as $term) {
3307
-                $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3308
-                $children = get_term_children($term->term_id, $taxonomy);
3309
-                /*if ( is_array( $children ) ) {
3306
+			foreach ($terms as $term) {
3307
+				$count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3308
+				$children = get_term_children($term->term_id, $taxonomy);
3309
+				/*if ( is_array( $children ) ) {
3310 3310
 					foreach ( $children as $child_id ) {
3311 3311
 						$child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3312 3312
 						$count = $count + $child_count;
3313 3313
 					}
3314 3314
 				}*/
3315
-                $term_array[$term->term_id] = $count;
3316
-            }
3317
-        }
3318
-
3319
-        update_option('geodir_global_review_count', $term_array);
3320
-        //clear cache
3321
-        wp_cache_delete('geodir_global_review_count');
3322
-        return $term_array;
3323
-    } else {
3324
-        return $option_data;
3325
-    }
3315
+				$term_array[$term->term_id] = $count;
3316
+			}
3317
+		}
3318
+
3319
+		update_option('geodir_global_review_count', $term_array);
3320
+		//clear cache
3321
+		wp_cache_delete('geodir_global_review_count');
3322
+		return $term_array;
3323
+	} else {
3324
+		return $option_data;
3325
+	}
3326 3326
 }
3327 3327
 
3328 3328
 /**
@@ -3334,15 +3334,15 @@  discard block
 block discarded – undo
3334 3334
  */
3335 3335
 function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3336 3336
 {
3337
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3338
-
3339
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3340
-        return;
3341
-    }
3342
-    if($new_status!=$old_status) {
3343
-        geodir_count_reviews_by_terms(true);
3344
-    }
3345
-    return true;
3337
+	if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3338
+
3339
+	if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3340
+		return;
3341
+	}
3342
+	if($new_status!=$old_status) {
3343
+		geodir_count_reviews_by_terms(true);
3344
+	}
3345
+	return true;
3346 3346
 }
3347 3347
 
3348 3348
 
@@ -3361,15 +3361,15 @@  discard block
 block discarded – undo
3361 3361
 function geodir_count_posts_by_term($data, $term)
3362 3362
 {
3363 3363
 
3364
-    if ($data) {
3365
-        if (isset($data[$term->term_id])) {
3366
-            return $data[$term->term_id];
3367
-        } else {
3368
-            return 0;
3369
-        }
3370
-    } else {
3371
-        return $term->count;
3372
-    }
3364
+	if ($data) {
3365
+		if (isset($data[$term->term_id])) {
3366
+			return $data[$term->term_id];
3367
+		} else {
3368
+			return 0;
3369
+		}
3370
+	} else {
3371
+		return $term->count;
3372
+	}
3373 3373
 }
3374 3374
 
3375 3375
 /**
@@ -3382,8 +3382,8 @@  discard block
 block discarded – undo
3382 3382
  */
3383 3383
 function geodir_sort_terms_by_count($terms)
3384 3384
 {
3385
-    usort($terms, "geodir_sort_by_count_obj");
3386
-    return $terms;
3385
+	usort($terms, "geodir_sort_by_count_obj");
3386
+	return $terms;
3387 3387
 }
3388 3388
 
3389 3389
 /**
@@ -3396,8 +3396,8 @@  discard block
 block discarded – undo
3396 3396
  */
3397 3397
 function geodir_sort_terms_by_review_count($terms)
3398 3398
 {
3399
-    usort($terms, "geodir_sort_by_review_count_obj");
3400
-    return $terms;
3399
+	usort($terms, "geodir_sort_by_review_count_obj");
3400
+	return $terms;
3401 3401
 }
3402 3402
 
3403 3403
 /**
@@ -3411,12 +3411,12 @@  discard block
 block discarded – undo
3411 3411
  */
3412 3412
 function geodir_sort_terms($terms, $sort = 'count')
3413 3413
 {
3414
-    if ($sort == 'count') {
3415
-        return geodir_sort_terms_by_count($terms);
3416
-    }
3417
-    if ($sort == 'review_count') {
3418
-        return geodir_sort_terms_by_review_count($terms);
3419
-    }
3414
+	if ($sort == 'count') {
3415
+		return geodir_sort_terms_by_count($terms);
3416
+	}
3417
+	if ($sort == 'review_count') {
3418
+		return geodir_sort_terms_by_review_count($terms);
3419
+	}
3420 3420
 }
3421 3421
 
3422 3422
 /*-----------------------------------------------------------------------------------*/
@@ -3433,7 +3433,7 @@  discard block
 block discarded – undo
3433 3433
  */
3434 3434
 function geodir_sort_by_count($a, $b)
3435 3435
 {
3436
-    return $a['count'] < $b['count'];
3436
+	return $a['count'] < $b['count'];
3437 3437
 }
3438 3438
 
3439 3439
 /**
@@ -3447,7 +3447,7 @@  discard block
 block discarded – undo
3447 3447
  */
3448 3448
 function geodir_sort_by_count_obj($a, $b)
3449 3449
 {
3450
-    return $a->count < $b->count;
3450
+	return $a->count < $b->count;
3451 3451
 }
3452 3452
 
3453 3453
 /**
@@ -3461,7 +3461,7 @@  discard block
 block discarded – undo
3461 3461
  */
3462 3462
 function geodir_sort_by_review_count_obj($a, $b)
3463 3463
 {
3464
-    return $a->review_count < $b->review_count;
3464
+	return $a->review_count < $b->review_count;
3465 3465
 }
3466 3466
 
3467 3467
 /**
@@ -3471,43 +3471,43 @@  discard block
 block discarded – undo
3471 3471
  * @package GeoDirectory
3472 3472
  */
3473 3473
 function geodir_load_textdomain() {
3474
-    /**
3475
-     * Filter the plugin locale.
3476
-     *
3477
-     * @since 1.4.2
3478
-     * @package GeoDirectory
3479
-     */
3480
-    $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3481
-
3482
-    load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3483
-    load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3474
+	/**
3475
+	 * Filter the plugin locale.
3476
+	 *
3477
+	 * @since 1.4.2
3478
+	 * @package GeoDirectory
3479
+	 */
3480
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
3481
+
3482
+	load_textdomain('geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo');
3483
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))) . '/geodirectory-languages');
3484
+
3485
+	/**
3486
+	 * Define language constants.
3487
+	 *
3488
+	 * @since 1.0.0
3489
+	 */
3490
+	require_once(geodir_plugin_path() . '/language.php');
3491
+
3492
+	$language_file = geodir_plugin_path() . '/db-language.php';
3493
+
3494
+	// Load language string file if not created yet
3495
+	if (!file_exists($language_file)) {
3496
+		geodirectory_load_db_language();
3497
+	}
3484 3498
 
3485
-    /**
3486
-     * Define language constants.
3487
-     *
3488
-     * @since 1.0.0
3489
-     */
3490
-    require_once(geodir_plugin_path() . '/language.php');
3491
-
3492
-    $language_file = geodir_plugin_path() . '/db-language.php';
3493
-
3494
-    // Load language string file if not created yet
3495
-    if (!file_exists($language_file)) {
3496
-        geodirectory_load_db_language();
3497
-    }
3498
-
3499
-    if (file_exists($language_file)) {
3500
-        /**
3501
-         * Language strings from database.
3502
-         *
3503
-         * @since 1.4.2
3504
-         */
3505
-        try {
3506
-            require_once($language_file);
3507
-        } catch(Exception $e) {
3508
-            error_log('Language Error: ' . $e->getMessage());
3509
-        }
3510
-    }
3499
+	if (file_exists($language_file)) {
3500
+		/**
3501
+		 * Language strings from database.
3502
+		 *
3503
+		 * @since 1.4.2
3504
+		 */
3505
+		try {
3506
+			require_once($language_file);
3507
+		} catch(Exception $e) {
3508
+			error_log('Language Error: ' . $e->getMessage());
3509
+		}
3510
+	}
3511 3511
 }
3512 3512
 
3513 3513
 /**
@@ -3521,66 +3521,66 @@  discard block
 block discarded – undo
3521 3521
  * @return bool True if file created otherwise false
3522 3522
  */
3523 3523
 function geodirectory_load_db_language() {
3524
-    global $wp_filesystem;
3525
-    if( empty( $wp_filesystem ) ) {
3526
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3527
-        WP_Filesystem();
3528
-        global $wp_filesystem;
3529
-    }
3530
-
3531
-    $language_file = geodir_plugin_path() . '/db-language.php';
3524
+	global $wp_filesystem;
3525
+	if( empty( $wp_filesystem ) ) {
3526
+		require_once( ABSPATH .'/wp-admin/includes/file.php' );
3527
+		WP_Filesystem();
3528
+		global $wp_filesystem;
3529
+	}
3532 3530
 
3533
-    if(is_file($language_file) && !is_writable($language_file))
3534
-        return false; // Not possible to create.
3531
+	$language_file = geodir_plugin_path() . '/db-language.php';
3532
+
3533
+	if(is_file($language_file) && !is_writable($language_file))
3534
+		return false; // Not possible to create.
3535
+
3536
+	if(!is_file($language_file) && !is_writable(dirname($language_file)))
3537
+		return false; // Not possible to create.
3538
+
3539
+	$contents_strings = array();
3540
+
3541
+	/**
3542
+	 * Filter the language string from database to translate via po editor
3543
+	 *
3544
+	 * @since 1.4.2
3545
+	 *
3546
+	 * @param array $contents_strings Array of strings.
3547
+	 */
3548
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3549
+
3550
+	$contents_strings = array_unique($contents_strings);
3551
+
3552
+	$contents_head = array();
3553
+	$contents_head[] = "<?php";
3554
+	$contents_head[] = "/**";
3555
+	$contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3556
+	$contents_head[] = " *";
3557
+	$contents_head[] = " * @package GeoDirectory";
3558
+	$contents_head[] = " * @since 1.4.2";
3559
+	$contents_head[] = " */";
3560
+	$contents_head[] = "";
3561
+	$contents_head[] = "// Language keys";
3562
+
3563
+	$contents_foot = array();
3564
+	$contents_foot[] = "";
3565
+	$contents_foot[] = "";
3566
+
3567
+	$contents = implode(PHP_EOL, $contents_head);
3568
+
3569
+	if (!empty($contents_strings)) {
3570
+		foreach ( $contents_strings as $string ) {
3571
+			if (is_scalar($string) && $string != '') {
3572
+				$string = str_replace("'", "\'", $string);
3573
+				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3574
+			}
3575
+		}
3576
+	}
3535 3577
 
3536
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3537
-        return false; // Not possible to create.
3578
+	$contents .= implode(PHP_EOL, $contents_foot);
3538 3579
 
3539
-    $contents_strings = array();
3580
+	if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3581
+		return false; // Failure; could not write file.
3540 3582
 
3541
-    /**
3542
-     * Filter the language string from database to translate via po editor
3543
-     *
3544
-     * @since 1.4.2
3545
-     *
3546
-     * @param array $contents_strings Array of strings.
3547
-     */
3548
-    $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
3549
-
3550
-    $contents_strings = array_unique($contents_strings);
3551
-
3552
-    $contents_head = array();
3553
-    $contents_head[] = "<?php";
3554
-    $contents_head[] = "/**";
3555
-    $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields";
3556
-    $contents_head[] = " *";
3557
-    $contents_head[] = " * @package GeoDirectory";
3558
-    $contents_head[] = " * @since 1.4.2";
3559
-    $contents_head[] = " */";
3560
-    $contents_head[] = "";
3561
-    $contents_head[] = "// Language keys";
3562
-
3563
-    $contents_foot = array();
3564
-    $contents_foot[] = "";
3565
-    $contents_foot[] = "";
3566
-
3567
-    $contents = implode(PHP_EOL, $contents_head);
3568
-
3569
-    if (!empty($contents_strings)) {
3570
-        foreach ( $contents_strings as $string ) {
3571
-            if (is_scalar($string) && $string != '') {
3572
-                $string = str_replace("'", "\'", $string);
3573
-                $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
3574
-            }
3575
-        }
3576
-    }
3577
-
3578
-    $contents .= implode(PHP_EOL, $contents_foot);
3579
-
3580
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3581
-        return false; // Failure; could not write file.
3582
-
3583
-    return true;
3583
+	return true;
3584 3584
 }
3585 3585
 
3586 3586
 /**
@@ -3596,31 +3596,31 @@  discard block
 block discarded – undo
3596 3596
  * @return array Translation texts.
3597 3597
  */
3598 3598
 function geodir_load_custom_field_translation($translation_texts = array()) {
3599
-    global $wpdb;
3599
+	global $wpdb;
3600 3600
 
3601
-    // Custom fields table
3602
-    $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3603
-    $rows = $wpdb->get_results($sql);
3601
+	// Custom fields table
3602
+	$sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
3603
+	$rows = $wpdb->get_results($sql);
3604 3604
 
3605
-    if (!empty($rows)) {
3606
-        foreach($rows as $row) {
3607
-            if (!empty($row->admin_title))
3608
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3605
+	if (!empty($rows)) {
3606
+		foreach($rows as $row) {
3607
+			if (!empty($row->admin_title))
3608
+				$translation_texts[] = stripslashes_deep($row->admin_title);
3609 3609
 			
3610
-            if (!empty($row->admin_desc))
3611
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3610
+			if (!empty($row->admin_desc))
3611
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
3612 3612
 
3613
-            if (!empty($row->site_title))
3614
-                $translation_texts[] = stripslashes_deep($row->site_title);
3613
+			if (!empty($row->site_title))
3614
+				$translation_texts[] = stripslashes_deep($row->site_title);
3615 3615
 
3616
-            if (!empty($row->clabels))
3617
-                $translation_texts[] = stripslashes_deep($row->clabels);
3616
+			if (!empty($row->clabels))
3617
+				$translation_texts[] = stripslashes_deep($row->clabels);
3618 3618
 
3619
-            if (!empty($row->required_msg))
3620
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3619
+			if (!empty($row->required_msg))
3620
+				$translation_texts[] = stripslashes_deep($row->required_msg);
3621 3621
 			
3622 3622
 			if (!empty($row->default_value))
3623
-                $translation_texts[] = stripslashes_deep($row->default_value);
3623
+				$translation_texts[] = stripslashes_deep($row->default_value);
3624 3624
 			
3625 3625
 			if (!empty($row->option_values)) {
3626 3626
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3633,25 +3633,25 @@  discard block
 block discarded – undo
3633 3633
 					}
3634 3634
 				}
3635 3635
 			}
3636
-        }
3637
-    }
3636
+		}
3637
+	}
3638 3638
 	
3639
-    // Custom sorting fields table
3640
-    $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3641
-    $rows = $wpdb->get_results($sql);
3642
-
3643
-    if (!empty($rows)) {
3644
-        foreach($rows as $row) {
3645
-            if (!empty($row->site_title))
3646
-                $translation_texts[] = stripslashes_deep($row->site_title);
3647
-
3648
-            if (!empty($row->asc_title))
3649
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3650
-
3651
-            if (!empty($row->desc_title))
3652
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3653
-        }
3654
-    }
3639
+	// Custom sorting fields table
3640
+	$sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
3641
+	$rows = $wpdb->get_results($sql);
3642
+
3643
+	if (!empty($rows)) {
3644
+		foreach($rows as $row) {
3645
+			if (!empty($row->site_title))
3646
+				$translation_texts[] = stripslashes_deep($row->site_title);
3647
+
3648
+			if (!empty($row->asc_title))
3649
+				$translation_texts[] = stripslashes_deep($row->asc_title);
3650
+
3651
+			if (!empty($row->desc_title))
3652
+				$translation_texts[] = stripslashes_deep($row->desc_title);
3653
+		}
3654
+	}
3655 3655
 	
3656 3656
 	// Advance search filter fields table
3657 3657
 	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
@@ -3672,9 +3672,9 @@  discard block
 block discarded – undo
3672 3672
 		}
3673 3673
 	}
3674 3674
 
3675
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3675
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3676 3676
 
3677
-    return $translation_texts;
3677
+	return $translation_texts;
3678 3678
 }
3679 3679
 
3680 3680
 /**
@@ -3686,71 +3686,71 @@  discard block
 block discarded – undo
3686 3686
  * @return array Array of mime types.
3687 3687
  */
3688 3688
 function geodir_allowed_mime_types() {
3689
-    /**
3690
-     * Filter the list of mime types and file extensions allowed for file upload.
3691
-     *
3692
-     * @since 1.4.7
3693
-     * @package GeoDirectory
3694
-     *
3695
-     * @param array $geodir_allowed_mime_types and file extensions.
3696
-     */
3697
-    return apply_filters( 'geodir_allowed_mime_types', array(
3698
-            'Image' => array( // Image formats.
3699
-                'jpg' => 'image/jpeg',
3700
-                'jpe' => 'image/jpeg',
3701
-                'jpeg' => 'image/jpeg',
3702
-                'gif' => 'image/gif',
3703
-                'png' => 'image/png',
3704
-                'bmp' => 'image/bmp',
3705
-                'ico' => 'image/x-icon',
3706
-            ),
3707
-            'Video' => array( // Video formats.
3708
-                'asf' => 'video/x-ms-asf',
3709
-                'avi' => 'video/avi',
3710
-                'flv' => 'video/x-flv',
3711
-                'mkv' => 'video/x-matroska',
3712
-                'mp4' => 'video/mp4',
3713
-                'mpeg' => 'video/mpeg',
3714
-                'mpg' => 'video/mpeg',
3715
-                'wmv' => 'video/x-ms-wmv',
3716
-                '3gp' => 'video/3gpp',
3717
-            ),
3718
-            'Audio' => array( // Audio formats.
3719
-                'ogg' => 'audio/ogg',
3720
-                'mp3' => 'audio/mpeg',
3721
-                'wav' => 'audio/wav',
3722
-                'wma' => 'audio/x-ms-wma',
3723
-            ),
3724
-            'Text' => array( // Text formats.
3725
-                'css' => 'text/css',
3726
-                'csv' => 'text/csv',
3727
-                'htm' => 'text/html',
3728
-                'html' => 'text/html',
3729
-                'txt' => 'text/plain',
3730
-                'rtx' => 'text/richtext',
3731
-                'vtt' => 'text/vtt',
3732
-            ),
3733
-            'Application' => array( // Application formats.
3734
-                'doc' => 'application/msword',
3735
-                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3736
-                'exe' => 'application/x-msdownload',
3737
-                'js' => 'application/javascript',
3738
-                'odt' => 'application/vnd.oasis.opendocument.text',
3739
-                'pdf' => 'application/pdf',
3740
-                'pot' => 'application/vnd.ms-powerpoint',
3741
-                'ppt' => 'application/vnd.ms-powerpoint',
3742
-                'pptx' => 'application/vnd.ms-powerpoint',
3743
-                'psd' => 'application/octet-stream',
3744
-                'rar' => 'application/rar',
3745
-                'rtf' => 'application/rtf',
3746
-                'swf' => 'application/x-shockwave-flash',
3747
-                'tar' => 'application/x-tar',
3748
-                'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3749
-                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3750
-                'zip' => 'application/zip',
3751
-            )
3752
-        )
3753
-    );
3689
+	/**
3690
+	 * Filter the list of mime types and file extensions allowed for file upload.
3691
+	 *
3692
+	 * @since 1.4.7
3693
+	 * @package GeoDirectory
3694
+	 *
3695
+	 * @param array $geodir_allowed_mime_types and file extensions.
3696
+	 */
3697
+	return apply_filters( 'geodir_allowed_mime_types', array(
3698
+			'Image' => array( // Image formats.
3699
+				'jpg' => 'image/jpeg',
3700
+				'jpe' => 'image/jpeg',
3701
+				'jpeg' => 'image/jpeg',
3702
+				'gif' => 'image/gif',
3703
+				'png' => 'image/png',
3704
+				'bmp' => 'image/bmp',
3705
+				'ico' => 'image/x-icon',
3706
+			),
3707
+			'Video' => array( // Video formats.
3708
+				'asf' => 'video/x-ms-asf',
3709
+				'avi' => 'video/avi',
3710
+				'flv' => 'video/x-flv',
3711
+				'mkv' => 'video/x-matroska',
3712
+				'mp4' => 'video/mp4',
3713
+				'mpeg' => 'video/mpeg',
3714
+				'mpg' => 'video/mpeg',
3715
+				'wmv' => 'video/x-ms-wmv',
3716
+				'3gp' => 'video/3gpp',
3717
+			),
3718
+			'Audio' => array( // Audio formats.
3719
+				'ogg' => 'audio/ogg',
3720
+				'mp3' => 'audio/mpeg',
3721
+				'wav' => 'audio/wav',
3722
+				'wma' => 'audio/x-ms-wma',
3723
+			),
3724
+			'Text' => array( // Text formats.
3725
+				'css' => 'text/css',
3726
+				'csv' => 'text/csv',
3727
+				'htm' => 'text/html',
3728
+				'html' => 'text/html',
3729
+				'txt' => 'text/plain',
3730
+				'rtx' => 'text/richtext',
3731
+				'vtt' => 'text/vtt',
3732
+			),
3733
+			'Application' => array( // Application formats.
3734
+				'doc' => 'application/msword',
3735
+				'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
3736
+				'exe' => 'application/x-msdownload',
3737
+				'js' => 'application/javascript',
3738
+				'odt' => 'application/vnd.oasis.opendocument.text',
3739
+				'pdf' => 'application/pdf',
3740
+				'pot' => 'application/vnd.ms-powerpoint',
3741
+				'ppt' => 'application/vnd.ms-powerpoint',
3742
+				'pptx' => 'application/vnd.ms-powerpoint',
3743
+				'psd' => 'application/octet-stream',
3744
+				'rar' => 'application/rar',
3745
+				'rtf' => 'application/rtf',
3746
+				'swf' => 'application/x-shockwave-flash',
3747
+				'tar' => 'application/x-tar',
3748
+				'xls' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3749
+				'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
3750
+				'zip' => 'application/zip',
3751
+			)
3752
+		)
3753
+	);
3754 3754
 }
3755 3755
 
3756 3756
 /**
@@ -3762,21 +3762,21 @@  discard block
 block discarded – undo
3762 3762
  * @return string User display name.
3763 3763
  */
3764 3764
 function geodir_get_client_name($user_id) {
3765
-    $client_name = '';
3765
+	$client_name = '';
3766 3766
 
3767
-    $user_data = get_userdata($user_id);
3767
+	$user_data = get_userdata($user_id);
3768 3768
 
3769
-    if (!empty($user_data)) {
3770
-        if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3771
-            $client_name = trim($user_data->display_name);
3772
-        } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3773
-            $client_name = trim($user_data->user_nicename);
3774
-        } else {
3775
-            $client_name = trim($user_data->user_login);
3776
-        }
3777
-    }
3769
+	if (!empty($user_data)) {
3770
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
3771
+			$client_name = trim($user_data->display_name);
3772
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
3773
+			$client_name = trim($user_data->user_nicename);
3774
+		} else {
3775
+			$client_name = trim($user_data->user_login);
3776
+		}
3777
+	}
3778 3778
 
3779
-    return $client_name;
3779
+	return $client_name;
3780 3780
 }
3781 3781
 
3782 3782
 
@@ -3791,125 +3791,125 @@  discard block
 block discarded – undo
3791 3791
  */
3792 3792
 function geodir_wpseo_replacements($vars){
3793 3793
 
3794
-    global $wp;
3795
-    $title = '';
3796
-    // location variables
3797
-    $gd_post_type = geodir_get_current_posttype();
3798
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
3799
-    /**
3800
-     * Filter the title variables location variables array
3801
-     *
3802
-     * @since 1.5.5
3803
-     * @package GeoDirectory
3804
-     * @param array $location_array The array of location variables.
3805
-     * @param array $vars The page title variables.
3806
-     */
3807
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3808
-    $location_titles = array();
3809
-    if(get_query_var( 'gd_country_full' )){
3810
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3811
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3812
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3813
-    }
3814
-    $location_single = '';
3815
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
3816
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
3817
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
3818
-
3819
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
3820
-
3821
-    if (function_exists('get_actual_location_name')) {
3822
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
3823
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
3824
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
3825
-    }
3826
-
3827
-    if ($gd_city != '') {
3828
-        if ($gd_city_actual != '') {
3829
-            $gd_city = $gd_city_actual;
3830
-        } else {
3831
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
3832
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
3833
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
3834
-        }
3835
-        $location_single = $gd_city;
3836
-
3837
-    } else if ($gd_region != '') {
3838
-        if ($gd_region_actual != '') {
3839
-            $gd_region = $gd_region_actual;
3840
-        } else {
3841
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
3842
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
3843
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
3844
-        }
3845
-
3846
-        $location_single = $gd_region;
3847
-    } else if ($gd_country != '') {
3848
-        if ($gd_country_actual != '') {
3849
-            $gd_country = $gd_country_actual;
3850
-        } else {
3851
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
3852
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
3853
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
3854
-        }
3855
-
3856
-        $location_single = $gd_country;
3857
-    }
3858
-
3859
-    if (!empty($location_array)) {
3860
-
3861
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
3862
-        $location_array = array_reverse($location_array);
3863
-
3864
-        foreach ($location_array as $location_type => $location) {
3865
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
3866
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
3867
-
3868
-            $location_name = geodir_ucwords($gd_location_link_text);
3869
-            $location_name = __($location_name, 'geodirectory');
3870
-
3871
-            if ($actual_location_name) {
3872
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
3873
-                $location_name = get_actual_location_name($location_type, $location, true);
3874
-            }
3875
-
3876
-            $location_titles[] = $location_name;
3877
-        }
3878
-        if (!empty($location_titles)) {
3879
-            $location_titles = array_unique($location_titles);
3880
-        }
3881
-    }
3882
-
3883
-
3884
-    if(!empty($location_titles)) {
3885
-        $vars['%%location%%'] = implode(", ", $location_titles);
3886
-    }
3887
-
3888
-
3889
-    if(!empty($location_titles)) {
3890
-        $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3891
-    }
3892
-
3893
-
3894
-
3895
-    if($location_single) {
3896
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3897
-    }
3898
-
3899
-
3900
-    if($location_single) {
3901
-        $vars['%%location_single%%'] = $location_single;
3902
-    }
3903
-
3904
-    /**
3905
-     * Filter the title variables after standard ones have been filtered for wpseo.
3906
-     *
3907
-     * @since 1.5.7
3908
-     * @package GeoDirectory
3909
-     * @param string $vars The title with variables.
3910
-     * @param array $location_array The array of location variables.
3911
-     */
3912
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3794
+	global $wp;
3795
+	$title = '';
3796
+	// location variables
3797
+	$gd_post_type = geodir_get_current_posttype();
3798
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
3799
+	/**
3800
+	 * Filter the title variables location variables array
3801
+	 *
3802
+	 * @since 1.5.5
3803
+	 * @package GeoDirectory
3804
+	 * @param array $location_array The array of location variables.
3805
+	 * @param array $vars The page title variables.
3806
+	 */
3807
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3808
+	$location_titles = array();
3809
+	if(get_query_var( 'gd_country_full' )){
3810
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3811
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3812
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3813
+	}
3814
+	$location_single = '';
3815
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
3816
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
3817
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
3818
+
3819
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
3820
+
3821
+	if (function_exists('get_actual_location_name')) {
3822
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
3823
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
3824
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
3825
+	}
3826
+
3827
+	if ($gd_city != '') {
3828
+		if ($gd_city_actual != '') {
3829
+			$gd_city = $gd_city_actual;
3830
+		} else {
3831
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
3832
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
3833
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
3834
+		}
3835
+		$location_single = $gd_city;
3836
+
3837
+	} else if ($gd_region != '') {
3838
+		if ($gd_region_actual != '') {
3839
+			$gd_region = $gd_region_actual;
3840
+		} else {
3841
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
3842
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
3843
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
3844
+		}
3845
+
3846
+		$location_single = $gd_region;
3847
+	} else if ($gd_country != '') {
3848
+		if ($gd_country_actual != '') {
3849
+			$gd_country = $gd_country_actual;
3850
+		} else {
3851
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
3852
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
3853
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
3854
+		}
3855
+
3856
+		$location_single = $gd_country;
3857
+	}
3858
+
3859
+	if (!empty($location_array)) {
3860
+
3861
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
3862
+		$location_array = array_reverse($location_array);
3863
+
3864
+		foreach ($location_array as $location_type => $location) {
3865
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
3866
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
3867
+
3868
+			$location_name = geodir_ucwords($gd_location_link_text);
3869
+			$location_name = __($location_name, 'geodirectory');
3870
+
3871
+			if ($actual_location_name) {
3872
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
3873
+				$location_name = get_actual_location_name($location_type, $location, true);
3874
+			}
3875
+
3876
+			$location_titles[] = $location_name;
3877
+		}
3878
+		if (!empty($location_titles)) {
3879
+			$location_titles = array_unique($location_titles);
3880
+		}
3881
+	}
3882
+
3883
+
3884
+	if(!empty($location_titles)) {
3885
+		$vars['%%location%%'] = implode(", ", $location_titles);
3886
+	}
3887
+
3888
+
3889
+	if(!empty($location_titles)) {
3890
+		$vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3891
+	}
3892
+
3893
+
3894
+
3895
+	if($location_single) {
3896
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3897
+	}
3898
+
3899
+
3900
+	if($location_single) {
3901
+		$vars['%%location_single%%'] = $location_single;
3902
+	}
3903
+
3904
+	/**
3905
+	 * Filter the title variables after standard ones have been filtered for wpseo.
3906
+	 *
3907
+	 * @since 1.5.7
3908
+	 * @package GeoDirectory
3909
+	 * @param string $vars The title with variables.
3910
+	 * @param array $location_array The array of location variables.
3911
+	 */
3912
+	return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3913 3913
 }
3914 3914
 
3915 3915
 
@@ -3919,10 +3919,10 @@  discard block
 block discarded – undo
3919 3919
 function geodir_filter_title_variables($title, $gd_page, $sep=''){
3920 3920
 
3921 3921
 
3922
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3923
-    global $post;
3924
-    //print_r($post);
3925
-    /*
3922
+	if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3923
+	global $post;
3924
+	//print_r($post);
3925
+	/*
3926 3926
     %%date%%	                Replaced with the date of the post/page
3927 3927
     %%title%%	                Replaced with the title of the post/page
3928 3928
     %%sitename%%	            The site's name
@@ -3949,301 +3949,301 @@  discard block
 block discarded – undo
3949 3949
     %%pagenumber%%	            Replaced with the current page number
3950 3950
      */
3951 3951
 
3952
-    if ($sep == '') {
3953
-        /**
3954
-         * Filter the page title separator.
3955
-         *
3956
-         * @since 1.0.0
3957
-         * @package GeoDirectory
3958
-         * @param string $sep The separator, default: `|`.
3959
-         */
3960
-        $sep = apply_filters('geodir_page_title_separator', '|');
3961
-    }
3962
-
3963
-
3964
-    if(strpos($title,'%%title%%') !== false){
3965
-        $title = str_replace("%%title%%",$post->post_title,$title);
3966
-    }
3967
-
3968
-    if(strpos($title,'%%sitename%%') !== false){
3969
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3970
-    }
3971
-
3972
-    if(strpos($title,'%%sitedesc%%') !== false){
3973
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3974
-    }
3975
-
3976
-    if(strpos($title,'%%excerpt%%') !== false){
3977
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3978
-    }
3979
-
3980
-    if(strpos($title,'%%pt_single%%') !== false){
3981
-        $single_name = '';
3982
-        if($gd_page=='search' || $gd_page=='author'){
3983
-            $geodir_post_types = get_option('geodir_post_types');
3984
-            $spt = esc_attr($_REQUEST['stype']);
3985
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3986
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3987
-            }
3988
-        }elseif($gd_page=='add-listing'){
3989
-            $geodir_post_types = get_option('geodir_post_types');
3990
-            $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
3991
-            if(!$spt && isset($_REQUEST['pid'])){
3992
-                $spt = get_post_type( $_REQUEST['pid'] );
3993
-            }
3994
-            if(!$spt){$spt='gd_place';}
3995
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3996
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3997
-            }
3998
-        }
3999
-        elseif($post->post_type){
4000
-            $geodir_post_types = get_option('geodir_post_types');
4001
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4002
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4003
-            }
4004
-
4005
-
4006
-        }
4007
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4008
-    }
4009
-
4010
-    if(strpos($title,'%%pt_plural%%') !== false){
4011
-        $plural_name = '';
4012
-        if($gd_page=='search' || $gd_page=='author'){
4013
-            $geodir_post_types = get_option('geodir_post_types');
4014
-            $spt = esc_attr($_REQUEST['stype']);
4015
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4016
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4017
-            }
4018
-        }elseif($gd_page=='add-listing'){
4019
-            $geodir_post_types = get_option('geodir_post_types');
4020
-            $spt = sanitize_text_field($_REQUEST['listing_type']);
4021
-            if(!$spt){$spt='gd_place';}
4022
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4023
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4024
-            }
4025
-        }
4026
-        elseif(isset($post->post_type) && $post->post_type){
4027
-            $geodir_post_types = get_option('geodir_post_types');
4028
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4029
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4030
-            }
4031
-
4032
-        }
4033
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4034
-    }
4035
-
4036
-
4037
-
4038
-    if(strpos($title,'%%category%%') !== false){
4039
-        $cat_name = '';
4040
-
4041
-        if($gd_page=='detail') {
4042
-            if ($post->default_category) {
4043
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4044
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4045
-            }
4046
-        }elseif($gd_page=='listing'){
4047
-            $queried_object = get_queried_object();
4048
-            if(isset($queried_object->name)){
4049
-                $cat_name = $queried_object->name;
4050
-            }
4051
-        }
4052
-        $title = str_replace("%%category%%",$cat_name,$title);
4053
-    }
4054
-
4055
-    if(strpos($title,'%%tag%%') !== false){
4056
-        $cat_name = '';
4057
-
4058
-        if($gd_page=='detail') {
4059
-            if ($post->default_category) {
4060
-                $cat = get_term($post->default_category, $post->post_type . 'category');
4061
-                $cat_name = (isset($cat->name)) ? $cat->name : '';
4062
-            }
4063
-        }elseif($gd_page=='listing'){
4064
-            $queried_object = get_queried_object();
4065
-            if(isset($queried_object->name)){
4066
-                $cat_name = $queried_object->name;
4067
-            }
4068
-        }
4069
-        $title = str_replace("%%tag%%",$cat_name,$title);
4070
-    }
4071
-
4072
-
4073
-
4074
-    if(strpos($title,'%%id%%') !== false){
4075
-        $ID = (isset($post->ID)) ? $post->ID : '';
4076
-        $title = str_replace("%%id%%",$ID,$title);
4077
-    }
4078
-
4079
-    if(strpos($title,'%%sep%%') !== false){
4080
-        $title = str_replace("%%sep%%",$sep,$title);
4081
-    }
4082
-
4083
-
4084
-    global $wp;
4085
-    // location variables
4086
-    $gd_post_type = geodir_get_current_posttype();
4087
-    $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4088
-    /**
4089
-     * Filter the title variables location variables array
4090
-     *
4091
-     * @since 1.5.5
4092
-     * @package GeoDirectory
4093
-     * @param array $location_array The array of location variables.
4094
-     * @param string $title The title with variables..
4095
-     * @param string $gd_page The page being filtered.
4096
-     * @param string $sep The separator, default: `|`.
4097
-     */
4098
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4099
-    $location_titles = array();
4100
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4101
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4102
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4103
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4104
-    }
4105
-    $location_single = '';
4106
-    $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4107
-    $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4108
-    $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4109
-
4110
-    $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4111
-
4112
-    if (function_exists('get_actual_location_name')) {
4113
-        $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4114
-        $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4115
-        $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4116
-    }
4117
-
4118
-    if ($gd_city != '') {
4119
-        if ($gd_city_actual != '') {
4120
-            $gd_city = $gd_city_actual;
4121
-        } else {
4122
-            $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4123
-            $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4124
-            $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4125
-        }
4126
-        $location_single = $gd_city;
4127
-
4128
-    } else if ($gd_region != '') {
4129
-        if ($gd_region_actual != '') {
4130
-            $gd_region = $gd_region_actual;
4131
-        } else {
4132
-            $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4133
-            $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4134
-            $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4135
-        }
4136
-
4137
-        $location_single = $gd_region;
4138
-    } else if ($gd_country != '') {
4139
-        if ($gd_country_actual != '') {
4140
-            $gd_country = $gd_country_actual;
4141
-        } else {
4142
-            $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4143
-            $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4144
-            $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4145
-        }
4146
-
4147
-        $location_single = $gd_country;
4148
-    }
4149
-
4150
-    if (!empty($location_array)) {
4151
-
4152
-        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4153
-        $location_array = array_reverse($location_array);
4154
-
4155
-        foreach ($location_array as $location_type => $location) {
4156
-            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4157
-            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4158
-
4159
-            $location_name = geodir_ucwords($gd_location_link_text);
4160
-            $location_name = __($location_name, 'geodirectory');
4161
-
4162
-            if ($actual_location_name) {
4163
-                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4164
-                $location_name = get_actual_location_name($location_type, $location, true);
4165
-            }
4166
-
4167
-            $location_titles[] = $location_name;
4168
-        }
4169
-        if (!empty($location_titles)) {
4170
-            $location_titles = array_unique($location_titles);
4171
-        }
4172
-    }
4173
-
4174
-
4175
-    if(strpos($title,'%%location%%') !== false){
4176
-        $location = '';
4177
-        if($location_titles) {
4178
-            $location = implode(", ", $location_titles);
4179
-        }
4180
-        $title = str_replace("%%location%%",$location,$title);
4181
-    }
4182
-
4183
-    if(strpos($title,'%%in_location%%') !== false){
4184
-        $location = '';
4185
-        if($location_titles) {
4186
-            $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4187
-        }
4188
-        $title = str_replace("%%in_location%%",$location,$title);
4189
-    }
4190
-
4191
-    if(strpos($title,'%%in_location_single%%') !== false){
4192
-        if($location_single) {
4193
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4194
-        }
4195
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4196
-    }
4197
-
4198
-    if(strpos($title,'%%location_single%%') !== false){
4199
-        $title = str_replace("%%location_single%%",$location_single,$title);
4200
-    }
4201
-
4202
-
4203
-    if(strpos($title,'%%search_term%%') !== false){
4204
-        $search_term = '';
4205
-        if(isset($_REQUEST['s'])){
4206
-            $search_term = esc_attr($_REQUEST['s']);
4207
-        }
4208
-        $title = str_replace("%%search_term%%",$search_term,$title);
4209
-    }
4210
-
4211
-    if(strpos($title,'%%search_near%%') !== false){
4212
-        $search_term = '';
4213
-        if(isset($_REQUEST['snear'])){
4214
-            $search_term = esc_attr($_REQUEST['snear']);
4215
-        }
4216
-        $title = str_replace("%%search_near%%",$search_term,$title);
4217
-    }
4218
-
4219
-    if(strpos($title,'%%name%%') !== false){
4220
-        $author_name = get_the_author();
4221
-        if (!$author_name || $author_name === '') {
4222
-            $queried_object = get_queried_object();
3952
+	if ($sep == '') {
3953
+		/**
3954
+		 * Filter the page title separator.
3955
+		 *
3956
+		 * @since 1.0.0
3957
+		 * @package GeoDirectory
3958
+		 * @param string $sep The separator, default: `|`.
3959
+		 */
3960
+		$sep = apply_filters('geodir_page_title_separator', '|');
3961
+	}
3962
+
3963
+
3964
+	if(strpos($title,'%%title%%') !== false){
3965
+		$title = str_replace("%%title%%",$post->post_title,$title);
3966
+	}
3967
+
3968
+	if(strpos($title,'%%sitename%%') !== false){
3969
+		$title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3970
+	}
3971
+
3972
+	if(strpos($title,'%%sitedesc%%') !== false){
3973
+		$title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3974
+	}
3975
+
3976
+	if(strpos($title,'%%excerpt%%') !== false){
3977
+		$title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3978
+	}
3979
+
3980
+	if(strpos($title,'%%pt_single%%') !== false){
3981
+		$single_name = '';
3982
+		if($gd_page=='search' || $gd_page=='author'){
3983
+			$geodir_post_types = get_option('geodir_post_types');
3984
+			$spt = esc_attr($_REQUEST['stype']);
3985
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3986
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3987
+			}
3988
+		}elseif($gd_page=='add-listing'){
3989
+			$geodir_post_types = get_option('geodir_post_types');
3990
+			$spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
3991
+			if(!$spt && isset($_REQUEST['pid'])){
3992
+				$spt = get_post_type( $_REQUEST['pid'] );
3993
+			}
3994
+			if(!$spt){$spt='gd_place';}
3995
+			if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3996
+				$single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3997
+			}
3998
+		}
3999
+		elseif($post->post_type){
4000
+			$geodir_post_types = get_option('geodir_post_types');
4001
+			if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4002
+				$single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4003
+			}
4004
+
4005
+
4006
+		}
4007
+		$title = str_replace("%%pt_single%%",$single_name,$title);
4008
+	}
4009
+
4010
+	if(strpos($title,'%%pt_plural%%') !== false){
4011
+		$plural_name = '';
4012
+		if($gd_page=='search' || $gd_page=='author'){
4013
+			$geodir_post_types = get_option('geodir_post_types');
4014
+			$spt = esc_attr($_REQUEST['stype']);
4015
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4016
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4017
+			}
4018
+		}elseif($gd_page=='add-listing'){
4019
+			$geodir_post_types = get_option('geodir_post_types');
4020
+			$spt = sanitize_text_field($_REQUEST['listing_type']);
4021
+			if(!$spt){$spt='gd_place';}
4022
+			if(isset($geodir_post_types[$spt]['labels']['name'])){
4023
+				$plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4024
+			}
4025
+		}
4026
+		elseif(isset($post->post_type) && $post->post_type){
4027
+			$geodir_post_types = get_option('geodir_post_types');
4028
+			if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4029
+				$plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4030
+			}
4031
+
4032
+		}
4033
+		$title = str_replace("%%pt_plural%%",$plural_name,$title);
4034
+	}
4035
+
4036
+
4037
+
4038
+	if(strpos($title,'%%category%%') !== false){
4039
+		$cat_name = '';
4040
+
4041
+		if($gd_page=='detail') {
4042
+			if ($post->default_category) {
4043
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4044
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4045
+			}
4046
+		}elseif($gd_page=='listing'){
4047
+			$queried_object = get_queried_object();
4048
+			if(isset($queried_object->name)){
4049
+				$cat_name = $queried_object->name;
4050
+			}
4051
+		}
4052
+		$title = str_replace("%%category%%",$cat_name,$title);
4053
+	}
4054
+
4055
+	if(strpos($title,'%%tag%%') !== false){
4056
+		$cat_name = '';
4057
+
4058
+		if($gd_page=='detail') {
4059
+			if ($post->default_category) {
4060
+				$cat = get_term($post->default_category, $post->post_type . 'category');
4061
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4062
+			}
4063
+		}elseif($gd_page=='listing'){
4064
+			$queried_object = get_queried_object();
4065
+			if(isset($queried_object->name)){
4066
+				$cat_name = $queried_object->name;
4067
+			}
4068
+		}
4069
+		$title = str_replace("%%tag%%",$cat_name,$title);
4070
+	}
4071
+
4072
+
4073
+
4074
+	if(strpos($title,'%%id%%') !== false){
4075
+		$ID = (isset($post->ID)) ? $post->ID : '';
4076
+		$title = str_replace("%%id%%",$ID,$title);
4077
+	}
4078
+
4079
+	if(strpos($title,'%%sep%%') !== false){
4080
+		$title = str_replace("%%sep%%",$sep,$title);
4081
+	}
4082
+
4083
+
4084
+	global $wp;
4085
+	// location variables
4086
+	$gd_post_type = geodir_get_current_posttype();
4087
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4088
+	/**
4089
+	 * Filter the title variables location variables array
4090
+	 *
4091
+	 * @since 1.5.5
4092
+	 * @package GeoDirectory
4093
+	 * @param array $location_array The array of location variables.
4094
+	 * @param string $title The title with variables..
4095
+	 * @param string $gd_page The page being filtered.
4096
+	 * @param string $sep The separator, default: `|`.
4097
+	 */
4098
+	$location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4099
+	$location_titles = array();
4100
+	if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4101
+		if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4102
+		if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4103
+		if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4104
+	}
4105
+	$location_single = '';
4106
+	$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4107
+	$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4108
+	$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4109
+
4110
+	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4111
+
4112
+	if (function_exists('get_actual_location_name')) {
4113
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4114
+		$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4115
+		$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4116
+	}
4117
+
4118
+	if ($gd_city != '') {
4119
+		if ($gd_city_actual != '') {
4120
+			$gd_city = $gd_city_actual;
4121
+		} else {
4122
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4123
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4124
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4125
+		}
4126
+		$location_single = $gd_city;
4127
+
4128
+	} else if ($gd_region != '') {
4129
+		if ($gd_region_actual != '') {
4130
+			$gd_region = $gd_region_actual;
4131
+		} else {
4132
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4133
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4134
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4135
+		}
4136
+
4137
+		$location_single = $gd_region;
4138
+	} else if ($gd_country != '') {
4139
+		if ($gd_country_actual != '') {
4140
+			$gd_country = $gd_country_actual;
4141
+		} else {
4142
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4143
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4144
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4145
+		}
4146
+
4147
+		$location_single = $gd_country;
4148
+	}
4149
+
4150
+	if (!empty($location_array)) {
4151
+
4152
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4153
+		$location_array = array_reverse($location_array);
4154
+
4155
+		foreach ($location_array as $location_type => $location) {
4156
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4157
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4158
+
4159
+			$location_name = geodir_ucwords($gd_location_link_text);
4160
+			$location_name = __($location_name, 'geodirectory');
4161
+
4162
+			if ($actual_location_name) {
4163
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4164
+				$location_name = get_actual_location_name($location_type, $location, true);
4165
+			}
4166
+
4167
+			$location_titles[] = $location_name;
4168
+		}
4169
+		if (!empty($location_titles)) {
4170
+			$location_titles = array_unique($location_titles);
4171
+		}
4172
+	}
4173
+
4174
+
4175
+	if(strpos($title,'%%location%%') !== false){
4176
+		$location = '';
4177
+		if($location_titles) {
4178
+			$location = implode(", ", $location_titles);
4179
+		}
4180
+		$title = str_replace("%%location%%",$location,$title);
4181
+	}
4182
+
4183
+	if(strpos($title,'%%in_location%%') !== false){
4184
+		$location = '';
4185
+		if($location_titles) {
4186
+			$location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4187
+		}
4188
+		$title = str_replace("%%in_location%%",$location,$title);
4189
+	}
4190
+
4191
+	if(strpos($title,'%%in_location_single%%') !== false){
4192
+		if($location_single) {
4193
+			$location_single = __('in', 'geodirectory') . ' ' .$location_single;
4194
+		}
4195
+		$title = str_replace("%%in_location_single%%",$location_single,$title);
4196
+	}
4197
+
4198
+	if(strpos($title,'%%location_single%%') !== false){
4199
+		$title = str_replace("%%location_single%%",$location_single,$title);
4200
+	}
4201
+
4202
+
4203
+	if(strpos($title,'%%search_term%%') !== false){
4204
+		$search_term = '';
4205
+		if(isset($_REQUEST['s'])){
4206
+			$search_term = esc_attr($_REQUEST['s']);
4207
+		}
4208
+		$title = str_replace("%%search_term%%",$search_term,$title);
4209
+	}
4210
+
4211
+	if(strpos($title,'%%search_near%%') !== false){
4212
+		$search_term = '';
4213
+		if(isset($_REQUEST['snear'])){
4214
+			$search_term = esc_attr($_REQUEST['snear']);
4215
+		}
4216
+		$title = str_replace("%%search_near%%",$search_term,$title);
4217
+	}
4218
+
4219
+	if(strpos($title,'%%name%%') !== false){
4220
+		$author_name = get_the_author();
4221
+		if (!$author_name || $author_name === '') {
4222
+			$queried_object = get_queried_object();
4223 4223
             
4224
-            if (isset($queried_object->data->user_nicename)) {
4225
-                $author_name = $queried_object->data->user_nicename;
4226
-            }
4227
-        }
4228
-        $title = str_replace("%%name%%", $author_name, $title);
4229
-    }
4230
-
4231
-    $title = wptexturize( $title );
4232
-    $title = convert_chars( $title );
4233
-    $title = esc_html( $title );
4234
-
4235
-    /**
4236
-     * Filter the title variables after standard ones have been filtered.
4237
-     *
4238
-     * @since 1.5.7
4239
-     * @package GeoDirectory
4240
-     * @param string $title The title with variables.
4241
-     * @param array $location_array The array of location variables.
4242
-     * @param string $gd_page The page being filtered.
4243
-     * @param string $sep The separator, default: `|`.
4244
-     */
4224
+			if (isset($queried_object->data->user_nicename)) {
4225
+				$author_name = $queried_object->data->user_nicename;
4226
+			}
4227
+		}
4228
+		$title = str_replace("%%name%%", $author_name, $title);
4229
+	}
4245 4230
 
4246
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4231
+	$title = wptexturize( $title );
4232
+	$title = convert_chars( $title );
4233
+	$title = esc_html( $title );
4234
+
4235
+	/**
4236
+	 * Filter the title variables after standard ones have been filtered.
4237
+	 *
4238
+	 * @since 1.5.7
4239
+	 * @package GeoDirectory
4240
+	 * @param string $title The title with variables.
4241
+	 * @param array $location_array The array of location variables.
4242
+	 * @param string $gd_page The page being filtered.
4243
+	 * @param string $sep The separator, default: `|`.
4244
+	 */
4245
+
4246
+	return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4247 4247
 }
4248 4248
 
4249 4249
 /**
@@ -4256,65 +4256,65 @@  discard block
 block discarded – undo
4256 4256
  * @return array Translation texts.
4257 4257
  */
4258 4258
 function geodir_load_cpt_text_translation($translation_texts = array()) {
4259
-    $gd_post_types = geodir_get_posttypes('array');
4260
-
4261
-    if (!empty($gd_post_types)) {
4262
-        foreach ($gd_post_types as $post_type => $cpt_info) {
4263
-            $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4264
-            $description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4265
-            $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4266
-
4267
-            if (!empty($labels)) {
4268
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4269
-                    $translation_texts[] = $labels['name'];
4270
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4271
-                    $translation_texts[] = $labels['singular_name'];
4272
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4273
-                    $translation_texts[] = $labels['add_new'];
4274
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4275
-                    $translation_texts[] = $labels['add_new_item'];
4276
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4277
-                    $translation_texts[] = $labels['edit_item'];
4278
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4279
-                    $translation_texts[] = $labels['new_item'];
4280
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4281
-                    $translation_texts[] = $labels['view_item'];
4282
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4283
-                    $translation_texts[] = $labels['search_items'];
4284
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4285
-                    $translation_texts[] = $labels['not_found'];
4286
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4287
-                    $translation_texts[] = $labels['not_found_in_trash'];
4288
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4289
-                    $translation_texts[] = $labels['label_post_profile'];
4290
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4291
-                    $translation_texts[] = $labels['label_post_info'];
4292
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4293
-                    $translation_texts[] = $labels['label_post_images'];
4294
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4295
-                    $translation_texts[] = $labels['label_post_map'];
4296
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4297
-                    $translation_texts[] = $labels['label_reviews'];
4298
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4299
-                    $translation_texts[] = $labels['label_related_listing'];
4300
-            }
4301
-
4302
-            if ($description != '' && !in_array($description, $translation_texts)) {
4303
-                $translation_texts[] = normalize_whitespace($description);
4304
-            }
4305
-
4306
-            if (!empty($seo)) {
4307
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4308
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4309
-
4310
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4311
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4312
-            }
4313
-        }
4314
-    }
4315
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4316
-
4317
-    return $translation_texts;
4259
+	$gd_post_types = geodir_get_posttypes('array');
4260
+
4261
+	if (!empty($gd_post_types)) {
4262
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4263
+			$labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4264
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4265
+			$seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4266
+
4267
+			if (!empty($labels)) {
4268
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4269
+					$translation_texts[] = $labels['name'];
4270
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4271
+					$translation_texts[] = $labels['singular_name'];
4272
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4273
+					$translation_texts[] = $labels['add_new'];
4274
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4275
+					$translation_texts[] = $labels['add_new_item'];
4276
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4277
+					$translation_texts[] = $labels['edit_item'];
4278
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4279
+					$translation_texts[] = $labels['new_item'];
4280
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4281
+					$translation_texts[] = $labels['view_item'];
4282
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4283
+					$translation_texts[] = $labels['search_items'];
4284
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4285
+					$translation_texts[] = $labels['not_found'];
4286
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4287
+					$translation_texts[] = $labels['not_found_in_trash'];
4288
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4289
+					$translation_texts[] = $labels['label_post_profile'];
4290
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4291
+					$translation_texts[] = $labels['label_post_info'];
4292
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4293
+					$translation_texts[] = $labels['label_post_images'];
4294
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4295
+					$translation_texts[] = $labels['label_post_map'];
4296
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4297
+					$translation_texts[] = $labels['label_reviews'];
4298
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4299
+					$translation_texts[] = $labels['label_related_listing'];
4300
+			}
4301
+
4302
+			if ($description != '' && !in_array($description, $translation_texts)) {
4303
+				$translation_texts[] = normalize_whitespace($description);
4304
+			}
4305
+
4306
+			if (!empty($seo)) {
4307
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4308
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4309
+
4310
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4311
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
4312
+			}
4313
+		}
4314
+	}
4315
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4316
+
4317
+	return $translation_texts;
4318 4318
 }
4319 4319
 
4320 4320
 /**
@@ -4327,27 +4327,27 @@  discard block
 block discarded – undo
4327 4327
  * @return array Location terms.
4328 4328
  */
4329 4329
 function geodir_remove_location_terms($location_terms = array()) {
4330
-    $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4331
-
4332
-    if (!empty($location_terms) && $location_manager) {
4333
-        $hide_country_part = get_option('geodir_location_hide_country_part');
4334
-        $hide_region_part = get_option('geodir_location_hide_region_part');
4335
-
4336
-        if ($hide_region_part && $hide_country_part) {
4337
-            if (isset($location_terms['gd_country']))
4338
-                unset($location_terms['gd_country']);
4339
-            if (isset($location_terms['gd_region']))
4340
-                unset($location_terms['gd_region']);
4341
-        } else if ($hide_region_part && !$hide_country_part) {
4342
-            if (isset($location_terms['gd_region']))
4343
-                unset($location_terms['gd_region']);
4344
-        } else if (!$hide_region_part && $hide_country_part) {
4345
-            if (isset($location_terms['gd_country']))
4346
-                unset($location_terms['gd_country']);
4347
-        }
4348
-    }
4349
-
4350
-    return $location_terms;
4330
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
4331
+
4332
+	if (!empty($location_terms) && $location_manager) {
4333
+		$hide_country_part = get_option('geodir_location_hide_country_part');
4334
+		$hide_region_part = get_option('geodir_location_hide_region_part');
4335
+
4336
+		if ($hide_region_part && $hide_country_part) {
4337
+			if (isset($location_terms['gd_country']))
4338
+				unset($location_terms['gd_country']);
4339
+			if (isset($location_terms['gd_region']))
4340
+				unset($location_terms['gd_region']);
4341
+		} else if ($hide_region_part && !$hide_country_part) {
4342
+			if (isset($location_terms['gd_region']))
4343
+				unset($location_terms['gd_region']);
4344
+		} else if (!$hide_region_part && $hide_country_part) {
4345
+			if (isset($location_terms['gd_country']))
4346
+				unset($location_terms['gd_country']);
4347
+		}
4348
+	}
4349
+
4350
+	return $location_terms;
4351 4351
 }
4352 4352
 
4353 4353
 /**
@@ -4361,45 +4361,45 @@  discard block
 block discarded – undo
4361 4361
  * @param bool $update Whether this is an existing listing being updated or not.
4362 4362
  */
4363 4363
 function geodir_on_wp_insert_post($post_ID, $post, $update) {
4364
-    if (!$update) {
4365
-        return;
4366
-    }
4364
+	if (!$update) {
4365
+		return;
4366
+	}
4367 4367
     
4368
-    $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4369
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4370
-    $inline_save = $action == 'inline-save' ? true : false;
4368
+	$action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4369
+	$is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4370
+	$inline_save = $action == 'inline-save' ? true : false;
4371 4371
 
4372
-    if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4373
-        return;
4374
-    }
4372
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
4373
+		return;
4374
+	}
4375 4375
     
4376
-    if ($action != '' && in_array($action, array('geodir_import_export'))) {
4377
-        return;
4378
-    }
4376
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
4377
+		return;
4378
+	}
4379 4379
 
4380
-    $user_id = (int)get_current_user_id();
4380
+	$user_id = (int)get_current_user_id();
4381 4381
         
4382
-    if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4383
-        $author_id = !empty($post->post_author) ? $post->post_author : 0;
4382
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4383
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
4384 4384
         
4385
-        if ($user_id == $author_id && !is_super_admin()) {
4386
-            $from_email = get_option('site_email');
4387
-            $from_name = get_site_emailName();
4388
-            $to_email = get_option('admin_email');
4389
-            $to_name = get_option('name');
4390
-            $message_type = 'listing_edited';
4385
+		if ($user_id == $author_id && !is_super_admin()) {
4386
+			$from_email = get_option('site_email');
4387
+			$from_name = get_site_emailName();
4388
+			$to_email = get_option('admin_email');
4389
+			$to_name = get_option('name');
4390
+			$message_type = 'listing_edited';
4391 4391
             
4392
-            $notify_edited = true;
4393
-            /**
4394
-             * Send notification when listing edited by author?
4395
-             *
4396
-             * @since 1.6.0
4397
-             * @param bool $notify_edited Notify on listing edited by author?
4398
-             * @param object $post The current post object.
4399
-             */
4400
-            $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4392
+			$notify_edited = true;
4393
+			/**
4394
+			 * Send notification when listing edited by author?
4395
+			 *
4396
+			 * @since 1.6.0
4397
+			 * @param bool $notify_edited Notify on listing edited by author?
4398
+			 * @param object $post The current post object.
4399
+			 */
4400
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
4401 4401
             
4402
-            geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4403
-        }
4404
-    }
4402
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
4403
+		}
4404
+	}
4405 4405
 }
4406 4406
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_plugin_path()
49 49
 {
50
-    if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
50
+    if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
51 51
         return dirname(dirname(__FILE__));
52 52
     } else {
53 53
         return WP_PLUGIN_DIR . "/" . plugin_basename(dirname(dirname(__FILE__)));
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
162 162
 
163
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
163
+        return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
164 164
     } else
165 165
         return get_bloginfo('url');
166 166
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 function geodir_is_page($gdpage = '')
253 253
 {
254 254
 
255
-    global $wp_query, $post,$wp;
255
+    global $wp_query, $post, $wp;
256 256
     //if(!is_admin()):
257 257
 
258 258
     switch ($gdpage):
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
             break;
278 278
         case 'detail':
279 279
             $post_type = get_query_var('post_type');
280
-            if(is_array($post_type)){$post_type = reset($post_type);}
280
+            if (is_array($post_type)) {$post_type = reset($post_type); }
281 281
             if (is_single() && in_array($post_type, geodir_get_posttypes()))
282 282
                 return true;
283 283
             break;
284 284
         case 'pt':
285 285
             $post_type = get_query_var('post_type');
286
-            if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
286
+            if (is_array($post_type)) {$post_type = reset($post_type); }
287
+            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax())
288 288
                 return true;
289 289
 
290 290
             break;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 return true;
296 296
             }
297 297
             $post_type = get_query_var('post_type');
298
-            if(is_array($post_type)){$post_type = reset($post_type);}
298
+            if (is_array($post_type)) {$post_type = reset($post_type); }
299 299
             if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300 300
                 return true;
301 301
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
315 315
                 return true;
316 316
 			
317
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
317
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
318
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
319 319
 					return true;
320 320
 				}
321 321
 			}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369 369
             if (get_option('geodir_set_as_home'))
370 370
                 $wp->query_vars['gd_is_geodir_page'] = true;
371
-            if(geodir_is_page('home')){
371
+            if (geodir_is_page('home')) {
372 372
                 $wp->query_vars['gd_is_geodir_page'] = true;
373 373
             }
374 374
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         if (!isset($wp->query_vars['gd_is_geodir_page'])) {
422 422
             $geodir_taxonomis = geodir_get_taxonomies('', true);
423
-            if(!empty($geodir_taxonomis)){
423
+            if (!empty($geodir_taxonomis)) {
424 424
                 foreach ($geodir_taxonomis as $taxonomy) {
425 425
                     if (array_key_exists($taxonomy, $wp->query_vars)) {
426 426
                         $wp->query_vars['gd_is_geodir_page'] = true;
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 
441 441
 
442 442
 //check if homepage
443
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
443
+        if (!isset($wp->query_vars['gd_is_geodir_page'])
444 444
             && !isset($wp->query_vars['page_id'])
445 445
             && !isset($wp->query_vars['pagename'])
446
-            && is_page_geodir_home()){
446
+            && is_page_geodir_home()) {
447 447
             $wp->query_vars['gd_is_geodir_page'] = true;
448 448
         }
449 449
         //echo $wp->query_vars['gd_is_geodir_page'] ;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     function createRandomString()
545 545
     {
546 546
         $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
547
-        srand((double)microtime() * 1000000);
547
+        srand((double) microtime() * 1000000);
548 548
         $i = 0;
549 549
         $rstring = '';
550 550
         while ($i <= 25) {
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
         }
682 682
 		
683 683
 		if (!empty($subject)) {
684
-			$subject = __(stripslashes_deep($subject),'geodirectory');
684
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
685 685
 		}
686 686
 		
687 687
 		if (!empty($message)) {
688
-			$message = __(stripslashes_deep($message),'geodirectory');
688
+			$message = __(stripslashes_deep($message), 'geodirectory');
689 689
 		}
690 690
 
691 691
         $to_message = nl2br($to_message);
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
             $fromEmailName = get_option('site_email_name');
725 725
         }
726 726
 
727
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
728
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
727
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
728
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
729 729
         $message = str_replace($search_array, $replace_array, $message);
730 730
 
731
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]','[#post_author_id#]','[#post_author_name#]','[#current_date#]');
732
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
731
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]', '[#post_author_id#]', '[#post_author_name#]', '[#current_date#]');
732
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login, $post_author_id, $post_author_name, $current_date);
733 733
         $subject = str_replace($search_array, $replace_array, $subject);
734 734
 
735 735
         $headers = 'MIME-Version: 1.0' . "\r\n";
@@ -740,18 +740,18 @@  discard block
 block discarded – undo
740 740
         $to = $toEmail;
741 741
         $sent = wp_mail($to, $subject, $message, $headers);
742 742
 
743
-        if( ! $sent ) {
744
-            if ( is_array( $to ) ) {
745
-                $to = implode( ',', $to );
743
+        if (!$sent) {
744
+            if (is_array($to)) {
745
+                $to = implode(',', $to);
746 746
             }
747 747
             $log_message = sprintf(
748
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
748
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
749 749
                 $message_type,
750
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
750
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
751 751
                 $to,
752 752
                 $subject
753 753
             );
754
-            geodir_error_log( $log_message );
754
+            geodir_error_log($log_message);
755 755
         }
756 756
 
757 757
         ///////// ADMIN BCC EMIALS
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
764 764
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
765 765
 
766
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
766
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
767 767
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
768 768
             $message = str_replace($search_array, $replace_array, $message);
769 769
 
770
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
770
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
771 771
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
772 772
             $subject = str_replace($search_array, $replace_array, $subject);
773 773
 
@@ -792,21 +792,21 @@  discard block
 block discarded – undo
792 792
             $admin_bcc = true;
793 793
         }
794 794
 
795
-        if($admin_bcc===true){
795
+        if ($admin_bcc === true) {
796 796
             $sent = wp_mail($to, $subject, $message, $headers);
797 797
 
798
-            if( ! $sent ) {
799
-                if ( is_array( $to ) ) {
800
-                    $to = implode( ',', $to );
798
+            if (!$sent) {
799
+                if (is_array($to)) {
800
+                    $to = implode(',', $to);
801 801
                 }
802 802
                 $log_message = sprintf(
803
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
803
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
804 804
                     $message_type,
805
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
805
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
806 806
                     $to,
807 807
                     $subject
808 808
                 );
809
-                geodir_error_log( $log_message );
809
+                geodir_error_log($log_message);
810 810
             }
811 811
         }
812 812
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
902 902
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
903 903
 				
904
-			if(geodir_is_page('detail') && isset($post->country_slug)){
904
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
905 905
                 $location_terms = array(
906 906
                     'gd_country' => $post->country_slug,
907 907
                     'gd_region' => $post->region_slug,
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
             $breadcrumb .= stripslashes_deep($page_title);
1157 1157
             $breadcrumb .= '</li>';
1158 1158
         } else if (is_tag()) {
1159
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1159
+            $breadcrumb .= "<li> " . $separator . single_tag_title('', false) . '</li>';
1160 1160
         } else if (is_day()) {
1161 1161
             $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1162 1162
             the_time('F jS, Y');
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
         return new WP_Error('upload_dir_error', $upload['error']);
1249 1249
 
1250 1250
     // fetch the remote url and write it to the placeholder file
1251
-    $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
1251
+    $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1252 1252
 
1253 1253
     $log_message = '';
1254 1254
     $filesize = filesize($upload['file']);
@@ -1261,16 +1261,16 @@  discard block
 block discarded – undo
1261 1261
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262 1262
     }
1263 1263
     elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1264
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1265 1265
     }
1266 1266
     elseif (0 == $filesize) {
1267 1267
         $log_message = __('Zero size file downloaded', 'geodirectory');
1268 1268
     }
1269 1269
 
1270
-    if($log_message){
1270
+    if ($log_message) {
1271 1271
         $del = unlink($upload['file']);
1272
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1273
-        return new WP_Error('import_file_error',$log_message );
1272
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1273
+        return new WP_Error('import_file_error', $log_message);
1274 1274
     }
1275 1275
 
1276 1276
 
@@ -1286,10 +1286,10 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function geodir_max_upload_size()
1288 1288
 {
1289
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1289
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1290 1290
 
1291 1291
     if ($max_filesize > 0 && $max_filesize < 1) {
1292
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1292
+        $max_filesize = (int) ($max_filesize * 1024) . 'kb';
1293 1293
     } else {
1294 1294
         $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1295 1295
     }
@@ -1358,35 +1358,35 @@  discard block
 block discarded – undo
1358 1358
     {
1359 1359
         global $wpdb;
1360 1360
         if ($message_type == 'expiration') {
1361
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1362
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1361
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1362
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1363 1363
         } elseif ($message_type == 'post_submited') {
1364
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1365
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1364
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1365
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1366 1366
         } elseif ($message_type == 'renew') {
1367
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1368
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1367
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1368
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1369 1369
         } elseif ($message_type == 'upgrade') {
1370
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1371
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1370
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1371
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1372 1372
         } elseif ($message_type == 'claim_approved') {
1373
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1374
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1373
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1374
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1375 1375
         } elseif ($message_type == 'claim_rejected') {
1376
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1377
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1376
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1377
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1378 1378
         } elseif ($message_type == 'claim_requested') {
1379
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1380
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1379
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1380
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1381 1381
         } elseif ($message_type == 'auto_claim') {
1382
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1383
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1382
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1383
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1384 1384
         } elseif ($message_type == 'payment_success') {
1385
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1386
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1385
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1386
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1387 1387
         } elseif ($message_type == 'payment_fail') {
1388
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1389
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1388
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1389
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1390 1390
         }
1391 1391
         $transaction_details = $custom_1;
1392 1392
         $fromEmail = get_option('site_email');
@@ -1427,18 +1427,18 @@  discard block
 block discarded – undo
1427 1427
         $to = $fromEmail;
1428 1428
         $message = $client_message;
1429 1429
         $sent = wp_mail($to, $subject, $message, $headers);
1430
-        if( ! $sent ) {
1431
-            if ( is_array( $to ) ) {
1432
-                $to = implode( ',', $to );
1430
+        if (!$sent) {
1431
+            if (is_array($to)) {
1432
+                $to = implode(',', $to);
1433 1433
             }
1434 1434
             $log_message = sprintf(
1435
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1435
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1436 1436
                 $message_type,
1437
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1437
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1438 1438
                 $to,
1439 1439
                 $subject
1440 1440
             );
1441
-            geodir_error_log( $log_message );
1441
+            geodir_error_log($log_message);
1442 1442
         }
1443 1443
     }
1444 1444
 }
@@ -1464,18 +1464,18 @@  discard block
 block discarded – undo
1464 1464
     {
1465 1465
         $login_details = '';
1466 1466
         if ($message_type == 'send_friend') {
1467
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1468
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1467
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1468
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1469 1469
         } elseif ($message_type == 'send_enquiry') {
1470
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1471
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1470
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1471
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1472 1472
         } elseif ($message_type == 'forgot_password') {
1473
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1474
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1473
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1474
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1475 1475
             $login_details = $to_message;
1476 1476
         } elseif ($message_type == 'registration') {
1477
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1478
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1477
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1478
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1479 1479
             $login_details = $to_message;
1480 1480
         }
1481 1481
         $to_message = nl2br($to_message);
@@ -1509,18 +1509,18 @@  discard block
 block discarded – undo
1509 1509
         $to = $toEmail;
1510 1510
 
1511 1511
         $sent = wp_mail($to, $subject, $message, $headers);
1512
-        if( ! $sent ) {
1513
-            if ( is_array( $to ) ) {
1514
-                $to = implode( ',', $to );
1512
+        if (!$sent) {
1513
+            if (is_array($to)) {
1514
+                $to = implode(',', $to);
1515 1515
             }
1516 1516
             $log_message = sprintf(
1517
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1517
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1518 1518
                 $message_type,
1519
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1519
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1520 1520
                 $to,
1521 1521
                 $subject
1522 1522
             );
1523
-            geodir_error_log( $log_message );
1523
+            geodir_error_log($log_message);
1524 1524
         }
1525 1525
 
1526 1526
         ///////// ADMIN BCC EMIALS
@@ -1546,20 +1546,20 @@  discard block
 block discarded – undo
1546 1546
             $admin_bcc = true;
1547 1547
         }
1548 1548
 
1549
-        if($admin_bcc === true){
1549
+        if ($admin_bcc === true) {
1550 1550
             $sent = wp_mail($to, $subject, $message, $headers);
1551
-            if( ! $sent ) {
1552
-                if ( is_array( $to ) ) {
1553
-                    $to = implode( ',', $to );
1551
+            if (!$sent) {
1552
+                if (is_array($to)) {
1553
+                    $to = implode(',', $to);
1554 1554
                 }
1555 1555
                 $log_message = sprintf(
1556
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1556
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1557 1557
                     $message_type,
1558
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1558
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1559 1559
                     $to,
1560 1560
                     $subject
1561 1561
                 );
1562
-                geodir_error_log( $log_message );
1562
+                geodir_error_log($log_message);
1563 1563
             }
1564 1564
         }
1565 1565
 
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 function geodir_custom_posts_body_class($classes) {
1608 1608
     global $wpdb, $wp;
1609 1609
     $post_types = geodir_get_posttypes('object');
1610
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1610
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1611 1611
         $classes[] = 'geodir_custom_posts';
1612 1612
     }
1613 1613
 
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
         $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1901 1901
 			" . $join . "
1902 1902
 			" . $where;
1903
-        $rows = (int)$wpdb->get_var($sql);
1903
+        $rows = (int) $wpdb->get_var($sql);
1904 1904
     } else {
1905 1905
         $orderby = geodir_widget_listings_get_order($query_args);
1906 1906
         /**
@@ -1926,10 +1926,10 @@  discard block
 block discarded – undo
1926 1926
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1927 1927
 
1928 1928
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1929
-        if ( !$page )
1929
+        if (!$page)
1930 1930
             $page = 1;
1931 1931
 
1932
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1932
+        $limit = (int) $limit > 0 ? " LIMIT " . absint(($page - 1) * (int) $limit) . ", " . (int) $limit : "";
1933 1933
 
1934 1934
         $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1935 1935
 			" . $join . "
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
         }
2032 2032
 
2033 2033
         if (!empty($query_args['post_author'])) {
2034
-            $where .= " AND " . $wpdb->posts . ".post_author = " . (int)$query_args['post_author'];
2034
+            $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2035 2035
         }
2036 2036
         
2037 2037
         if (!empty($query_args['show_featured_only'])) {
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
     }
2109 2109
 
2110 2110
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2111
-        $limit = (int)$query_args['posts_per_page'];
2111
+        $limit = (int) $query_args['posts_per_page'];
2112 2112
     }
2113 2113
 
2114 2114
     return $limit;
@@ -2251,9 +2251,9 @@  discard block
 block discarded – undo
2251 2251
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2252 2252
     }
2253 2253
     $home_url = str_replace("www.", "", $home_url);
2254
-    if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2254
+    if ((strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2255 2255
         return true;
2256
-    }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2256
+    }elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2257 2257
         return true;
2258 2258
     } else {
2259 2259
         return false;
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 
2337 2337
     $gd_post_type = geodir_get_current_posttype();
2338 2338
 
2339
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2339
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2340 2340
     $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2341 2341
 
2342 2342
     $taxonomy = array();
@@ -2369,14 +2369,14 @@  discard block
 block discarded – undo
2369 2369
             foreach ($b_terms as $key => $val) {
2370 2370
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2371 2371
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2372
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2372
+                $tax_change_output .= "<option value='$key' " . selected($key, $default_taxonomy, false) . ">" . sprintf(__('%s Categories', 'geodirectory'), $cpt_name) . "</option>";
2373 2373
             }
2374 2374
             $tax_change_output .= "</select>";
2375 2375
         }
2376 2376
 
2377 2377
         if (!empty($b_terms)) {
2378
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2379
-            global $cat_count;//make global so we can change via function
2378
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2379
+            global $cat_count; //make global so we can change via function
2380 2380
             $cat_count = 0;
2381 2381
             ?>
2382 2382
             <div class="geodir-category-list-in clearfix">
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2441 2441
         $total_post = $cat->count;
2442 2442
 
2443
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2443
+        $term_link = get_term_link($cat, $cat->taxonomy);
2444 2444
         /**
2445 2445
          * Filer the category term link.
2446 2446
          *
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
          * @param int    $cat->term_id The term id.
2450 2450
          * @param string $post_type Wordpress post type.
2451 2451
          */
2452
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2452
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2453 2453
 
2454 2454
         echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2455 2455
         echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
@@ -2583,29 +2583,29 @@  discard block
 block discarded – undo
2583 2583
                 itemWidth: 75,
2584 2584
                 itemMargin: 5,
2585 2585
                 asNavFor: '#geodir_widget_slider',
2586
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2586
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2587 2587
             });
2588 2588
 
2589 2589
             jQuery('#geodir_widget_slider').flexslider({
2590
-                animation: "<?php echo $animation;?>",
2590
+                animation: "<?php echo $animation; ?>",
2591 2591
                 selector: ".geodir-slides > li",
2592 2592
                 namespace: "geodir-",
2593 2593
                 controlNav: true,
2594
-                animationLoop: <?php echo $animationLoop;?>,
2595
-                slideshow: <?php echo $slideshow;?>,
2596
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2597
-                animationSpeed: <?php echo $animationSpeed;?>,
2598
-                directionNav: <?php echo $directionNav;?>,
2599
-                maxItems: <?php echo $max_show;?>,
2594
+                animationLoop: <?php echo $animationLoop; ?>,
2595
+                slideshow: <?php echo $slideshow; ?>,
2596
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2597
+                animationSpeed: <?php echo $animationSpeed; ?>,
2598
+                directionNav: <?php echo $directionNav; ?>,
2599
+                maxItems: <?php echo $max_show; ?>,
2600 2600
                 move: 1,
2601
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2601
+                <?php if ($slide_width) { echo "itemWidth: " . $slide_width . ","; }?>
2602 2602
                 sync: "#geodir_widget_carousel",
2603 2603
                 start: function (slider) {
2604 2604
                     jQuery('.geodir-listing-flex-loader').hide();
2605 2605
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2606 2606
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2607 2607
                 },
2608
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2608
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2609 2609
             });
2610 2610
         });
2611 2611
     </script>
@@ -2646,7 +2646,7 @@  discard block
 block discarded – undo
2646 2646
 
2647 2647
         global $post;
2648 2648
 
2649
-        $current_post = $post;// keep current post info
2649
+        $current_post = $post; // keep current post info
2650 2650
 
2651 2651
         $widget_main_slides = '';
2652 2652
         $nav_slides = '';
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
             $geodir_add_location_url = '1';
3087 3087
         }
3088 3088
 
3089
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3089
+        $viewall_url = get_term_link((int) $category[0], $post_type . 'category');
3090 3090
 
3091 3091
         $geodir_add_location_url = NULL;
3092 3092
     }
@@ -3094,7 +3094,7 @@  discard block
 block discarded – undo
3094 3094
         $gd_session->set('gd_multi_location', 1);
3095 3095
     }
3096 3096
 
3097
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3097
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3098 3098
 
3099 3099
     $query_args = array(
3100 3100
         'posts_per_page' => $post_number,
@@ -3332,14 +3332,14 @@  discard block
 block discarded – undo
3332 3332
  * @package GeoDirectory
3333 3333
  * @return bool
3334 3334
  */
3335
-function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3335
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '')
3336 3336
 {
3337
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3337
+    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {return; }//do not run if importing listings
3338 3338
 
3339
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3339
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
3340 3340
         return;
3341 3341
     }
3342
-    if($new_status!=$old_status) {
3342
+    if ($new_status != $old_status) {
3343 3343
         geodir_count_reviews_by_terms(true);
3344 3344
     }
3345 3345
     return true;
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
          */
3505 3505
         try {
3506 3506
             require_once($language_file);
3507
-        } catch(Exception $e) {
3507
+        } catch (Exception $e) {
3508 3508
             error_log('Language Error: ' . $e->getMessage());
3509 3509
         }
3510 3510
     }
@@ -3522,18 +3522,18 @@  discard block
 block discarded – undo
3522 3522
  */
3523 3523
 function geodirectory_load_db_language() {
3524 3524
     global $wp_filesystem;
3525
-    if( empty( $wp_filesystem ) ) {
3526
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3525
+    if (empty($wp_filesystem)) {
3526
+        require_once(ABSPATH . '/wp-admin/includes/file.php');
3527 3527
         WP_Filesystem();
3528 3528
         global $wp_filesystem;
3529 3529
     }
3530 3530
 
3531 3531
     $language_file = geodir_plugin_path() . '/db-language.php';
3532 3532
 
3533
-    if(is_file($language_file) && !is_writable($language_file))
3533
+    if (is_file($language_file) && !is_writable($language_file))
3534 3534
         return false; // Not possible to create.
3535 3535
 
3536
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3536
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3537 3537
         return false; // Not possible to create.
3538 3538
 
3539 3539
     $contents_strings = array();
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
     $contents = implode(PHP_EOL, $contents_head);
3568 3568
 
3569 3569
     if (!empty($contents_strings)) {
3570
-        foreach ( $contents_strings as $string ) {
3570
+        foreach ($contents_strings as $string) {
3571 3571
             if (is_scalar($string) && $string != '') {
3572 3572
                 $string = str_replace("'", "\'", $string);
3573 3573
                 $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
@@ -3577,7 +3577,7 @@  discard block
 block discarded – undo
3577 3577
 
3578 3578
     $contents .= implode(PHP_EOL, $contents_foot);
3579 3579
 
3580
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3580
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3581 3581
         return false; // Failure; could not write file.
3582 3582
 
3583 3583
     return true;
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
     $rows = $wpdb->get_results($sql);
3604 3604
 
3605 3605
     if (!empty($rows)) {
3606
-        foreach($rows as $row) {
3606
+        foreach ($rows as $row) {
3607 3607
             if (!empty($row->admin_title))
3608 3608
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3609 3609
 			
@@ -3641,7 +3641,7 @@  discard block
 block discarded – undo
3641 3641
     $rows = $wpdb->get_results($sql);
3642 3642
 
3643 3643
     if (!empty($rows)) {
3644
-        foreach($rows as $row) {
3644
+        foreach ($rows as $row) {
3645 3645
             if (!empty($row->site_title))
3646 3646
                 $translation_texts[] = stripslashes_deep($row->site_title);
3647 3647
 
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
 		$rows = $wpdb->get_results($sql);
3660 3660
 
3661 3661
 		if (!empty($rows)) {
3662
-			foreach($rows as $row) {
3662
+			foreach ($rows as $row) {
3663 3663
 				if (!empty($row->field_site_name))
3664 3664
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3665 3665
 
@@ -3694,7 +3694,7 @@  discard block
 block discarded – undo
3694 3694
      *
3695 3695
      * @param array $geodir_allowed_mime_types and file extensions.
3696 3696
      */
3697
-    return apply_filters( 'geodir_allowed_mime_types', array(
3697
+    return apply_filters('geodir_allowed_mime_types', array(
3698 3698
             'Image' => array( // Image formats.
3699 3699
                 'jpg' => 'image/jpeg',
3700 3700
                 'jpe' => 'image/jpeg',
@@ -3783,13 +3783,13 @@  discard block
 block discarded – undo
3783 3783
 
3784 3784
 
3785 3785
 
3786
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
3786
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
3787 3787
 /*
3788 3788
  * Add location variables to wpseo replacements.
3789 3789
  *
3790 3790
  * @since 1.5.4
3791 3791
  */
3792
-function geodir_wpseo_replacements($vars){
3792
+function geodir_wpseo_replacements($vars) {
3793 3793
 
3794 3794
     global $wp;
3795 3795
     $title = '';
@@ -3804,12 +3804,12 @@  discard block
 block discarded – undo
3804 3804
      * @param array $location_array The array of location variables.
3805 3805
      * @param array $vars The page title variables.
3806 3806
      */
3807
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3807
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
3808 3808
     $location_titles = array();
3809
-    if(get_query_var( 'gd_country_full' )){
3810
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3811
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3812
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3809
+    if (get_query_var('gd_country_full')) {
3810
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
3811
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
3812
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
3813 3813
     }
3814 3814
     $location_single = '';
3815 3815
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -3881,23 +3881,23 @@  discard block
 block discarded – undo
3881 3881
     }
3882 3882
 
3883 3883
 
3884
-    if(!empty($location_titles)) {
3884
+    if (!empty($location_titles)) {
3885 3885
         $vars['%%location%%'] = implode(", ", $location_titles);
3886 3886
     }
3887 3887
 
3888 3888
 
3889
-    if(!empty($location_titles)) {
3889
+    if (!empty($location_titles)) {
3890 3890
         $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3891 3891
     }
3892 3892
 
3893 3893
 
3894 3894
 
3895
-    if($location_single) {
3896
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3895
+    if ($location_single) {
3896
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' . $location_single;
3897 3897
     }
3898 3898
 
3899 3899
 
3900
-    if($location_single) {
3900
+    if ($location_single) {
3901 3901
         $vars['%%location_single%%'] = $location_single;
3902 3902
     }
3903 3903
 
@@ -3909,17 +3909,17 @@  discard block
 block discarded – undo
3909 3909
      * @param string $vars The title with variables.
3910 3910
      * @param array $location_array The array of location variables.
3911 3911
      */
3912
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3912
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
3913 3913
 }
3914 3914
 
3915 3915
 
3916
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
3917
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
3918
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
3919
-function geodir_filter_title_variables($title, $gd_page, $sep=''){
3916
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
3917
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
3918
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
3919
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
3920 3920
 
3921 3921
 
3922
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3922
+    if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
3923 3923
     global $post;
3924 3924
     //print_r($post);
3925 3925
     /*
@@ -3961,123 +3961,123 @@  discard block
 block discarded – undo
3961 3961
     }
3962 3962
 
3963 3963
 
3964
-    if(strpos($title,'%%title%%') !== false){
3965
-        $title = str_replace("%%title%%",$post->post_title,$title);
3964
+    if (strpos($title, '%%title%%') !== false) {
3965
+        $title = str_replace("%%title%%", $post->post_title, $title);
3966 3966
     }
3967 3967
 
3968
-    if(strpos($title,'%%sitename%%') !== false){
3969
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3968
+    if (strpos($title, '%%sitename%%') !== false) {
3969
+        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
3970 3970
     }
3971 3971
 
3972
-    if(strpos($title,'%%sitedesc%%') !== false){
3973
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3972
+    if (strpos($title, '%%sitedesc%%') !== false) {
3973
+        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
3974 3974
     }
3975 3975
 
3976
-    if(strpos($title,'%%excerpt%%') !== false){
3977
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3976
+    if (strpos($title, '%%excerpt%%') !== false) {
3977
+        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
3978 3978
     }
3979 3979
 
3980
-    if(strpos($title,'%%pt_single%%') !== false){
3980
+    if (strpos($title, '%%pt_single%%') !== false) {
3981 3981
         $single_name = '';
3982
-        if($gd_page=='search' || $gd_page=='author'){
3982
+        if ($gd_page == 'search' || $gd_page == 'author') {
3983 3983
             $geodir_post_types = get_option('geodir_post_types');
3984 3984
             $spt = esc_attr($_REQUEST['stype']);
3985
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3986
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3985
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
3986
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
3987 3987
             }
3988
-        }elseif($gd_page=='add-listing'){
3988
+        }elseif ($gd_page == 'add-listing') {
3989 3989
             $geodir_post_types = get_option('geodir_post_types');
3990 3990
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
3991
-            if(!$spt && isset($_REQUEST['pid'])){
3992
-                $spt = get_post_type( $_REQUEST['pid'] );
3991
+            if (!$spt && isset($_REQUEST['pid'])) {
3992
+                $spt = get_post_type($_REQUEST['pid']);
3993 3993
             }
3994
-            if(!$spt){$spt='gd_place';}
3995
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3996
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3994
+            if (!$spt) {$spt = 'gd_place'; }
3995
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
3996
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
3997 3997
             }
3998 3998
         }
3999
-        elseif($post->post_type){
3999
+        elseif ($post->post_type) {
4000 4000
             $geodir_post_types = get_option('geodir_post_types');
4001
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4002
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4001
+            if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
4002
+                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory');
4003 4003
             }
4004 4004
 
4005 4005
 
4006 4006
         }
4007
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4007
+        $title = str_replace("%%pt_single%%", $single_name, $title);
4008 4008
     }
4009 4009
 
4010
-    if(strpos($title,'%%pt_plural%%') !== false){
4010
+    if (strpos($title, '%%pt_plural%%') !== false) {
4011 4011
         $plural_name = '';
4012
-        if($gd_page=='search' || $gd_page=='author'){
4012
+        if ($gd_page == 'search' || $gd_page == 'author') {
4013 4013
             $geodir_post_types = get_option('geodir_post_types');
4014 4014
             $spt = esc_attr($_REQUEST['stype']);
4015
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4016
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4015
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4016
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4017 4017
             }
4018
-        }elseif($gd_page=='add-listing'){
4018
+        }elseif ($gd_page == 'add-listing') {
4019 4019
             $geodir_post_types = get_option('geodir_post_types');
4020 4020
             $spt = sanitize_text_field($_REQUEST['listing_type']);
4021
-            if(!$spt){$spt='gd_place';}
4022
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4023
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4021
+            if (!$spt) {$spt = 'gd_place'; }
4022
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4023
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4024 4024
             }
4025 4025
         }
4026
-        elseif(isset($post->post_type) && $post->post_type){
4026
+        elseif (isset($post->post_type) && $post->post_type) {
4027 4027
             $geodir_post_types = get_option('geodir_post_types');
4028
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4029
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4028
+            if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
4029
+                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory');
4030 4030
             }
4031 4031
 
4032 4032
         }
4033
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4033
+        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4034 4034
     }
4035 4035
 
4036 4036
 
4037 4037
 
4038
-    if(strpos($title,'%%category%%') !== false){
4038
+    if (strpos($title, '%%category%%') !== false) {
4039 4039
         $cat_name = '';
4040 4040
 
4041
-        if($gd_page=='detail') {
4041
+        if ($gd_page == 'detail') {
4042 4042
             if ($post->default_category) {
4043 4043
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4044 4044
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4045 4045
             }
4046
-        }elseif($gd_page=='listing'){
4046
+        }elseif ($gd_page == 'listing') {
4047 4047
             $queried_object = get_queried_object();
4048
-            if(isset($queried_object->name)){
4048
+            if (isset($queried_object->name)) {
4049 4049
                 $cat_name = $queried_object->name;
4050 4050
             }
4051 4051
         }
4052
-        $title = str_replace("%%category%%",$cat_name,$title);
4052
+        $title = str_replace("%%category%%", $cat_name, $title);
4053 4053
     }
4054 4054
 
4055
-    if(strpos($title,'%%tag%%') !== false){
4055
+    if (strpos($title, '%%tag%%') !== false) {
4056 4056
         $cat_name = '';
4057 4057
 
4058
-        if($gd_page=='detail') {
4058
+        if ($gd_page == 'detail') {
4059 4059
             if ($post->default_category) {
4060 4060
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4061 4061
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4062 4062
             }
4063
-        }elseif($gd_page=='listing'){
4063
+        }elseif ($gd_page == 'listing') {
4064 4064
             $queried_object = get_queried_object();
4065
-            if(isset($queried_object->name)){
4065
+            if (isset($queried_object->name)) {
4066 4066
                 $cat_name = $queried_object->name;
4067 4067
             }
4068 4068
         }
4069
-        $title = str_replace("%%tag%%",$cat_name,$title);
4069
+        $title = str_replace("%%tag%%", $cat_name, $title);
4070 4070
     }
4071 4071
 
4072 4072
 
4073 4073
 
4074
-    if(strpos($title,'%%id%%') !== false){
4074
+    if (strpos($title, '%%id%%') !== false) {
4075 4075
         $ID = (isset($post->ID)) ? $post->ID : '';
4076
-        $title = str_replace("%%id%%",$ID,$title);
4076
+        $title = str_replace("%%id%%", $ID, $title);
4077 4077
     }
4078 4078
 
4079
-    if(strpos($title,'%%sep%%') !== false){
4080
-        $title = str_replace("%%sep%%",$sep,$title);
4079
+    if (strpos($title, '%%sep%%') !== false) {
4080
+        $title = str_replace("%%sep%%", $sep, $title);
4081 4081
     }
4082 4082
 
4083 4083
 
@@ -4095,12 +4095,12 @@  discard block
 block discarded – undo
4095 4095
      * @param string $gd_page The page being filtered.
4096 4096
      * @param string $sep The separator, default: `|`.
4097 4097
      */
4098
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4098
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4099 4099
     $location_titles = array();
4100
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4101
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4102
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4103
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4100
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4101
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4102
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4103
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4104 4104
     }
4105 4105
     $location_single = '';
4106 4106
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4172,51 +4172,51 @@  discard block
 block discarded – undo
4172 4172
     }
4173 4173
 
4174 4174
 
4175
-    if(strpos($title,'%%location%%') !== false){
4175
+    if (strpos($title, '%%location%%') !== false) {
4176 4176
         $location = '';
4177
-        if($location_titles) {
4177
+        if ($location_titles) {
4178 4178
             $location = implode(", ", $location_titles);
4179 4179
         }
4180
-        $title = str_replace("%%location%%",$location,$title);
4180
+        $title = str_replace("%%location%%", $location, $title);
4181 4181
     }
4182 4182
 
4183
-    if(strpos($title,'%%in_location%%') !== false){
4183
+    if (strpos($title, '%%in_location%%') !== false) {
4184 4184
         $location = '';
4185
-        if($location_titles) {
4185
+        if ($location_titles) {
4186 4186
             $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4187 4187
         }
4188
-        $title = str_replace("%%in_location%%",$location,$title);
4188
+        $title = str_replace("%%in_location%%", $location, $title);
4189 4189
     }
4190 4190
 
4191
-    if(strpos($title,'%%in_location_single%%') !== false){
4192
-        if($location_single) {
4193
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4191
+    if (strpos($title, '%%in_location_single%%') !== false) {
4192
+        if ($location_single) {
4193
+            $location_single = __('in', 'geodirectory') . ' ' . $location_single;
4194 4194
         }
4195
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4195
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4196 4196
     }
4197 4197
 
4198
-    if(strpos($title,'%%location_single%%') !== false){
4199
-        $title = str_replace("%%location_single%%",$location_single,$title);
4198
+    if (strpos($title, '%%location_single%%') !== false) {
4199
+        $title = str_replace("%%location_single%%", $location_single, $title);
4200 4200
     }
4201 4201
 
4202 4202
 
4203
-    if(strpos($title,'%%search_term%%') !== false){
4203
+    if (strpos($title, '%%search_term%%') !== false) {
4204 4204
         $search_term = '';
4205
-        if(isset($_REQUEST['s'])){
4205
+        if (isset($_REQUEST['s'])) {
4206 4206
             $search_term = esc_attr($_REQUEST['s']);
4207 4207
         }
4208
-        $title = str_replace("%%search_term%%",$search_term,$title);
4208
+        $title = str_replace("%%search_term%%", $search_term, $title);
4209 4209
     }
4210 4210
 
4211
-    if(strpos($title,'%%search_near%%') !== false){
4211
+    if (strpos($title, '%%search_near%%') !== false) {
4212 4212
         $search_term = '';
4213
-        if(isset($_REQUEST['snear'])){
4213
+        if (isset($_REQUEST['snear'])) {
4214 4214
             $search_term = esc_attr($_REQUEST['snear']);
4215 4215
         }
4216
-        $title = str_replace("%%search_near%%",$search_term,$title);
4216
+        $title = str_replace("%%search_near%%", $search_term, $title);
4217 4217
     }
4218 4218
 
4219
-    if(strpos($title,'%%name%%') !== false){
4219
+    if (strpos($title, '%%name%%') !== false) {
4220 4220
         $author_name = get_the_author();
4221 4221
         if (!$author_name || $author_name === '') {
4222 4222
             $queried_object = get_queried_object();
@@ -4228,9 +4228,9 @@  discard block
 block discarded – undo
4228 4228
         $title = str_replace("%%name%%", $author_name, $title);
4229 4229
     }
4230 4230
 
4231
-    $title = wptexturize( $title );
4232
-    $title = convert_chars( $title );
4233
-    $title = esc_html( $title );
4231
+    $title = wptexturize($title);
4232
+    $title = convert_chars($title);
4233
+    $title = esc_html($title);
4234 4234
 
4235 4235
     /**
4236 4236
      * Filter the title variables after standard ones have been filtered.
@@ -4243,7 +4243,7 @@  discard block
 block discarded – undo
4243 4243
      * @param string $sep The separator, default: `|`.
4244 4244
      */
4245 4245
 
4246
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4246
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4247 4247
 }
4248 4248
 
4249 4249
 /**
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
     }
4367 4367
     
4368 4368
     $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
4369
-    $is_admin = is_admin() && ( !defined('DOING_AJAX' ) || ( defined('DOING_AJAX') && !DOING_AJAX ) )  ? true : false;
4369
+    $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
4370 4370
     $inline_save = $action == 'inline-save' ? true : false;
4371 4371
 
4372 4372
     if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
@@ -4377,7 +4377,7 @@  discard block
 block discarded – undo
4377 4377
         return;
4378 4378
     }
4379 4379
 
4380
-    $user_id = (int)get_current_user_id();
4380
+    $user_id = (int) get_current_user_id();
4381 4381
         
4382 4382
     if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
4383 4383
         $author_id = !empty($post->post_author) ? $post->post_author : 0;
Please login to merge, or discard this patch.
Braces   +270 added lines, -188 removed lines patch added patch discarded remove patch
@@ -30,8 +30,10 @@  discard block
 block discarded – undo
30 30
 
31 31
     if (is_ssl()) :
32 32
         return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
-    else :
34
-        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
33
+    else {
34
+    	:
35
+        return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__)));
36
+    }
35 37
     endif;
36 38
 }
37 39
 
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 {
68 70
     $active_plugins = get_option('active_plugins');
69 71
     foreach ($active_plugins as $key => $active_plugin) {
70
-        if (strstr($active_plugin, $plugin)) return true;
72
+        if (strstr($active_plugin, $plugin)) {
73
+        	return true;
74
+        }
71 75
     }
72 76
     return false;
73 77
 }
@@ -118,12 +122,25 @@  discard block
 block discarded – undo
118 122
  */
119 123
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
120 124
 {
121
-    if ($use_existing_arguments) $params = $params + $_GET;
122
-    if (!$params) return $url;
125
+    if ($use_existing_arguments) {
126
+    	$params = $params + $_GET;
127
+    }
128
+    if (!$params) {
129
+    	return $url;
130
+    }
123 131
     $link = $url;
124
-    if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
125
-    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&amp;'; //If there is no '&' at the END, add one.
126
-    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
132
+    if (strpos($link, '?') === false) {
133
+    	$link .= '?';
134
+    }
135
+    //If there is no '?' add one at the end
136
+    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
137
+    	$link .= '&amp;';
138
+    }
139
+    //If there is no '&' at the END, add one.
140
+    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
141
+    	$link .= '&';
142
+    }
143
+    //If there is no '&' at the END, add one.
127 144
 
128 145
     $params_arr = array();
129 146
     foreach ($params as $key => $value) {
@@ -161,9 +178,10 @@  discard block
 block discarded – undo
161 178
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
162 179
 
163 180
         return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
164
-    } else
165
-        return get_bloginfo('url');
166
-}
181
+    } else {
182
+            return get_bloginfo('url');
183
+    }
184
+    }
167 185
 
168 186
 /**
169 187
  * Get the current page URL.
@@ -268,24 +286,28 @@  discard block
 block discarded – undo
268 286
         case 'preview':
269 287
             if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
270 288
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
271
-            )
272
-                return true;
289
+            ) {
290
+                            return true;
291
+            }
273 292
             break;
274 293
         case 'listing-success':
275
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
276
-                return true;
294
+            if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
295
+                            return true;
296
+            }
277 297
             break;
278 298
         case 'detail':
279 299
             $post_type = get_query_var('post_type');
280 300
             if(is_array($post_type)){$post_type = reset($post_type);}
281
-            if (is_single() && in_array($post_type, geodir_get_posttypes()))
282
-                return true;
301
+            if (is_single() && in_array($post_type, geodir_get_posttypes())) {
302
+                            return true;
303
+            }
283 304
             break;
284 305
         case 'pt':
285 306
             $post_type = get_query_var('post_type');
286 307
             if(is_array($post_type)){$post_type = reset($post_type);}
287
-            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax())
288
-                return true;
308
+            if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) {
309
+                            return true;
310
+            }
289 311
 
290 312
             break;
291 313
         case 'listing':
@@ -296,23 +318,27 @@  discard block
 block discarded – undo
296 318
             }
297 319
             $post_type = get_query_var('post_type');
298 320
             if(is_array($post_type)){$post_type = reset($post_type);}
299
-            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()))
300
-                return true;
321
+            if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
322
+                            return true;
323
+            }
301 324
 
302 325
             break;
303 326
         case 'home':
304 327
 
305
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
306
-                return true;
328
+            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
329
+                            return true;
330
+            }
307 331
 
308 332
             break;
309 333
         case 'location':
310
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
311
-                return true;
334
+            if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
335
+                            return true;
336
+            }
312 337
             break;
313 338
         case 'author':
314
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
315
-                return true;
339
+            if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
340
+                            return true;
341
+            }
316 342
 			
317 343
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
318 344
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
@@ -321,24 +347,29 @@  discard block
 block discarded – undo
321 347
 			}
322 348
             break;
323 349
         case 'search':
324
-            if (is_search() && isset($_REQUEST['geodir_search']))
325
-                return true;
350
+            if (is_search() && isset($_REQUEST['geodir_search'])) {
351
+                            return true;
352
+            }
326 353
             break;
327 354
         case 'info':
328
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
329
-                return true;
355
+            if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
356
+                            return true;
357
+            }
330 358
             break;
331 359
         case 'login':
332
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
333
-                return true;
360
+            if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
361
+                            return true;
362
+            }
334 363
             break;
335 364
         case 'checkout':
336
-            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
337
-                return true;
365
+            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
366
+                            return true;
367
+            }
338 368
             break;
339 369
         case 'invoices':
340
-            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
341
-                return true;
370
+            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
371
+                            return true;
372
+            }
342 373
             break;
343 374
         default:
344 375
             return false;
@@ -366,8 +397,9 @@  discard block
 block discarded – undo
366 397
         //$wp->query_vars['gd_is_geodir_page'] = false;
367 398
         //print_r()
368 399
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
369
-            if (get_option('geodir_set_as_home'))
370
-                $wp->query_vars['gd_is_geodir_page'] = true;
400
+            if (get_option('geodir_set_as_home')) {
401
+                            $wp->query_vars['gd_is_geodir_page'] = true;
402
+            }
371 403
             if(geodir_is_page('home')){
372 404
                 $wp->query_vars['gd_is_geodir_page'] = true;
373 405
             }
@@ -386,8 +418,9 @@  discard block
 block discarded – undo
386 418
                 || $wp->query_vars['page_id'] == geodir_login_page_id()
387 419
                 || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
388 420
                 || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
389
-            )
390
-                $wp->query_vars['gd_is_geodir_page'] = true;
421
+            ) {
422
+                            $wp->query_vars['gd_is_geodir_page'] = true;
423
+            }
391 424
         }
392 425
 
393 426
         if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
@@ -404,8 +437,9 @@  discard block
 block discarded – undo
404 437
                     || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
405 438
                     || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
406 439
                 )
407
-            )
408
-                $wp->query_vars['gd_is_geodir_page'] = true;
440
+            ) {
441
+                            $wp->query_vars['gd_is_geodir_page'] = true;
442
+            }
409 443
         }
410 444
 
411 445
 
@@ -431,12 +465,14 @@  discard block
 block discarded – undo
431 465
 
432 466
         }
433 467
 
434
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
435
-            $wp->query_vars['gd_is_geodir_page'] = true;
468
+        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
469
+                    $wp->query_vars['gd_is_geodir_page'] = true;
470
+        }
436 471
 
437 472
 
438
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
439
-            $wp->query_vars['gd_is_geodir_page'] = true;
473
+        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
474
+                    $wp->query_vars['gd_is_geodir_page'] = true;
475
+        }
440 476
 
441 477
 
442 478
 //check if homepage
@@ -466,11 +502,12 @@  discard block
 block discarded – undo
466 502
 function geodir_is_geodir_page()
467 503
 {
468 504
     global $wp;
469
-    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
470
-        return true;
471
-    else
472
-        return false;
473
-}
505
+    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
506
+            return true;
507
+    } else {
508
+            return false;
509
+    }
510
+    }
474 511
 
475 512
 if (!function_exists('geodir_get_imagesize')) {
476 513
     /**
@@ -774,20 +811,16 @@  discard block
 block discarded – undo
774 811
             $subject .= ' - ADMIN BCC COPY';
775 812
             $admin_bcc = true;
776 813
 
777
-        }
778
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
814
+        } elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
779 815
             $subject .= ' - ADMIN BCC COPY';
780 816
             $admin_bcc = true;
781
-        }
782
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
817
+        } elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
783 818
             $subject .= ' - ADMIN BCC COPY';
784 819
             $admin_bcc = true;
785
-        }
786
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
820
+        } elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
787 821
             $subject .= ' - ADMIN BCC COPY';
788 822
             $admin_bcc = true;
789
-        }
790
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
823
+        } elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
791 824
             $subject .= ' - ADMIN BCC COPY';
792 825
             $admin_bcc = true;
793 826
         }
@@ -956,21 +989,24 @@  discard block
 block discarded – undo
956 989
             $is_location_last = '';
957 990
             $is_taxonomy_last = '';
958 991
             $breadcrumb .= '<li>';
959
-            if (get_query_var($gd_post_type . 'category'))
960
-                $gd_taxonomy = $gd_post_type . 'category';
961
-            elseif (get_query_var($gd_post_type . '_tags'))
962
-                $gd_taxonomy = $gd_post_type . '_tags';
992
+            if (get_query_var($gd_post_type . 'category')) {
993
+                            $gd_taxonomy = $gd_post_type . 'category';
994
+            } elseif (get_query_var($gd_post_type . '_tags')) {
995
+                            $gd_taxonomy = $gd_post_type . '_tags';
996
+            }
963 997
 
964 998
             $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
965
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
966
-                $is_location_last = false;
967
-            else
968
-                $is_location_last = true;
969
-
970
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
971
-                $is_taxonomy_last = true;
972
-            else
973
-                $is_taxonomy_last = false;
999
+            if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1000
+                            $is_location_last = false;
1001
+            } else {
1002
+                            $is_location_last = true;
1003
+            }
1004
+
1005
+            if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1006
+                            $is_taxonomy_last = true;
1007
+            } else {
1008
+                            $is_taxonomy_last = false;
1009
+            }
974 1010
 
975 1011
             if (!empty($location_terms)) {
976 1012
                 $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
@@ -1052,8 +1088,9 @@  discard block
 block discarded – undo
1052 1088
                 {
1053 1089
                     if (get_query_var($gd_post_type . '_tags')) {
1054 1090
                         $cat_link = $listing_link . 'tags/';
1055
-                    } else
1056
-                        $cat_link = $listing_link;
1091
+                    } else {
1092
+                                            $cat_link = $listing_link;
1093
+                    }
1057 1094
 
1058 1095
                     foreach ($location_terms as $key => $location_term) {
1059 1096
                         if ($location_manager && in_array($key, $hide_url_part)) {
@@ -1080,9 +1117,9 @@  discard block
 block discarded – undo
1080 1117
                             $term_link_text = geodir_ucwords(urldecode($term_link_text));
1081 1118
                         }
1082 1119
 
1083
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1084
-                            $breadcrumb .= $separator . $term_link_text;
1085
-                        else {
1120
+                        if ($term_index == count($term_array) && $is_taxonomy_last) {
1121
+                                                    $breadcrumb .= $separator . $term_link_text;
1122
+                        } else {
1086 1123
                             $cat_link .= $term . '/';
1087 1124
                             $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1088 1125
                         }
@@ -1093,8 +1130,9 @@  discard block
 block discarded – undo
1093 1130
 
1094 1131
             }
1095 1132
 
1096
-            if (geodir_is_page('detail'))
1097
-                $breadcrumb .= $separator . get_the_title();
1133
+            if (geodir_is_page('detail')) {
1134
+                            $breadcrumb .= $separator . get_the_title();
1135
+            }
1098 1136
 
1099 1137
             $breadcrumb .= '</li>';
1100 1138
 
@@ -1131,8 +1169,9 @@  discard block
 block discarded – undo
1131 1169
 
1132 1170
                 $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1133 1171
                 $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1134
-            } else
1135
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1172
+            } else {
1173
+                            $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1174
+            }
1136 1175
 
1137 1176
             $breadcrumb .= '</li>';
1138 1177
         } elseif (is_category() || is_single()) {
@@ -1207,12 +1246,14 @@  discard block
 block discarded – undo
1207 1246
     function geodir_allow_wpadmin()
1208 1247
     {
1209 1248
         global $wpdb;
1210
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1249
+        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) {
1250
+        	// checking action in request to allow ajax request go through
1211 1251
         {
1212 1252
             if (current_user_can('manage_options')) {
1213 1253
             } else {
1214 1254
 
1215
-                wp_redirect(home_url());
1255
+                wp_redirect(home_url());
1256
+        }
1216 1257
                 exit;
1217 1258
             }
1218 1259
 
@@ -1244,8 +1285,9 @@  discard block
 block discarded – undo
1244 1285
     $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1245 1286
 
1246 1287
     $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1247
-    if ($upload['error'])
1248
-        return new WP_Error('upload_dir_error', $upload['error']);
1288
+    if ($upload['error']) {
1289
+            return new WP_Error('upload_dir_error', $upload['error']);
1290
+    }
1249 1291
 
1250 1292
     // fetch the remote url and write it to the placeholder file
1251 1293
     $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file']));
@@ -1259,11 +1301,9 @@  discard block
 block discarded – undo
1259 1301
     // make sure the fetch was successful
1260 1302
     elseif ($headers['response']['code'] != '200') {
1261 1303
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1262
-    }
1263
-    elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1304
+    } elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1264 1305
         $log_message =  __('Remote file is incorrect size', 'geodirectory');
1265
-    }
1266
-    elseif (0 == $filesize) {
1306
+    } elseif (0 == $filesize) {
1267 1307
         $log_message = __('Zero size file downloaded', 'geodirectory');
1268 1308
     }
1269 1309
 
@@ -1315,10 +1355,11 @@  discard block
 block discarded – undo
1315 1355
 function geodir_dummy_folder_exists()
1316 1356
 {
1317 1357
     $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1318
-    if (!is_dir($path))
1319
-        return false;
1320
-    else
1321
-        return true;
1358
+    if (!is_dir($path)) {
1359
+            return false;
1360
+    } else {
1361
+            return true;
1362
+    }
1322 1363
 
1323 1364
 }
1324 1365
 
@@ -1536,12 +1577,10 @@  discard block
 block discarded – undo
1536 1577
         if ($message_type == 'registration' && get_option('bcc_new_user')) {
1537 1578
             $subject .= ' - ADMIN BCC COPY';
1538 1579
             $admin_bcc = true;
1539
-        }
1540
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1580
+        } elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1541 1581
             $subject .= ' - ADMIN BCC COPY';
1542 1582
             $admin_bcc = true;
1543
-        }
1544
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1583
+        } elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1545 1584
             $subject .= ' - ADMIN BCC COPY';
1546 1585
             $admin_bcc = true;
1547 1586
         }
@@ -1585,7 +1624,9 @@  discard block
 block discarded – undo
1585 1624
         $res = array();
1586 1625
         foreach ($ids_array as $id) {
1587 1626
             $xlat = icl_object_id($id, $type, false);
1588
-            if (!is_null($xlat)) $res[] = $xlat;
1627
+            if (!is_null($xlat)) {
1628
+            	$res[] = $xlat;
1629
+            }
1589 1630
         }
1590 1631
         return $res;
1591 1632
     } else {
@@ -1926,8 +1967,9 @@  discard block
 block discarded – undo
1926 1967
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1927 1968
 
1928 1969
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1929
-        if ( !$page )
1930
-            $page = 1;
1970
+        if ( !$page ) {
1971
+                    $page = 1;
1972
+        }
1931 1973
 
1932 1974
         $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1933 1975
 
@@ -2253,7 +2295,7 @@  discard block
 block discarded – undo
2253 2295
     $home_url = str_replace("www.", "", $home_url);
2254 2296
     if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) {
2255 2297
         return true;
2256
-    }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2298
+    } elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){
2257 2299
         return true;
2258 2300
     } else {
2259 2301
         return false;
@@ -2745,8 +2787,9 @@  discard block
 block discarded – undo
2745 2787
                         $name = $postobj->labels->name;
2746 2788
 
2747 2789
                         $selected = '';
2748
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2749
-                            $selected = 'selected="selected"';
2790
+                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
2791
+                                                    $selected = 'selected="selected"';
2792
+                        }
2750 2793
 
2751 2794
                         /**
2752 2795
                          * Filter add listing link.
@@ -3213,8 +3256,9 @@  discard block
 block discarded – undo
3213 3256
             $geodir_is_widget_listing = false;
3214 3257
 
3215 3258
             $GLOBALS['post'] = $current_post;
3216
-            if (!empty($current_post))
3217
-                setup_postdata($current_post);
3259
+            if (!empty($current_post)) {
3260
+                            setup_postdata($current_post);
3261
+            }
3218 3262
             $map_jason = $current_map_jason;
3219 3263
             $map_canvas_arr = $current_map_canvas_arr;
3220 3264
             ?>
@@ -3530,11 +3574,15 @@  discard block
 block discarded – undo
3530 3574
 
3531 3575
     $language_file = geodir_plugin_path() . '/db-language.php';
3532 3576
 
3533
-    if(is_file($language_file) && !is_writable($language_file))
3534
-        return false; // Not possible to create.
3577
+    if(is_file($language_file) && !is_writable($language_file)) {
3578
+            return false;
3579
+    }
3580
+    // Not possible to create.
3535 3581
 
3536
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3537
-        return false; // Not possible to create.
3582
+    if(!is_file($language_file) && !is_writable(dirname($language_file))) {
3583
+            return false;
3584
+    }
3585
+    // Not possible to create.
3538 3586
 
3539 3587
     $contents_strings = array();
3540 3588
 
@@ -3577,8 +3625,10 @@  discard block
 block discarded – undo
3577 3625
 
3578 3626
     $contents .= implode(PHP_EOL, $contents_foot);
3579 3627
 
3580
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3581
-        return false; // Failure; could not write file.
3628
+    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) {
3629
+            return false;
3630
+    }
3631
+    // Failure; could not write file.
3582 3632
 
3583 3633
     return true;
3584 3634
 }
@@ -3604,23 +3654,29 @@  discard block
 block discarded – undo
3604 3654
 
3605 3655
     if (!empty($rows)) {
3606 3656
         foreach($rows as $row) {
3607
-            if (!empty($row->admin_title))
3608
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3657
+            if (!empty($row->admin_title)) {
3658
+                            $translation_texts[] = stripslashes_deep($row->admin_title);
3659
+            }
3609 3660
 			
3610
-            if (!empty($row->admin_desc))
3611
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3661
+            if (!empty($row->admin_desc)) {
3662
+                            $translation_texts[] = stripslashes_deep($row->admin_desc);
3663
+            }
3612 3664
 
3613
-            if (!empty($row->site_title))
3614
-                $translation_texts[] = stripslashes_deep($row->site_title);
3665
+            if (!empty($row->site_title)) {
3666
+                            $translation_texts[] = stripslashes_deep($row->site_title);
3667
+            }
3615 3668
 
3616
-            if (!empty($row->clabels))
3617
-                $translation_texts[] = stripslashes_deep($row->clabels);
3669
+            if (!empty($row->clabels)) {
3670
+                            $translation_texts[] = stripslashes_deep($row->clabels);
3671
+            }
3618 3672
 
3619
-            if (!empty($row->required_msg))
3620
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3673
+            if (!empty($row->required_msg)) {
3674
+                            $translation_texts[] = stripslashes_deep($row->required_msg);
3675
+            }
3621 3676
 			
3622
-			if (!empty($row->default_value))
3623
-                $translation_texts[] = stripslashes_deep($row->default_value);
3677
+			if (!empty($row->default_value)) {
3678
+			                $translation_texts[] = stripslashes_deep($row->default_value);
3679
+			}
3624 3680
 			
3625 3681
 			if (!empty($row->option_values)) {
3626 3682
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3642,14 +3698,17 @@  discard block
 block discarded – undo
3642 3698
 
3643 3699
     if (!empty($rows)) {
3644 3700
         foreach($rows as $row) {
3645
-            if (!empty($row->site_title))
3646
-                $translation_texts[] = stripslashes_deep($row->site_title);
3701
+            if (!empty($row->site_title)) {
3702
+                            $translation_texts[] = stripslashes_deep($row->site_title);
3703
+            }
3647 3704
 
3648
-            if (!empty($row->asc_title))
3649
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3705
+            if (!empty($row->asc_title)) {
3706
+                            $translation_texts[] = stripslashes_deep($row->asc_title);
3707
+            }
3650 3708
 
3651
-            if (!empty($row->desc_title))
3652
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3709
+            if (!empty($row->desc_title)) {
3710
+                            $translation_texts[] = stripslashes_deep($row->desc_title);
3711
+            }
3653 3712
         }
3654 3713
     }
3655 3714
 	
@@ -3660,14 +3719,17 @@  discard block
 block discarded – undo
3660 3719
 
3661 3720
 		if (!empty($rows)) {
3662 3721
 			foreach($rows as $row) {
3663
-				if (!empty($row->field_site_name))
3664
-					$translation_texts[] = stripslashes_deep($row->field_site_name);
3722
+				if (!empty($row->field_site_name)) {
3723
+									$translation_texts[] = stripslashes_deep($row->field_site_name);
3724
+				}
3665 3725
 
3666
-				if (!empty($row->front_search_title))
3667
-					$translation_texts[] = stripslashes_deep($row->front_search_title);
3726
+				if (!empty($row->front_search_title)) {
3727
+									$translation_texts[] = stripslashes_deep($row->front_search_title);
3728
+				}
3668 3729
 
3669
-				if (!empty($row->field_desc))
3670
-					$translation_texts[] = stripslashes_deep($row->field_desc);
3730
+				if (!empty($row->field_desc)) {
3731
+									$translation_texts[] = stripslashes_deep($row->field_desc);
3732
+				}
3671 3733
 			}
3672 3734
 		}
3673 3735
 	}
@@ -3985,7 +4047,7 @@  discard block
 block discarded – undo
3985 4047
             if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3986 4048
                 $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3987 4049
             }
3988
-        }elseif($gd_page=='add-listing'){
4050
+        } elseif($gd_page=='add-listing'){
3989 4051
             $geodir_post_types = get_option('geodir_post_types');
3990 4052
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
3991 4053
             if(!$spt && isset($_REQUEST['pid'])){
@@ -3995,8 +4057,7 @@  discard block
 block discarded – undo
3995 4057
             if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3996 4058
                 $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3997 4059
             }
3998
-        }
3999
-        elseif($post->post_type){
4060
+        } elseif($post->post_type){
4000 4061
             $geodir_post_types = get_option('geodir_post_types');
4001 4062
             if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4002 4063
                 $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
@@ -4015,15 +4076,14 @@  discard block
 block discarded – undo
4015 4076
             if(isset($geodir_post_types[$spt]['labels']['name'])){
4016 4077
                 $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4017 4078
             }
4018
-        }elseif($gd_page=='add-listing'){
4079
+        } elseif($gd_page=='add-listing'){
4019 4080
             $geodir_post_types = get_option('geodir_post_types');
4020 4081
             $spt = sanitize_text_field($_REQUEST['listing_type']);
4021 4082
             if(!$spt){$spt='gd_place';}
4022 4083
             if(isset($geodir_post_types[$spt]['labels']['name'])){
4023 4084
                 $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4024 4085
             }
4025
-        }
4026
-        elseif(isset($post->post_type) && $post->post_type){
4086
+        } elseif(isset($post->post_type) && $post->post_type){
4027 4087
             $geodir_post_types = get_option('geodir_post_types');
4028 4088
             if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4029 4089
                 $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
@@ -4043,7 +4103,7 @@  discard block
 block discarded – undo
4043 4103
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4044 4104
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4045 4105
             }
4046
-        }elseif($gd_page=='listing'){
4106
+        } elseif($gd_page=='listing'){
4047 4107
             $queried_object = get_queried_object();
4048 4108
             if(isset($queried_object->name)){
4049 4109
                 $cat_name = $queried_object->name;
@@ -4060,7 +4120,7 @@  discard block
 block discarded – undo
4060 4120
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4061 4121
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4062 4122
             }
4063
-        }elseif($gd_page=='listing'){
4123
+        } elseif($gd_page=='listing'){
4064 4124
             $queried_object = get_queried_object();
4065 4125
             if(isset($queried_object->name)){
4066 4126
                 $cat_name = $queried_object->name;
@@ -4265,38 +4325,54 @@  discard block
 block discarded – undo
4265 4325
             $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4266 4326
 
4267 4327
             if (!empty($labels)) {
4268
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4269
-                    $translation_texts[] = $labels['name'];
4270
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4271
-                    $translation_texts[] = $labels['singular_name'];
4272
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4273
-                    $translation_texts[] = $labels['add_new'];
4274
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4275
-                    $translation_texts[] = $labels['add_new_item'];
4276
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4277
-                    $translation_texts[] = $labels['edit_item'];
4278
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4279
-                    $translation_texts[] = $labels['new_item'];
4280
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4281
-                    $translation_texts[] = $labels['view_item'];
4282
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4283
-                    $translation_texts[] = $labels['search_items'];
4284
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4285
-                    $translation_texts[] = $labels['not_found'];
4286
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4287
-                    $translation_texts[] = $labels['not_found_in_trash'];
4288
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4289
-                    $translation_texts[] = $labels['label_post_profile'];
4290
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4291
-                    $translation_texts[] = $labels['label_post_info'];
4292
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4293
-                    $translation_texts[] = $labels['label_post_images'];
4294
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4295
-                    $translation_texts[] = $labels['label_post_map'];
4296
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4297
-                    $translation_texts[] = $labels['label_reviews'];
4298
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4299
-                    $translation_texts[] = $labels['label_related_listing'];
4328
+                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4329
+                                    $translation_texts[] = $labels['name'];
4330
+                }
4331
+                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4332
+                                    $translation_texts[] = $labels['singular_name'];
4333
+                }
4334
+                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4335
+                                    $translation_texts[] = $labels['add_new'];
4336
+                }
4337
+                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4338
+                                    $translation_texts[] = $labels['add_new_item'];
4339
+                }
4340
+                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4341
+                                    $translation_texts[] = $labels['edit_item'];
4342
+                }
4343
+                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4344
+                                    $translation_texts[] = $labels['new_item'];
4345
+                }
4346
+                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4347
+                                    $translation_texts[] = $labels['view_item'];
4348
+                }
4349
+                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4350
+                                    $translation_texts[] = $labels['search_items'];
4351
+                }
4352
+                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4353
+                                    $translation_texts[] = $labels['not_found'];
4354
+                }
4355
+                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4356
+                                    $translation_texts[] = $labels['not_found_in_trash'];
4357
+                }
4358
+                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4359
+                                    $translation_texts[] = $labels['label_post_profile'];
4360
+                }
4361
+                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4362
+                                    $translation_texts[] = $labels['label_post_info'];
4363
+                }
4364
+                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4365
+                                    $translation_texts[] = $labels['label_post_images'];
4366
+                }
4367
+                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4368
+                                    $translation_texts[] = $labels['label_post_map'];
4369
+                }
4370
+                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4371
+                                    $translation_texts[] = $labels['label_reviews'];
4372
+                }
4373
+                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4374
+                                    $translation_texts[] = $labels['label_related_listing'];
4375
+                }
4300 4376
             }
4301 4377
 
4302 4378
             if ($description != '' && !in_array($description, $translation_texts)) {
@@ -4304,11 +4380,13 @@  discard block
 block discarded – undo
4304 4380
             }
4305 4381
 
4306 4382
             if (!empty($seo)) {
4307
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4308
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4383
+                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4384
+                                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4385
+                }
4309 4386
 
4310
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4311
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4387
+                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4388
+                                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4389
+                }
4312 4390
             }
4313 4391
         }
4314 4392
     }
@@ -4334,16 +4412,20 @@  discard block
 block discarded – undo
4334 4412
         $hide_region_part = get_option('geodir_location_hide_region_part');
4335 4413
 
4336 4414
         if ($hide_region_part && $hide_country_part) {
4337
-            if (isset($location_terms['gd_country']))
4338
-                unset($location_terms['gd_country']);
4339
-            if (isset($location_terms['gd_region']))
4340
-                unset($location_terms['gd_region']);
4415
+            if (isset($location_terms['gd_country'])) {
4416
+                            unset($location_terms['gd_country']);
4417
+            }
4418
+            if (isset($location_terms['gd_region'])) {
4419
+                            unset($location_terms['gd_region']);
4420
+            }
4341 4421
         } else if ($hide_region_part && !$hide_country_part) {
4342
-            if (isset($location_terms['gd_region']))
4343
-                unset($location_terms['gd_region']);
4422
+            if (isset($location_terms['gd_region'])) {
4423
+                            unset($location_terms['gd_region']);
4424
+            }
4344 4425
         } else if (!$hide_region_part && $hide_country_part) {
4345
-            if (isset($location_terms['gd_country']))
4346
-                unset($location_terms['gd_country']);
4426
+            if (isset($location_terms['gd_country'])) {
4427
+                            unset($location_terms['gd_country']);
4428
+            }
4347 4429
         }
4348 4430
     }
4349 4431
 
Please login to merge, or discard this patch.