Test Failed
Pull Request — master (#293)
by Kiran
05:30
created
geodirectory-admin/admin_dummy_data_functions.php 3 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,149 +19,149 @@  discard block
 block discarded – undo
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21 21
 function geodir_dummy_data_taxonomies($post_type,$category_array) {
22
-    global $wpdb, $dummy_image_path;
22
+	global $wpdb, $dummy_image_path;
23 23
 
24 24
 
25 25
 
26
-    $last_catid = '';
26
+	$last_catid = '';
27 27
 
28
-    $uploads = wp_upload_dir(); // Array of key => value pairs
28
+	$uploads = wp_upload_dir(); // Array of key => value pairs
29 29
 
30
-    for ($i = 0; $i < count($category_array); $i++) {
31
-        $parent_catid = 0;
32
-        if (is_array($category_array[$i])) {
33
-            $cat_name_arr = $category_array[$i];
34
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
35
-                $catname = $cat_name_arr[$j];
30
+	for ($i = 0; $i < count($category_array); $i++) {
31
+		$parent_catid = 0;
32
+		if (is_array($category_array[$i])) {
33
+			$cat_name_arr = $category_array[$i];
34
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
35
+				$catname = $cat_name_arr[$j];
36 36
 
37
-                if (!term_exists($catname, $post_type.'category')) {
38
-                    $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
37
+				if (!term_exists($catname, $post_type.'category')) {
38
+					$last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
39 39
 
40
-                    if ($j == 0) {
41
-                        $parent_catid = $last_catid;
42
-                    }
40
+					if ($j == 0) {
41
+						$parent_catid = $last_catid;
42
+					}
43 43
 
44 44
 
45
-                    if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
-                    else
48
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
45
+					if (geodir_dummy_folder_exists())
46
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
+					else
48
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
49 49
 
50
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
50
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52
-                    $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
52
+					$catname = str_replace(' ', '_', $catname);
53
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
54 54
 
55
-                    if (empty($uploaded['error'])) {
56
-                        $new_path = $uploaded['file'];
57
-                        $new_url = $uploaded['url'];
58
-                    }
55
+					if (empty($uploaded['error'])) {
56
+						$new_path = $uploaded['file'];
57
+						$new_url = $uploaded['url'];
58
+					}
59 59
 
60
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
61
-
62
-                    $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
-                        'post_mime_type' => $wp_filetype['type'],
65
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
-                        'post_content' => '',
67
-                        'post_status' => 'inherit'
68
-                    );
69
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
70
-
71
-                    // you must first include the image.php file
72
-                    // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
74
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
-                    wp_update_attachment_metadata($attach_id, $attach_data);
76
-
77
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
-                    }
80
-                }
81
-            }
60
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
82 61
 
83
-        } else {
84
-            $catname = $category_array[$i];
62
+					$attachment = array(
63
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
+						'post_mime_type' => $wp_filetype['type'],
65
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
+						'post_content' => '',
67
+						'post_status' => 'inherit'
68
+					);
69
+					$attach_id = wp_insert_attachment($attachment, $new_path);
85 70
 
86
-            if (!term_exists($catname, $post_type.'category')) {
87
-                $last_catid = wp_insert_term($catname, $post_type.'category');
71
+					// you must first include the image.php file
72
+					// for the function wp_generate_attachment_metadata() to work
73
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
74
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
+					wp_update_attachment_metadata($attach_id, $attach_data);
88 76
 
89
-                if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
-                else
92
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
77
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
+					}
80
+				}
81
+			}
93 82
 
94
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
83
+		} else {
84
+			$catname = $category_array[$i];
95 85
 
96
-                $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
86
+			if (!term_exists($catname, $post_type.'category')) {
87
+				$last_catid = wp_insert_term($catname, $post_type.'category');
98 88
 
99
-                if (empty($uploaded['error'])) {
100
-                    $new_path = $uploaded['file'];
101
-                    $new_url = $uploaded['url'];
102
-                }
89
+				if (geodir_dummy_folder_exists())
90
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
+				else
92
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
103 93
 
104
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
94
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
105 95
 
106
-                $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
-                    'post_mime_type' => $wp_filetype['type'],
109
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
-                    'post_content' => '',
111
-                    'post_status' => 'inherit'
112
-                );
96
+				$catname = str_replace(' ', '_', $catname);
97
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
113 98
 
114
-                $attach_id = wp_insert_attachment($attachment, $new_path);
99
+				if (empty($uploaded['error'])) {
100
+					$new_path = $uploaded['file'];
101
+					$new_url = $uploaded['url'];
102
+				}
115 103
 
104
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
116 105
 
117
-                // you must first include the image.php file
118
-                // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
120
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
-                wp_update_attachment_metadata($attach_id, $attach_data);
106
+				$attachment = array(
107
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
+					'post_mime_type' => $wp_filetype['type'],
109
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
+					'post_content' => '',
111
+					'post_status' => 'inherit'
112
+				);
113
+
114
+				$attach_id = wp_insert_attachment($attachment, $new_path);
122 115
 
123
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
-                }
126
-            }
127
-        }
128 116
 
129
-    }
117
+				// you must first include the image.php file
118
+				// for the function wp_generate_attachment_metadata() to work
119
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
120
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
+				wp_update_attachment_metadata($attach_id, $attach_data);
122
+
123
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
+				}
126
+			}
127
+		}
128
+
129
+	}
130 130
 }
131 131
 
132 132
 
133 133
 function geodir_dummy_data_types(){
134
-    return array(
135
-        'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
137
-            'count'=> 30
138
-        ),
139
-        'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
141
-            'count'=> 10
142
-        ),
143
-        'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
145
-            'count'=> 10
146
-        )
147
-    );
134
+	return array(
135
+		'standard_places' => array(
136
+			'name'=>__('Default','geodirectory'),
137
+			'count'=> 30
138
+		),
139
+		'property_sale' => array(
140
+			'name'=>__('Property for sale','geodirectory'),
141
+			'count'=> 10
142
+		),
143
+		'property_rent' => array(
144
+			'name'=>__('Property for rent','geodirectory'),
145
+			'count'=> 10
146
+		)
147
+	);
148 148
 }
149 149
 
150 150
 
151 151
 function geodir_create_dummy_fields($fields)
152 152
 {
153 153
     
154
-    /**
155
-     * Filter the array of default custom fields DB table data.
156
-     *
157
-     * @since 1.0.0
158
-     * @param string $fields The default custom fields as an array.
159
-     */
160
-    $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
161
-    foreach ($fields as $field_index => $field) {
162
-        geodir_custom_field_save($field);
163
-
164
-    }
154
+	/**
155
+	 * Filter the array of default custom fields DB table data.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @param string $fields The default custom fields as an array.
159
+	 */
160
+	$fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
161
+	foreach ($fields as $field_index => $field) {
162
+		geodir_custom_field_save($field);
163
+
164
+	}
165 165
 }
166 166
 
167 167
 /**
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
  */
175 175
 function geodir_delete_dummy_posts($post_type,$data_type)
176 176
 {
177
-    global $wpdb, $plugin_prefix;
177
+	global $wpdb, $plugin_prefix;
178 178
 
179 179
 
180
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
180
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
181 181
 
182 182
 
183
-    foreach ($post_ids as $post_ids_obj) {
184
-        wp_delete_post($post_ids_obj->post_id);
185
-    }
183
+	foreach ($post_ids as $post_ids_obj) {
184
+		wp_delete_post($post_ids_obj->post_id);
185
+	}
186 186
 
187
-    //double check posts are deleted
188
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
187
+	//double check posts are deleted
188
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
189 189
 
190
-    update_option($post_type.'_dummy_data_type','');
190
+	update_option($post_type.'_dummy_data_type','');
191 191
 }
192 192
 
193 193
 /**
@@ -201,78 +201,78 @@  discard block
 block discarded – undo
201 201
 function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
202 202
 {
203 203
 
204
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
205
-    $data_types = geodir_dummy_data_types();
206
-
207
-    $total_count = 0;
208
-    global $dummy_post_index;
209
-    $dummy_post_index = $item_index;
210
-    foreach( $data_types as $key=>$val){
211
-        if($key==$data_type){
212
-            $total_count = $val['count'];
213
-            if($key=='standard_places'){
214
-                /**
215
-                 * Contains dummy post content.
216
-                 *
217
-                 * @since 1.0.0
218
-                 * @package GeoDirectory
219
-                 */
220
-                include_once( 'dummy-data/standard_places.php' );
221
-            }elseif($key=='property_sale'){
222
-                /**
223
-                 * Contains dummy property for sale post content.
224
-                 *
225
-                 * @since 1.6.11
226
-                 * @package GeoDirectory
227
-                 */
228
-                include_once( 'dummy-data/property_sale.php' );
229
-            }elseif($key=='property_rent'){
230
-                /**
231
-                 * Contains dummy property for sale post content.
232
-                 *
233
-                 * @since 1.6.11
234
-                 * @package GeoDirectory
235
-                 */
236
-                include_once( 'dummy-data/property_rent.php' );
237
-            }
238
-
239
-        }
240
-
241
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
242
-    }
243
-
244
-
245
-
246
-    // delete image cache on last entry
247
-    if($total_count == $item_index){
248
-        delete_transient( 'cached_dummy_images' );
249
-        flush_rewrite_rules();
250
-    }
204
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
205
+	$data_types = geodir_dummy_data_types();
206
+
207
+	$total_count = 0;
208
+	global $dummy_post_index;
209
+	$dummy_post_index = $item_index;
210
+	foreach( $data_types as $key=>$val){
211
+		if($key==$data_type){
212
+			$total_count = $val['count'];
213
+			if($key=='standard_places'){
214
+				/**
215
+				 * Contains dummy post content.
216
+				 *
217
+				 * @since 1.0.0
218
+				 * @package GeoDirectory
219
+				 */
220
+				include_once( 'dummy-data/standard_places.php' );
221
+			}elseif($key=='property_sale'){
222
+				/**
223
+				 * Contains dummy property for sale post content.
224
+				 *
225
+				 * @since 1.6.11
226
+				 * @package GeoDirectory
227
+				 */
228
+				include_once( 'dummy-data/property_sale.php' );
229
+			}elseif($key=='property_rent'){
230
+				/**
231
+				 * Contains dummy property for sale post content.
232
+				 *
233
+				 * @since 1.6.11
234
+				 * @package GeoDirectory
235
+				 */
236
+				include_once( 'dummy-data/property_rent.php' );
237
+			}
238
+
239
+		}
240
+
241
+		do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
242
+	}
243
+
244
+
245
+
246
+	// delete image cache on last entry
247
+	if($total_count == $item_index){
248
+		delete_transient( 'cached_dummy_images' );
249
+		flush_rewrite_rules();
250
+	}
251 251
 
252 252
 
253 253
 }
254 254
 
255 255
 
256 256
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
257
-    /**
258
-     * GeoDirectory dummy data installation.
259
-     *
260
-     * @since 1.0.0
261
-     * @package GeoDirectory
262
-     * @global object $wpdb WordPress Database object.
263
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
264
-     * @param string $post_type The post type.
265
-     */
266
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
267
-    {
268
-
269
-        global $wpdb, $plugin_prefix;
270
-
271
-        if (!geodir_is_default_location_set()) {
272
-            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>';
273
-        } else {
274
-
275
-            ?>
257
+	/**
258
+	 * GeoDirectory dummy data installation.
259
+	 *
260
+	 * @since 1.0.0
261
+	 * @package GeoDirectory
262
+	 * @global object $wpdb WordPress Database object.
263
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
264
+	 * @param string $post_type The post type.
265
+	 */
266
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
267
+	{
268
+
269
+		global $wpdb, $plugin_prefix;
270
+
271
+		if (!geodir_is_default_location_set()) {
272
+			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>';
273
+		} else {
274
+
275
+			?>
276 276
             <table class="form-table gd-dummy-table">
277 277
                 <tbody>
278 278
                 <tr>
@@ -283,74 +283,74 @@  discard block
 block discarded – undo
283 283
 
284 284
                 <?php
285 285
 
286
-                $cpts = geodir_get_posttypes('array');
286
+				$cpts = geodir_get_posttypes('array');
287 287
 
288
-                $data_types = geodir_dummy_data_types();
288
+				$data_types = geodir_dummy_data_types();
289 289
 
290
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
290
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
291 291
 
292
-                foreach($cpts as $post_type=>$cpt){
292
+				foreach($cpts as $post_type=>$cpt){
293 293
 
294
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
294
+					$data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
295 295
 
296 296
 
297
-                    $set_dt = get_option($post_type.'_dummy_data_type');
297
+					$set_dt = get_option($post_type.'_dummy_data_type');
298 298
 
299
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
299
+					geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
300 300
 
301
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
301
+					$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
302 302
 
303
-                    echo "<tr>";
304
-                    echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
303
+					echo "<tr>";
304
+					echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
305 305
 
306 306
 
307
-                    $select_disabled = $post_counts > 0 ? 'disabled' : '';
308
-                    echo "<td>";
309
-                    echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
310
-                    foreach($data_types_for as $key=>$val){
311
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
312
-                        echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
313
-                    }
314
-                    echo "</select>";
315
-
316
-                    $select_display = $post_counts > 0 ? 'display:none;' : '';
317
-                    echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
318
-                    $x = 1;
319
-                    while($x <= $val['count']){
320
-                        $selected = ($x==$val['count']) ? "selected='selected'" : '';
321
-                        echo "<option $selected value='$x'>".$x."</option>";
322
-                        $x++;
323
-                    }
324
-                    echo "</select>";
325
-                    echo "</td>";
307
+					$select_disabled = $post_counts > 0 ? 'disabled' : '';
308
+					echo "<td>";
309
+					echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
310
+					foreach($data_types_for as $key=>$val){
311
+						$selected = ($key==$set_dt) ? "selected='selected'" : '';
312
+						echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
313
+					}
314
+					echo "</select>";
326 315
 
316
+					$select_display = $post_counts > 0 ? 'display:none;' : '';
317
+					echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
318
+					$x = 1;
319
+					while($x <= $val['count']){
320
+						$selected = ($x==$val['count']) ? "selected='selected'" : '';
321
+						echo "<option $selected value='$x'>".$x."</option>";
322
+						$x++;
323
+					}
324
+					echo "</select>";
325
+					echo "</td>";
327 326
 
328 327
 
329 328
 
330 329
 
331
-                    if($post_counts > 0){
332
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
333
-                    }else{
334
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
335
-                    }
336 330
 
337
-                    echo "</tr>";
338
-                    //print_r($cpt);
339
-                }
331
+					if($post_counts > 0){
332
+						echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
333
+					}else{
334
+						echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
335
+					}
336
+
337
+					echo "</tr>";
338
+					//print_r($cpt);
339
+				}
340 340
 
341
-                ?>
341
+				?>
342 342
                 </tbody>
343 343
             </table>
344 344
             <?php
345 345
 
346 346
 
347
-            $default_location = geodir_get_default_location();
348
-            $city = isset($default_location->city) ? $default_location->city : '';
349
-            $region = isset($default_location->region) ? $default_location->region : '';
350
-            $country = isset($default_location->country) ? $default_location->country : '';
351
-            $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
352
-            $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
353
-            ?>
347
+			$default_location = geodir_get_default_location();
348
+			$city = isset($default_location->city) ? $default_location->city : '';
349
+			$region = isset($default_location->region) ? $default_location->region : '';
350
+			$country = isset($default_location->country) ? $default_location->country : '';
351
+			$city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
352
+			$city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
353
+			?>
354 354
             <script type="text/javascript">
355 355
 
356 356
                 function geodir_dummy_set_count(data,cpt){
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 }
561 561
             </script>
562 562
             <?php
563
-        }
564
-    }
563
+		}
564
+	}
565 565
 }
566 566
 
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @global object $wpdb WordPress Database object.
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21
-function geodir_dummy_data_taxonomies($post_type,$category_array) {
21
+function geodir_dummy_data_taxonomies($post_type, $category_array) {
22 22
     global $wpdb, $dummy_image_path;
23 23
 
24 24
 
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 
44 44
 
45 45
                     if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
46
+                        $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
47 47
                     else
48 48
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
49 49
 
50 50
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52 52
                     $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
53
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
54 54
 
55 55
                     if (empty($uploaded['error'])) {
56 56
                         $new_path = $uploaded['file'];
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                     $wp_filetype = wp_check_filetype(basename($new_path), null);
61 61
 
62 62
                     $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
63
+                        'guid' => $uploads['baseurl'].'/'.basename($new_path),
64 64
                         'post_mime_type' => $wp_filetype['type'],
65 65
                         'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66 66
                         'post_content' => '',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
                     // you must first include the image.php file
72 72
                     // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
73
+                    require_once(ABSPATH.'wp-admin/includes/image.php');
74 74
                     $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75 75
                     wp_update_attachment_metadata($attach_id, $attach_data);
76 76
 
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
                 $last_catid = wp_insert_term($catname, $post_type.'category');
88 88
 
89 89
                 if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
90
+                    $dummy_image_url = geodir_plugin_url()."/geodirectory-admin/dummy/cat_icon";
91 91
                 else
92 92
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
93 93
 
94 94
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
95 95
 
96 96
                 $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
97
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/".$catname.".png");
98 98
 
99 99
                 if (empty($uploaded['error'])) {
100 100
                     $new_path = $uploaded['file'];
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 $wp_filetype = wp_check_filetype(basename($new_path), null);
105 105
 
106 106
                 $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
107
+                    'guid' => $uploads['baseurl'].'/'.basename($new_path),
108 108
                     'post_mime_type' => $wp_filetype['type'],
109 109
                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110 110
                     'post_content' => '',
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
                 // you must first include the image.php file
118 118
                 // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
119
+                require_once(ABSPATH.'wp-admin/includes/image.php');
120 120
                 $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121 121
                 wp_update_attachment_metadata($attach_id, $attach_data);
122 122
 
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
 }
131 131
 
132 132
 
133
-function geodir_dummy_data_types(){
133
+function geodir_dummy_data_types() {
134 134
     return array(
135 135
         'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
136
+            'name'=>__('Default', 'geodirectory'),
137 137
             'count'=> 30
138 138
         ),
139 139
         'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
140
+            'name'=>__('Property for sale', 'geodirectory'),
141 141
             'count'=> 10
142 142
         ),
143 143
         'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
144
+            'name'=>__('Property for rent', 'geodirectory'),
145 145
             'count'=> 10
146 146
         )
147 147
     );
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
  * @global object $wpdb WordPress Database object.
173 173
  * @global string $plugin_prefix Geodirectory plugin table prefix.
174 174
  */
175
-function geodir_delete_dummy_posts($post_type,$data_type)
175
+function geodir_delete_dummy_posts($post_type, $data_type)
176 176
 {
177 177
     global $wpdb, $plugin_prefix;
178 178
 
179 179
 
180
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
180
+    $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
181 181
 
182 182
 
183 183
     foreach ($post_ids as $post_ids_obj) {
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
     }
186 186
 
187 187
     //double check posts are deleted
188
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
188
+    $wpdb->get_results("DELETE FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
189 189
 
190
-    update_option($post_type.'_dummy_data_type','');
190
+    update_option($post_type.'_dummy_data_type', '');
191 191
 }
192 192
 
193 193
 /**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
  * @global object $wpdb WordPress Database object.
199 199
  * @global object $current_user Current user object.
200 200
  */
201
-function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
201
+function geodir_insert_dummy_posts($post_type, $data_type, $item_index)
202 202
 {
203 203
 
204 204
     ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
@@ -207,45 +207,45 @@  discard block
 block discarded – undo
207 207
     $total_count = 0;
208 208
     global $dummy_post_index;
209 209
     $dummy_post_index = $item_index;
210
-    foreach( $data_types as $key=>$val){
211
-        if($key==$data_type){
210
+    foreach ($data_types as $key=>$val) {
211
+        if ($key == $data_type) {
212 212
             $total_count = $val['count'];
213
-            if($key=='standard_places'){
213
+            if ($key == 'standard_places') {
214 214
                 /**
215 215
                  * Contains dummy post content.
216 216
                  *
217 217
                  * @since 1.0.0
218 218
                  * @package GeoDirectory
219 219
                  */
220
-                include_once( 'dummy-data/standard_places.php' );
221
-            }elseif($key=='property_sale'){
220
+                include_once('dummy-data/standard_places.php');
221
+            }elseif ($key == 'property_sale') {
222 222
                 /**
223 223
                  * Contains dummy property for sale post content.
224 224
                  *
225 225
                  * @since 1.6.11
226 226
                  * @package GeoDirectory
227 227
                  */
228
-                include_once( 'dummy-data/property_sale.php' );
229
-            }elseif($key=='property_rent'){
228
+                include_once('dummy-data/property_sale.php');
229
+            }elseif ($key == 'property_rent') {
230 230
                 /**
231 231
                  * Contains dummy property for sale post content.
232 232
                  *
233 233
                  * @since 1.6.11
234 234
                  * @package GeoDirectory
235 235
                  */
236
-                include_once( 'dummy-data/property_rent.php' );
236
+                include_once('dummy-data/property_rent.php');
237 237
             }
238 238
 
239 239
         }
240 240
 
241
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
241
+        do_action('geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index);
242 242
     }
243 243
 
244 244
 
245 245
 
246 246
     // delete image cache on last entry
247
-    if($total_count == $item_index){
248
-        delete_transient( 'cached_dummy_images' );
247
+    if ($total_count == $item_index) {
248
+        delete_transient('cached_dummy_images');
249 249
         flush_rewrite_rules();
250 250
     }
251 251
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 }
254 254
 
255 255
 
256
-if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
256
+if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) {
257 257
     /**
258 258
      * GeoDirectory dummy data installation.
259 259
      *
@@ -269,16 +269,16 @@  discard block
 block discarded – undo
269 269
         global $wpdb, $plugin_prefix;
270 270
 
271 271
         if (!geodir_is_default_location_set()) {
272
-            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>';
272
+            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>';
273 273
         } else {
274 274
 
275 275
             ?>
276 276
             <table class="form-table gd-dummy-table">
277 277
                 <tbody>
278 278
                 <tr>
279
-                    <td><strong><?php _e('CPT','geodirectory');?></strong></td>
280
-                    <td><strong><?php _e('Data Type','geodirectory');?></strong></td>
281
-                    <td><strong><?php _e('Action','geodirectory');?></strong></td>
279
+                    <td><strong><?php _e('CPT', 'geodirectory'); ?></strong></td>
280
+                    <td><strong><?php _e('Data Type', 'geodirectory'); ?></strong></td>
281
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
282 282
                 </tr>
283 283
 
284 284
                 <?php
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 
290 290
                 $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
291 291
 
292
-                foreach($cpts as $post_type=>$cpt){
292
+                foreach ($cpts as $post_type=>$cpt) {
293 293
 
294
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
294
+                    $data_types_for = apply_filters('geodir_dummy_date_types_for', $data_types, $post_type);
295 295
 
296 296
 
297 297
                     $set_dt = get_option($post_type.'_dummy_data_type');
298 298
 
299
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
299
+                    geodir_add_column_if_not_exist($plugin_prefix.$post_type."_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
300 300
 
301
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
301
+                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
302 302
 
303 303
                     echo "<tr>";
304 304
                     echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
                     $select_disabled = $post_counts > 0 ? 'disabled' : '';
308 308
                     echo "<td>";
309 309
                     echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
310
-                    foreach($data_types_for as $key=>$val){
311
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
310
+                    foreach ($data_types_for as $key=>$val) {
311
+                        $selected = ($key == $set_dt) ? "selected='selected'" : '';
312 312
                         echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
313 313
                     }
314 314
                     echo "</select>";
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
                     $select_display = $post_counts > 0 ? 'display:none;' : '';
317 317
                     echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
318 318
                     $x = 1;
319
-                    while($x <= $val['count']){
320
-                        $selected = ($x==$val['count']) ? "selected='selected'" : '';
319
+                    while ($x <= $val['count']) {
320
+                        $selected = ($x == $val['count']) ? "selected='selected'" : '';
321 321
                         echo "<option $selected value='$x'>".$x."</option>";
322 322
                         $x++;
323 323
                     }
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 
329 329
 
330 330
 
331
-                    if($post_counts > 0){
332
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
333
-                    }else{
334
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
331
+                    if ($post_counts > 0) {
332
+                        echo '<td><input type="button" value="'.__('Remove data', 'geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
333
+                    } else {
334
+                        echo '<td><input type="button" value="'.__('Insert data', 'geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
335 335
                     }
336 336
 
337 337
                     echo "</tr>";
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 
368 368
                 }
369 369
                 var geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
370
-                var CITY_ADDRESS = '<?php echo addslashes( $city . ',' . $region . ',' . $country );?>';
370
+                var CITY_ADDRESS = '<?php echo addslashes($city.','.$region.','.$country); ?>';
371 371
                 var bound_lat_lng;
372 372
                 var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>];
373 373
                 var lat = <?php echo $city_latitude; ?>;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                                     return x.replace(" ", '');
398 398
                                 }); // remove spaces from lat/lon
399 399
                             } else {
400
-                                alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
400
+                                alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
401 401
                             }
402 402
                         });
403 403
                 } else if (window.gdMaps == 'osm') {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
423 423
 
424 424
                     if (id == 'geodir_dummy_delete') {
425
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
425
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
426 426
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
427 427
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
428 428
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                         var post_url = '<?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;
444 444
 
445 445
                         jQuery.post( post_url, function (data) {
446
-                            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 + '');
446
+                            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 + '');
447 447
 
448 448
                             dummy_post_index++;
449 449
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 
459 459
 
460 460
                 function gdRemoveDummyData(obj, nonce, posttype){
461
-                    if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
461
+                    if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
462 462
                         jQuery(obj).prop('disabled', true);
463 463
                         jQuery('.gd-dummy-data-results-' + posttype).remove();
464 464
                         jQuery('<tr class="gd-dummy-data-results gd-dummy-data-results-' + posttype + '" >'+
@@ -473,14 +473,14 @@  discard block
 block discarded – undo
473 473
 
474 474
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
475 475
 
476
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation'));?>');
476
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation')); ?>');
477 477
 
478 478
 
479 479
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=geodir_dummy_delete&posttype=' + posttype + '&_wpnonce=' + nonce,
480 480
                             function (data) {
481
-                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
481
+                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
482 482
                                 jQuery(obj).removeClass('gd-remove-data');
483
-                                jQuery(obj).val('<?php _e('Insert data','geodirectory');?>');
483
+                                jQuery(obj).val('<?php _e('Insert data', 'geodirectory'); ?>');
484 484
                                 jQuery(obj).prop('disabled', false);
485 485
                                 jQuery('#'+posttype+'_data_type_count').show();
486 486
                                 jQuery('#'+posttype+'_data_type').prop('disabled', false);
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
525 525
 
526
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation'));?>');
526
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '0% (0 / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Creating categories and custom fields...', 'geodirlocation')); ?>');
527 527
                     }
528 528
 
529 529
                     if (!(typeof bound_lat_lng == 'object' && bound_lat_lng.length == 4)) {
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
                             percentage = percentage > 100 ? 100 : percentage;
544 544
 
545 545
 
546
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation'));?>');
546
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Inserting data...', 'geodirlocation')); ?>');
547 547
 
548 548
                             gdInstallDummyData(obj, nonce, posttype,insertedCount);
549 549
                         }
550 550
                         else {
551 551
                             percentage = 100;
552
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
552
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
553 553
                             jQuery(obj).addClass('gd-remove-data');
554
-                            jQuery(obj).val('<?php _e('Remove data','geodirectory');?>');
554
+                            jQuery(obj).val('<?php _e('Remove data', 'geodirectory'); ?>');
555 555
                             jQuery(obj).prop('disabled', false);
556 556
 
557 557
                         }
Please login to merge, or discard this patch.
Braces   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,10 +42,11 @@  discard block
 block discarded – undo
42 42
                     }
43 43
 
44 44
 
45
-                    if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
-                    else
48
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
45
+                    if (geodir_dummy_folder_exists()) {
46
+                                            $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
+                    } else {
48
+                                            $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
49
+                    }
49 50
 
50 51
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 52
 
@@ -86,10 +87,11 @@  discard block
 block discarded – undo
86 87
             if (!term_exists($catname, $post_type.'category')) {
87 88
                 $last_catid = wp_insert_term($catname, $post_type.'category');
88 89
 
89
-                if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
-                else
92
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
90
+                if (geodir_dummy_folder_exists()) {
91
+                                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
92
+                } else {
93
+                                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
94
+                }
93 95
 
94 96
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
95 97
 
@@ -218,7 +220,7 @@  discard block
 block discarded – undo
218 220
                  * @package GeoDirectory
219 221
                  */
220 222
                 include_once( 'dummy-data/standard_places.php' );
221
-            }elseif($key=='property_sale'){
223
+            } elseif($key=='property_sale'){
222 224
                 /**
223 225
                  * Contains dummy property for sale post content.
224 226
                  *
@@ -226,7 +228,7 @@  discard block
 block discarded – undo
226 228
                  * @package GeoDirectory
227 229
                  */
228 230
                 include_once( 'dummy-data/property_sale.php' );
229
-            }elseif($key=='property_rent'){
231
+            } elseif($key=='property_rent'){
230 232
                 /**
231 233
                  * Contains dummy property for sale post content.
232 234
                  *
@@ -330,7 +332,7 @@  discard block
 block discarded – undo
330 332
 
331 333
                     if($post_counts > 0){
332 334
                         echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
333
-                    }else{
335
+                    } else{
334 336
                         echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
335 337
                     }
336 338
 
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 3 patches
Indentation   +1218 added lines, -1218 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(ucfirst($args->labels->name),'geodirectory') . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
158
+
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -401,41 +401,41 @@  discard block
 block discarded – undo
401 401
  */
402 402
 function geodir_get_current_posttype()
403 403
 {
404
-    global $wp_query, $geodir_post_type;
404
+	global $wp_query, $geodir_post_type;
405 405
 
406
-    $geodir_post_type = get_query_var('post_type');
406
+	$geodir_post_type = get_query_var('post_type');
407 407
 
408
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
-    }
408
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
+		elseif (isset($_REQUEST['listing_type']))
412
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413
+	}
414 414
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
415
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
417 417
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
418
+	if (is_tax())
419
+		$geodir_post_type = geodir_get_taxonomy_posttype();
420 420
 
421 421
 
422
-    $all_postypes = geodir_get_posttypes();
423
-    $all_postypes = stripslashes_deep($all_postypes);
422
+	$all_postypes = geodir_get_posttypes();
423
+	$all_postypes = stripslashes_deep($all_postypes);
424 424
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
425
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
+		$geodir_post_type = '';
427 427
 
428
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430
-    }
428
+	if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430
+	}
431 431
 
432 432
 
433
-    /**
434
-     * Filter the default CPT return.
435
-     *
436
-     * @since 1.6.9
437
-     */
438
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
433
+	/**
434
+	 * Filter the default CPT return.
435
+	 *
436
+	 * @since 1.6.9
437
+	 */
438
+	return apply_filters('geodir_get_current_posttype',$geodir_post_type);
439 439
 }
440 440
 
441 441
 /**
@@ -449,21 +449,21 @@  discard block
 block discarded – undo
449 449
  */
450 450
 function geodir_get_default_posttype()
451 451
 {
452
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
452
+	$post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
453 453
 
454
-    foreach ( $post_types as $post_type => $info ) {
455
-        global $wpdb;
456
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
457
-        if ( $has_posts ) {
458
-            $stype = $post_type; break;
459
-        }
460
-    }
454
+	foreach ( $post_types as $post_type => $info ) {
455
+		global $wpdb;
456
+		$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
457
+		if ( $has_posts ) {
458
+			$stype = $post_type; break;
459
+		}
460
+	}
461 461
 
462
-    if(!$stype){
463
-        $stype = 'gd_place';
464
-    }
462
+	if(!$stype){
463
+		$stype = 'gd_place';
464
+	}
465 465
 
466
-    return $stype;
466
+	return $stype;
467 467
 }
468 468
 
469 469
 /**
@@ -477,21 +477,21 @@  discard block
 block discarded – undo
477 477
  */
478 478
 function geodir_get_posttypes($output = 'names')
479 479
 {
480
-    $post_types = array();
481
-    $post_types = get_option('geodir_post_types');
482
-    $post_types = stripslashes_deep($post_types);
483
-    if (!empty($post_types)) {
484
-        switch ($output):
485
-            case 'object':
486
-            case 'Object':
487
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
488
-                break;
489
-            case 'array':
490
-            case 'Array':
491
-                $post_types = (array)$post_types;
492
-                break;
480
+	$post_types = array();
481
+	$post_types = get_option('geodir_post_types');
482
+	$post_types = stripslashes_deep($post_types);
483
+	if (!empty($post_types)) {
484
+		switch ($output):
485
+			case 'object':
486
+			case 'Object':
487
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
488
+				break;
489
+			case 'array':
490
+			case 'Array':
491
+				$post_types = (array)$post_types;
492
+				break;
493 493
 			case 'options':
494
-                $post_types = (array)$post_types;
494
+				$post_types = (array)$post_types;
495 495
 				
496 496
 				$options = array();
497 497
 				if (!empty($post_types)) {
@@ -500,17 +500,17 @@  discard block
 block discarded – undo
500 500
 					}
501 501
 				}
502 502
 				$post_types = $options;
503
-                break;
504
-            default:
505
-                $post_types = array_keys($post_types);
506
-                break;
507
-        endswitch;
508
-    }
509
-
510
-    if (!empty($post_types))
511
-        return $post_types;
512
-    else
513
-        return array();
503
+				break;
504
+			default:
505
+				$post_types = array_keys($post_types);
506
+				break;
507
+		endswitch;
508
+	}
509
+
510
+	if (!empty($post_types))
511
+		return $post_types;
512
+	else
513
+		return array();
514 514
 }
515 515
 
516 516
 /**
@@ -523,108 +523,108 @@  discard block
 block discarded – undo
523 523
  */
524 524
 function geodir_get_posttype_info($post_type = '')
525 525
 {
526
-    $post_types = array();
527
-    $post_types = get_option('geodir_post_types');
528
-    $post_types = stripslashes_deep($post_types);
529
-    if (!empty($post_types) && $post_type != '') {
530
-        return $post_types[$post_type];
531
-    } else
532
-        return false;
526
+	$post_types = array();
527
+	$post_types = get_option('geodir_post_types');
528
+	$post_types = stripslashes_deep($post_types);
529
+	if (!empty($post_types) && $post_type != '') {
530
+		return $post_types[$post_type];
531
+	} else
532
+		return false;
533 533
 }
534 534
 
535 535
 if (!function_exists('geodir_get_taxonomies')) {
536
-    /**
537
-     * Get all custom taxonomies.
538
-     *
539
-     * @since 1.0.0
540
-     * @package GeoDirectory
541
-     * @param string $post_type The post type.
542
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
543
-     * @return array|bool Taxonomies on success. false on failure.
544
-     */
545
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
546
-    {
536
+	/**
537
+	 * Get all custom taxonomies.
538
+	 *
539
+	 * @since 1.0.0
540
+	 * @package GeoDirectory
541
+	 * @param string $post_type The post type.
542
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
543
+	 * @return array|bool Taxonomies on success. false on failure.
544
+	 */
545
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
546
+	{
547 547
 
548
-        $taxonomies = array();
549
-        $gd_taxonomies = array();
548
+		$taxonomies = array();
549
+		$gd_taxonomies = array();
550 550
 
551
-        if ($taxonomies = get_option('geodir_taxonomies')) {
551
+		if ($taxonomies = get_option('geodir_taxonomies')) {
552 552
 
553 553
 
554
-            $gd_taxonomies = array_keys($taxonomies);
554
+			$gd_taxonomies = array_keys($taxonomies);
555 555
 
556 556
 
557
-            if ($post_type != '')
558
-                $gd_taxonomies = array();
557
+			if ($post_type != '')
558
+				$gd_taxonomies = array();
559 559
 
560
-            $i = 0;
561
-            foreach ($taxonomies as $taxonomy => $args) {
560
+			$i = 0;
561
+			foreach ($taxonomies as $taxonomy => $args) {
562 562
 
563
-                if ($post_type != '' && $args['object_type'] == $post_type)
564
-                    $gd_taxonomies[] = $taxonomy;
563
+				if ($post_type != '' && $args['object_type'] == $post_type)
564
+					$gd_taxonomies[] = $taxonomy;
565 565
 
566
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
568
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
569
-                }
566
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
568
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
569
+				}
570 570
 
571
-            }
571
+			}
572
+
573
+			$gd_taxonomies = array_values($gd_taxonomies);
574
+		}
572 575
 
573
-            $gd_taxonomies = array_values($gd_taxonomies);
574
-        }
575
-
576
-        /**
577
-         * Filter the taxonomies.
578
-         *
579
-         * @since 1.0.0
580
-         * @param array $gd_taxonomies The taxonomy array.
581
-         */
582
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
583
-
584
-        if (!empty($taxonomies)) {
585
-            return $taxonomies;
586
-        } else {
587
-            return false;
588
-        }
589
-    }
576
+		/**
577
+		 * Filter the taxonomies.
578
+		 *
579
+		 * @since 1.0.0
580
+		 * @param array $gd_taxonomies The taxonomy array.
581
+		 */
582
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
583
+
584
+		if (!empty($taxonomies)) {
585
+			return $taxonomies;
586
+		} else {
587
+			return false;
588
+		}
589
+	}
590 590
 }
591 591
 
592 592
 if (!function_exists(' geodir_get_categories_dl')) {
593
-    /**
594
-     * Get categories dropdown HTML.
595
-     *
596
-     * @since 1.0.0
597
-     * @package GeoDirectory
598
-     * @param string $post_type The post type.
599
-     * @param string $selected The selected value.
600
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
601
-     * @param bool $echo Prints the HTML when set to true. Default: true.
602
-     * @return void|string Dropdown HTML.
603
-     */
604
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
605
-    {
606
-
607
-        $html = '';
608
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
609
-
610
-        $categories = get_terms($taxonomies);
611
-
612
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
613
-
614
-        foreach ($categories as $category_obj) {
615
-            $select_opt = '';
616
-            if ($selected == $category_obj->term_id) {
617
-                $select_opt = 'selected="selected"';
618
-            }
619
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
620
-                . ucfirst($category_obj->name) . '</option>';
621
-        }
622
-
623
-        if ($echo)
624
-            echo $html;
625
-        else
626
-            return $html;
627
-    }
593
+	/**
594
+	 * Get categories dropdown HTML.
595
+	 *
596
+	 * @since 1.0.0
597
+	 * @package GeoDirectory
598
+	 * @param string $post_type The post type.
599
+	 * @param string $selected The selected value.
600
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
601
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
602
+	 * @return void|string Dropdown HTML.
603
+	 */
604
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
605
+	{
606
+
607
+		$html = '';
608
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
609
+
610
+		$categories = get_terms($taxonomies);
611
+
612
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
613
+
614
+		foreach ($categories as $category_obj) {
615
+			$select_opt = '';
616
+			if ($selected == $category_obj->term_id) {
617
+				$select_opt = 'selected="selected"';
618
+			}
619
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
620
+				. ucfirst($category_obj->name) . '</option>';
621
+		}
622
+
623
+		if ($echo)
624
+			echo $html;
625
+		else
626
+			return $html;
627
+	}
628 628
 }
629 629
 
630 630
 
@@ -639,28 +639,28 @@  discard block
 block discarded – undo
639 639
 function geodir_get_listing_slug($object_type = '')
640 640
 {
641 641
 
642
-    $listing_slug = '';
642
+	$listing_slug = '';
643 643
 
644
-    $post_types = get_option('geodir_post_types');
645
-    $taxonomies = get_option('geodir_taxonomies');
644
+	$post_types = get_option('geodir_post_types');
645
+	$taxonomies = get_option('geodir_taxonomies');
646 646
 
647 647
 
648
-    if ($object_type != '') {
649
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
648
+	if ($object_type != '') {
649
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
650 650
 
651
-            $object_info = $post_types[$object_type];
652
-            $listing_slug = $object_info['listing_slug'];
653
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
654
-            $object_info = $taxonomies[$object_type];
655
-            $listing_slug = $object_info['listing_slug'];
656
-        }
651
+			$object_info = $post_types[$object_type];
652
+			$listing_slug = $object_info['listing_slug'];
653
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
654
+			$object_info = $taxonomies[$object_type];
655
+			$listing_slug = $object_info['listing_slug'];
656
+		}
657 657
 
658
-    }
658
+	}
659 659
 
660
-    if (!empty($listing_slug))
661
-        return $listing_slug;
662
-    else
663
-        return false;
660
+	if (!empty($listing_slug))
661
+		return $listing_slug;
662
+	else
663
+		return false;
664 664
 }
665 665
 
666 666
 
@@ -675,212 +675,212 @@  discard block
 block discarded – undo
675 675
  */
676 676
 function geodir_get_taxonomy_posttype($taxonomy = '')
677 677
 {
678
-    global $wp_query;
679
-
680
-    $post_type = array();
681
-    $taxonomies = array();
682
-
683
-    if (!empty($taxonomy)) {
684
-        $taxonomies[] = $taxonomy;
685
-    } elseif (isset($wp_query->tax_query->queries)) {
686
-        $tax_arr = $wp_query->tax_query->queries;
687
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
688
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
689
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
690
-    }
691
-
692
-    if (!empty($taxonomies)) {
693
-        foreach (geodir_get_posttypes() as $pt) {
694
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
-            if (array_intersect($taxonomies, $object_taxonomies))
696
-                $post_type[] = $pt;
697
-        }
698
-    }
699
-
700
-    if (!empty($post_type))
701
-        return $post_type[0];
702
-    else
703
-        return false;
678
+	global $wp_query;
679
+
680
+	$post_type = array();
681
+	$taxonomies = array();
682
+
683
+	if (!empty($taxonomy)) {
684
+		$taxonomies[] = $taxonomy;
685
+	} elseif (isset($wp_query->tax_query->queries)) {
686
+		$tax_arr = $wp_query->tax_query->queries;
687
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
688
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
689
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
690
+	}
691
+
692
+	if (!empty($taxonomies)) {
693
+		foreach (geodir_get_posttypes() as $pt) {
694
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
+			if (array_intersect($taxonomies, $object_taxonomies))
696
+				$post_type[] = $pt;
697
+		}
698
+	}
699
+
700
+	if (!empty($post_type))
701
+		return $post_type[0];
702
+	else
703
+		return false;
704 704
 }
705 705
 
706 706
 if (!function_exists('geodir_custom_taxonomy_walker')) {
707
-    /**
708
-     * Custom taxonomy walker function.
709
-     *
710
-     * @since 1.0.0
711
-     * @package GeoDirectory
712
-     * @param string $cat_taxonomy The taxonomy name.
713
-     * @param int $cat_parent The parent term ID.
714
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
715
-     * @param int $pading CSS padding in pixels.
716
-     * @return string|void taxonomy HTML.
717
-     */
718
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
719
-    {
720
-        global $cat_display, $post_cat, $exclude_cats;
721
-
722
-        $search_terms = trim($post_cat, ",");
723
-
724
-        $search_terms = explode(",", $search_terms);
725
-
726
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
727
-
728
-        $display = '';
729
-        $onchange = '';
730
-        $term_check = '';
731
-        $main_list_class = '';
732
-        $out = '';
733
-        //If there are terms, start displaying
734
-        if (count($cat_terms) > 0) {
735
-            //Displaying as a list
736
-            $p = $pading * 20;
737
-            $pading++;
738
-
739
-
740
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
741
-                if ($cat_parent == 0) {
742
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
743
-                    $main_list_class = 'class="main_list_selecter"';
744
-                } else {
745
-                    //$display = 'display:none';
746
-                    $list_class = 'sub_list gd-sub-cats-list';
747
-                }
748
-            }
707
+	/**
708
+	 * Custom taxonomy walker function.
709
+	 *
710
+	 * @since 1.0.0
711
+	 * @package GeoDirectory
712
+	 * @param string $cat_taxonomy The taxonomy name.
713
+	 * @param int $cat_parent The parent term ID.
714
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
715
+	 * @param int $pading CSS padding in pixels.
716
+	 * @return string|void taxonomy HTML.
717
+	 */
718
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
719
+	{
720
+		global $cat_display, $post_cat, $exclude_cats;
721
+
722
+		$search_terms = trim($post_cat, ",");
723
+
724
+		$search_terms = explode(",", $search_terms);
725
+
726
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
727
+
728
+		$display = '';
729
+		$onchange = '';
730
+		$term_check = '';
731
+		$main_list_class = '';
732
+		$out = '';
733
+		//If there are terms, start displaying
734
+		if (count($cat_terms) > 0) {
735
+			//Displaying as a list
736
+			$p = $pading * 20;
737
+			$pading++;
738
+
739
+
740
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
741
+				if ($cat_parent == 0) {
742
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
743
+					$main_list_class = 'class="main_list_selecter"';
744
+				} else {
745
+					//$display = 'display:none';
746
+					$list_class = 'sub_list gd-sub-cats-list';
747
+				}
748
+			}
749 749
 
750
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
751
-                $p = 0;
752
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
753
-            }
750
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
751
+				$p = 0;
752
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
753
+			}
754 754
 
755
-            foreach ($cat_terms as $cat_term) {
755
+			foreach ($cat_terms as $cat_term) {
756 756
 
757
-                $checked = '';
757
+				$checked = '';
758 758
 
759
-                if (in_array($cat_term->term_id, $search_terms)) {
760
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
761
-                        $checked = 'selected="selected"';
762
-                    else
763
-                        $checked = 'checked="checked"';
764
-                }
759
+				if (in_array($cat_term->term_id, $search_terms)) {
760
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
761
+						$checked = 'selected="selected"';
762
+					else
763
+						$checked = 'checked="checked"';
764
+				}
765 765
 
766
-                if ($cat_display == 'radio')
767
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
768
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
766
+				if ($cat_display == 'radio')
767
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
768
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
770 770
 
771
-                else {
772
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
773
-                }
771
+				else {
772
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
773
+				}
774 774
 
775
-                // Call recurson to print sub cats
776
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
775
+				// Call recurson to print sub cats
776
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
777 777
 
778
-            }
778
+			}
779 779
 
780
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
-                $out .= '</div>';
780
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
+				$out .= '</div>';
782 782
 
783
-            return $out;
784
-        }
785
-        return;
786
-    }
783
+			return $out;
784
+		}
785
+		return;
786
+	}
787 787
 }
788 788
 
789 789
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
790
-    /**
791
-     * Custom taxonomy walker function.
792
-     *
793
-     * @since 1.0.0
794
-     * @package GeoDirectory
795
-     * @global object $post WordPress Post object.
796
-     * @global object $gd_session GeoDirectory Session object.
797
-     * @param string $cat_taxonomy The taxonomy name.
798
-     * @param string $cat_limit Number of categories to display.
799
-     */
800
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
801
-    {
802
-        $post_category = '';
803
-        $post_category_str = '';
804
-        global $exclude_cats, $gd_session;
805
-
806
-        $cat_exclude = '';
807
-        if (is_array($exclude_cats) && !empty($exclude_cats))
808
-            $cat_exclude = serialize($exclude_cats);
809
-
810
-        if (isset($_REQUEST['backandedit'])) {
811
-            $post = (object)$gd_session->get('listing');
812
-
813
-            if (!is_array($post->post_category[$cat_taxonomy]))
814
-                $post_category = $post->post_category[$cat_taxonomy];
815
-
816
-            $post_categories = $post->post_category_str;
817
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
-                $post_category_str = $post_categories[$cat_taxonomy];
819
-
820
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821
-            global $post;
822
-
823
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
824
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
825
-                $post_category = $post->{$cat_taxonomy};
826
-            }
790
+	/**
791
+	 * Custom taxonomy walker function.
792
+	 *
793
+	 * @since 1.0.0
794
+	 * @package GeoDirectory
795
+	 * @global object $post WordPress Post object.
796
+	 * @global object $gd_session GeoDirectory Session object.
797
+	 * @param string $cat_taxonomy The taxonomy name.
798
+	 * @param string $cat_limit Number of categories to display.
799
+	 */
800
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
801
+	{
802
+		$post_category = '';
803
+		$post_category_str = '';
804
+		global $exclude_cats, $gd_session;
805
+
806
+		$cat_exclude = '';
807
+		if (is_array($exclude_cats) && !empty($exclude_cats))
808
+			$cat_exclude = serialize($exclude_cats);
809
+
810
+		if (isset($_REQUEST['backandedit'])) {
811
+			$post = (object)$gd_session->get('listing');
812
+
813
+			if (!is_array($post->post_category[$cat_taxonomy]))
814
+				$post_category = $post->post_category[$cat_taxonomy];
815
+
816
+			$post_categories = $post->post_category_str;
817
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
+				$post_category_str = $post_categories[$cat_taxonomy];
819
+
820
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821
+			global $post;
822
+
823
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
824
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
825
+				$post_category = $post->{$cat_taxonomy};
826
+			}
827 827
 
828
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
828
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
829 829
 
830
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
831
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
832
-                    if (is_numeric($cat_part)) {
833
-                        $cat_part_arr[] = $cat_part;
834
-                    }
835
-                }
836
-                if (is_array($cat_part_arr)) {
837
-                    $post_category = implode(',', $cat_part_arr);
838
-                }
839
-            }
830
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
831
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
832
+					if (is_numeric($cat_part)) {
833
+						$cat_part_arr[] = $cat_part;
834
+					}
835
+				}
836
+				if (is_array($cat_part_arr)) {
837
+					$post_category = implode(',', $cat_part_arr);
838
+				}
839
+			}
840 840
 
841
-            if (!empty($post_category)) {
842
-                $cat1 = array_filter(explode(',', $post_category));
843
-                $post_category = ',' . implode(',', $cat1) . ',';
841
+			if (!empty($post_category)) {
842
+				$cat1 = array_filter(explode(',', $post_category));
843
+				$post_category = ',' . implode(',', $cat1) . ',';
844 844
 
845
-            }
845
+			}
846 846
 
847
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
847
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
848 848
 
849
-                $post_category_upd = explode(',', $post_category);
850
-                $post_category_change = '';
851
-                foreach ($post_category_upd as $cat) {
849
+				$post_category_upd = explode(',', $post_category);
850
+				$post_category_change = '';
851
+				foreach ($post_category_upd as $cat) {
852 852
 
853
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
854
-                        $post_category_change .= ',' . $cat;
855
-                    }
856
-                }
857
-                $post_category = $post_category_change;
858
-            }
853
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
854
+						$post_category_change .= ',' . $cat;
855
+					}
856
+				}
857
+				$post_category = $post_category_change;
858
+			}
859 859
 
860 860
 
861
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
862
-                $post_category_str = $post_categories[$cat_taxonomy];
863
-            }
864
-        }
861
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
862
+				$post_category_str = $post_categories[$cat_taxonomy];
863
+			}
864
+		}
865 865
 
866
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
866
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
867 867
 
868
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
868
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
869 869
 
870
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
870
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
871 871
 
872 872
 
873
-        ?>
873
+		?>
874 874
         <div class="cat_sublist">
875 875
             <?php
876 876
 
877
-            $post_id = isset($post->ID) ? $post->ID : '';
877
+			$post_id = isset($post->ID) ? $post->ID : '';
878 878
 
879
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
879
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
880 880
 
881
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
882
-            }
883
-            ?>
881
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
882
+			}
883
+			?>
884 884
         </div>
885 885
         <script type="text/javascript">
886 886
 
@@ -1003,22 +1003,22 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
         </script>
1005 1005
         <?php
1006
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007
-            $post_cat_str = $post_categories[$cat_taxonomy];
1008
-            $post_cat_array = explode("#", $post_cat_str);
1009
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
-                $style = "display:none;";
1011
-        }
1012
-        ?>
1006
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007
+			$post_cat_str = $post_categories[$cat_taxonomy];
1008
+			$post_cat_array = explode("#", $post_cat_str);
1009
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
+				$style = "display:none;";
1011
+		}
1012
+		?>
1013 1013
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1014
-            echo $style;
1015
-        }?> ">
1014
+			echo $style;
1015
+		}?> ">
1016 1016
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1017
-            ?>
1017
+			?>
1018 1018
         </div>
1019 1019
     <?php
1020 1020
 
1021
-    }
1021
+	}
1022 1022
 }
1023 1023
 
1024 1024
 /**
@@ -1035,23 +1035,23 @@  discard block
 block discarded – undo
1035 1035
  */
1036 1036
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1037 1037
 {
1038
-    global $exclude_cats;
1038
+	global $exclude_cats;
1039 1039
 
1040
-    if ($exclude != '') {
1041
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1040
+	if ($exclude != '') {
1041
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1042 1042
 
1043
-        if(is_array( $exclude_cats)){
1044
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1046
-            $exclude_cats = intval($exclude_cats);
1047
-        }
1043
+		if(is_array( $exclude_cats)){
1044
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1045
+		}else{
1046
+			$exclude_cats = intval($exclude_cats);
1047
+		}
1048 1048
 
1049
-    }
1049
+	}
1050 1050
 
1051
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1052
-        (!is_array($exclude_cats) || empty($exclude_cats))
1053
-    ) {
1054
-        ?>
1051
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1052
+		(!is_array($exclude_cats) || empty($exclude_cats))
1053
+	) {
1054
+		?>
1055 1055
 
1056 1056
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1057 1057
 
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
             <br/>
1082 1082
             <?php
1083
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1084
-            if (!empty($cat_terms)) { ?>
1083
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1084
+			if (!empty($cat_terms)) { ?>
1085 1085
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1086 1086
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1087 1087
             <?php } ?>
@@ -1103,53 +1103,53 @@  discard block
 block discarded – undo
1103 1103
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1104 1104
 {
1105 1105
 
1106
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1107
-        $post_cat_str = $post_categories[$request_taxonomy];
1108
-        $post_cat_array = explode("#", $post_cat_str);
1109
-        if (is_array($post_cat_array)) {
1110
-            $post_cat_array = array_unique( $post_cat_array );
1106
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1107
+		$post_cat_str = $post_categories[$request_taxonomy];
1108
+		$post_cat_array = explode("#", $post_cat_str);
1109
+		if (is_array($post_cat_array)) {
1110
+			$post_cat_array = array_unique( $post_cat_array );
1111 1111
 
1112 1112
 			foreach ($post_cat_array as $post_cat_html) {
1113 1113
 
1114
-                $post_cat_info = explode(":", $post_cat_html);
1115
-                $post_maincat_str = $post_cat_info[0];
1114
+				$post_cat_info = explode(":", $post_cat_html);
1115
+				$post_maincat_str = $post_cat_info[0];
1116 1116
 
1117
-                if (!empty($post_maincat_str)) {
1118
-                    $post_maincat_info = explode(",", $post_maincat_str);
1119
-                    $post_maincat_id = $post_maincat_info[0];
1120
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1121
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1122
-                }
1123
-                $post_sub_catid = '';
1124
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1125
-                    $post_sub_catid = (int)$post_cat_info[1];
1126
-                }
1117
+				if (!empty($post_maincat_str)) {
1118
+					$post_maincat_info = explode(",", $post_maincat_str);
1119
+					$post_maincat_id = $post_maincat_info[0];
1120
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1121
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1122
+				}
1123
+				$post_sub_catid = '';
1124
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1125
+					$post_sub_catid = (int)$post_cat_info[1];
1126
+				}
1127 1127
 
1128
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1128
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1129 1129
 
1130
-            }
1131
-        } else {
1130
+			}
1131
+		} else {
1132 1132
 
1133
-            $post_cat_info = explode(":", $post_cat_str);
1134
-            $post_maincat_str = $post_cat_info[0];
1133
+			$post_cat_info = explode(":", $post_cat_str);
1134
+			$post_maincat_str = $post_cat_info[0];
1135 1135
 
1136
-            $post_sub_catid = '';
1136
+			$post_sub_catid = '';
1137 1137
 
1138
-            if (!empty($post_maincat_str)) {
1139
-                $post_maincat_info = explode(",", $post_maincat_str);
1140
-                $post_maincat_id = $post_maincat_info[0];
1141
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1142
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1143
-            }
1138
+			if (!empty($post_maincat_str)) {
1139
+				$post_maincat_info = explode(",", $post_maincat_str);
1140
+				$post_maincat_id = $post_maincat_info[0];
1141
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1142
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1143
+			}
1144 1144
 
1145
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1146
-                $post_sub_catid = (int)$post_cat_info[1];
1147
-            }
1145
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1146
+				$post_sub_catid = (int)$post_cat_info[1];
1147
+			}
1148 1148
 
1149
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1149
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1150 1150
 
1151
-        }
1152
-    }
1151
+		}
1152
+	}
1153 1153
 }
1154 1154
 
1155 1155
 /**
@@ -1163,35 +1163,35 @@  discard block
 block discarded – undo
1163 1163
  */
1164 1164
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1165 1165
 {
1166
-    global $exclude_cats;
1166
+	global $exclude_cats;
1167 1167
 
1168
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1168
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1169 1169
 
1170
-    if (!empty($cat_terms)) {
1171
-        $onchange = '';
1172
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1170
+	if (!empty($cat_terms)) {
1171
+		$onchange = '';
1172
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1173 1173
 
1174
-        $option_selected = '';
1175
-        if (!$selected)
1176
-            $option_slected = ' selected="selected" ';
1174
+		$option_selected = '';
1175
+		if (!$selected)
1176
+			$option_slected = ' selected="selected" ';
1177 1177
 
1178
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1178
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1179 1179
 
1180
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1180
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1181 1181
 
1182
-        foreach ($cat_terms as $cat_term) {
1183
-            $option_selected = '';
1184
-            if ($selected == $cat_term->term_id)
1185
-                $option_selected = ' selected="selected" ';
1182
+		foreach ($cat_terms as $cat_term) {
1183
+			$option_selected = '';
1184
+			if ($selected == $cat_term->term_id)
1185
+				$option_selected = ' selected="selected" ';
1186 1186
 
1187
-            // Count child terms
1188
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1189
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1187
+			// Count child terms
1188
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1189
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1190 1190
 
1191
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1192
-        }
1193
-        echo '</select>';
1194
-    }
1191
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1192
+		}
1193
+		echo '</select>';
1194
+	}
1195 1195
 }
1196 1196
 
1197 1197
 /**
@@ -1207,28 +1207,28 @@  discard block
 block discarded – undo
1207 1207
  */
1208 1208
 function geodir_custom_update_messages($messages)
1209 1209
 {
1210
-    global $post, $post_ID;
1211
-
1212
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1213
-
1214
-    foreach ($post_types as $post_type => $post_object) {
1215
-
1216
-        $messages[$post_type] = array(
1217
-            0 => '', // Unused. Messages start at index 1.
1218
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1219
-            2 => __('Custom field updated.', 'geodirectory'),
1220
-            3 => __('Custom field deleted.', 'geodirectory'),
1221
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1222
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1223
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1224
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1225
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1226
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1227
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1228
-        );
1229
-    }
1230
-
1231
-    return $messages;
1210
+	global $post, $post_ID;
1211
+
1212
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1213
+
1214
+	foreach ($post_types as $post_type => $post_object) {
1215
+
1216
+		$messages[$post_type] = array(
1217
+			0 => '', // Unused. Messages start at index 1.
1218
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1219
+			2 => __('Custom field updated.', 'geodirectory'),
1220
+			3 => __('Custom field deleted.', 'geodirectory'),
1221
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1222
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1223
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1224
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1225
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1226
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1227
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1228
+		);
1229
+	}
1230
+
1231
+	return $messages;
1232 1232
 }
1233 1233
 
1234 1234
 
@@ -1243,183 +1243,183 @@  discard block
 block discarded – undo
1243 1243
 function geodir_register_defaults()
1244 1244
 {
1245 1245
 
1246
-    global $wpdb;
1247
-
1248
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249
-
1250
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
-        $listing_slug = 'places';
1252
-
1253
-    /**
1254
-     * Taxonomies
1255
-     **/
1256
-    //if ( ! taxonomy_exists('gd_place_tags') )
1257
-    {
1258
-
1259
-        $gd_placetags = array();
1260
-        $gd_placetags['object_type'] = 'gd_place';
1261
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1262
-        $gd_placetags['args'] = array(
1263
-            'public' => true,
1264
-            'hierarchical' => false,
1265
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1266
-            'query_var' => true,
1267
-
1268
-            'labels' => array(
1269
-                'name' => __('Place Tags', 'geodirectory'),
1270
-                'singular_name' => __('Place Tag', 'geodirectory'),
1271
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1272
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1273
-                'all_items' => __('All Place Tags', 'geodirectory'),
1274
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1275
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1276
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1277
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1278
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1279
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1280
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1281
-            ),
1282
-        );
1283
-
1284
-
1285
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1286
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1287
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1288
-
1289
-
1290
-        // Update post types and delete tmp options
1291
-        flush_rewrite_rules();
1292
-
1293
-    }
1294
-
1295
-    //if ( ! taxonomy_exists('gd_placecategory') )
1296
-    {
1297
-
1298
-        $gd_placecategory = array();
1299
-        $gd_placecategory['object_type'] = 'gd_place';
1300
-        $gd_placecategory['listing_slug'] = $listing_slug;
1301
-        $gd_placecategory['args'] = array(
1302
-            'public' => true,
1303
-            'hierarchical' => true,
1304
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1305
-            'query_var' => true,
1306
-            'labels' => array(
1307
-                'name' => __('Place Categories', 'geodirectory'),
1308
-                'singular_name' => __('Place Category', 'geodirectory'),
1309
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1310
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1311
-                'all_items' => __('All Place Categories', 'geodirectory'),
1312
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1313
-                'update_item' => __('Update Place Category', 'geodirectory'),
1314
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1315
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1316
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1317
-            ),
1318
-        );
1319
-
1320
-
1321
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1322
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1323
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1324
-
1325
-
1326
-        flush_rewrite_rules();
1327
-    }
1328
-
1329
-    /**
1330
-     * Post Types
1331
-     **/
1332
-
1333
-    //if ( ! post_type_exists('gd_place') )
1334
-    {
1335
-
1336
-        $labels = array(
1337
-            'name' => __('Places', 'geodirectory'),
1338
-            'singular_name' => __('Place', 'geodirectory'),
1339
-            'add_new' => __('Add New', 'geodirectory'),
1340
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1341
-            'edit_item' => __('Edit Place', 'geodirectory'),
1342
-            'new_item' => __('New Place', 'geodirectory'),
1343
-            'view_item' => __('View Place', 'geodirectory'),
1344
-            'search_items' => __('Search Places', 'geodirectory'),
1345
-            'not_found' => __('No Place Found', 'geodirectory'),
1346
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1347
-
1348
-        $place_default = array(
1349
-            'labels' => $labels,
1350
-            'can_export' => true,
1351
-            'capability_type' => 'post',
1352
-            'description' => 'Place post type.',
1353
-            'has_archive' => $listing_slug,
1354
-            'hierarchical' => false,
1355
-            'map_meta_cap' => true,
1356
-            'menu_icon' => $menu_icon,
1357
-            'public' => true,
1358
-            'query_var' => true,
1359
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1360
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1361
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1362
-
1363
-        //Update custom post types
1364
-        $geodir_post_types = get_option('geodir_post_types');
1365
-        $geodir_post_types['gd_place'] = $place_default;
1366
-        update_option('geodir_post_types', $geodir_post_types);
1367
-
1368
-        // Update post types and delete tmp options
1369
-        flush_rewrite_rules();
1370
-    }
1371
-
1372
-
1373
-    geodir_register_taxonomies();
1374
-    geodir_register_post_types();
1375
-
1376
-    //die;
1246
+	global $wpdb;
1247
+
1248
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249
+
1250
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
+		$listing_slug = 'places';
1252
+
1253
+	/**
1254
+	 * Taxonomies
1255
+	 **/
1256
+	//if ( ! taxonomy_exists('gd_place_tags') )
1257
+	{
1258
+
1259
+		$gd_placetags = array();
1260
+		$gd_placetags['object_type'] = 'gd_place';
1261
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1262
+		$gd_placetags['args'] = array(
1263
+			'public' => true,
1264
+			'hierarchical' => false,
1265
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1266
+			'query_var' => true,
1267
+
1268
+			'labels' => array(
1269
+				'name' => __('Place Tags', 'geodirectory'),
1270
+				'singular_name' => __('Place Tag', 'geodirectory'),
1271
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1272
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1273
+				'all_items' => __('All Place Tags', 'geodirectory'),
1274
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1275
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1276
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1277
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1278
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1279
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1280
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1281
+			),
1282
+		);
1283
+
1284
+
1285
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1286
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1287
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1288
+
1289
+
1290
+		// Update post types and delete tmp options
1291
+		flush_rewrite_rules();
1292
+
1293
+	}
1294
+
1295
+	//if ( ! taxonomy_exists('gd_placecategory') )
1296
+	{
1297
+
1298
+		$gd_placecategory = array();
1299
+		$gd_placecategory['object_type'] = 'gd_place';
1300
+		$gd_placecategory['listing_slug'] = $listing_slug;
1301
+		$gd_placecategory['args'] = array(
1302
+			'public' => true,
1303
+			'hierarchical' => true,
1304
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1305
+			'query_var' => true,
1306
+			'labels' => array(
1307
+				'name' => __('Place Categories', 'geodirectory'),
1308
+				'singular_name' => __('Place Category', 'geodirectory'),
1309
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1310
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1311
+				'all_items' => __('All Place Categories', 'geodirectory'),
1312
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1313
+				'update_item' => __('Update Place Category', 'geodirectory'),
1314
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1315
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1316
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1317
+			),
1318
+		);
1319
+
1320
+
1321
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1322
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1323
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1324
+
1325
+
1326
+		flush_rewrite_rules();
1327
+	}
1328
+
1329
+	/**
1330
+	 * Post Types
1331
+	 **/
1332
+
1333
+	//if ( ! post_type_exists('gd_place') )
1334
+	{
1335
+
1336
+		$labels = array(
1337
+			'name' => __('Places', 'geodirectory'),
1338
+			'singular_name' => __('Place', 'geodirectory'),
1339
+			'add_new' => __('Add New', 'geodirectory'),
1340
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1341
+			'edit_item' => __('Edit Place', 'geodirectory'),
1342
+			'new_item' => __('New Place', 'geodirectory'),
1343
+			'view_item' => __('View Place', 'geodirectory'),
1344
+			'search_items' => __('Search Places', 'geodirectory'),
1345
+			'not_found' => __('No Place Found', 'geodirectory'),
1346
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1347
+
1348
+		$place_default = array(
1349
+			'labels' => $labels,
1350
+			'can_export' => true,
1351
+			'capability_type' => 'post',
1352
+			'description' => 'Place post type.',
1353
+			'has_archive' => $listing_slug,
1354
+			'hierarchical' => false,
1355
+			'map_meta_cap' => true,
1356
+			'menu_icon' => $menu_icon,
1357
+			'public' => true,
1358
+			'query_var' => true,
1359
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1360
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1361
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1362
+
1363
+		//Update custom post types
1364
+		$geodir_post_types = get_option('geodir_post_types');
1365
+		$geodir_post_types['gd_place'] = $place_default;
1366
+		update_option('geodir_post_types', $geodir_post_types);
1367
+
1368
+		// Update post types and delete tmp options
1369
+		flush_rewrite_rules();
1370
+	}
1371
+
1372
+
1373
+	geodir_register_taxonomies();
1374
+	geodir_register_post_types();
1375
+
1376
+	//die;
1377 1377
 
1378 1378
 }
1379 1379
 
1380 1380
 $gd_wpml_get_languages = "";
1381 1381
 function gd_wpml_get_lang_from_url($url){
1382 1382
 
1383
-    global $gd_wpml_get_languages;
1384
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1383
+	global $gd_wpml_get_languages;
1384
+	if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1385 1385
 
1386 1386
 
1387
-    //
1388
-    $url = str_replace(array("http://","https://"),"",$url);
1387
+	//
1388
+	$url = str_replace(array("http://","https://"),"",$url);
1389 1389
 
1390
-    // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1391
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1390
+	// site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1391
+	$site_url = str_replace(array("http://","https://"),"",site_url());
1392 1392
 
1393
-    $url = str_replace($site_url,"",$url);
1393
+	$url = str_replace($site_url,"",$url);
1394 1394
 
1395 1395
 
1396
-    $segments = explode('/', trim($url, '/'));
1396
+	$segments = explode('/', trim($url, '/'));
1397 1397
 
1398
-    //print_r( $segments);
1399
-    if($gd_wpml_get_languages){
1400
-        $langs = $gd_wpml_get_languages;
1401
-    }else{
1402
-        global $sitepress;
1403
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1404
-    }
1398
+	//print_r( $segments);
1399
+	if($gd_wpml_get_languages){
1400
+		$langs = $gd_wpml_get_languages;
1401
+	}else{
1402
+		global $sitepress;
1403
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1404
+	}
1405 1405
 
1406
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1407
-        return $segments[0];
1408
-    }
1406
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1407
+		return $segments[0];
1408
+	}
1409 1409
 
1410
-    return false;
1410
+	return false;
1411 1411
 
1412 1412
 
1413 1413
 }
1414 1414
 
1415 1415
 function gd_wpml_slug_translation_turned_on($post_type) {
1416 1416
 
1417
-    global $sitepress;
1418
-    $settings = $sitepress->get_settings();
1419
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1420
-    && $settings['posts_slug_translation']['types'][$post_type]
1421
-    && isset($settings['posts_slug_translation']['on'])
1422
-    && $settings['posts_slug_translation']['on'];
1417
+	global $sitepress;
1418
+	$settings = $sitepress->get_settings();
1419
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1420
+	&& $settings['posts_slug_translation']['types'][$post_type]
1421
+	&& isset($settings['posts_slug_translation']['on'])
1422
+	&& $settings['posts_slug_translation']['on'];
1423 1423
 }
1424 1424
 
1425 1425
 
@@ -1444,150 +1444,150 @@  discard block
 block discarded – undo
1444 1444
  */
1445 1445
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1446 1446
 {
1447
-    //echo $post_link."<br />".$sample ;
1447
+	//echo $post_link."<br />".$sample ;
1448 1448
 
1449 1449
 
1450
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1451
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1452
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1453
-        return $post_link;
1454
-    } else {
1455
-        $orig_post = $post;
1456
-        $post = $post_obj;
1457
-    }
1450
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1451
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1452
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1453
+		return $post_link;
1454
+	} else {
1455
+		$orig_post = $post;
1456
+		$post = $post_obj;
1457
+	}
1458 1458
 
1459
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1459
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1460 1460
 
1461 1461
 
1462
-        $post_types = get_option('geodir_post_types');
1463
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1462
+		$post_types = get_option('geodir_post_types');
1463
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1464 1464
 
1465
-        // Alter the CPT slug if WPML is set to do so
1466
-        if(function_exists('icl_object_id')){
1467
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1465
+		// Alter the CPT slug if WPML is set to do so
1466
+		if(function_exists('icl_object_id')){
1467
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1468 1468
 
1469
-                $org_slug = $slug;
1470
-                $slug = apply_filters( 'wpml_translate_single_string',
1471
-                    $slug,
1472
-                    'WordPress',
1473
-                    'URL slug: ' . $slug,
1474
-                    $language_code);
1469
+				$org_slug = $slug;
1470
+				$slug = apply_filters( 'wpml_translate_single_string',
1471
+					$slug,
1472
+					'WordPress',
1473
+					'URL slug: ' . $slug,
1474
+					$language_code);
1475 1475
 
1476
-                if(!$slug){$slug = $org_slug;}
1476
+				if(!$slug){$slug = $org_slug;}
1477 1477
 
1478
-            }
1479
-        }
1478
+			}
1479
+		}
1480 1480
 
1481
-        if (function_exists('geodir_location_geo_home_link')) {
1482
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1483
-        }
1481
+		if (function_exists('geodir_location_geo_home_link')) {
1482
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1483
+		}
1484 1484
         
1485
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1486
-        $site_url = trailingslashit(get_bloginfo('url'));
1485
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1486
+		$site_url = trailingslashit(get_bloginfo('url'));
1487 1487
         
1488
-        if (function_exists('geodir_location_geo_home_link')) {
1489
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1490
-        }
1491
-
1492
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1493
-        if ($fix_url) {
1494
-            $post_link = str_replace($site_url, '', $post_link);
1495
-        }
1496
-
1497
-        $post_link = trailingslashit(
1498
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1499
-        );
1500
-
1501
-        if ($fix_url) {
1502
-            $post_link = $site_url . $post_link;
1503
-        }
1504
-
1505
-        if (isset($comment_post_cache[$post->ID])) {
1506
-            $post = $comment_post_cache[$post->ID];
1507
-        }
1508
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1509
-            $post_id = $post->ID;
1510
-            if (isset($orig_post)) {
1511
-                $post = $orig_post;
1512
-            }
1513
-            return $gd_permalink_cache[$post_id];
1514
-        }
1488
+		if (function_exists('geodir_location_geo_home_link')) {
1489
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1490
+		}
1515 1491
 
1516
-        if (!isset($post->post_locations)) {
1517
-            $post_type = $post->post_type;
1518
-            $ID = $post->ID;
1519
-            $post2 = $wpdb->get_row(
1520
-                $wpdb->prepare(
1521
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1522
-                    array($post->ID)
1523
-                )
1524
-            );
1492
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1493
+		if ($fix_url) {
1494
+			$post_link = str_replace($site_url, '', $post_link);
1495
+		}
1525 1496
 
1526
-            $post = (object)array_merge((array)$post, (array)$post2);
1497
+		$post_link = trailingslashit(
1498
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1499
+		);
1527 1500
 
1528
-            $comment_post_cache[$post->ID] = $post;
1529
-        }
1501
+		if ($fix_url) {
1502
+			$post_link = $site_url . $post_link;
1503
+		}
1530 1504
 
1505
+		if (isset($comment_post_cache[$post->ID])) {
1506
+			$post = $comment_post_cache[$post->ID];
1507
+		}
1508
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1509
+			$post_id = $post->ID;
1510
+			if (isset($orig_post)) {
1511
+				$post = $orig_post;
1512
+			}
1513
+			return $gd_permalink_cache[$post_id];
1514
+		}
1531 1515
 
1516
+		if (!isset($post->post_locations)) {
1517
+			$post_type = $post->post_type;
1518
+			$ID = $post->ID;
1519
+			$post2 = $wpdb->get_row(
1520
+				$wpdb->prepare(
1521
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1522
+					array($post->ID)
1523
+				)
1524
+			);
1532 1525
 
1533
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1526
+			$post = (object)array_merge((array)$post, (array)$post2);
1534 1527
 
1535
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1536
-                $location_request = '';
1528
+			$comment_post_cache[$post->ID] = $post;
1529
+		}
1537 1530
 
1538 1531
 
1539
-                if (!empty($post->post_locations)) {
1540
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1541
-                    if (count($geodir_arr_locations) == 3) {
1542
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1543
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1544
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1545
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1546
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1547
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1548 1532
 
1549
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1550
-                            'region_slug' => $post->region_slug,
1551
-                            'city_slug' => $post->city_slug
1552
-                        );
1533
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1553 1534
 
1554
-                    } else
1555
-                        $post_location = geodir_get_location();
1535
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1536
+				$location_request = '';
1556 1537
 
1557 1538
 
1558
-                } else {
1539
+				if (!empty($post->post_locations)) {
1540
+					$geodir_arr_locations = explode(',', $post->post_locations);
1541
+					if (count($geodir_arr_locations) == 3) {
1542
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1543
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1544
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1545
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1546
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1547
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1559 1548
 
1560
-                    $post_location_sql = $wpdb->get_results(
1561
-                        $wpdb->prepare(
1562
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1563
-                            array($post->ID)
1564
-                        )
1565
-                    );
1566
-
1567
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1568
-
1569
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1570
-                        if (count($geodir_arr_locations) == 3) {
1571
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1572
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1573
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1574
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1575
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1576
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1577
-
1578
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1579
-                                'region_slug' => $post->region_slug,
1580
-                                'city_slug' => $post->city_slug
1581
-                            );
1549
+						$post_location = (object)array('country_slug' => $post->country_slug,
1550
+							'region_slug' => $post->region_slug,
1551
+							'city_slug' => $post->city_slug
1552
+						);
1582 1553
 
1583
-                        }
1584
-                    } else
1585
-                        $post_location = geodir_get_location();
1586
-                }
1554
+					} else
1555
+						$post_location = geodir_get_location();
1587 1556
 
1588 1557
 
1589
-                if (!empty($post_location)) {
1590
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1558
+				} else {
1559
+
1560
+					$post_location_sql = $wpdb->get_results(
1561
+						$wpdb->prepare(
1562
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1563
+							array($post->ID)
1564
+						)
1565
+					);
1566
+
1567
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1568
+
1569
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1570
+						if (count($geodir_arr_locations) == 3) {
1571
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1572
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1573
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1574
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1575
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1576
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1577
+
1578
+							$post_location = (object)array('country_slug' => $post->country_slug,
1579
+								'region_slug' => $post->region_slug,
1580
+								'city_slug' => $post->city_slug
1581
+							);
1582
+
1583
+						}
1584
+					} else
1585
+						$post_location = geodir_get_location();
1586
+				}
1587
+
1588
+
1589
+				if (!empty($post_location)) {
1590
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1591 1591
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1592 1592
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1593 1593
 					
@@ -1605,78 +1605,78 @@  discard block
 block discarded – undo
1605 1605
 					$location_slug[] = $city_slug;
1606 1606
 					
1607 1607
 					$location_request .= implode('/', $location_slug) . '/';
1608
-                }
1609
-            }
1608
+				}
1609
+			}
1610 1610
 
1611
-            if (get_option('geodir_add_categories_url')) {
1611
+			if (get_option('geodir_add_categories_url')) {
1612 1612
 
1613
-                $term_request = '';
1614
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1613
+				$term_request = '';
1614
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1615 1615
 
1616
-                $taxonomies = end($taxonomies);
1616
+				$taxonomies = end($taxonomies);
1617 1617
 
1618
-                if (!empty($post->default_category)) {
1619
-                    $post_terms = $post->default_category;
1620
-                } else {
1621
-                    $post_terms = '';
1618
+				if (!empty($post->default_category)) {
1619
+					$post_terms = $post->default_category;
1620
+				} else {
1621
+					$post_terms = '';
1622 1622
 
1623
-                    if (isset($post->{$taxonomies})) {
1624
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1625
-                        $post_terms = $post_terms[0];
1626
-                    }
1623
+					if (isset($post->{$taxonomies})) {
1624
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1625
+						$post_terms = $post_terms[0];
1626
+					}
1627 1627
 
1628
-                    if (!$post_terms)
1629
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1628
+					if (!$post_terms)
1629
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1630 1630
 
1631
-                    if (!$post_terms) {
1632
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1631
+					if (!$post_terms) {
1632
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1633 1633
 
1634
-                        if ($post_terms) {
1635
-                            $post_terms = explode(",", trim($post_terms, ","));
1636
-                            $post_terms = $post_terms[0];
1637
-                        }
1638
-                    }
1639
-                }
1634
+						if ($post_terms) {
1635
+							$post_terms = explode(",", trim($post_terms, ","));
1636
+							$post_terms = $post_terms[0];
1637
+						}
1638
+					}
1639
+				}
1640 1640
 
1641
-                $term = get_term_by('id', $post_terms, $taxonomies);
1641
+				$term = get_term_by('id', $post_terms, $taxonomies);
1642 1642
 
1643
-                if (!empty($term))
1644
-                    $term_request = $term->slug;
1645
-                //$term_request = $term->slug.'/';
1646
-            }
1643
+				if (!empty($term))
1644
+					$term_request = $term->slug;
1645
+				//$term_request = $term->slug.'/';
1646
+			}
1647 1647
 
1648
-            $request_term = '';
1649
-            $listingurl_separator = '';
1650
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1651
-            $detailurl_separator = '';
1652
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1653
-                $request_term = $location_request;
1654
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1655
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1656
-                $request_term .= $term_request;
1648
+			$request_term = '';
1649
+			$listingurl_separator = '';
1650
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1651
+			$detailurl_separator = '';
1652
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1653
+				$request_term = $location_request;
1654
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1655
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1656
+				$request_term .= $term_request;
1657 1657
 
1658
-            } else {
1659
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1658
+			} else {
1659
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1660 1660
 
1661
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1662
-            }
1663
-            $request_term = trim($request_term, '/');
1664
-            if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
-            else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1668
-            //echo $post_link ;
1669
-        }
1670
-        // temp cache the permalink
1671
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1672
-            $gd_permalink_cache[$post->ID] = $post_link;
1673
-        }
1674
-    }
1675
-    if (isset($orig_post)) {
1676
-        $post = $orig_post;
1677
-    }
1678
-
1679
-    return $post_link;
1661
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1662
+			}
1663
+			$request_term = trim($request_term, '/');
1664
+			if (!empty($request_term))
1665
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
+			else
1667
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1668
+			//echo $post_link ;
1669
+		}
1670
+		// temp cache the permalink
1671
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1672
+			$gd_permalink_cache[$post->ID] = $post_link;
1673
+		}
1674
+	}
1675
+	if (isset($orig_post)) {
1676
+		$post = $orig_post;
1677
+	}
1678
+
1679
+	return $post_link;
1680 1680
 }
1681 1681
 
1682 1682
 /**
@@ -1692,99 +1692,99 @@  discard block
 block discarded – undo
1692 1692
  * @return string The term link.
1693 1693
  */
1694 1694
 function geodir_term_link($termlink, $term, $taxonomy) {
1695
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1695
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1696 1696
 
1697
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1698
-        global $geodir_add_location_url, $gd_session;
1699
-        $include_location = false;
1700
-        $request_term = array();
1701
-        $add_location_url = get_option('geodir_add_location_url');
1702
-        $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1697
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1698
+		global $geodir_add_location_url, $gd_session;
1699
+		$include_location = false;
1700
+		$request_term = array();
1701
+		$add_location_url = get_option('geodir_add_location_url');
1702
+		$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1703 1703
 
1704
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1704
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1705 1705
 
1706
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1707
-            if ($geodir_add_location_url && $add_location_url) {
1708
-                $include_location = true;
1709
-            }
1710
-        } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1711
-            $include_location = true;
1712
-        } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1713
-            $include_location = true;
1714
-        }
1715
-
1716
-        if ($include_location) {
1717
-            global $post;
1706
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1707
+			if ($geodir_add_location_url && $add_location_url) {
1708
+				$include_location = true;
1709
+			}
1710
+		} elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1711
+			$include_location = true;
1712
+		} elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1713
+			$include_location = true;
1714
+		}
1715
+
1716
+		if ($include_location) {
1717
+			global $post;
1718 1718
             
1719
-            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1719
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1720 1720
             
1721
-            if (geodir_is_page('detail') && isset($post->country_slug)) {
1722
-                $location_terms = array(
1723
-                    'gd_country' => $post->country_slug,
1724
-                    'gd_region' => $post->region_slug,
1725
-                    'gd_city' => $post->city_slug
1726
-                );
1721
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1722
+				$location_terms = array(
1723
+					'gd_country' => $post->country_slug,
1724
+					'gd_region' => $post->region_slug,
1725
+					'gd_city' => $post->city_slug
1726
+				);
1727 1727
                 
1728
-                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1729
-                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1730
-                }
1731
-            } else {
1732
-                $location_terms = geodir_get_current_location_terms('query_vars');
1733
-            }
1728
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1729
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1730
+				}
1731
+			} else {
1732
+				$location_terms = geodir_get_current_location_terms('query_vars');
1733
+			}
1734 1734
 
1735
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1736
-            $location_terms = geodir_remove_location_terms($location_terms);
1735
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1736
+			$location_terms = geodir_remove_location_terms($location_terms);
1737 1737
 
1738
-            if (!empty($location_terms)) {
1739
-                $url_separator = '';
1738
+			if (!empty($location_terms)) {
1739
+				$url_separator = '';
1740 1740
 
1741
-                if (get_option('permalink_structure') != '') {
1742
-                    $old_listing_slug = '/' . $listing_slug . '/';
1743
-                    $request_term = implode("/", $location_terms);
1744
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1741
+				if (get_option('permalink_structure') != '') {
1742
+					$old_listing_slug = '/' . $listing_slug . '/';
1743
+					$request_term = implode("/", $location_terms);
1744
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1745 1745
 
1746
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1747
-                } else {
1748
-                    $termlink = geodir_getlink($termlink, $request_term);
1749
-                }
1750
-            }
1751
-        }
1746
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1747
+				} else {
1748
+					$termlink = geodir_getlink($termlink, $request_term);
1749
+				}
1750
+			}
1751
+		}
1752 1752
 
1753
-        // Alter the CPT slug is WPML is set to do so
1754
-        /* we can replace this with the below function
1753
+		// Alter the CPT slug is WPML is set to do so
1754
+		/* we can replace this with the below function
1755 1755
         if(function_exists('icl_object_id')){
1756 1756
             global $sitepress;
1757 1757
             $post_type = str_replace("category","",$taxonomy);
1758 1758
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1759 1759
         }*/
1760 1760
 
1761
-        // Alter the CPT slug if WPML is set to do so
1762
-        if (function_exists('icl_object_id')) {
1763
-            $post_types = get_option('geodir_post_types');
1764
-            $post_type = str_replace("category","",$taxonomy);
1765
-            $post_type = str_replace("_tags","",$post_type);
1766
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1767
-            if (gd_wpml_slug_translation_turned_on($post_type)) {
1768
-                global $sitepress;
1769
-                $default_lang = $sitepress->get_default_language();
1770
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1771
-                if (!$language_code ) {
1772
-                    $language_code  = $default_lang;
1773
-                }
1761
+		// Alter the CPT slug if WPML is set to do so
1762
+		if (function_exists('icl_object_id')) {
1763
+			$post_types = get_option('geodir_post_types');
1764
+			$post_type = str_replace("category","",$taxonomy);
1765
+			$post_type = str_replace("_tags","",$post_type);
1766
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1767
+			if (gd_wpml_slug_translation_turned_on($post_type)) {
1768
+				global $sitepress;
1769
+				$default_lang = $sitepress->get_default_language();
1770
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1771
+				if (!$language_code ) {
1772
+					$language_code  = $default_lang;
1773
+				}
1774 1774
 
1775
-                $org_slug = $slug;
1776
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1775
+				$org_slug = $slug;
1776
+				$slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1777 1777
 
1778
-                if (!$slug) {
1779
-                    $slug = $org_slug;
1780
-                }
1778
+				if (!$slug) {
1779
+					$slug = $org_slug;
1780
+				}
1781 1781
 
1782
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1783
-            }
1784
-        }
1785
-    }
1782
+				$termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1783
+			}
1784
+		}
1785
+	}
1786 1786
     
1787
-    return $termlink;
1787
+	return $termlink;
1788 1788
 }
1789 1789
 
1790 1790
 /**
@@ -1810,14 +1810,14 @@  discard block
 block discarded – undo
1810 1810
 	if (in_array($post_type, geodir_get_posttypes())) {
1811 1811
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1812 1812
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1813
-                $location_terms = array(
1814
-                    'gd_country' => $post->country_slug,
1815
-                    'gd_region' => $post->region_slug,
1816
-                    'gd_city' => $post->city_slug
1817
-                );
1818
-            } else {
1819
-                $location_terms = geodir_get_current_location_terms('query_vars');
1820
-            }
1813
+				$location_terms = array(
1814
+					'gd_country' => $post->country_slug,
1815
+					'gd_region' => $post->region_slug,
1816
+					'gd_city' => $post->city_slug
1817
+				);
1818
+			} else {
1819
+				$location_terms = geodir_get_current_location_terms('query_vars');
1820
+			}
1821 1821
 			
1822 1822
 			$location_terms = geodir_remove_location_terms($location_terms);
1823 1823
 			
@@ -1848,14 +1848,14 @@  discard block
 block discarded – undo
1848 1848
  */
1849 1849
 function get_post_type_singular_label($post_type, $echo = false)
1850 1850
 {
1851
-    $obj_post_type = get_post_type_object($post_type);
1852
-    if (!is_object($obj_post_type)) {
1853
-        return;
1854
-    }
1855
-    if ($echo)
1856
-        echo $obj_post_type->labels->singular_name;
1857
-    else
1858
-        return $obj_post_type->labels->singular_name;
1851
+	$obj_post_type = get_post_type_object($post_type);
1852
+	if (!is_object($obj_post_type)) {
1853
+		return;
1854
+	}
1855
+	if ($echo)
1856
+		echo $obj_post_type->labels->singular_name;
1857
+	else
1858
+		return $obj_post_type->labels->singular_name;
1859 1859
 
1860 1860
 }
1861 1861
 
@@ -1870,16 +1870,16 @@  discard block
 block discarded – undo
1870 1870
  */
1871 1871
 function get_post_type_plural_label($post_type, $echo = false)
1872 1872
 {
1873
-    $all_postypes = geodir_get_posttypes();
1873
+	$all_postypes = geodir_get_posttypes();
1874 1874
 
1875
-    if (!in_array($post_type, $all_postypes))
1876
-        return false;
1875
+	if (!in_array($post_type, $all_postypes))
1876
+		return false;
1877 1877
 
1878
-    $obj_post_type = get_post_type_object($post_type);
1879
-    if ($echo)
1880
-        echo $obj_post_type->labels->name;
1881
-    else
1882
-        return $obj_post_type->labels->name;
1878
+	$obj_post_type = get_post_type_object($post_type);
1879
+	if ($echo)
1880
+		echo $obj_post_type->labels->name;
1881
+	else
1882
+		return $obj_post_type->labels->name;
1883 1883
 
1884 1884
 }
1885 1885
 
@@ -1898,51 +1898,51 @@  discard block
 block discarded – undo
1898 1898
  */
1899 1899
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1900 1900
 {
1901
-    global $wpdb;
1902
-
1903
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1904
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1905
-
1906
-    if (is_int($term)) {
1907
-        if (0 == $term)
1908
-            return 0;
1909
-        $where = 't.term_id = %d';
1910
-        if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
-        else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1914
-    }
1901
+	global $wpdb;
1902
+
1903
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1904
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1905
+
1906
+	if (is_int($term)) {
1907
+		if (0 == $term)
1908
+			return 0;
1909
+		$where = 't.term_id = %d';
1910
+		if (!empty($taxonomy))
1911
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
+		else
1913
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1914
+	}
1915 1915
 
1916
-    $term = trim(wp_unslash($term));
1916
+	$term = trim(wp_unslash($term));
1917 1917
 
1918
-    if ('' === $slug = sanitize_title($term))
1919
-        return 0;
1918
+	if ('' === $slug = sanitize_title($term))
1919
+		return 0;
1920 1920
 
1921
-    $where = 't.slug = %s';
1921
+	$where = 't.slug = %s';
1922 1922
 
1923
-    $where_fields = array($slug);
1924
-    if (!empty($taxonomy)) {
1925
-        $parent = (int)$parent;
1926
-        if ($parent > 0) {
1927
-            $where_fields[] = $parent;
1928
-            $else_where_fields[] = $parent;
1929
-            $where .= ' AND tt.parent = %d';
1923
+	$where_fields = array($slug);
1924
+	if (!empty($taxonomy)) {
1925
+		$parent = (int)$parent;
1926
+		if ($parent > 0) {
1927
+			$where_fields[] = $parent;
1928
+			$else_where_fields[] = $parent;
1929
+			$where .= ' AND tt.parent = %d';
1930 1930
 
1931
-        }
1931
+		}
1932 1932
 
1933
-        $where_fields[] = $taxonomy;
1933
+		$where_fields[] = $taxonomy;
1934 1934
 
1935 1935
 
1936
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1937
-            return $result;
1936
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1937
+			return $result;
1938 1938
 
1939
-        return false;
1940
-    }
1939
+		return false;
1940
+	}
1941 1941
 
1942
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
-        return $result;
1942
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
+		return $result;
1944 1944
 
1945
-    return false;
1945
+	return false;
1946 1946
 }
1947 1947
 
1948 1948
 /**
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 function geodir_get_term_icon_rebuild()
1955 1955
 {
1956 1956
 
1957
-    update_option('gd_term_icons', '');
1957
+	update_option('gd_term_icons', '');
1958 1958
 
1959 1959
 }
1960 1960
 
@@ -1972,60 +1972,60 @@  discard block
 block discarded – undo
1972 1972
  */
1973 1973
 function geodir_get_term_icon($term_id = false, $rebuild = false)
1974 1974
 {
1975
-    global $wpdb;
1976
-    if (!$rebuild) {
1977
-        $terms_icons = get_option('gd_term_icons');
1978
-    } else {
1979
-        $terms_icons = '';
1980
-    }
1981
-
1982
-    if (empty($terms_icons)) {
1983
-        $default_icon_url = get_option('geodir_default_marker_icon');
1984
-        $taxonomy = geodir_get_taxonomies();
1985
-        $post_types = geodir_get_posttypes();
1986
-        $tax_arr = array();
1987
-        foreach ($post_types as $post_type) {
1988
-            $tax_arr[] = "'" . $post_type . "category'";
1989
-        }
1990
-        $tax_c = implode(',', $tax_arr);
1991
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1992
-        //$terms = get_terms( $taxonomy );
1993
-
1994
-        if($terms) {
1995
-            foreach ($terms as $term) {
1996
-                $post_type = str_replace("category", "", $term->taxonomy);
1997
-                $a_terms[$post_type][] = $term;
1975
+	global $wpdb;
1976
+	if (!$rebuild) {
1977
+		$terms_icons = get_option('gd_term_icons');
1978
+	} else {
1979
+		$terms_icons = '';
1980
+	}
1998 1981
 
1999
-            }
2000
-        }
1982
+	if (empty($terms_icons)) {
1983
+		$default_icon_url = get_option('geodir_default_marker_icon');
1984
+		$taxonomy = geodir_get_taxonomies();
1985
+		$post_types = geodir_get_posttypes();
1986
+		$tax_arr = array();
1987
+		foreach ($post_types as $post_type) {
1988
+			$tax_arr[] = "'" . $post_type . "category'";
1989
+		}
1990
+		$tax_c = implode(',', $tax_arr);
1991
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1992
+		//$terms = get_terms( $taxonomy );
2001 1993
 
2002
-        if($a_terms) {
2003
-            foreach ($a_terms as $pt => $t2) {
1994
+		if($terms) {
1995
+			foreach ($terms as $term) {
1996
+				$post_type = str_replace("category", "", $term->taxonomy);
1997
+				$a_terms[$post_type][] = $term;
2004 1998
 
2005
-                foreach ($t2 as $term) {
2006
-                    $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2007
-                    if ($term_icon) {
2008
-                        $term_icon_url = $term_icon["src"];
2009
-                    } else {
2010
-                        $term_icon_url = $default_icon_url;
2011
-                    }
2012
-                    $terms_icons[$term->term_id] = $term_icon_url;
2013
-                }
2014
-            }
2015
-        }
1999
+			}
2000
+		}
2001
+
2002
+		if($a_terms) {
2003
+			foreach ($a_terms as $pt => $t2) {
2004
+
2005
+				foreach ($t2 as $term) {
2006
+					$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2007
+					if ($term_icon) {
2008
+						$term_icon_url = $term_icon["src"];
2009
+					} else {
2010
+						$term_icon_url = $default_icon_url;
2011
+					}
2012
+					$terms_icons[$term->term_id] = $term_icon_url;
2013
+				}
2014
+			}
2015
+		}
2016 2016
 
2017
-        update_option('gd_term_icons', $terms_icons);
2018
-    }
2017
+		update_option('gd_term_icons', $terms_icons);
2018
+	}
2019 2019
 
2020
-    if ($term_id && isset($terms_icons[$term_id])) {
2021
-        return $terms_icons[$term_id];
2022
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
2023
-        return get_option('geodir_default_marker_icon');
2024
-    }
2020
+	if ($term_id && isset($terms_icons[$term_id])) {
2021
+		return $terms_icons[$term_id];
2022
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
2023
+		return get_option('geodir_default_marker_icon');
2024
+	}
2025 2025
 
2026
-    if (is_ssl()) {
2027
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2028
-    }
2026
+	if (is_ssl()) {
2027
+		$terms_icons = str_replace("http:","https:",$terms_icons );
2028
+	}
2029 2029
 
2030
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2030
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2031 2031
 }
2032 2032
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
                              * @since 1.0.0
61 61
                              * @param string $menu_class The menu HTML class.
62 62
                              */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
63
+                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
64 64
                             /**
65 65
                              * Filter the menu a class.
66 66
                              *
67 67
                              * @since 1.0.0
68 68
                              */
69 69
                             $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
71
-									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72
-										' . __(ucfirst($args->labels->name),'geodirectory') . '
70
+                            $items .= '<li class="'.$li_class.'">
71
+									<a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'">
72
+										' . __(ucfirst($args->labels->name), 'geodirectory').'
73 73
 									</a>
74 74
 								</li>';
75 75
                         }
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
              * @since 1.0.0
89 89
              * @param string $menu_class The menu HTML class.
90 90
              */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
91
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
92 92
             /**
93 93
              * Filter the sub menu li class.
94 94
              *
95 95
              * @since 1.0.0
96 96
              * @param string $menu_class The menu HTML class.
97 97
              */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
98
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
99 99
             /**
100 100
              * Filter the sub menu ul class.
101 101
              *
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
              * @since 1.0.0
115 115
              */
116 116
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
118
-					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119
-					<ul class="' . $sub_ul_class . '">';
117
+            $items .= '<li class="'.$li_class.'">
118
+					<a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
119
+					<ul class="' . $sub_ul_class.'">';
120 120
             $post_types = geodir_get_posttypes('object');
121 121
 
122 122
             $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
                                 if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134 134
                                     $menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
137
-														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138
-															' . __(ucfirst($args->labels->name),'geodirectory') . '
136
+                                $items .= '<li class="'.$sub_li_class.'">
137
+														<a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'">
138
+															' . __(ucfirst($args->labels->name), 'geodirectory').'
139 139
 														</a>
140 140
 													</li>';
141 141
                             }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
              *
152 152
              * @since 1.5.9
153 153
              */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
154
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
155 155
             $items .= '</li>';
156 156
         }
157 157
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                      * @since 1.0.0
185 185
                                      * @param string $menu_class The menu HTML class.
186 186
                                      */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
187
+                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
188 188
                                     /**
189 189
                                      * Filter the menu a class.
190 190
                                      *
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
                                      */
193 193
                                     $a_class = apply_filters('geodir_menu_a_class', '');
194 194
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
196
-											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
195
+                                    $items .= '<li class="'.$li_class.'">
196
+											<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'">
197
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
198 198
 											</a>
199 199
 										</li>';
200 200
                                 }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
              * @since 1.0.0
219 219
              * @param string $menu_class The menu HTML class.
220 220
              */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
221
+            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
222 222
             /**
223 223
              * Filter the sub menu li class.
224 224
              *
225 225
              * @since 1.0.0
226 226
              * @param string $menu_class The menu HTML class.
227 227
              */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
228
+            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
229 229
             /**
230 230
              * Filter the sub menu ul class.
231 231
              *
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
              * @since 1.0.0
245 245
              */
246 246
             $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
248
-					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249
-					<ul class="' . $sub_ul_class . '">';
247
+            $items .= '<li  class="'.$li_class.'">
248
+					<a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
249
+					<ul class="' . $sub_ul_class.'">';
250 250
 
251 251
             $post_types = geodir_get_posttypes('object');
252 252
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
                                          * @since 1.0.0
270 270
                                          * @param string $menu_class The menu HTML class.
271 271
                                          */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
272
+                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
273 273
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $li_class . '">
275
-														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
274
+                                        $items .= '<li class="'.$li_class.'">
275
+														<a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'">
276
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
277 277
 														</a>
278 278
 													</li>';
279 279
                                     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
 
287 287
             $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
288
+            $items .= apply_filters('geodir_menu_after_sub_ul', '');
289 289
             $items .= '</li>';
290 290
 
291 291
         }
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
     $geodir_theme_location = get_option('geodir_theme_location_nav');
314 314
     $geodir_theme_location_nav = array();
315 315
     if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
316
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
317 317
         $geodir_theme_location_nav[] = $args['theme_location'];
318 318
         update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319 319
     }
320 320
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322 322
     else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
323
+        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
324 324
 
325 325
     return $menu;
326 326
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
     if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
351
+        $items = $items.geodir_add_nav_menu_items();
352 352
         return $items;
353 353
 
354 354
     } else {
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
 
374 374
     $taxonomies = geodir_get_taxonomies();
375 375
     $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
376
+    $taxonomies = "'".$taxonomies."'";
377 377
 
378 378
     $pn_categories = $wpdb->get_results(
379 379
         $wpdb->prepare(
380 380
             "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
381
+            array($wpdb->terms.term_id)
382 382
         )
383 383
     );
384 384
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409 409
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
410
+            $geodir_post_type = get_post_type((int) $_REQUEST['pid']);
411 411
         elseif (isset($_REQUEST['listing_type']))
412 412
             $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
413 413
     }
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426 426
         $geodir_post_type = '';
427 427
 
428
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
428
+    if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) {
429 429
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
430 430
     }
431 431
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      *
436 436
      * @since 1.6.9
437 437
      */
438
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
438
+    return apply_filters('geodir_get_current_posttype', $geodir_post_type);
439 439
 }
440 440
 
441 441
 /**
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
  */
450 450
 function geodir_get_default_posttype()
451 451
 {
452
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
452
+    $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
453 453
 
454
-    foreach ( $post_types as $post_type => $info ) {
454
+    foreach ($post_types as $post_type => $info) {
455 455
         global $wpdb;
456
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
457
-        if ( $has_posts ) {
456
+        $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
457
+        if ($has_posts) {
458 458
             $stype = $post_type; break;
459 459
         }
460 460
     }
461 461
 
462
-    if(!$stype){
462
+    if (!$stype) {
463 463
         $stype = 'gd_place';
464 464
     }
465 465
 
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
         switch ($output):
485 485
             case 'object':
486 486
             case 'Object':
487
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
487
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
488 488
                 break;
489 489
             case 'array':
490 490
             case 'Array':
491
-                $post_types = (array)$post_types;
491
+                $post_types = (array) $post_types;
492 492
                 break;
493 493
 			case 'options':
494
-                $post_types = (array)$post_types;
494
+                $post_types = (array) $post_types;
495 495
 				
496 496
 				$options = array();
497 497
 				if (!empty($post_types)) {
@@ -609,15 +609,15 @@  discard block
 block discarded – undo
609 609
 
610 610
         $categories = get_terms($taxonomies);
611 611
 
612
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
612
+        $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
613 613
 
614 614
         foreach ($categories as $category_obj) {
615 615
             $select_opt = '';
616 616
             if ($selected == $category_obj->term_id) {
617 617
                 $select_opt = 'selected="selected"';
618 618
             }
619
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
620
-                . ucfirst($category_obj->name) . '</option>';
619
+            $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">'
620
+                . ucfirst($category_obj->name).'</option>';
621 621
         }
622 622
 
623 623
         if ($echo)
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
     } elseif (isset($wp_query->tax_query->queries)) {
686 686
         $tax_arr = $wp_query->tax_query->queries;
687 687
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
688
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
688
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
689 689
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
690 690
     }
691 691
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
             if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
741 741
                 if ($cat_parent == 0) {
742
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
742
+                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display;
743 743
                     $main_list_class = 'class="main_list_selecter"';
744 744
                 } else {
745 745
                     //$display = 'display:none';
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 
750 750
             if ($cat_display == 'checkbox' || $cat_display == 'radio') {
751 751
                 $p = 0;
752
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
752
+                $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">';
753 753
             }
754 754
 
755 755
             foreach ($cat_terms as $cat_term) {
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
                 }
765 765
 
766 766
                 if ($cat_display == 'radio')
767
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
767
+                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
768 768
                 elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
769
+                    $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.ucfirst($cat_term->name).'</option>';
770 770
 
771 771
                 else {
772
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
772
+                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>';
773 773
                 }
774 774
 
775 775
                 // Call recurson to print sub cats
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
             $cat_exclude = serialize($exclude_cats);
809 809
 
810 810
         if (isset($_REQUEST['backandedit'])) {
811
-            $post = (object)$gd_session->get('listing');
811
+            $post = (object) $gd_session->get('listing');
812 812
 
813 813
             if (!is_array($post->post_category[$cat_taxonomy]))
814 814
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 
841 841
             if (!empty($post_category)) {
842 842
                 $cat1 = array_filter(explode(',', $post_category));
843
-                $post_category = ',' . implode(',', $cat1) . ',';
843
+                $post_category = ','.implode(',', $cat1).',';
844 844
 
845 845
             }
846 846
 
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
                 foreach ($post_category_upd as $cat) {
852 852
 
853 853
                     if (!in_array($cat, $exclude_cats) && $cat != '') {
854
-                        $post_category_change .= ',' . $cat;
854
+                        $post_category_change .= ','.$cat;
855 855
                     }
856 856
                 }
857 857
                 $post_category = $post_category_change;
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
             }
864 864
         }
865 865
 
866
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
866
+        echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']"  />';
867 867
 
868
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
868
+        echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']"  />';
869 869
 
870
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
870
+        echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']"  />';
871 871
 
872 872
 
873 873
         ?>
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
 
887 887
             function show_subcatlist(main_cat, catObj) {
888 888
                 if (main_cat != '') {
889
-					var url = '<?php echo geodir_get_ajax_url();?>';
890
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
891
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
889
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
890
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
891
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
892 892
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
893
-					<?php if ((int)$cat_limit > 0) { ?>
893
+					<?php if ((int) $cat_limit > 0) { ?>
894 894
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
895 895
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
896
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
896
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
897 897
 						return false;
898 898
 					}
899 899
 					<?php } ?>
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
             }
933 933
 
934 934
             function update_listing_cat(el) {
935
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
935
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
936 936
                 var cat_ids = '';
937 937
                 var main_cat = '';
938 938
                 var sub_cat = '';
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1014 1014
             echo $style;
1015 1015
         }?> ">
1016
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1016
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
1017 1017
             ?>
1018 1018
         </div>
1019 1019
     <?php
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
     if ($exclude != '') {
1041 1041
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
1042 1042
 
1043
-        if(is_array( $exclude_cats)){
1044
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1043
+        if (is_array($exclude_cats)) {
1044
+            $exclude_cats = array_map('intval', $exclude_cats);
1045
+        } else {
1046 1046
             $exclude_cats = intval($exclude_cats);
1047 1047
         }
1048 1048
 
@@ -1056,25 +1056,25 @@  discard block
 block discarded – undo
1056 1056
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1057 1057
 
1058 1058
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1059
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1059
+            <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>"
1060 1060
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1061 1061
             <?php /* ?>
1062 1062
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1063 1063
 		<?php */ ?>
1064 1064
 
1065
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1065
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1066 1066
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1067 1067
                    checked="checked" disabled="disabled"/>
1068 1068
        <span> 
1069
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1069
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1070 1070
         </span>
1071 1071
             <br/>
1072 1072
 
1073 1073
             <div class="post_default_category">
1074
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1075
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1074
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1075
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1076 1076
         <span> 
1077
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1077
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1078 1078
         </span>
1079 1079
             </div>
1080 1080
 
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         $post_cat_str = $post_categories[$request_taxonomy];
1108 1108
         $post_cat_array = explode("#", $post_cat_str);
1109 1109
         if (is_array($post_cat_array)) {
1110
-            $post_cat_array = array_unique( $post_cat_array );
1110
+            $post_cat_array = array_unique($post_cat_array);
1111 1111
 
1112 1112
 			foreach ($post_cat_array as $post_cat_html) {
1113 1113
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
                 }
1123 1123
                 $post_sub_catid = '';
1124 1124
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1125
-                    $post_sub_catid = (int)$post_cat_info[1];
1125
+                    $post_sub_catid = (int) $post_cat_info[1];
1126 1126
                 }
1127 1127
 
1128 1128
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
             }
1144 1144
 
1145 1145
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1146
-                $post_sub_catid = (int)$post_cat_info[1];
1146
+                $post_sub_catid = (int) $post_cat_info[1];
1147 1147
             }
1148 1148
 
1149 1149
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
         if (!$selected)
1176 1176
             $option_slected = ' selected="selected" ';
1177 1177
 
1178
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1178
+        echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >';
1179 1179
 
1180
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1180
+        echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
1181 1181
 
1182 1182
         foreach ($cat_terms as $cat_term) {
1183 1183
             $option_selected = '';
@@ -1185,10 +1185,10 @@  discard block
 block discarded – undo
1185 1185
                 $option_selected = ' selected="selected" ';
1186 1186
 
1187 1187
             // Count child terms
1188
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1189
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1188
+            $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1189
+            $has_child = !empty($child_terms) ? 't' : 'f';
1190 1190
 
1191
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1191
+            echo '<option  '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.ucfirst($cat_term->name).'</option>';
1192 1192
         }
1193 1193
         echo '</select>';
1194 1194
     }
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
             2 => __('Custom field updated.', 'geodirectory'),
1220 1220
             3 => __('Custom field deleted.', 'geodirectory'),
1221 1221
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1222
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1222
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1223 1223
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1224 1224
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1225 1225
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
     global $wpdb;
1247 1247
 
1248
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1248
+    $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico';
1249 1249
 
1250 1250
     if (!$listing_slug = get_option('geodir_listing_prefix'))
1251 1251
         $listing_slug = 'places';
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 
1259 1259
         $gd_placetags = array();
1260 1260
         $gd_placetags['object_type'] = 'gd_place';
1261
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1261
+        $gd_placetags['listing_slug'] = $listing_slug.'/tags';
1262 1262
         $gd_placetags['args'] = array(
1263 1263
             'public' => true,
1264 1264
             'hierarchical' => false,
1265
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1265
+            'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
1266 1266
             'query_var' => true,
1267 1267
 
1268 1268
             'labels' => array(
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
             'menu_icon' => $menu_icon,
1357 1357
             'public' => true,
1358 1358
             'query_var' => true,
1359
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1359
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1360 1360
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1361 1361
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1362 1362
 
@@ -1378,27 +1378,27 @@  discard block
 block discarded – undo
1378 1378
 }
1379 1379
 
1380 1380
 $gd_wpml_get_languages = "";
1381
-function gd_wpml_get_lang_from_url($url){
1381
+function gd_wpml_get_lang_from_url($url) {
1382 1382
 
1383 1383
     global $gd_wpml_get_languages;
1384
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1384
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1385 1385
 
1386 1386
 
1387 1387
     //
1388
-    $url = str_replace(array("http://","https://"),"",$url);
1388
+    $url = str_replace(array("http://", "https://"), "", $url);
1389 1389
 
1390 1390
     // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1391
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1391
+    $site_url = str_replace(array("http://", "https://"), "", site_url());
1392 1392
 
1393
-    $url = str_replace($site_url,"",$url);
1393
+    $url = str_replace($site_url, "", $url);
1394 1394
 
1395 1395
 
1396 1396
     $segments = explode('/', trim($url, '/'));
1397 1397
 
1398 1398
     //print_r( $segments);
1399
-    if($gd_wpml_get_languages){
1399
+    if ($gd_wpml_get_languages) {
1400 1400
         $langs = $gd_wpml_get_languages;
1401
-    }else{
1401
+    } else {
1402 1402
         global $sitepress;
1403 1403
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1404 1404
     }
@@ -1463,17 +1463,17 @@  discard block
 block discarded – undo
1463 1463
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1464 1464
 
1465 1465
         // Alter the CPT slug if WPML is set to do so
1466
-        if(function_exists('icl_object_id')){
1467
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1466
+        if (function_exists('icl_object_id')) {
1467
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1468 1468
 
1469 1469
                 $org_slug = $slug;
1470
-                $slug = apply_filters( 'wpml_translate_single_string',
1470
+                $slug = apply_filters('wpml_translate_single_string',
1471 1471
                     $slug,
1472 1472
                     'WordPress',
1473
-                    'URL slug: ' . $slug,
1473
+                    'URL slug: '.$slug,
1474 1474
                     $language_code);
1475 1475
 
1476
-                if(!$slug){$slug = $org_slug;}
1476
+                if (!$slug) {$slug = $org_slug; }
1477 1477
 
1478 1478
             }
1479 1479
         }
@@ -1495,11 +1495,11 @@  discard block
 block discarded – undo
1495 1495
         }
1496 1496
 
1497 1497
         $post_link = trailingslashit(
1498
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1498
+            preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
1499 1499
         );
1500 1500
 
1501 1501
         if ($fix_url) {
1502
-            $post_link = $site_url . $post_link;
1502
+            $post_link = $site_url.$post_link;
1503 1503
         }
1504 1504
 
1505 1505
         if (isset($comment_post_cache[$post->ID])) {
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
             $ID = $post->ID;
1519 1519
             $post2 = $wpdb->get_row(
1520 1520
                 $wpdb->prepare(
1521
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1521
+                    "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1522 1522
                     array($post->ID)
1523 1523
                 )
1524 1524
             );
1525 1525
 
1526
-            $post = (object)array_merge((array)$post, (array)$post2);
1526
+            $post = (object) array_merge((array) $post, (array) $post2);
1527 1527
 
1528 1528
             $comment_post_cache[$post->ID] = $post;
1529 1529
         }
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1534 1534
 
1535
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1535
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1536 1536
                 $location_request = '';
1537 1537
 
1538 1538
 
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1547 1547
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1548 1548
 
1549
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1549
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1550 1550
                             'region_slug' => $post->region_slug,
1551 1551
                             'city_slug' => $post->city_slug
1552 1552
                         );
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
                     $post_location_sql = $wpdb->get_results(
1561 1561
                         $wpdb->prepare(
1562
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1562
+                            "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ",
1563 1563
                             array($post->ID)
1564 1564
                         )
1565 1565
                     );
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1576 1576
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1577 1577
 
1578
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1578
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1579 1579
                                 'region_slug' => $post->region_slug,
1580 1580
                                 'city_slug' => $post->city_slug
1581 1581
                             );
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 					}
1605 1605
 					$location_slug[] = $city_slug;
1606 1606
 					
1607
-					$location_request .= implode('/', $location_slug) . '/';
1607
+					$location_request .= implode('/', $location_slug).'/';
1608 1608
                 }
1609 1609
             }
1610 1610
 
@@ -1662,9 +1662,9 @@  discard block
 block discarded – undo
1662 1662
             }
1663 1663
             $request_term = trim($request_term, '/');
1664 1664
             if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1665
+                $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1666 1666
             else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1667
+                $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
1668 1668
             //echo $post_link ;
1669 1669
         }
1670 1670
         // temp cache the permalink
@@ -1739,9 +1739,9 @@  discard block
 block discarded – undo
1739 1739
                 $url_separator = '';
1740 1740
 
1741 1741
                 if (get_option('permalink_structure') != '') {
1742
-                    $old_listing_slug = '/' . $listing_slug . '/';
1742
+                    $old_listing_slug = '/'.$listing_slug.'/';
1743 1743
                     $request_term = implode("/", $location_terms);
1744
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1744
+                    $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/';
1745 1745
 
1746 1746
                     $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1747 1747
                 } else {
@@ -1761,25 +1761,25 @@  discard block
 block discarded – undo
1761 1761
         // Alter the CPT slug if WPML is set to do so
1762 1762
         if (function_exists('icl_object_id')) {
1763 1763
             $post_types = get_option('geodir_post_types');
1764
-            $post_type = str_replace("category","",$taxonomy);
1765
-            $post_type = str_replace("_tags","",$post_type);
1764
+            $post_type = str_replace("category", "", $taxonomy);
1765
+            $post_type = str_replace("_tags", "", $post_type);
1766 1766
             $slug = $post_types[$post_type]['rewrite']['slug'];
1767 1767
             if (gd_wpml_slug_translation_turned_on($post_type)) {
1768 1768
                 global $sitepress;
1769 1769
                 $default_lang = $sitepress->get_default_language();
1770 1770
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1771
-                if (!$language_code ) {
1772
-                    $language_code  = $default_lang;
1771
+                if (!$language_code) {
1772
+                    $language_code = $default_lang;
1773 1773
                 }
1774 1774
 
1775 1775
                 $org_slug = $slug;
1776
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1776
+                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code);
1777 1777
 
1778 1778
                 if (!$slug) {
1779 1779
                     $slug = $org_slug;
1780 1780
                 }
1781 1781
 
1782
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1782
+                $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1));
1783 1783
             }
1784 1784
         }
1785 1785
     }
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 	
1810 1810
 	if (in_array($post_type, geodir_get_posttypes())) {
1811 1811
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1812
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1812
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1813 1813
                 $location_terms = array(
1814 1814
                     'gd_country' => $post->country_slug,
1815 1815
                     'gd_region' => $post->region_slug,
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 					$location_terms = implode("/", $location_terms);
1827 1827
 					$location_terms = rtrim($location_terms, '/');
1828 1828
 					
1829
-					$link .= urldecode($location_terms) . '/';
1829
+					$link .= urldecode($location_terms).'/';
1830 1830
 				} else {
1831 1831
 					$link = geodir_getlink($link, $location_terms);
1832 1832
 				}
@@ -1908,9 +1908,9 @@  discard block
 block discarded – undo
1908 1908
             return 0;
1909 1909
         $where = 't.term_id = %d';
1910 1910
         if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1911
+            return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912 1912
         else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1913
+            return $wpdb->get_var($wpdb->prepare($select.$where, $term));
1914 1914
     }
1915 1915
 
1916 1916
     $term = trim(wp_unslash($term));
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
 
1923 1923
     $where_fields = array($slug);
1924 1924
     if (!empty($taxonomy)) {
1925
-        $parent = (int)$parent;
1925
+        $parent = (int) $parent;
1926 1926
         if ($parent > 0) {
1927 1927
             $where_fields[] = $parent;
1928 1928
             $else_where_fields[] = $parent;
@@ -1985,13 +1985,13 @@  discard block
 block discarded – undo
1985 1985
         $post_types = geodir_get_posttypes();
1986 1986
         $tax_arr = array();
1987 1987
         foreach ($post_types as $post_type) {
1988
-            $tax_arr[] = "'" . $post_type . "category'";
1988
+            $tax_arr[] = "'".$post_type."category'";
1989 1989
         }
1990 1990
         $tax_c = implode(',', $tax_arr);
1991 1991
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1992 1992
         //$terms = get_terms( $taxonomy );
1993 1993
 
1994
-        if($terms) {
1994
+        if ($terms) {
1995 1995
             foreach ($terms as $term) {
1996 1996
                 $post_type = str_replace("category", "", $term->taxonomy);
1997 1997
                 $a_terms[$post_type][] = $term;
@@ -1999,7 +1999,7 @@  discard block
 block discarded – undo
1999 1999
             }
2000 2000
         }
2001 2001
 
2002
-        if($a_terms) {
2002
+        if ($a_terms) {
2003 2003
             foreach ($a_terms as $pt => $t2) {
2004 2004
 
2005 2005
                 foreach ($t2 as $term) {
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
     }
2025 2025
 
2026 2026
     if (is_ssl()) {
2027
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2027
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
2028 2028
     }
2029 2029
 
2030 2030
     return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
Please login to merge, or discard this patch.
Braces   +167 added lines, -119 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -159,8 +162,9 @@  discard block
 block discarded – undo
159 162
     if (get_option('geodir_show_addlisting_nav')) {
160 163
 
161 164
         $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
165
+        if (geodir_is_page('add-listing')) {
166
+                    $menu_class = 'current-menu-item';
167
+        }
164 168
 
165 169
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166 170
         $post_types = geodir_get_posttypes('object');
@@ -176,8 +180,9 @@  discard block
 block discarded – undo
176 180
                                 if (geodir_get_addlisting_link($post_type)) {
177 181
 
178 182
                                     $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
183
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
184
+                                                                            $menu_class = 'current-menu-item';
185
+                                    }
181 186
                                     /**
182 187
                                      * Filter the menu li class.
183 188
                                      *
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
                                     if (geodir_get_addlisting_link($post_type)) {
262 267
 
263 268
                                         $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
269
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
270
+                                                                                    $menu_class = 'current-menu-item';
271
+                                        }
266 272
                                         /**
267 273
                                          * Filter the menu li class.
268 274
                                          *
@@ -319,8 +325,9 @@  discard block
 block discarded – undo
319 325
     }
320 326
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 327
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
328
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
329
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
330
+    }
324 331
 
325 332
     return $menu;
326 333
 
@@ -406,24 +413,28 @@  discard block
 block discarded – undo
406 413
     $geodir_post_type = get_query_var('post_type');
407 414
 
408 415
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
409
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
410
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
411
-        elseif (isset($_REQUEST['listing_type']))
412
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
416
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
417
+                    $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
418
+        } elseif (isset($_REQUEST['listing_type'])) {
419
+                    $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
420
+        }
413 421
     }
414 422
 
415
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
416
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
423
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
424
+            $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
425
+    }
417 426
 
418
-    if (is_tax())
419
-        $geodir_post_type = geodir_get_taxonomy_posttype();
427
+    if (is_tax()) {
428
+            $geodir_post_type = geodir_get_taxonomy_posttype();
429
+    }
420 430
 
421 431
 
422 432
     $all_postypes = geodir_get_posttypes();
423 433
     $all_postypes = stripslashes_deep($all_postypes);
424 434
 
425
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
426
-        $geodir_post_type = '';
435
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
436
+            $geodir_post_type = '';
437
+    }
427 438
 
428 439
     if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
429 440
         $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
@@ -507,11 +518,12 @@  discard block
 block discarded – undo
507 518
         endswitch;
508 519
     }
509 520
 
510
-    if (!empty($post_types))
511
-        return $post_types;
512
-    else
513
-        return array();
514
-}
521
+    if (!empty($post_types)) {
522
+            return $post_types;
523
+    } else {
524
+            return array();
525
+    }
526
+    }
515 527
 
516 528
 /**
517 529
  * Get Custom Post Type info.
@@ -528,9 +540,10 @@  discard block
 block discarded – undo
528 540
     $post_types = stripslashes_deep($post_types);
529 541
     if (!empty($post_types) && $post_type != '') {
530 542
         return $post_types[$post_type];
531
-    } else
532
-        return false;
533
-}
543
+    } else {
544
+            return false;
545
+    }
546
+    }
534 547
 
535 548
 if (!function_exists('geodir_get_taxonomies')) {
536 549
     /**
@@ -554,18 +567,21 @@  discard block
 block discarded – undo
554 567
             $gd_taxonomies = array_keys($taxonomies);
555 568
 
556 569
 
557
-            if ($post_type != '')
558
-                $gd_taxonomies = array();
570
+            if ($post_type != '') {
571
+                            $gd_taxonomies = array();
572
+            }
559 573
 
560 574
             $i = 0;
561 575
             foreach ($taxonomies as $taxonomy => $args) {
562 576
 
563
-                if ($post_type != '' && $args['object_type'] == $post_type)
564
-                    $gd_taxonomies[] = $taxonomy;
577
+                if ($post_type != '' && $args['object_type'] == $post_type) {
578
+                                    $gd_taxonomies[] = $taxonomy;
579
+                }
565 580
 
566 581
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
567
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
568
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
582
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
583
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
584
+                    }
569 585
                 }
570 586
 
571 587
             }
@@ -620,10 +636,11 @@  discard block
 block discarded – undo
620 636
                 . ucfirst($category_obj->name) . '</option>';
621 637
         }
622 638
 
623
-        if ($echo)
624
-            echo $html;
625
-        else
626
-            return $html;
639
+        if ($echo) {
640
+                    echo $html;
641
+        } else {
642
+                    return $html;
643
+        }
627 644
     }
628 645
 }
629 646
 
@@ -657,11 +674,12 @@  discard block
 block discarded – undo
657 674
 
658 675
     }
659 676
 
660
-    if (!empty($listing_slug))
661
-        return $listing_slug;
662
-    else
663
-        return false;
664
-}
677
+    if (!empty($listing_slug)) {
678
+            return $listing_slug;
679
+    } else {
680
+            return false;
681
+    }
682
+    }
665 683
 
666 684
 
667 685
 /**
@@ -692,16 +710,18 @@  discard block
 block discarded – undo
692 710
     if (!empty($taxonomies)) {
693 711
         foreach (geodir_get_posttypes() as $pt) {
694 712
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
695
-            if (array_intersect($taxonomies, $object_taxonomies))
696
-                $post_type[] = $pt;
713
+            if (array_intersect($taxonomies, $object_taxonomies)) {
714
+                            $post_type[] = $pt;
715
+            }
697 716
         }
698 717
     }
699 718
 
700
-    if (!empty($post_type))
701
-        return $post_type[0];
702
-    else
703
-        return false;
704
-}
719
+    if (!empty($post_type)) {
720
+            return $post_type[0];
721
+    } else {
722
+            return false;
723
+    }
724
+    }
705 725
 
706 726
 if (!function_exists('geodir_custom_taxonomy_walker')) {
707 727
     /**
@@ -757,18 +777,18 @@  discard block
 block discarded – undo
757 777
                 $checked = '';
758 778
 
759 779
                 if (in_array($cat_term->term_id, $search_terms)) {
760
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
761
-                        $checked = 'selected="selected"';
762
-                    else
763
-                        $checked = 'checked="checked"';
780
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
781
+                                            $checked = 'selected="selected"';
782
+                    } else {
783
+                                            $checked = 'checked="checked"';
784
+                    }
764 785
                 }
765 786
 
766
-                if ($cat_display == 'radio')
767
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
768
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
769
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
770
-
771
-                else {
787
+                if ($cat_display == 'radio') {
788
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
789
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
790
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
791
+                } else {
772 792
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
773 793
                 }
774 794
 
@@ -777,8 +797,9 @@  discard block
 block discarded – undo
777 797
 
778 798
             }
779 799
 
780
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
781
-                $out .= '</div>';
800
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
801
+                            $out .= '</div>';
802
+            }
782 803
 
783 804
             return $out;
784 805
         }
@@ -804,18 +825,21 @@  discard block
 block discarded – undo
804 825
         global $exclude_cats, $gd_session;
805 826
 
806 827
         $cat_exclude = '';
807
-        if (is_array($exclude_cats) && !empty($exclude_cats))
808
-            $cat_exclude = serialize($exclude_cats);
828
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
829
+                    $cat_exclude = serialize($exclude_cats);
830
+        }
809 831
 
810 832
         if (isset($_REQUEST['backandedit'])) {
811 833
             $post = (object)$gd_session->get('listing');
812 834
 
813
-            if (!is_array($post->post_category[$cat_taxonomy]))
814
-                $post_category = $post->post_category[$cat_taxonomy];
835
+            if (!is_array($post->post_category[$cat_taxonomy])) {
836
+                            $post_category = $post->post_category[$cat_taxonomy];
837
+            }
815 838
 
816 839
             $post_categories = $post->post_category_str;
817
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
818
-                $post_category_str = $post_categories[$cat_taxonomy];
840
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
841
+                            $post_category_str = $post_categories[$cat_taxonomy];
842
+            }
819 843
 
820 844
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
821 845
             global $post;
@@ -1006,8 +1030,9 @@  discard block
 block discarded – undo
1006 1030
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1007 1031
             $post_cat_str = $post_categories[$cat_taxonomy];
1008 1032
             $post_cat_array = explode("#", $post_cat_str);
1009
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1010
-                $style = "display:none;";
1033
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
1034
+                            $style = "display:none;";
1035
+            }
1011 1036
         }
1012 1037
         ?>
1013 1038
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -1042,7 +1067,7 @@  discard block
 block discarded – undo
1042 1067
 
1043 1068
         if(is_array( $exclude_cats)){
1044 1069
             $exclude_cats = array_map( 'intval', $exclude_cats );
1045
-        }else{
1070
+        } else{
1046 1071
             $exclude_cats = intval($exclude_cats);
1047 1072
         }
1048 1073
 
@@ -1072,7 +1097,10 @@  discard block
 block discarded – undo
1072 1097
 
1073 1098
             <div class="post_default_category">
1074 1099
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1075
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1100
+                       onchange="update_listing_cat()" <?php if ($default) {
1101
+	echo ' checked="checked" ';
1102
+}
1103
+?>   />
1076 1104
         <span> 
1077 1105
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1078 1106
         </span>
@@ -1172,8 +1200,9 @@  discard block
 block discarded – undo
1172 1200
         $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1173 1201
 
1174 1202
         $option_selected = '';
1175
-        if (!$selected)
1176
-            $option_slected = ' selected="selected" ';
1203
+        if (!$selected) {
1204
+                    $option_slected = ' selected="selected" ';
1205
+        }
1177 1206
 
1178 1207
         echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1179 1208
 
@@ -1181,8 +1210,9 @@  discard block
 block discarded – undo
1181 1210
 
1182 1211
         foreach ($cat_terms as $cat_term) {
1183 1212
             $option_selected = '';
1184
-            if ($selected == $cat_term->term_id)
1185
-                $option_selected = ' selected="selected" ';
1213
+            if ($selected == $cat_term->term_id) {
1214
+                            $option_selected = ' selected="selected" ';
1215
+            }
1186 1216
 
1187 1217
             // Count child terms
1188 1218
             $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1247,8 +1277,9 @@  discard block
 block discarded – undo
1247 1277
 
1248 1278
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1249 1279
 
1250
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1251
-        $listing_slug = 'places';
1280
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1281
+            $listing_slug = 'places';
1282
+    }
1252 1283
 
1253 1284
     /**
1254 1285
      * Taxonomies
@@ -1398,7 +1429,7 @@  discard block
 block discarded – undo
1398 1429
     //print_r( $segments);
1399 1430
     if($gd_wpml_get_languages){
1400 1431
         $langs = $gd_wpml_get_languages;
1401
-    }else{
1432
+    } else{
1402 1433
         global $sitepress;
1403 1434
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1404 1435
     }
@@ -1551,8 +1582,9 @@  discard block
 block discarded – undo
1551 1582
                             'city_slug' => $post->city_slug
1552 1583
                         );
1553 1584
 
1554
-                    } else
1555
-                        $post_location = geodir_get_location();
1585
+                    } else {
1586
+                                            $post_location = geodir_get_location();
1587
+                    }
1556 1588
 
1557 1589
 
1558 1590
                 } else {
@@ -1581,8 +1613,9 @@  discard block
 block discarded – undo
1581 1613
                             );
1582 1614
 
1583 1615
                         }
1584
-                    } else
1585
-                        $post_location = geodir_get_location();
1616
+                    } else {
1617
+                                            $post_location = geodir_get_location();
1618
+                    }
1586 1619
                 }
1587 1620
 
1588 1621
 
@@ -1625,8 +1658,9 @@  discard block
 block discarded – undo
1625 1658
                         $post_terms = $post_terms[0];
1626 1659
                     }
1627 1660
 
1628
-                    if (!$post_terms)
1629
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1661
+                    if (!$post_terms) {
1662
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1663
+                    }
1630 1664
 
1631 1665
                     if (!$post_terms) {
1632 1666
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1640,8 +1674,9 @@  discard block
 block discarded – undo
1640 1674
 
1641 1675
                 $term = get_term_by('id', $post_terms, $taxonomies);
1642 1676
 
1643
-                if (!empty($term))
1644
-                    $term_request = $term->slug;
1677
+                if (!empty($term)) {
1678
+                                    $term_request = $term->slug;
1679
+                }
1645 1680
                 //$term_request = $term->slug.'/';
1646 1681
             }
1647 1682
 
@@ -1656,15 +1691,20 @@  discard block
 block discarded – undo
1656 1691
                 $request_term .= $term_request;
1657 1692
 
1658 1693
             } else {
1659
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1694
+                if (isset($location_request) && $location_request != '') {
1695
+                	$request_term = $location_request;
1696
+                }
1660 1697
 
1661
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1698
+                if (isset($term_request) && $term_request != '') {
1699
+                	$request_term .= $term_request;
1700
+                }
1662 1701
             }
1663 1702
             $request_term = trim($request_term, '/');
1664
-            if (!empty($request_term))
1665
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1666
-            else
1667
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1703
+            if (!empty($request_term)) {
1704
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1705
+            } else {
1706
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1707
+            }
1668 1708
             //echo $post_link ;
1669 1709
         }
1670 1710
         // temp cache the permalink
@@ -1852,10 +1892,11 @@  discard block
 block discarded – undo
1852 1892
     if (!is_object($obj_post_type)) {
1853 1893
         return;
1854 1894
     }
1855
-    if ($echo)
1856
-        echo $obj_post_type->labels->singular_name;
1857
-    else
1858
-        return $obj_post_type->labels->singular_name;
1895
+    if ($echo) {
1896
+            echo $obj_post_type->labels->singular_name;
1897
+    } else {
1898
+            return $obj_post_type->labels->singular_name;
1899
+    }
1859 1900
 
1860 1901
 }
1861 1902
 
@@ -1872,14 +1913,16 @@  discard block
 block discarded – undo
1872 1913
 {
1873 1914
     $all_postypes = geodir_get_posttypes();
1874 1915
 
1875
-    if (!in_array($post_type, $all_postypes))
1876
-        return false;
1916
+    if (!in_array($post_type, $all_postypes)) {
1917
+            return false;
1918
+    }
1877 1919
 
1878 1920
     $obj_post_type = get_post_type_object($post_type);
1879
-    if ($echo)
1880
-        echo $obj_post_type->labels->name;
1881
-    else
1882
-        return $obj_post_type->labels->name;
1921
+    if ($echo) {
1922
+            echo $obj_post_type->labels->name;
1923
+    } else {
1924
+            return $obj_post_type->labels->name;
1925
+    }
1883 1926
 
1884 1927
 }
1885 1928
 
@@ -1904,19 +1947,22 @@  discard block
 block discarded – undo
1904 1947
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1905 1948
 
1906 1949
     if (is_int($term)) {
1907
-        if (0 == $term)
1908
-            return 0;
1950
+        if (0 == $term) {
1951
+                    return 0;
1952
+        }
1909 1953
         $where = 't.term_id = %d';
1910
-        if (!empty($taxonomy))
1911
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1912
-        else
1913
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1954
+        if (!empty($taxonomy)) {
1955
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1956
+        } else {
1957
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1958
+        }
1914 1959
     }
1915 1960
 
1916 1961
     $term = trim(wp_unslash($term));
1917 1962
 
1918
-    if ('' === $slug = sanitize_title($term))
1919
-        return 0;
1963
+    if ('' === $slug = sanitize_title($term)) {
1964
+            return 0;
1965
+    }
1920 1966
 
1921 1967
     $where = 't.slug = %s';
1922 1968
 
@@ -1933,14 +1979,16 @@  discard block
 block discarded – undo
1933 1979
         $where_fields[] = $taxonomy;
1934 1980
 
1935 1981
 
1936
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1937
-            return $result;
1982
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1983
+                    return $result;
1984
+        }
1938 1985
 
1939 1986
         return false;
1940 1987
     }
1941 1988
 
1942
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1943
-        return $result;
1989
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1990
+            return $result;
1991
+    }
1944 1992
 
1945 1993
     return false;
1946 1994
 }
Please login to merge, or discard this patch.