Test Failed
Push — master ( 621ef4...7a266a )
by Stiofan
01:07
created
geodirectory-admin/admin_dummy_data_functions.php 3 patches
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://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://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://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://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
 
@@ -220,7 +222,7 @@  discard block
 block discarded – undo
220 222
                  * @package GeoDirectory
221 223
                  */
222 224
                 include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
225
+            } elseif($key=='property_sale'){
224 226
                 /**
225 227
                  * Contains dummy property for sale post content.
226 228
                  *
@@ -228,7 +230,7 @@  discard block
 block discarded – undo
228 230
                  * @package GeoDirectory
229 231
                  */
230 232
                 include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
233
+            } elseif($key=='property_rent'){
232 234
                 /**
233 235
                  * Contains dummy property for sale post content.
234 236
                  *
@@ -337,7 +339,7 @@  discard block
 block discarded – undo
337 339
 
338 340
                     if($post_counts > 0){
339 341
                         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>';
340
-                    }else{
342
+                    } else{
341 343
                         echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342 344
                     }
343 345
 
Please login to merge, or discard this patch.
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -19,151 +19,151 @@  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://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://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 (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
-                        geodir_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://wpgeodirectory.com/dummy/cat_icon';
77
+					if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
+						geodir_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://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 (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
-                    geodir_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 (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
+					geodir_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
-    $data =  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
-
149
-    return apply_filters('geodir_dummy_data_types',$data );
134
+	$data =  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
+
149
+	return apply_filters('geodir_dummy_data_types',$data );
150 150
 }
151 151
 
152 152
 
153 153
 function geodir_create_dummy_fields($fields)
154 154
 {
155 155
     
156
-    /**
157
-     * Filter the array of default custom fields DB table data.
158
-     *
159
-     * @since 1.0.0
160
-     * @param string $fields The default custom fields as an array.
161
-     */
162
-    $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
-    foreach ($fields as $field_index => $field) {
164
-        geodir_custom_field_save($field);
165
-
166
-    }
156
+	/**
157
+	 * Filter the array of default custom fields DB table data.
158
+	 *
159
+	 * @since 1.0.0
160
+	 * @param string $fields The default custom fields as an array.
161
+	 */
162
+	$fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
+	foreach ($fields as $field_index => $field) {
164
+		geodir_custom_field_save($field);
165
+
166
+	}
167 167
 }
168 168
 
169 169
 /**
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_delete_dummy_posts($post_type,$data_type)
178 178
 {
179
-    global $wpdb, $plugin_prefix;
179
+	global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185
-    foreach ($post_ids as $post_ids_obj) {
186
-        wp_delete_post($post_ids_obj->post_id);
187
-    }
185
+	foreach ($post_ids as $post_ids_obj) {
186
+		wp_delete_post($post_ids_obj->post_id);
187
+	}
188 188
 
189
-    //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
189
+	//double check posts are deleted
190
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+	update_option($post_type.'_dummy_data_type','');
193 193
 }
194 194
 
195 195
 /**
@@ -203,78 +203,78 @@  discard block
 block discarded – undo
203 203
 function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
204 204
 {
205 205
 
206
-    @ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
-    $data_types = geodir_dummy_data_types();
208
-
209
-    $total_count = 0;
210
-    global $dummy_post_index;
211
-    $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
214
-            $total_count = $val['count'];
215
-            if($key=='standard_places'){
216
-                /**
217
-                 * Contains dummy post content.
218
-                 *
219
-                 * @since 1.0.0
220
-                 * @package GeoDirectory
221
-                 */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
224
-                /**
225
-                 * Contains dummy property for sale post content.
226
-                 *
227
-                 * @since 1.6.11
228
-                 * @package GeoDirectory
229
-                 */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
232
-                /**
233
-                 * Contains dummy property for sale post content.
234
-                 *
235
-                 * @since 1.6.11
236
-                 * @package GeoDirectory
237
-                 */
238
-                include_once( 'dummy-data/property_rent.php' );
239
-            }
240
-
241
-        }
242
-
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
-    }
245
-
246
-
247
-
248
-    // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
251
-        flush_rewrite_rules();
252
-    }
206
+	@ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
+	$data_types = geodir_dummy_data_types();
208
+
209
+	$total_count = 0;
210
+	global $dummy_post_index;
211
+	$dummy_post_index = $item_index;
212
+	foreach( $data_types as $key=>$val){
213
+		if($key==$data_type){
214
+			$total_count = $val['count'];
215
+			if($key=='standard_places'){
216
+				/**
217
+				 * Contains dummy post content.
218
+				 *
219
+				 * @since 1.0.0
220
+				 * @package GeoDirectory
221
+				 */
222
+				include_once( 'dummy-data/standard_places.php' );
223
+			}elseif($key=='property_sale'){
224
+				/**
225
+				 * Contains dummy property for sale post content.
226
+				 *
227
+				 * @since 1.6.11
228
+				 * @package GeoDirectory
229
+				 */
230
+				include_once( 'dummy-data/property_sale.php' );
231
+			}elseif($key=='property_rent'){
232
+				/**
233
+				 * Contains dummy property for sale post content.
234
+				 *
235
+				 * @since 1.6.11
236
+				 * @package GeoDirectory
237
+				 */
238
+				include_once( 'dummy-data/property_rent.php' );
239
+			}
240
+
241
+		}
242
+
243
+		do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
+	}
245
+
246
+
247
+
248
+	// delete image cache on last entry
249
+	if($total_count == $item_index){
250
+		delete_transient( 'cached_dummy_images' );
251
+		flush_rewrite_rules();
252
+	}
253 253
 
254 254
 
255 255
 }
256 256
 
257 257
 
258 258
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
259
-    /**
260
-     * GeoDirectory dummy data installation.
261
-     *
262
-     * @since 1.0.0
263
-     * @package GeoDirectory
264
-     * @global object $wpdb WordPress Database object.
265
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
266
-     * @param string $post_type The post type.
267
-     */
268
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
-    {
270
-
271
-        global $wpdb, $plugin_prefix;
272
-
273
-        if (!geodir_is_default_location_set()) {
274
-            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>';
275
-        } else {
276
-
277
-            ?>
259
+	/**
260
+	 * GeoDirectory dummy data installation.
261
+	 *
262
+	 * @since 1.0.0
263
+	 * @package GeoDirectory
264
+	 * @global object $wpdb WordPress Database object.
265
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
266
+	 * @param string $post_type The post type.
267
+	 */
268
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
+	{
270
+
271
+		global $wpdb, $plugin_prefix;
272
+
273
+		if (!geodir_is_default_location_set()) {
274
+			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>';
275
+		} else {
276
+
277
+			?>
278 278
             <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
@@ -286,78 +286,78 @@  discard block
 block discarded – undo
286 286
 
287 287
                 <?php
288 288
 
289
-                $cpts = geodir_get_posttypes('array');
289
+				$cpts = geodir_get_posttypes('array');
290 290
 
291
-                $data_types = geodir_dummy_data_types();
291
+				$data_types = geodir_dummy_data_types();
292 292
 
293
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
293
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+				foreach($cpts as $post_type=>$cpt){
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+					$data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
298 298
 
299 299
 
300
-                    $set_dt = get_option($post_type.'_dummy_data_type');
300
+					$set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302
-                    $count = 30;
302
+					$count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+					geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+					$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
307 307
 
308
-                    echo "<tr>";
309
-                    echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
308
+					echo "<tr>";
309
+					echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
310 310
 
311 311
 
312
-                    $select_disabled = $post_counts > 0 ? 'disabled' : '';
313
-                    echo "<td>";
314
-                    echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
312
+					$select_disabled = $post_counts > 0 ? 'disabled' : '';
313
+					echo "<td>";
314
+					echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
319
-                        echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
-                    }
321
-                    echo "</select>";
322
-
323
-                    $select_display = $post_counts > 0 ? 'display:none;' : '';
324
-                    echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
-                    $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
328
-                        echo "<option $selected value='$x'>".$x."</option>";
329
-                        $x++;
330
-                    }
331
-                    echo "</select>";
332
-                    echo "</td>";
316
+					foreach($data_types_for as $key=>$val){
317
+						$selected = ($key==$set_dt) ? "selected='selected'" : '';
318
+						if($selected || count($data_types_for)==1){$count = $val['count'];}
319
+						echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
+					}
321
+					echo "</select>";
333 322
 
323
+					$select_display = $post_counts > 0 ? 'display:none;' : '';
324
+					echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
+					$x = 1;
326
+					while($x <= $count){
327
+						$selected = ($x==$count) ? "selected='selected'" : '';
328
+						echo "<option $selected value='$x'>".$x."</option>";
329
+						$x++;
330
+					}
331
+					echo "</select>";
332
+					echo "</td>";
334 333
 
335 334
 
336 335
 
337 336
 
338
-                    if($post_counts > 0){
339
-                        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>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
-                    }
343 337
 
344
-                    echo "</tr>";
345
-                    //print_r($cpt);
346
-                }
338
+					if($post_counts > 0){
339
+						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>';
340
+					}else{
341
+						echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
+					}
343
+
344
+					echo "</tr>";
345
+					//print_r($cpt);
346
+				}
347 347
 
348
-                ?>
348
+				?>
349 349
                 </tbody>
350 350
             </table>
351 351
             <?php
352 352
 
353 353
 
354
-            $default_location = geodir_get_default_location();
355
-            $city = isset($default_location->city) ? $default_location->city : '';
356
-            $region = isset($default_location->region) ? $default_location->region : '';
357
-            $country = isset($default_location->country) ? $default_location->country : '';
358
-            $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
-            $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
-            ?>
354
+			$default_location = geodir_get_default_location();
355
+			$city = isset($default_location->city) ? $default_location->city : '';
356
+			$region = isset($default_location->region) ? $default_location->region : '';
357
+			$country = isset($default_location->country) ? $default_location->country : '';
358
+			$city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
+			$city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
+			?>
361 361
             <script type="text/javascript">
362 362
 
363 363
                 function geodir_dummy_set_count(data,cpt){
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 }
534 534
             </script>
535 535
             <?php
536
-        }
537
-    }
536
+		}
537
+	}
538 538
 }
539 539
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 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://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://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,23 +130,23 @@  discard block
 block discarded – undo
130 130
 }
131 131
 
132 132
 
133
-function geodir_dummy_data_types(){
134
-    $data =  array(
133
+function geodir_dummy_data_types() {
134
+    $data = 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
     );
148 148
 
149
-    return apply_filters('geodir_dummy_data_types',$data );
149
+    return apply_filters('geodir_dummy_data_types', $data);
150 150
 }
151 151
 
152 152
 
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
  * @global object $wpdb WordPress Database object.
175 175
  * @global string $plugin_prefix Geodirectory plugin table prefix.
176 176
  */
177
-function geodir_delete_dummy_posts($post_type,$data_type)
177
+function geodir_delete_dummy_posts($post_type, $data_type)
178 178
 {
179 179
     global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+    $post_ids = $wpdb->get_results("SELECT post_id FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185 185
     foreach ($post_ids as $post_ids_obj) {
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
190
+    $wpdb->get_results("DELETE FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+    update_option($post_type.'_dummy_data_type', '');
193 193
 }
194 194
 
195 195
 /**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
  * @global object $wpdb WordPress Database object.
201 201
  * @global object $current_user Current user object.
202 202
  */
203
-function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
203
+function geodir_insert_dummy_posts($post_type, $data_type, $item_index)
204 204
 {
205 205
 
206 206
     @ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
@@ -209,45 +209,45 @@  discard block
 block discarded – undo
209 209
     $total_count = 0;
210 210
     global $dummy_post_index;
211 211
     $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
212
+    foreach ($data_types as $key=>$val) {
213
+        if ($key == $data_type) {
214 214
             $total_count = $val['count'];
215
-            if($key=='standard_places'){
215
+            if ($key == 'standard_places') {
216 216
                 /**
217 217
                  * Contains dummy post content.
218 218
                  *
219 219
                  * @since 1.0.0
220 220
                  * @package GeoDirectory
221 221
                  */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
222
+                include_once('dummy-data/standard_places.php');
223
+            }elseif ($key == 'property_sale') {
224 224
                 /**
225 225
                  * Contains dummy property for sale post content.
226 226
                  *
227 227
                  * @since 1.6.11
228 228
                  * @package GeoDirectory
229 229
                  */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
230
+                include_once('dummy-data/property_sale.php');
231
+            }elseif ($key == 'property_rent') {
232 232
                 /**
233 233
                  * Contains dummy property for sale post content.
234 234
                  *
235 235
                  * @since 1.6.11
236 236
                  * @package GeoDirectory
237 237
                  */
238
-                include_once( 'dummy-data/property_rent.php' );
238
+                include_once('dummy-data/property_rent.php');
239 239
             }
240 240
 
241 241
         }
242 242
 
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
243
+        do_action('geodir_insert_dummy_data_loop', $post_type, $data_type, $item_index);
244 244
     }
245 245
 
246 246
 
247 247
 
248 248
     // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
249
+    if ($total_count == $item_index) {
250
+        delete_transient('cached_dummy_images');
251 251
         flush_rewrite_rules();
252 252
     }
253 253
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 }
256 256
 
257 257
 
258
-if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
258
+if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined('GD_TESTING_MODE'))) {
259 259
     /**
260 260
      * GeoDirectory dummy data installation.
261 261
      *
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
         global $wpdb, $plugin_prefix;
272 272
 
273 273
         if (!geodir_is_default_location_set()) {
274
-            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>';
274
+            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>';
275 275
         } else {
276 276
 
277 277
             ?>
278
-            <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
278
+            <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.', 'geodirectory'); ?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
281 281
                 <tr>
282
-                    <td><strong><?php _e('CPT','geodirectory');?></strong></td>
283
-                    <td><strong><?php _e('Data Type','geodirectory');?></strong></td>
284
-                    <td><strong><?php _e('Action','geodirectory');?></strong></td>
282
+                    <td><strong><?php _e('CPT', 'geodirectory'); ?></strong></td>
283
+                    <td><strong><?php _e('Data Type', 'geodirectory'); ?></strong></td>
284
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
285 285
                 </tr>
286 286
 
287 287
                 <?php
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 
293 293
                 $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+                foreach ($cpts as $post_type=>$cpt) {
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+                    $data_types_for = apply_filters('geodir_dummy_date_types_for', $data_types, $post_type);
298 298
 
299 299
 
300 300
                     $set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302 302
                     $count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+                    geodir_add_column_if_not_exist($plugin_prefix.$post_type."_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM ".$plugin_prefix.$post_type."_detail WHERE post_dummy='1'");
307 307
 
308 308
                     echo "<tr>";
309 309
                     echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
                     echo "<td>";
314 314
                     echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
316
+                    foreach ($data_types_for as $key=>$val) {
317
+                        $selected = ($key == $set_dt) ? "selected='selected'" : '';
318
+                        if ($selected || count($data_types_for) == 1) {$count = $val['count']; }
319 319
                         echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320 320
                     }
321 321
                     echo "</select>";
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
                     $select_display = $post_counts > 0 ? 'display:none;' : '';
324 324
                     echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325 325
                     $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
326
+                    while ($x <= $count) {
327
+                        $selected = ($x == $count) ? "selected='selected'" : '';
328 328
                         echo "<option $selected value='$x'>".$x."</option>";
329 329
                         $x++;
330 330
                     }
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 
336 336
 
337 337
 
338
-                    if($post_counts > 0){
339
-                        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>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
338
+                    if ($post_counts > 0) {
339
+                        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>';
340
+                    } else {
341
+                        echo '<td><input type="button" value="'.__('Insert data', 'geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\''.$nonce.'\',\''.$post_type.'\'); return false;" ></td>';
342 342
                     }
343 343
 
344 344
                     echo "</tr>";
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
                 }
376 376
 
377
-                var CITY_ADDRESS = '<?php echo addslashes( $city . ',' . $region . ',' . $country );?>';
377
+                var CITY_ADDRESS = '<?php echo addslashes($city.','.$region.','.$country); ?>';
378 378
                 var bound_lat_lng;
379 379
                 var latlng = ['<?php echo $city_latitude; ?>', <?php echo $city_longitude; ?>];
380 380
                 var lat = <?php echo $city_latitude; ?>;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                                         return x.replace(" ", '');
408 408
                                     }); // remove spaces from lat/lon
409 409
                                 } else {
410
-                                    alert("<?php _e( 'Geocode was not successful for the following reason:', 'geodirectory' );?> " + status);
410
+                                    alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
411 411
                                 }
412 412
                             });
413 413
                     } else if (window.gdMaps == 'osm') {
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 var dummy_post_index = 1;
432 432
 
433 433
                 function gdRemoveDummyData(obj, nonce, posttype){
434
-                    if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
434
+                    if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
435 435
                         jQuery(obj).prop('disabled', true);
436 436
                         jQuery('.gd-dummy-data-results-' + posttype).remove();
437 437
                         jQuery('<tr class="gd-dummy-data-results gd-dummy-data-results-' + posttype + '" >'+
@@ -446,14 +446,14 @@  discard block
 block discarded – undo
446 446
 
447 447
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
448 448
 
449
-                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation'));?>');
449
+                        gd_progressbar('.gd_progressbar_container_'+posttype, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Removing data...', 'geodirlocation')); ?>');
450 450
 
451 451
 
452 452
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=geodir_dummy_delete&posttype=' + posttype + '&_wpnonce=' + nonce,
453 453
                             function (data) {
454
-                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
454
+                                gd_progressbar('.gd_progressbar_container_'+posttype, 100, '<i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
455 455
                                 jQuery(obj).removeClass('gd-remove-data');
456
-                                jQuery(obj).val('<?php _e('Insert data','geodirectory');?>');
456
+                                jQuery(obj).val('<?php _e('Insert data', 'geodirectory'); ?>');
457 457
                                 jQuery(obj).prop('disabled', false);
458 458
                                 jQuery('#'+posttype+'_data_type_count').show();
459 459
                                 jQuery('#'+posttype+'_data_type').prop('disabled', false);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
                         jQuery('.gd_progressbar_'+posttype).progressbar({value: 0});
498 498
 
499
-                        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'));?>');
499
+                        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')); ?>');
500 500
                     }
501 501
 
502 502
                     if (!(typeof bound_lat_lng == 'object' && bound_lat_lng.length == 4)) {
@@ -516,15 +516,15 @@  discard block
 block discarded – undo
516 516
                             percentage = percentage > 100 ? 100 : percentage;
517 517
 
518 518
 
519
-                            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'));?>');
519
+                            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')); ?>');
520 520
 
521 521
                             gdInstallDummyData(obj, nonce, posttype,insertedCount);
522 522
                         }
523 523
                         else {
524 524
                             percentage = 100;
525
-                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation'));?>');
525
+                            gd_progressbar('.gd_progressbar_container_'+posttype, percentage, percentage + '% ('+insertedCount+' / ' + dateTypeCount + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirlocation')); ?>');
526 526
                             jQuery(obj).addClass('gd-remove-data');
527
-                            jQuery(obj).val('<?php _e('Remove data','geodirectory');?>');
527
+                            jQuery(obj).val('<?php _e('Remove data', 'geodirectory'); ?>');
528 528
                             jQuery(obj).prop('disabled', false);
529 529
 
530 530
                         }
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_predefined.php 3 patches
Indentation   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -17,370 +17,370 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_custom_fields_predefined($post_type=''){
19 19
 
20
-    $custom_fields = array();
21
-
22
-
23
-    // price
24
-    $custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
25
-        'field_type'  =>  'text',
26
-        'class'       =>  'gd-price',
27
-        'icon'        =>  'fa fa-usd',
28
-        'name'        =>  __('Price', 'geodirectory'),
29
-        'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
30
-        'defaults'    => array(
31
-            'data_type'           =>  'FLOAT',
32
-            'decimal_point'       =>  '2',
33
-            'admin_title'         =>  'Price',
34
-            'site_title'          =>  'Price',
35
-            'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
36
-            'htmlvar_name'        =>  'price',
37
-            'is_active'           =>  true,
38
-            'for_admin_use'       =>  false,
39
-            'default_value'       =>  '',
40
-            'show_in' 	      =>  '[detail],[listing]',
41
-            'is_required'         =>  false,
42
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
43
-            'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
44
-            'required_msg'        =>  '',
45
-            'field_icon'          =>  'fa fa-usd',
46
-            'css_class'           =>  '',
47
-            'cat_sort'            =>  true,
48
-            'cat_filter'	      =>  true,
49
-            'extra_fields'        =>  array(
50
-                'is_price'                  =>  1,
51
-                'thousand_separator'        =>  'comma',
52
-                'decimal_separator'         =>  'period',
53
-                'decimal_display'           =>  'if',
54
-                'currency_symbol'           =>  '$',
55
-                'currency_symbol_placement' =>  'left'
56
-            )
57
-        )
58
-    );
59
-
60
-    // property status
61
-    $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
62
-        'field_type'  =>  'select',
63
-        'class'       =>  'gd-property-status',
64
-        'icon'        =>  'fa fa-home',
65
-        'name'        =>  __('Property Status', 'geodirectory'),
66
-        'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
67
-        'defaults'    => array(
68
-            'data_type'           =>  'VARCHAR',
69
-            'admin_title'         =>  'Property Status',
70
-            'site_title'          =>  'Property Status',
71
-            'admin_desc'          =>  'Enter the status of the property.',
72
-            'htmlvar_name'        =>  'property_status',
73
-            'is_active'           =>  true,
74
-            'for_admin_use'       =>  false,
75
-            'default_value'       =>  '',
76
-            'show_in' 	          =>  '[detail],[listing]',
77
-            'is_required'         =>  true,
78
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
79
-            'validation_pattern'  =>  '',
80
-            'validation_msg'      =>  '',
81
-            'required_msg'        =>  '',
82
-            'field_icon'          =>  'fa fa-home',
83
-            'css_class'           =>  '',
84
-            'cat_sort'            =>  true,
85
-            'cat_filter'	      =>  true
86
-        )
87
-    );
88
-
89
-    // property furnishing
90
-    $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
91
-        'field_type'  =>  'select',
92
-        'class'       =>  'gd-property-furnishing',
93
-        'icon'        =>  'fa fa-home',
94
-        'name'        =>  __('Property Furnishing', 'geodirectory'),
95
-        'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
96
-        'defaults'    => array(
97
-            'data_type'           =>  'VARCHAR',
98
-            'admin_title'         =>  'Furnishing',
99
-            'site_title'          =>  'Furnishing',
100
-            'admin_desc'          =>  'Enter the furnishing status of the property.',
101
-            'htmlvar_name'        =>  'property_furnishing',
102
-            'is_active'           =>  true,
103
-            'for_admin_use'       =>  false,
104
-            'default_value'       =>  '',
105
-            'show_in' 	          =>  '[detail],[listing]',
106
-            'is_required'         =>  true,
107
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
108
-            'validation_pattern'  =>  '',
109
-            'validation_msg'      =>  '',
110
-            'required_msg'        =>  '',
111
-            'field_icon'          =>  'fa fa-th-large',
112
-            'css_class'           =>  '',
113
-            'cat_sort'            =>  true,
114
-            'cat_filter'	      =>  true
115
-        )
116
-    );
117
-
118
-    // property type
119
-    $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
120
-        'field_type'  =>  'select',
121
-        'class'       =>  'gd-property-type',
122
-        'icon'        =>  'fa fa-home',
123
-        'name'        =>  __('Property Type', 'geodirectory'),
124
-        'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
125
-        'defaults'    => array(
126
-            'data_type'           =>  'VARCHAR',
127
-            'admin_title'         =>  'Property Type',
128
-            'site_title'          =>  'Property Type',
129
-            'admin_desc'          =>  'Select the property type.',
130
-            'htmlvar_name'        =>  'property_type',
131
-            'is_active'           =>  true,
132
-            'for_admin_use'       =>  false,
133
-            'default_value'       =>  '',
134
-            'show_in' 	          =>  '[detail],[listing]',
135
-            'is_required'         =>  true,
136
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
137
-            'validation_pattern'  =>  '',
138
-            'validation_msg'      =>  '',
139
-            'required_msg'        =>  '',
140
-            'field_icon'          =>  'fa fa-home',
141
-            'css_class'           =>  '',
142
-            'cat_sort'            =>  true,
143
-            'cat_filter'	      =>  true
144
-        )
145
-    );
146
-
147
-    // property bedrooms
148
-    $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
149
-        'field_type'  =>  'select',
150
-        'class'       =>  'gd-property-bedrooms',
151
-        'icon'        =>  'fa fa-home',
152
-        'name'        =>  __('Property Bedrooms', 'geodirectory'),
153
-        'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
154
-        'defaults'    => array(
155
-            'data_type'           =>  'VARCHAR',
156
-            'admin_title'         =>  'Property Bedrooms',
157
-            'site_title'          =>  'Bedrooms',
158
-            'admin_desc'          =>  'Select the number of bedrooms',
159
-            'htmlvar_name'        =>  'property_bedrooms',
160
-            'is_active'           =>  true,
161
-            'for_admin_use'       =>  false,
162
-            'default_value'       =>  '',
163
-            'show_in' 	          =>  '[detail],[listing]',
164
-            'is_required'         =>  true,
165
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
166
-            'validation_pattern'  =>  '',
167
-            'validation_msg'      =>  '',
168
-            'required_msg'        =>  '',
169
-            'field_icon'          =>  'fa fa-bed',
170
-            'css_class'           =>  '',
171
-            'cat_sort'            =>  true,
172
-            'cat_filter'	      =>  true
173
-        )
174
-    );
175
-
176
-    // property bathrooms
177
-    $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
178
-        'field_type'  =>  'select',
179
-        'class'       =>  'gd-property-bathrooms',
180
-        'icon'        =>  'fa fa-home',
181
-        'name'        =>  __('Property Bathrooms', 'geodirectory'),
182
-        'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
183
-        'defaults'    => array(
184
-            'data_type'           =>  'VARCHAR',
185
-            'admin_title'         =>  'Property Bathrooms',
186
-            'site_title'          =>  'Bathrooms',
187
-            'admin_desc'          =>  'Select the number of bathrooms',
188
-            'htmlvar_name'        =>  'property_bathrooms',
189
-            'is_active'           =>  true,
190
-            'for_admin_use'       =>  false,
191
-            'default_value'       =>  '',
192
-            'show_in' 	          =>  '[detail],[listing]',
193
-            'is_required'         =>  true,
194
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
195
-            'validation_pattern'  =>  '',
196
-            'validation_msg'      =>  '',
197
-            'required_msg'        =>  '',
198
-            'field_icon'          =>  'fa fa-bold',
199
-            'css_class'           =>  '',
200
-            'cat_sort'            =>  true,
201
-            'cat_filter'	      =>  true
202
-        )
203
-    );
204
-
205
-    // property area
206
-    $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
207
-        'field_type'  =>  'text',
208
-        'class'       =>  'gd-area',
209
-        'icon'        =>  'fa fa-home',
210
-        'name'        =>  __('Property Area', 'geodirectory'),
211
-        'description' =>  __('Adds a input for the property area.', 'geodirectory'),
212
-        'defaults'    => array(
213
-            'data_type'           =>  'FLOAT',
214
-            'admin_title'         =>  'Property Area',
215
-            'site_title'          =>  'Area (Sq Ft)',
216
-            'admin_desc'          =>  'Enter the Sq Ft value for the property',
217
-            'htmlvar_name'        =>  'property_area',
218
-            'is_active'           =>  true,
219
-            'for_admin_use'       =>  false,
220
-            'default_value'       =>  '',
221
-            'show_in' 	      =>  '[detail],[listing]',
222
-            'is_required'         =>  false,
223
-            'validation_pattern'  =>  '\d+(\.\d{2})?',
224
-            'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
225
-            'required_msg'        =>  '',
226
-            'field_icon'          =>  'fa fa-area-chart',
227
-            'css_class'           =>  '',
228
-            'cat_sort'            =>  true,
229
-            'cat_filter'	      =>  true
230
-        )
231
-    );
232
-
233
-    // property features
234
-    $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
235
-        'field_type'  =>  'multiselect',
236
-        'class'       =>  'gd-property-features',
237
-        'icon'        =>  'fa fa-home',
238
-        'name'        =>  __('Property Features', 'geodirectory'),
239
-        'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
240
-        'defaults'    => array(
241
-            'data_type'           =>  'VARCHAR',
242
-            'admin_title'         =>  'Property Features',
243
-            'site_title'          =>  'Features',
244
-            'admin_desc'          =>  'Select the property features.',
245
-            'htmlvar_name'        =>  'property_features',
246
-            'is_active'           =>  true,
247
-            'for_admin_use'       =>  false,
248
-            'default_value'       =>  '',
249
-            'show_in' 	          =>  '[detail],[listing]',
250
-            'is_required'         =>  true,
251
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
252
-            'validation_pattern'  =>  '',
253
-            'validation_msg'      =>  '',
254
-            'required_msg'        =>  '',
255
-            'field_icon'          =>  'fa fa-plus-square',
256
-            'css_class'           =>  '',
257
-            'cat_sort'            =>  true,
258
-            'cat_filter'	      =>  true
259
-        )
260
-    );
261
-
262
-    // Twitter feed
263
-    $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
264
-        'field_type'  =>  'text',
265
-        'class'       =>  'gd-twitter',
266
-        'icon'        =>  'fa fa-twitter',
267
-        'name'        =>  __('Twitter feed', 'geodirectory'),
268
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
269
-        'defaults'    => array(
270
-            'data_type'           =>  'VARCHAR',
271
-            'admin_title'         =>  'Twitter',
272
-            'site_title'          =>  'Twitter',
273
-            'admin_desc'          =>  'Enter your Twitter username',
274
-            'htmlvar_name'        =>  'twitterusername',
275
-            'is_active'           =>  true,
276
-            'for_admin_use'       =>  false,
277
-            'default_value'       =>  '',
278
-            'show_in' 	      =>  '[detail],[owntab]',
279
-            'is_required'         =>  false,
280
-            'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
281
-            'validation_msg'      =>  'Please enter a valid twitter username.',
282
-            'required_msg'        =>  '',
283
-            'field_icon'          =>  'fa fa-twitter',
284
-            'css_class'           =>  '',
285
-            'cat_sort'            =>  false,
286
-            'cat_filter'	      =>  false
287
-        )
288
-    );
289
-
290
-    // Get directions link
291
-    $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
292
-        'field_type'  =>  'text',
293
-        'class'       =>  'gd-get-directions',
294
-        'icon'        =>  'fa fa-location-arrow',
295
-        'name'        =>  __('Get Directions Link', 'geodirectory'),
296
-        'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
297
-        'defaults'    => array(
298
-            'data_type'           =>  'VARCHAR',
299
-            'admin_title'         =>  'Get Directions',
300
-            'site_title'          =>  'Get Directions',
301
-            'admin_desc'          =>  '',
302
-            'htmlvar_name'        =>  'get_directions',
303
-            'is_active'           =>  true,
304
-            'for_admin_use'       =>  true,
305
-            'default_value'       =>  'Get Directions',
306
-            'show_in' 	      =>  '[detail],[listing]',
307
-            'is_required'         =>  false,
308
-            'validation_pattern'  =>  '',
309
-            'validation_msg'      =>  '',
310
-            'required_msg'        =>  '',
311
-            'field_icon'          =>  'fa fa-location-arrow',
312
-            'css_class'           =>  '',
313
-            'cat_sort'            =>  false,
314
-            'cat_filter'	      =>  false
315
-        )
316
-    );
317
-
318
-
319
-    // JOB TYPE CF
320
-
321
-    // job type
322
-    $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces.
323
-        'field_type'  =>  'select',
324
-        'class'       =>  'gd-job-type',
325
-        'icon'        =>  'fa fa-briefcase',
326
-        'name'        =>  __('Job Type', 'geodirectory'),
327
-        'description' =>  __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'),
328
-        'defaults'    => array(
329
-            'data_type'           =>  'VARCHAR',
330
-            'admin_title'         =>  __('Job Type', 'geodirectory'),
331
-            'site_title'          =>  __('Job Type','geodirectory'),
332
-            'admin_desc'          =>  __('Select the type of job.','geodirectory'),
333
-            'htmlvar_name'        =>  'job_type',
334
-            'is_active'           =>  true,
335
-            'for_admin_use'       =>  false,
336
-            'default_value'       =>  '',
337
-            'show_in' 	          =>  '[detail],[listing]',
338
-            'is_required'         =>  true,
339
-            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
340
-            'validation_pattern'  =>  '',
341
-            'validation_msg'      =>  '',
342
-            'required_msg'        =>  '',
343
-            'field_icon'          =>  'fa fa-briefcase',
344
-            'css_class'           =>  '',
345
-            'cat_sort'            =>  true,
346
-            'cat_filter'	      =>  true
347
-        )
348
-    );
349
-
350
-    // job sector
351
-    $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces.
352
-        'field_type'  =>  'select',
353
-        'class'       =>  'gd-job-type',
354
-        'icon'        =>  'fa fa-briefcase',
355
-        'name'        =>  __('Job Sector', 'geodirectory'),
356
-        'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357
-        'defaults'    => array(
358
-            'data_type'           =>  'VARCHAR',
359
-            'admin_title'         =>  __('Job Sector','geodirectory'),
360
-            'site_title'          =>  __('Job Sector','geodirectory'),
361
-            'admin_desc'          =>  __('Select the job sector.','geodirectory'),
362
-            'htmlvar_name'        =>  'job_sector',
363
-            'is_active'           =>  true,
364
-            'for_admin_use'       =>  false,
365
-            'default_value'       =>  '',
366
-            'show_in' 	          =>  '[detail]',
367
-            'is_required'         =>  true,
368
-            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
369
-            'validation_pattern'  =>  '',
370
-            'validation_msg'      =>  '',
371
-            'required_msg'        =>  '',
372
-            'field_icon'          =>  'fa fa-briefcase',
373
-            'css_class'           =>  '',
374
-            'cat_sort'            =>  true,
375
-            'cat_filter'	      =>  true
376
-        )
377
-    );
378
-
379
-
380
-    /**
381
-     * @see `geodir_custom_fields`
382
-     */
383
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
20
+	$custom_fields = array();
21
+
22
+
23
+	// price
24
+	$custom_fields['price'] = array( // The key value should be unique and not contain any spaces.
25
+		'field_type'  =>  'text',
26
+		'class'       =>  'gd-price',
27
+		'icon'        =>  'fa fa-usd',
28
+		'name'        =>  __('Price', 'geodirectory'),
29
+		'description' =>  __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'),
30
+		'defaults'    => array(
31
+			'data_type'           =>  'FLOAT',
32
+			'decimal_point'       =>  '2',
33
+			'admin_title'         =>  'Price',
34
+			'site_title'          =>  'Price',
35
+			'admin_desc'          =>  'Enter the price in $ (no currency symbol)',
36
+			'htmlvar_name'        =>  'price',
37
+			'is_active'           =>  true,
38
+			'for_admin_use'       =>  false,
39
+			'default_value'       =>  '',
40
+			'show_in' 	      =>  '[detail],[listing]',
41
+			'is_required'         =>  false,
42
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
43
+			'validation_msg'      =>  'Please enter number and decimal only ie: 100.50',
44
+			'required_msg'        =>  '',
45
+			'field_icon'          =>  'fa fa-usd',
46
+			'css_class'           =>  '',
47
+			'cat_sort'            =>  true,
48
+			'cat_filter'	      =>  true,
49
+			'extra_fields'        =>  array(
50
+				'is_price'                  =>  1,
51
+				'thousand_separator'        =>  'comma',
52
+				'decimal_separator'         =>  'period',
53
+				'decimal_display'           =>  'if',
54
+				'currency_symbol'           =>  '$',
55
+				'currency_symbol_placement' =>  'left'
56
+			)
57
+		)
58
+	);
59
+
60
+	// property status
61
+	$custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces.
62
+		'field_type'  =>  'select',
63
+		'class'       =>  'gd-property-status',
64
+		'icon'        =>  'fa fa-home',
65
+		'name'        =>  __('Property Status', 'geodirectory'),
66
+		'description' =>  __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'),
67
+		'defaults'    => array(
68
+			'data_type'           =>  'VARCHAR',
69
+			'admin_title'         =>  'Property Status',
70
+			'site_title'          =>  'Property Status',
71
+			'admin_desc'          =>  'Enter the status of the property.',
72
+			'htmlvar_name'        =>  'property_status',
73
+			'is_active'           =>  true,
74
+			'for_admin_use'       =>  false,
75
+			'default_value'       =>  '',
76
+			'show_in' 	          =>  '[detail],[listing]',
77
+			'is_required'         =>  true,
78
+			'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
79
+			'validation_pattern'  =>  '',
80
+			'validation_msg'      =>  '',
81
+			'required_msg'        =>  '',
82
+			'field_icon'          =>  'fa fa-home',
83
+			'css_class'           =>  '',
84
+			'cat_sort'            =>  true,
85
+			'cat_filter'	      =>  true
86
+		)
87
+	);
88
+
89
+	// property furnishing
90
+	$custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces.
91
+		'field_type'  =>  'select',
92
+		'class'       =>  'gd-property-furnishing',
93
+		'icon'        =>  'fa fa-home',
94
+		'name'        =>  __('Property Furnishing', 'geodirectory'),
95
+		'description' =>  __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'),
96
+		'defaults'    => array(
97
+			'data_type'           =>  'VARCHAR',
98
+			'admin_title'         =>  'Furnishing',
99
+			'site_title'          =>  'Furnishing',
100
+			'admin_desc'          =>  'Enter the furnishing status of the property.',
101
+			'htmlvar_name'        =>  'property_furnishing',
102
+			'is_active'           =>  true,
103
+			'for_admin_use'       =>  false,
104
+			'default_value'       =>  '',
105
+			'show_in' 	          =>  '[detail],[listing]',
106
+			'is_required'         =>  true,
107
+			'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
108
+			'validation_pattern'  =>  '',
109
+			'validation_msg'      =>  '',
110
+			'required_msg'        =>  '',
111
+			'field_icon'          =>  'fa fa-th-large',
112
+			'css_class'           =>  '',
113
+			'cat_sort'            =>  true,
114
+			'cat_filter'	      =>  true
115
+		)
116
+	);
117
+
118
+	// property type
119
+	$custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces.
120
+		'field_type'  =>  'select',
121
+		'class'       =>  'gd-property-type',
122
+		'icon'        =>  'fa fa-home',
123
+		'name'        =>  __('Property Type', 'geodirectory'),
124
+		'description' =>  __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'),
125
+		'defaults'    => array(
126
+			'data_type'           =>  'VARCHAR',
127
+			'admin_title'         =>  'Property Type',
128
+			'site_title'          =>  'Property Type',
129
+			'admin_desc'          =>  'Select the property type.',
130
+			'htmlvar_name'        =>  'property_type',
131
+			'is_active'           =>  true,
132
+			'for_admin_use'       =>  false,
133
+			'default_value'       =>  '',
134
+			'show_in' 	          =>  '[detail],[listing]',
135
+			'is_required'         =>  true,
136
+			'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
137
+			'validation_pattern'  =>  '',
138
+			'validation_msg'      =>  '',
139
+			'required_msg'        =>  '',
140
+			'field_icon'          =>  'fa fa-home',
141
+			'css_class'           =>  '',
142
+			'cat_sort'            =>  true,
143
+			'cat_filter'	      =>  true
144
+		)
145
+	);
146
+
147
+	// property bedrooms
148
+	$custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces.
149
+		'field_type'  =>  'select',
150
+		'class'       =>  'gd-property-bedrooms',
151
+		'icon'        =>  'fa fa-home',
152
+		'name'        =>  __('Property Bedrooms', 'geodirectory'),
153
+		'description' =>  __('Adds a select input for the number of bedrooms.', 'geodirectory'),
154
+		'defaults'    => array(
155
+			'data_type'           =>  'VARCHAR',
156
+			'admin_title'         =>  'Property Bedrooms',
157
+			'site_title'          =>  'Bedrooms',
158
+			'admin_desc'          =>  'Select the number of bedrooms',
159
+			'htmlvar_name'        =>  'property_bedrooms',
160
+			'is_active'           =>  true,
161
+			'for_admin_use'       =>  false,
162
+			'default_value'       =>  '',
163
+			'show_in' 	          =>  '[detail],[listing]',
164
+			'is_required'         =>  true,
165
+			'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
166
+			'validation_pattern'  =>  '',
167
+			'validation_msg'      =>  '',
168
+			'required_msg'        =>  '',
169
+			'field_icon'          =>  'fa fa-bed',
170
+			'css_class'           =>  '',
171
+			'cat_sort'            =>  true,
172
+			'cat_filter'	      =>  true
173
+		)
174
+	);
175
+
176
+	// property bathrooms
177
+	$custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces.
178
+		'field_type'  =>  'select',
179
+		'class'       =>  'gd-property-bathrooms',
180
+		'icon'        =>  'fa fa-home',
181
+		'name'        =>  __('Property Bathrooms', 'geodirectory'),
182
+		'description' =>  __('Adds a select input for the number of bathrooms.', 'geodirectory'),
183
+		'defaults'    => array(
184
+			'data_type'           =>  'VARCHAR',
185
+			'admin_title'         =>  'Property Bathrooms',
186
+			'site_title'          =>  'Bathrooms',
187
+			'admin_desc'          =>  'Select the number of bathrooms',
188
+			'htmlvar_name'        =>  'property_bathrooms',
189
+			'is_active'           =>  true,
190
+			'for_admin_use'       =>  false,
191
+			'default_value'       =>  '',
192
+			'show_in' 	          =>  '[detail],[listing]',
193
+			'is_required'         =>  true,
194
+			'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
195
+			'validation_pattern'  =>  '',
196
+			'validation_msg'      =>  '',
197
+			'required_msg'        =>  '',
198
+			'field_icon'          =>  'fa fa-bold',
199
+			'css_class'           =>  '',
200
+			'cat_sort'            =>  true,
201
+			'cat_filter'	      =>  true
202
+		)
203
+	);
204
+
205
+	// property area
206
+	$custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces.
207
+		'field_type'  =>  'text',
208
+		'class'       =>  'gd-area',
209
+		'icon'        =>  'fa fa-home',
210
+		'name'        =>  __('Property Area', 'geodirectory'),
211
+		'description' =>  __('Adds a input for the property area.', 'geodirectory'),
212
+		'defaults'    => array(
213
+			'data_type'           =>  'FLOAT',
214
+			'admin_title'         =>  'Property Area',
215
+			'site_title'          =>  'Area (Sq Ft)',
216
+			'admin_desc'          =>  'Enter the Sq Ft value for the property',
217
+			'htmlvar_name'        =>  'property_area',
218
+			'is_active'           =>  true,
219
+			'for_admin_use'       =>  false,
220
+			'default_value'       =>  '',
221
+			'show_in' 	      =>  '[detail],[listing]',
222
+			'is_required'         =>  false,
223
+			'validation_pattern'  =>  '\d+(\.\d{2})?',
224
+			'validation_msg'      =>  'Please enter the property area in numbers only: 1500',
225
+			'required_msg'        =>  '',
226
+			'field_icon'          =>  'fa fa-area-chart',
227
+			'css_class'           =>  '',
228
+			'cat_sort'            =>  true,
229
+			'cat_filter'	      =>  true
230
+		)
231
+	);
232
+
233
+	// property features
234
+	$custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces.
235
+		'field_type'  =>  'multiselect',
236
+		'class'       =>  'gd-property-features',
237
+		'icon'        =>  'fa fa-home',
238
+		'name'        =>  __('Property Features', 'geodirectory'),
239
+		'description' =>  __('Adds a select input for the property features.', 'geodirectory'),
240
+		'defaults'    => array(
241
+			'data_type'           =>  'VARCHAR',
242
+			'admin_title'         =>  'Property Features',
243
+			'site_title'          =>  'Features',
244
+			'admin_desc'          =>  'Select the property features.',
245
+			'htmlvar_name'        =>  'property_features',
246
+			'is_active'           =>  true,
247
+			'for_admin_use'       =>  false,
248
+			'default_value'       =>  '',
249
+			'show_in' 	          =>  '[detail],[listing]',
250
+			'is_required'         =>  true,
251
+			'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
252
+			'validation_pattern'  =>  '',
253
+			'validation_msg'      =>  '',
254
+			'required_msg'        =>  '',
255
+			'field_icon'          =>  'fa fa-plus-square',
256
+			'css_class'           =>  '',
257
+			'cat_sort'            =>  true,
258
+			'cat_filter'	      =>  true
259
+		)
260
+	);
261
+
262
+	// Twitter feed
263
+	$custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces.
264
+		'field_type'  =>  'text',
265
+		'class'       =>  'gd-twitter',
266
+		'icon'        =>  'fa fa-twitter',
267
+		'name'        =>  __('Twitter feed', 'geodirectory'),
268
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
269
+		'defaults'    => array(
270
+			'data_type'           =>  'VARCHAR',
271
+			'admin_title'         =>  'Twitter',
272
+			'site_title'          =>  'Twitter',
273
+			'admin_desc'          =>  'Enter your Twitter username',
274
+			'htmlvar_name'        =>  'twitterusername',
275
+			'is_active'           =>  true,
276
+			'for_admin_use'       =>  false,
277
+			'default_value'       =>  '',
278
+			'show_in' 	      =>  '[detail],[owntab]',
279
+			'is_required'         =>  false,
280
+			'validation_pattern'  =>  '^[A-Za-z0-9_]{1,32}$',
281
+			'validation_msg'      =>  'Please enter a valid twitter username.',
282
+			'required_msg'        =>  '',
283
+			'field_icon'          =>  'fa fa-twitter',
284
+			'css_class'           =>  '',
285
+			'cat_sort'            =>  false,
286
+			'cat_filter'	      =>  false
287
+		)
288
+	);
289
+
290
+	// Get directions link
291
+	$custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces.
292
+		'field_type'  =>  'text',
293
+		'class'       =>  'gd-get-directions',
294
+		'icon'        =>  'fa fa-location-arrow',
295
+		'name'        =>  __('Get Directions Link', 'geodirectory'),
296
+		'description' =>  __('Adds a input for twitter username and outputs feed.', 'geodirectory'),
297
+		'defaults'    => array(
298
+			'data_type'           =>  'VARCHAR',
299
+			'admin_title'         =>  'Get Directions',
300
+			'site_title'          =>  'Get Directions',
301
+			'admin_desc'          =>  '',
302
+			'htmlvar_name'        =>  'get_directions',
303
+			'is_active'           =>  true,
304
+			'for_admin_use'       =>  true,
305
+			'default_value'       =>  'Get Directions',
306
+			'show_in' 	      =>  '[detail],[listing]',
307
+			'is_required'         =>  false,
308
+			'validation_pattern'  =>  '',
309
+			'validation_msg'      =>  '',
310
+			'required_msg'        =>  '',
311
+			'field_icon'          =>  'fa fa-location-arrow',
312
+			'css_class'           =>  '',
313
+			'cat_sort'            =>  false,
314
+			'cat_filter'	      =>  false
315
+		)
316
+	);
317
+
318
+
319
+	// JOB TYPE CF
320
+
321
+	// job type
322
+	$custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces.
323
+		'field_type'  =>  'select',
324
+		'class'       =>  'gd-job-type',
325
+		'icon'        =>  'fa fa-briefcase',
326
+		'name'        =>  __('Job Type', 'geodirectory'),
327
+		'description' =>  __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'),
328
+		'defaults'    => array(
329
+			'data_type'           =>  'VARCHAR',
330
+			'admin_title'         =>  __('Job Type', 'geodirectory'),
331
+			'site_title'          =>  __('Job Type','geodirectory'),
332
+			'admin_desc'          =>  __('Select the type of job.','geodirectory'),
333
+			'htmlvar_name'        =>  'job_type',
334
+			'is_active'           =>  true,
335
+			'for_admin_use'       =>  false,
336
+			'default_value'       =>  '',
337
+			'show_in' 	          =>  '[detail],[listing]',
338
+			'is_required'         =>  true,
339
+			'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
340
+			'validation_pattern'  =>  '',
341
+			'validation_msg'      =>  '',
342
+			'required_msg'        =>  '',
343
+			'field_icon'          =>  'fa fa-briefcase',
344
+			'css_class'           =>  '',
345
+			'cat_sort'            =>  true,
346
+			'cat_filter'	      =>  true
347
+		)
348
+	);
349
+
350
+	// job sector
351
+	$custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces.
352
+		'field_type'  =>  'select',
353
+		'class'       =>  'gd-job-type',
354
+		'icon'        =>  'fa fa-briefcase',
355
+		'name'        =>  __('Job Sector', 'geodirectory'),
356
+		'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357
+		'defaults'    => array(
358
+			'data_type'           =>  'VARCHAR',
359
+			'admin_title'         =>  __('Job Sector','geodirectory'),
360
+			'site_title'          =>  __('Job Sector','geodirectory'),
361
+			'admin_desc'          =>  __('Select the job sector.','geodirectory'),
362
+			'htmlvar_name'        =>  'job_sector',
363
+			'is_active'           =>  true,
364
+			'for_admin_use'       =>  false,
365
+			'default_value'       =>  '',
366
+			'show_in' 	          =>  '[detail]',
367
+			'is_required'         =>  true,
368
+			'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
369
+			'validation_pattern'  =>  '',
370
+			'validation_msg'      =>  '',
371
+			'required_msg'        =>  '',
372
+			'field_icon'          =>  'fa fa-briefcase',
373
+			'css_class'           =>  '',
374
+			'cat_sort'            =>  true,
375
+			'cat_filter'	      =>  true
376
+		)
377
+	);
378
+
379
+
380
+	/**
381
+	 * @see `geodir_custom_fields`
382
+	 */
383
+	return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
384 384
 }
385 385
 
386 386
 
@@ -395,32 +395,32 @@  discard block
 block discarded – undo
395 395
  * @return string The html to output.
396 396
  */
397 397
 function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
398
-    global $post;
398
+	global $post;
399 399
 
400 400
 
401
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
401
+	if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
402 402
 
403
-        $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
403
+		$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
404 404
 
405
-        $field_icon = geodir_field_icon_proccess($cf);
406
-        if (strpos($field_icon, 'http') !== false) {
407
-            $field_icon_af = '';
408
-        } elseif ($field_icon == '') {
409
-            $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
410
-        } else {
411
-            $field_icon_af = $field_icon;
412
-            $field_icon = '';
413
-        }
405
+		$field_icon = geodir_field_icon_proccess($cf);
406
+		if (strpos($field_icon, 'http') !== false) {
407
+			$field_icon_af = '';
408
+		} elseif ($field_icon == '') {
409
+			$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
410
+		} else {
411
+			$field_icon_af = $field_icon;
412
+			$field_icon = '';
413
+		}
414 414
 
415 415
 
416
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
416
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
417 417
 
418
-        $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
419
-        $html .= '</div>';
418
+		$html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
419
+		$html .= '</div>';
420 420
 
421
-    endif;
421
+	endif;
422 422
 
423
-    return $html;
423
+	return $html;
424 424
 }
425 425
 add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
426 426
 
@@ -435,37 +435,37 @@  discard block
 block discarded – undo
435 435
  * @return string The html to output.
436 436
  */
437 437
 function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
438
-    global $post;
438
+	global $post;
439 439
 
440 440
 
441
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
441
+	if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
442 442
 
443
-        $field_icon = geodir_field_icon_proccess( $cf );
444
-        if ( strpos( $field_icon, 'http' ) !== false ) {
445
-            $field_icon_af = '';
446
-        } elseif ( $field_icon == '' ) {
447
-            $field_icon_af = '<i class="fa fa-location-arrow"></i>';
448
-        } else {
449
-            $field_icon_af = $field_icon;
450
-            $field_icon    = '';
451
-        }
443
+		$field_icon = geodir_field_icon_proccess( $cf );
444
+		if ( strpos( $field_icon, 'http' ) !== false ) {
445
+			$field_icon_af = '';
446
+		} elseif ( $field_icon == '' ) {
447
+			$field_icon_af = '<i class="fa fa-location-arrow"></i>';
448
+		} else {
449
+			$field_icon_af = $field_icon;
450
+			$field_icon    = '';
451
+		}
452 452
 
453
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
453
+		$link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
454 454
 
455
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
455
+		$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
456 456
 
457
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
458
-            $html .= $field_icon_af;
459
-        }
457
+		if(isset( $cf['field_icon'] ) && $cf['field_icon']){
458
+			$html .= $field_icon_af;
459
+		}
460 460
 
461
-        // We use maps.apple.com here because it will handle redirects nicely in most cases
462
-        $html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
463
-        $html .= '</div>';
461
+		// We use maps.apple.com here because it will handle redirects nicely in most cases
462
+		$html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
463
+		$html .= '</div>';
464 464
 
465
-    }else{
466
-        $html ='';
467
-    }
465
+	}else{
466
+		$html ='';
467
+	}
468 468
 
469
-    return $html;
469
+	return $html;
470 470
 }
471 471
 add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package GeoDirectory
16 16
  * @see `geodir_custom_field_save` for array details.
17 17
  */
18
-function geodir_custom_fields_predefined($post_type=''){
18
+function geodir_custom_fields_predefined($post_type = '') {
19 19
 
20 20
     $custom_fields = array();
21 21
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             'default_value'       =>  '',
76 76
             'show_in' 	          =>  '[detail],[listing]',
77 77
             'is_required'         =>  true,
78
-            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'),
78
+            'option_values'       =>  __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'),
79 79
             'validation_pattern'  =>  '',
80 80
             'validation_msg'      =>  '',
81 81
             'required_msg'        =>  '',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'default_value'       =>  '',
105 105
             'show_in' 	          =>  '[detail],[listing]',
106 106
             'is_required'         =>  true,
107
-            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'),
107
+            'option_values'       =>  __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'),
108 108
             'validation_pattern'  =>  '',
109 109
             'validation_msg'      =>  '',
110 110
             'required_msg'        =>  '',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             'default_value'       =>  '',
134 134
             'show_in' 	          =>  '[detail],[listing]',
135 135
             'is_required'         =>  true,
136
-            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'),
136
+            'option_values'       =>  __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'),
137 137
             'validation_pattern'  =>  '',
138 138
             'validation_msg'      =>  '',
139 139
             'required_msg'        =>  '',
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             'default_value'       =>  '',
163 163
             'show_in' 	          =>  '[detail],[listing]',
164 164
             'is_required'         =>  true,
165
-            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
165
+            'option_values'       =>  __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
166 166
             'validation_pattern'  =>  '',
167 167
             'validation_msg'      =>  '',
168 168
             'required_msg'        =>  '',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             'default_value'       =>  '',
192 192
             'show_in' 	          =>  '[detail],[listing]',
193 193
             'is_required'         =>  true,
194
-            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'),
194
+            'option_values'       =>  __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'),
195 195
             'validation_pattern'  =>  '',
196 196
             'validation_msg'      =>  '',
197 197
             'required_msg'        =>  '',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             'default_value'       =>  '',
249 249
             'show_in' 	          =>  '[detail],[listing]',
250 250
             'is_required'         =>  true,
251
-            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'),
251
+            'option_values'       =>  __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'),
252 252
             'validation_pattern'  =>  '',
253 253
             'validation_msg'      =>  '',
254 254
             'required_msg'        =>  '',
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
         'defaults'    => array(
329 329
             'data_type'           =>  'VARCHAR',
330 330
             'admin_title'         =>  __('Job Type', 'geodirectory'),
331
-            'site_title'          =>  __('Job Type','geodirectory'),
332
-            'admin_desc'          =>  __('Select the type of job.','geodirectory'),
331
+            'site_title'          =>  __('Job Type', 'geodirectory'),
332
+            'admin_desc'          =>  __('Select the type of job.', 'geodirectory'),
333 333
             'htmlvar_name'        =>  'job_type',
334 334
             'is_active'           =>  true,
335 335
             'for_admin_use'       =>  false,
336 336
             'default_value'       =>  '',
337 337
             'show_in' 	          =>  '[detail],[listing]',
338 338
             'is_required'         =>  true,
339
-            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'),
339
+            'option_values'       =>  __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other', 'geodirectory'),
340 340
             'validation_pattern'  =>  '',
341 341
             'validation_msg'      =>  '',
342 342
             'required_msg'        =>  '',
@@ -356,16 +356,16 @@  discard block
 block discarded – undo
356 356
         'description' =>  __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'),
357 357
         'defaults'    => array(
358 358
             'data_type'           =>  'VARCHAR',
359
-            'admin_title'         =>  __('Job Sector','geodirectory'),
360
-            'site_title'          =>  __('Job Sector','geodirectory'),
361
-            'admin_desc'          =>  __('Select the job sector.','geodirectory'),
359
+            'admin_title'         =>  __('Job Sector', 'geodirectory'),
360
+            'site_title'          =>  __('Job Sector', 'geodirectory'),
361
+            'admin_desc'          =>  __('Select the job sector.', 'geodirectory'),
362 362
             'htmlvar_name'        =>  'job_sector',
363 363
             'is_active'           =>  true,
364 364
             'for_admin_use'       =>  false,
365 365
             'default_value'       =>  '',
366 366
             'show_in' 	          =>  '[detail]',
367 367
             'is_required'         =>  true,
368
-            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'),
368
+            'option_values'       =>  __('Select Sector/,Private Sector,Public Sector,Agencies', 'geodirectory'),
369 369
             'validation_pattern'  =>  '',
370 370
             'validation_msg'      =>  '',
371 371
             'required_msg'        =>  '',
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     /**
381 381
      * @see `geodir_custom_fields`
382 382
      */
383
-    return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type);
383
+    return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type);
384 384
 }
385 385
 
386 386
 
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
  * @since 1.6.9
395 395
  * @return string The html to output.
396 396
  */
397
-function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){
397
+function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) {
398 398
     global $post;
399 399
 
400 400
 
401
-    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
401
+    if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
402 402
 
403 403
         $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
404 404
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         }
414 414
 
415 415
 
416
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
416
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
417 417
 
418 418
         $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>';
419 419
         $html .= '</div>';
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
     return $html;
424 424
 }
425
-add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3);
425
+add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3);
426 426
 
427 427
 /**
428 428
  * Filter the get_directions custom field output to show a link.
@@ -434,38 +434,38 @@  discard block
 block discarded – undo
434 434
  * @since 1.6.9
435 435
  * @return string The html to output.
436 436
  */
437
-function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) {
437
+function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) {
438 438
     global $post;
439 439
 
440 440
 
441
-    if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){
441
+    if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) {
442 442
 
443
-        $field_icon = geodir_field_icon_proccess( $cf );
444
-        if ( strpos( $field_icon, 'http' ) !== false ) {
443
+        $field_icon = geodir_field_icon_proccess($cf);
444
+        if (strpos($field_icon, 'http') !== false) {
445 445
             $field_icon_af = '';
446
-        } elseif ( $field_icon == '' ) {
446
+        } elseif ($field_icon == '') {
447 447
             $field_icon_af = '<i class="fa fa-location-arrow"></i>';
448 448
         } else {
449 449
             $field_icon_af = $field_icon;
450 450
             $field_icon    = '';
451 451
         }
452 452
 
453
-        $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' );
453
+        $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory');
454 454
 
455
-        $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">';
455
+        $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">';
456 456
 
457
-        if(isset( $cf['field_icon'] ) && $cf['field_icon']){
457
+        if (isset($cf['field_icon']) && $cf['field_icon']) {
458 458
             $html .= $field_icon_af;
459 459
         }
460 460
 
461 461
         // We use maps.apple.com here because it will handle redirects nicely in most cases
462
-        $html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
462
+        $html .= '<a href="https://maps.apple.com/?daddr='.$post->post_latitude.','.$post->post_longitude.'" target="_blank" >'.$link_text.'</a>';
463 463
         $html .= '</div>';
464 464
 
465
-    }else{
466
-        $html ='';
465
+    } else {
466
+        $html = '';
467 467
     }
468 468
 
469 469
     return $html;
470 470
 }
471
-add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3);
471
+add_filter('geodir_custom_field_output_text_key_get_directions', 'geodir_predefined_custom_field_output_get_directions', 10, 3);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -462,7 +462,7 @@
 block discarded – undo
462 462
         $html .= '<a href="https://maps.apple.com/?daddr=' . $post->post_latitude . ',' . $post->post_longitude . '" target="_blank" >' . $link_text . '</a>';
463 463
         $html .= '</div>';
464 464
 
465
-    }else{
465
+    } else{
466 466
         $html ='';
467 467
     }
468 468
 
Please login to merge, or discard this patch.
geodirectory-functions/template_functions.php 4 patches
Braces   +49 added lines, -20 removed lines patch added patch discarded remove patch
@@ -83,14 +83,16 @@  discard block
 block discarded – undo
83 83
             $success_page_id = geodir_success_page_id();
84 84
             if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
85 85
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
86
-            )
87
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
86
+            ) {
87
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
88
+            }
88 89
             return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
89 90
             break;
90 91
         case 'detail':
91 92
         case 'preview':
92
-            if (in_array(get_post_type(), geodir_get_posttypes()))
93
-                $post_type = get_post_type();
93
+            if (in_array(get_post_type(), geodir_get_posttypes())) {
94
+                            $post_type = get_post_type();
95
+            }
94 96
             return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
95 97
             break;
96 98
         case 'listing':
@@ -196,7 +198,9 @@  discard block
 block discarded – undo
196 198
 
197 199
         $template = geodir_locate_template('signup');
198 200
 
199
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
201
+        if (!$template) {
202
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
203
+        }
200 204
 
201 205
         /**
202 206
          * Filter the signup template path.
@@ -214,7 +218,9 @@  discard block
 block discarded – undo
214 218
 
215 219
             $template = geodir_locate_template('information');
216 220
 
217
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
221
+            if (!$template) {
222
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
223
+            }
218 224
             /**
219 225
              * Filter the information template path.
220 226
              *
@@ -248,7 +254,9 @@  discard block
 block discarded – undo
248 254
             if (!$is_current_user_owner) {
249 255
                 $template = geodir_locate_template('information');
250 256
 
251
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
257
+                if (!$template) {
258
+                	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
259
+                }
252 260
                 /**
253 261
                  * Filter the information template path.
254 262
                  *
@@ -270,7 +278,9 @@  discard block
 block discarded – undo
270 278
 
271 279
         $template = geodir_locate_template('add-listing');
272 280
 
273
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
281
+        if (!$template) {
282
+        	$template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
283
+        }
274 284
         /**
275 285
          * Filter the add listing template path.
276 286
          *
@@ -287,7 +297,9 @@  discard block
 block discarded – undo
287 297
 
288 298
         $template = geodir_locate_template('preview');
289 299
 
290
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
300
+        if (!$template) {
301
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
302
+        }
291 303
         /**
292 304
          * Filter the preview template path.
293 305
          *
@@ -303,7 +315,9 @@  discard block
 block discarded – undo
303 315
 
304 316
         $template = geodir_locate_template('success');
305 317
 
306
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
318
+        if (!$template) {
319
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
320
+        }
307 321
         /**
308 322
          * Filter the success template path.
309 323
          *
@@ -318,7 +332,9 @@  discard block
 block discarded – undo
318 332
 
319 333
         $template = geodir_locate_template('detail');
320 334
 
321
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
335
+        if (!$template) {
336
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
337
+        }
322 338
         /**
323 339
          * Filter the detail template path.
324 340
          *
@@ -333,7 +349,9 @@  discard block
 block discarded – undo
333 349
 
334 350
         $template = geodir_locate_template('listing');
335 351
 
336
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
352
+        if (!$template) {
353
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
354
+        }
337 355
         /**
338 356
          * Filter the listing template path.
339 357
          *
@@ -348,7 +366,9 @@  discard block
 block discarded – undo
348 366
 
349 367
         $template = geodir_locate_template('search');
350 368
 
351
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
369
+        if (!$template) {
370
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
371
+        }
352 372
         /**
353 373
          * Filter the search template path.
354 374
          *
@@ -363,7 +383,9 @@  discard block
 block discarded – undo
363 383
 
364 384
         $template = geodir_locate_template('author');
365 385
 
366
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
386
+        if (!$template) {
387
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
388
+        }
367 389
         /**
368 390
          * Filter the author template path.
369 391
          *
@@ -384,7 +406,9 @@  discard block
 block discarded – undo
384 406
 
385 407
             $template = geodir_locate_template('geodir-home');
386 408
 
387
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
409
+            if (!$template) {
410
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
411
+            }
388 412
             /**
389 413
              * Filter the home page template path.
390 414
              *
@@ -397,7 +421,9 @@  discard block
 block discarded – undo
397 421
 
398 422
             $template = geodir_locate_template('location');
399 423
 
400
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
424
+            if (!$template) {
425
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
426
+            }
401 427
             /**
402 428
              * Filter the location template path.
403 429
              *
@@ -406,8 +432,9 @@  discard block
 block discarded – undo
406 432
              */
407 433
             return $template = apply_filters('geodir_template_location', $template);
408 434
 
409
-        } else
410
-            return $template;
435
+        } else {
436
+                    return $template;
437
+        }
411 438
 
412 439
     }
413 440
 
@@ -461,8 +488,10 @@  discard block
 block discarded – undo
461 488
          * @since 1.0.0
462 489
          */
463 490
         include($template);
464
-    else:
465
-        locate_template(array("geodirectory/" . $template_name), true, false);
491
+    else {
492
+    	:
493
+        locate_template(array("geodirectory/" . $template_name), true, false);
494
+    }
466 495
     endif;
467 496
 
468 497
 }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
  * @global object $post The current post object.
418 418
  * @global object $geodirectory Not yet implemented.
419 419
  * @param string $slug The template slug.
420
- * @param null $name The template name.
420
+ * @param string $name The template name.
421 421
  */
422 422
 function geodir_get_template_part($slug = '', $name = NULL)
423 423
 {
@@ -673,6 +673,9 @@  discard block
 block discarded – undo
673 673
 	}
674 674
 }
675 675
 
676
+/**
677
+ * @param string $shortcode
678
+ */
676 679
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
677 680
     if ( empty( $content ) || empty( $shortcode ) ) {
678 681
         return array();
Please login to merge, or discard this patch.
Indentation   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -19,134 +19,134 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_locate_template($template = '')
21 21
 {
22
-    global $post_type, $wp, $post;
23
-    $fields = array();
24
-
25
-    switch ($template):
26
-        case 'signup':
27
-            return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
-            break;
29
-        case 'add-listing':
30
-            $gd_post_types = geodir_get_posttypes();
22
+	global $post_type, $wp, $post;
23
+	$fields = array();
24
+
25
+	switch ($template):
26
+		case 'signup':
27
+			return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
+			break;
29
+		case 'add-listing':
30
+			$gd_post_types = geodir_get_posttypes();
31 31
             
32
-            if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
-                $post_type = '';
34
-            }
32
+			if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
+				$post_type = '';
34
+			}
35 35
             
36
-            $sc_post_type = '';
37
-            if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
-                $listing_page_id = $post->ID;
39
-                if (!empty($shortcode['listing_type'])) {
40
-                    $sc_post_type = $shortcode['listing_type'];
41
-                }
42
-            } else {
43
-                $listing_page_id = geodir_add_listing_page_id();
44
-            }
36
+			$sc_post_type = '';
37
+			if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
+				$listing_page_id = $post->ID;
39
+				if (!empty($shortcode['listing_type'])) {
40
+					$sc_post_type = $shortcode['listing_type'];
41
+				}
42
+			} else {
43
+				$listing_page_id = geodir_add_listing_page_id();
44
+			}
45 45
             
46
-            $is_wpml = geodir_is_wpml() ? true : false;
46
+			$is_wpml = geodir_is_wpml() ? true : false;
47 47
 
48
-            if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
-                && in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
51
-            }
48
+			if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
+				&& in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
51
+			}
52 52
             
53
-            if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
-                $pagename = $wp->query_vars['pagename'];
53
+			if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
+				$pagename = $wp->query_vars['pagename'];
55 55
                 
56
-                if (!empty($gd_post_types)) {
57
-                    $post_type = $gd_post_types[0];
58
-                }
56
+				if (!empty($gd_post_types)) {
57
+					$post_type = $gd_post_types[0];
58
+				}
59 59
                 
60
-                if ($sc_post_type != '') {
61
-                    $post_type = $sc_post_type;
62
-                }
60
+				if ($sc_post_type != '') {
61
+					$post_type = $sc_post_type;
62
+				}
63 63
                 
64
-                if (empty($post_type) && !empty($gd_post_types)) {
65
-                    $post_type = $gd_post_types[0];
66
-                }
64
+				if (empty($post_type) && !empty($gd_post_types)) {
65
+					$post_type = $gd_post_types[0];
66
+				}
67 67
                 
68
-                if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
-                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
-                } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
-                }
73
-                gd_die();
74
-            }
75
-            return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
-            break;
77
-        case 'success':
78
-            $success_page_id = geodir_success_page_id();
79
-            if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
-            )
82
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
83
-            return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
-            break;
85
-        case 'detail':
86
-        case 'preview':
87
-            if (in_array(get_post_type(), geodir_get_posttypes()))
88
-                $post_type = get_post_type();
89
-            return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
-            break;
91
-        case 'listing':
92
-            $templates = array();
93
-            if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
-                $post_type = get_post_type();
95
-                $templates[] = "geodirectory/archive-$post_type.php";
96
-            }
97
-
98
-
99
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
100
-                $query_obj = get_queried_object();
101
-                $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
-                $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
-            }
106
-
107
-            $templates[] = "geodirectory/geodir-listing.php";
108
-
109
-            return $template = locate_template($templates);
110
-            break;
111
-        case 'information':
112
-            return $template = locate_template(array("geodirectory/geodir-information.php"));
113
-            break;
114
-        case 'author':
115
-            return $template = locate_template(array("geodirectory/geodir-author.php"));
116
-            break;
117
-        case 'search':
118
-            return $template = locate_template(array("geodirectory/geodir-search.php"));
119
-            break;
120
-        case 'location':
121
-            return $template = locate_template(array("geodirectory/geodir-location.php"));
122
-            break;
123
-        case 'geodir-home':
124
-            return $template = locate_template(array("geodirectory/geodir-home.php"));
125
-            break;
126
-        case 'listing-listview':
127
-            $template = locate_template(array("geodirectory/listing-listview.php"));
128
-            if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
-            }
131
-            return $template;
132
-            break;
133
-        case 'widget-listing-listview':
134
-            $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
-            if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
-            }
138
-            return $template;
139
-            break;
68
+				if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
+					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
+				} else {
71
+					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
+				}
73
+				gd_die();
74
+			}
75
+			return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
+			break;
77
+		case 'success':
78
+			$success_page_id = geodir_success_page_id();
79
+			if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
+			)
82
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
83
+			return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
+			break;
85
+		case 'detail':
86
+		case 'preview':
87
+			if (in_array(get_post_type(), geodir_get_posttypes()))
88
+				$post_type = get_post_type();
89
+			return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
+			break;
91
+		case 'listing':
92
+			$templates = array();
93
+			if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
+				$post_type = get_post_type();
95
+				$templates[] = "geodirectory/archive-$post_type.php";
96
+			}
97
+
98
+
99
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
100
+				$query_obj = get_queried_object();
101
+				$curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
+				$curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
+			}
106
+
107
+			$templates[] = "geodirectory/geodir-listing.php";
108
+
109
+			return $template = locate_template($templates);
110
+			break;
111
+		case 'information':
112
+			return $template = locate_template(array("geodirectory/geodir-information.php"));
113
+			break;
114
+		case 'author':
115
+			return $template = locate_template(array("geodirectory/geodir-author.php"));
116
+			break;
117
+		case 'search':
118
+			return $template = locate_template(array("geodirectory/geodir-search.php"));
119
+			break;
120
+		case 'location':
121
+			return $template = locate_template(array("geodirectory/geodir-location.php"));
122
+			break;
123
+		case 'geodir-home':
124
+			return $template = locate_template(array("geodirectory/geodir-home.php"));
125
+			break;
126
+		case 'listing-listview':
127
+			$template = locate_template(array("geodirectory/listing-listview.php"));
128
+			if (!$template) {
129
+				$template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
+			}
131
+			return $template;
132
+			break;
133
+		case 'widget-listing-listview':
134
+			$template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
+			if (!$template) {
136
+				$template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
+			}
138
+			return $template;
139
+			break;
140 140
 		case 'email-message':
141
-            $template = locate_template(array("geodirectory/email-message.php"));
142
-            if (!$template) {
143
-                $template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
144
-            }
145
-            return $template;
146
-            break;
147
-    endswitch;
141
+			$template = locate_template(array("geodirectory/email-message.php"));
142
+			if (!$template) {
143
+				$template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
144
+			}
145
+			return $template;
146
+			break;
147
+	endswitch;
148 148
 
149
-    return false;
149
+	return false;
150 150
 
151 151
 }
152 152
 
@@ -165,255 +165,255 @@  discard block
 block discarded – undo
165 165
 function geodir_template_loader($template)
166 166
 {
167 167
 
168
-    global $wp_query;
169
-
170
-    /**
171
-     * Filter the custom page list.
172
-     *
173
-     * @since 1.0.0
174
-     */
175
-    $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
176
-        'geodir_signup_page' =>
177
-            apply_filters('geodir_set_custom_signup_page', false),
178
-        'geodir_add_listing_page' =>
179
-            apply_filters('geodir_set_custom_add_listing_page', false),
180
-        'geodir_preview_page' =>
181
-            apply_filters('geodir_set_custom_preview_page', false),
182
-        'geodir_listing_success_page' =>
183
-            apply_filters('geodir_set_custom_listing_success_page', false),
184
-        'geodir_listing_detail_page' =>
185
-            apply_filters('geodir_set_custom_listing_detail_page', false),
186
-        'geodir_listing_page' =>
187
-            apply_filters('geodir_set_custom_listing_page', false),
188
-        'geodir_search_page' =>
189
-            apply_filters('geodir_set_custom_search_page', false),
190
-        'geodir_author_page' =>
191
-            apply_filters('geodir_set_custom_author_page', false),
192
-        'geodir_home_map_page' =>
193
-            apply_filters('geodir_set_custom_home_map_page', false)
194
-    ));
195
-
196
-
197
-    if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
198
-
199
-        $template = geodir_locate_template('signup');
200
-
201
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
202
-
203
-        /**
204
-         * Filter the signup template path.
205
-         *
206
-         * @since 1.0.0
207
-         * @param string $template The template path.
208
-         */
209
-        return $template = apply_filters('geodir_template_signup', $template);
210
-    }
211
-
212
-    if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213
-        if (!geodir_is_default_location_set()) {
214
-            global $information;
215
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
216
-
217
-            $template = geodir_locate_template('information');
218
-
219
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
220
-            /**
221
-             * Filter the information template path.
222
-             *
223
-             * @since 1.0.0
224
-             * @param string $template The template path.
225
-             */
226
-            return $template = apply_filters('geodir_template_information', $template);
227
-        }
228
-        // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230
-            /// WPML
231
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
232
-                global $sitepress;
168
+	global $wp_query;
169
+
170
+	/**
171
+	 * Filter the custom page list.
172
+	 *
173
+	 * @since 1.0.0
174
+	 */
175
+	$geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
176
+		'geodir_signup_page' =>
177
+			apply_filters('geodir_set_custom_signup_page', false),
178
+		'geodir_add_listing_page' =>
179
+			apply_filters('geodir_set_custom_add_listing_page', false),
180
+		'geodir_preview_page' =>
181
+			apply_filters('geodir_set_custom_preview_page', false),
182
+		'geodir_listing_success_page' =>
183
+			apply_filters('geodir_set_custom_listing_success_page', false),
184
+		'geodir_listing_detail_page' =>
185
+			apply_filters('geodir_set_custom_listing_detail_page', false),
186
+		'geodir_listing_page' =>
187
+			apply_filters('geodir_set_custom_listing_page', false),
188
+		'geodir_search_page' =>
189
+			apply_filters('geodir_set_custom_search_page', false),
190
+		'geodir_author_page' =>
191
+			apply_filters('geodir_set_custom_author_page', false),
192
+		'geodir_home_map_page' =>
193
+			apply_filters('geodir_set_custom_home_map_page', false)
194
+	));
195
+
196
+
197
+	if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
198
+
199
+		$template = geodir_locate_template('signup');
200
+
201
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
202
+
203
+		/**
204
+		 * Filter the signup template path.
205
+		 *
206
+		 * @since 1.0.0
207
+		 * @param string $template The template path.
208
+		 */
209
+		return $template = apply_filters('geodir_template_signup', $template);
210
+	}
211
+
212
+	if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213
+		if (!geodir_is_default_location_set()) {
214
+			global $information;
215
+			$information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
216
+
217
+			$template = geodir_locate_template('information');
218
+
219
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
220
+			/**
221
+			 * Filter the information template path.
222
+			 *
223
+			 * @since 1.0.0
224
+			 * @param string $template The template path.
225
+			 */
226
+			return $template = apply_filters('geodir_template_information', $template);
227
+		}
228
+		// check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230
+			/// WPML
231
+			if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
232
+				global $sitepress;
233 233
                 
234
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
235
-                $sitepress->switch_lang($lang_of_duplicate, true);
234
+				$lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
235
+				$sitepress->switch_lang($lang_of_duplicate, true);
236 236
         
237
-                $redirect_to = get_permalink(geodir_add_listing_page_id());
238
-                $_GET['pid'] = $duplicate_of;
239
-                if (!empty($_GET)) {
240
-                    $redirect_to = add_query_arg($_GET, $redirect_to);
241
-                }
242
-                wp_redirect($redirect_to);
243
-                exit;
244
-            }
245
-            /// WPML
237
+				$redirect_to = get_permalink(geodir_add_listing_page_id());
238
+				$_GET['pid'] = $duplicate_of;
239
+				if (!empty($_GET)) {
240
+					$redirect_to = add_query_arg($_GET, $redirect_to);
241
+				}
242
+				wp_redirect($redirect_to);
243
+				exit;
244
+			}
245
+			/// WPML
246 246
             
247
-            global $information;
248
-            $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
249
-            $is_current_user_owner = geodir_listing_belong_to_current_user();
250
-            if (!$is_current_user_owner) {
251
-                $template = geodir_locate_template('information');
252
-
253
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
254
-                /**
255
-                 * Filter the information template path.
256
-                 *
257
-                 * @since 1.0.0
258
-                 * @param string $template The template path.
259
-                 */
260
-                return $template = apply_filters('geodir_template_information', $template);
261
-            }
247
+			global $information;
248
+			$information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
249
+			$is_current_user_owner = geodir_listing_belong_to_current_user();
250
+			if (!$is_current_user_owner) {
251
+				$template = geodir_locate_template('information');
252
+
253
+				if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
254
+				/**
255
+				 * Filter the information template path.
256
+				 *
257
+				 * @since 1.0.0
258
+				 * @param string $template The template path.
259
+				 */
260
+				return $template = apply_filters('geodir_template_information', $template);
261
+			}
262 262
 
263 263
 
264
-        }
264
+		}
265 265
 
266
-        //geodir_is_login(true);
267
-        global $current_user;
268
-        if (!$current_user->ID) {
269
-            wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
270
-            exit;
271
-        }
266
+		//geodir_is_login(true);
267
+		global $current_user;
268
+		if (!$current_user->ID) {
269
+			wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
270
+			exit;
271
+		}
272 272
 
273
-        $template = geodir_locate_template('add-listing');
274
-
275
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
276
-        /**
277
-         * Filter the add listing template path.
278
-         *
279
-         * @since 1.0.0
280
-         * @param string $template The template path.
281
-         */
282
-        return $template = apply_filters('geodir_template_add_listing', $template);
283
-    }
273
+		$template = geodir_locate_template('add-listing');
284 274
 
275
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
276
+		/**
277
+		 * Filter the add listing template path.
278
+		 *
279
+		 * @since 1.0.0
280
+		 * @param string $template The template path.
281
+		 */
282
+		return $template = apply_filters('geodir_template_add_listing', $template);
283
+	}
285 284
 
286
-    if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
287
-        global $preview;
288
-        $preview = true;
289 285
 
290
-        $template = geodir_locate_template('preview');
286
+	if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
287
+		global $preview;
288
+		$preview = true;
291 289
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
293
-        /**
294
-         * Filter the preview template path.
295
-         *
296
-         * @since 1.0.0
297
-         * @param string $template The template path.
298
-         */
299
-        return $template = apply_filters('geodir_template_preview', $template);
290
+		$template = geodir_locate_template('preview');
300 291
 
301
-    }
292
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
293
+		/**
294
+		 * Filter the preview template path.
295
+		 *
296
+		 * @since 1.0.0
297
+		 * @param string $template The template path.
298
+		 */
299
+		return $template = apply_filters('geodir_template_preview', $template);
302 300
 
301
+	}
303 302
 
304
-    if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
305 303
 
306
-        $template = geodir_locate_template('success');
304
+	if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
307 305
 
308
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
309
-        /**
310
-         * Filter the success template path.
311
-         *
312
-         * @since 1.0.0
313
-         * @param string $template The template path.
314
-         */
315
-        return $template = apply_filters('geodir_template_success', $template);
306
+		$template = geodir_locate_template('success');
316 307
 
317
-    }
308
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
309
+		/**
310
+		 * Filter the success template path.
311
+		 *
312
+		 * @since 1.0.0
313
+		 * @param string $template The template path.
314
+		 */
315
+		return $template = apply_filters('geodir_template_success', $template);
318 316
 
319
-    if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
317
+	}
320 318
 
321
-        $template = geodir_locate_template('detail');
319
+	if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
322 320
 
323
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
324
-        /**
325
-         * Filter the detail template path.
326
-         *
327
-         * @since 1.0.0
328
-         * @param string $template The template path.
329
-         */
330
-        return $template = apply_filters('geodir_template_detail', $template);
321
+		$template = geodir_locate_template('detail');
331 322
 
332
-    }
323
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
324
+		/**
325
+		 * Filter the detail template path.
326
+		 *
327
+		 * @since 1.0.0
328
+		 * @param string $template The template path.
329
+		 */
330
+		return $template = apply_filters('geodir_template_detail', $template);
333 331
 
334
-    if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
332
+	}
335 333
 
336
-        $template = geodir_locate_template('listing');
334
+	if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
337 335
 
338
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
339
-        /**
340
-         * Filter the listing template path.
341
-         *
342
-         * @since 1.0.0
343
-         * @param string $template The template path.
344
-         */
345
-        return $template = apply_filters('geodir_template_listing', $template);
336
+		$template = geodir_locate_template('listing');
346 337
 
347
-    }
338
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
339
+		/**
340
+		 * Filter the listing template path.
341
+		 *
342
+		 * @since 1.0.0
343
+		 * @param string $template The template path.
344
+		 */
345
+		return $template = apply_filters('geodir_template_listing', $template);
348 346
 
349
-    if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
347
+	}
350 348
 
351
-        $template = geodir_locate_template('search');
349
+	if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
352 350
 
353
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
354
-        /**
355
-         * Filter the search template path.
356
-         *
357
-         * @since 1.0.0
358
-         * @param string $template The template path.
359
-         */
360
-        return $template = apply_filters('geodir_template_search', $template);
351
+		$template = geodir_locate_template('search');
361 352
 
362
-    }
353
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
354
+		/**
355
+		 * Filter the search template path.
356
+		 *
357
+		 * @since 1.0.0
358
+		 * @param string $template The template path.
359
+		 */
360
+		return $template = apply_filters('geodir_template_search', $template);
363 361
 
364
-    if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
362
+	}
365 363
 
366
-        $template = geodir_locate_template('author');
364
+	if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
367 365
 
368
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
369
-        /**
370
-         * Filter the author template path.
371
-         *
372
-         * @since 1.0.0
373
-         * @param string $template The template path.
374
-         */
375
-        return $template = apply_filters('geodir_template_author', $template);
366
+		$template = geodir_locate_template('author');
376 367
 
377
-    }
368
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
369
+		/**
370
+		 * Filter the author template path.
371
+		 *
372
+		 * @since 1.0.0
373
+		 * @param string $template The template path.
374
+		 */
375
+		return $template = apply_filters('geodir_template_author', $template);
378 376
 
379
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
377
+	}
380 378
 
381
-        global $post, $wp_query;
379
+	if ( geodir_is_page('home') || geodir_is_page('location')) {
382 380
 
383
-        if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
384
-            || (is_home() && !$wp_query->is_posts_page)
385
-        ) {
381
+		global $post, $wp_query;
386 382
 
387
-            $template = geodir_locate_template('geodir-home');
383
+		if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
384
+			|| (is_home() && !$wp_query->is_posts_page)
385
+		) {
388 386
 
389
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
390
-            /**
391
-             * Filter the home page template path.
392
-             *
393
-             * @since 1.0.0
394
-             * @param string $template The template path.
395
-             */
396
-            return $template = apply_filters('geodir_template_homepage', $template);
387
+			$template = geodir_locate_template('geodir-home');
397 388
 
398
-        } elseif (geodir_is_page('location')) {
389
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
390
+			/**
391
+			 * Filter the home page template path.
392
+			 *
393
+			 * @since 1.0.0
394
+			 * @param string $template The template path.
395
+			 */
396
+			return $template = apply_filters('geodir_template_homepage', $template);
399 397
 
400
-            $template = geodir_locate_template('location');
398
+		} elseif (geodir_is_page('location')) {
401 399
 
402
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
403
-            /**
404
-             * Filter the location template path.
405
-             *
406
-             * @since 1.0.0
407
-             * @param string $template The template path.
408
-             */
409
-            return $template = apply_filters('geodir_template_location', $template);
400
+			$template = geodir_locate_template('location');
410 401
 
411
-        } else
412
-            return $template;
402
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
403
+			/**
404
+			 * Filter the location template path.
405
+			 *
406
+			 * @since 1.0.0
407
+			 * @param string $template The template path.
408
+			 */
409
+			return $template = apply_filters('geodir_template_location', $template);
413 410
 
414
-    }
411
+		} else
412
+			return $template;
415 413
 
416
-    return $template;
414
+	}
415
+
416
+	return $template;
417 417
 }
418 418
 
419 419
 /**
@@ -428,44 +428,44 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function geodir_get_template_part($slug = '', $name = NULL)
430 430
 {
431
-    global $geodirectory, $post;
432
-    /**
433
-     * Called at the start for the geodir_get_template_part() function.
434
-     *
435
-     * Used dynamic hook name: geodir_get_template_part_{$slug}
436
-     *
437
-     * @since 1.0.0
438
-     * @package GeoDirectory
439
-     * @param string $slug The template slug.
440
-     * @param string $name The template name.
441
-     */
442
-    do_action("geodir_get_template_part_{$slug}", $slug, $name);
443
-    $templates = array();
444
-    $name = (string)$name;
445
-    if ('' !== $name) {
446
-        $template_name = "{$slug}-{$name}.php";
447
-
448
-    } else {
449
-        $template_name = "{$slug}.php";
450
-    }
451
-
452
-    if (!locate_template(array("geodirectory/" . $template_name))) :
453
-        /**
454
-         * Filter the template part with slug and name.
455
-         *
456
-         * @since 1.0.0
457
-         * @param string $template_name The template name.
458
-         */
459
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
460
-        /**
461
-         * Includes the template part with slug and name.
462
-         *
463
-         * @since 1.0.0
464
-         */
465
-        include($template);
466
-    else:
467
-        locate_template(array("geodirectory/" . $template_name), true, false);
468
-    endif;
431
+	global $geodirectory, $post;
432
+	/**
433
+	 * Called at the start for the geodir_get_template_part() function.
434
+	 *
435
+	 * Used dynamic hook name: geodir_get_template_part_{$slug}
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @package GeoDirectory
439
+	 * @param string $slug The template slug.
440
+	 * @param string $name The template name.
441
+	 */
442
+	do_action("geodir_get_template_part_{$slug}", $slug, $name);
443
+	$templates = array();
444
+	$name = (string)$name;
445
+	if ('' !== $name) {
446
+		$template_name = "{$slug}-{$name}.php";
447
+
448
+	} else {
449
+		$template_name = "{$slug}.php";
450
+	}
451
+
452
+	if (!locate_template(array("geodirectory/" . $template_name))) :
453
+		/**
454
+		 * Filter the template part with slug and name.
455
+		 *
456
+		 * @since 1.0.0
457
+		 * @param string $template_name The template name.
458
+		 */
459
+		$template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
460
+		/**
461
+		 * Includes the template part with slug and name.
462
+		 *
463
+		 * @since 1.0.0
464
+		 */
465
+		include($template);
466
+	else:
467
+		locate_template(array("geodirectory/" . $template_name), true, false);
468
+	endif;
469 469
 
470 470
 }
471 471
 
@@ -481,23 +481,23 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function geodir_core_post_view_extra_class($class, $all_postypes = '')
483 483
 {
484
-    global $post;
484
+	global $post;
485 485
 
486
-    if (!$all_postypes) {
487
-        $all_postypes = geodir_get_posttypes();
488
-    }
486
+	if (!$all_postypes) {
487
+		$all_postypes = geodir_get_posttypes();
488
+	}
489 489
 
490
-    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
491
-    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
492
-    $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
490
+	$gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
491
+	$gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
492
+	$gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
493 493
 
494
-    if ($gdp_post_id && $gdp_post_type) {
495
-        $append_class = 'gd-post-' . $gdp_post_type;
496
-        $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
498
-    }
494
+	if ($gdp_post_id && $gdp_post_type) {
495
+		$append_class = 'gd-post-' . $gdp_post_type;
496
+		$append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
+		$class = $class != '' ? $class . ' ' . $append_class : $append_class;
498
+	}
499 499
 
500
-    return $class;
500
+	return $class;
501 501
 }
502 502
 
503 503
 /**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
  * @param bool $favorite Listing Optional. Are favorite listings results? Default: false.
512 512
  */
513 513
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
514
-    if ($favorite) {
514
+	if ($favorite) {
515 515
 		$message = __('No favorite listings found which match your selection.', 'geodirectory');
516 516
 	} else {
517 517
 		$message = __('No listings found which match your selection.', 'geodirectory');
@@ -681,42 +681,42 @@  discard block
 block discarded – undo
681 681
 }
682 682
 
683 683
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
684
-    if ( empty( $content ) || empty( $shortcode ) ) {
685
-        return array();
686
-    }
684
+	if ( empty( $content ) || empty( $shortcode ) ) {
685
+		return array();
686
+	}
687 687
     
688
-    if ( false === strpos( $content, '[' ) ) {
689
-        return array();
690
-    }
691
-
692
-    if ( ! has_shortcode( $content, $shortcode ) ) {
693
-        return array();
694
-    }
695
-
696
-    $shortcodes = array();
697
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
-        foreach ( $matches as $match ) {
699
-            if ( $shortcode === $match[2] ) {
700
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
701
-                if ( ! is_array( $shortcode_attrs ) ) {
702
-                    $shortcode_attrs = array();
703
-                }
704
-                $shortcode_attrs['shortcode_tag'] = $shortcode;
705
-                if ( !empty( $match[5] ) ) {
706
-                    $shortcode_attrs['shortcode_content'] = $match[5];
707
-                }
708
-                $shortcodes[] = $shortcode_attrs;
709
-                if ( $first === true ) {
710
-                    break;
711
-                }
712
-            }
713
-        }
714
-        if ( $first === true && !empty( $shortcodes ) ) {
715
-            $shortcodes = $shortcodes[0];
716
-        }
717
-    }
718
-
719
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
688
+	if ( false === strpos( $content, '[' ) ) {
689
+		return array();
690
+	}
691
+
692
+	if ( ! has_shortcode( $content, $shortcode ) ) {
693
+		return array();
694
+	}
695
+
696
+	$shortcodes = array();
697
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
+		foreach ( $matches as $match ) {
699
+			if ( $shortcode === $match[2] ) {
700
+				$shortcode_attrs = shortcode_parse_atts( $match[3] );
701
+				if ( ! is_array( $shortcode_attrs ) ) {
702
+					$shortcode_attrs = array();
703
+				}
704
+				$shortcode_attrs['shortcode_tag'] = $shortcode;
705
+				if ( !empty( $match[5] ) ) {
706
+					$shortcode_attrs['shortcode_content'] = $match[5];
707
+				}
708
+				$shortcodes[] = $shortcode_attrs;
709
+				if ( $first === true ) {
710
+					break;
711
+				}
712
+			}
713
+		}
714
+		if ( $first === true && !empty( $shortcodes ) ) {
715
+			$shortcodes = $shortcodes[0];
716
+		}
717
+	}
718
+
719
+	return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
720 720
 }
721 721
 
722 722
 /**
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69 69
                     wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70 70
                 } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
71
+                    wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type);
72 72
                 }
73 73
                 gd_die();
74 74
             }
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
         case 'listing-listview':
127 127
             $template = locate_template(array("geodirectory/listing-listview.php"));
128 128
             if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
129
+                $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php';
130 130
             }
131 131
             return $template;
132 132
             break;
133 133
         case 'widget-listing-listview':
134 134
             $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135 135
             if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
136
+                $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php';
137 137
             }
138 138
             return $template;
139 139
             break;
140 140
 		case 'email-message':
141 141
             $template = locate_template(array("geodirectory/email-message.php"));
142 142
             if (!$template) {
143
-                $template = geodir_plugin_path() . '/geodirectory-templates/email-message.php';
143
+                $template = geodir_plugin_path().'/geodirectory-templates/email-message.php';
144 144
             }
145 145
             return $template;
146 146
             break;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
         $template = geodir_locate_template('signup');
200 200
 
201
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
201
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php';
202 202
 
203 203
         /**
204 204
          * Filter the signup template path.
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
     if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
213 213
         if (!geodir_is_default_location_set()) {
214 214
             global $information;
215
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
215
+            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>');
216 216
 
217 217
             $template = geodir_locate_template('information');
218 218
 
219
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
219
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
220 220
             /**
221 221
              * Filter the information template path.
222 222
              *
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
         // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
229 229
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
230 230
             /// WPML
231
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
231
+            if (geodir_wpml_is_post_type_translated(get_post_type((int) $_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
232 232
                 global $sitepress;
233 233
                 
234
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
234
+                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of));
235 235
                 $sitepress->switch_lang($lang_of_duplicate, true);
236 236
         
237 237
                 $redirect_to = get_permalink(geodir_add_listing_page_id());
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             if (!$is_current_user_owner) {
251 251
                 $template = geodir_locate_template('information');
252 252
 
253
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
253
+                if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
254 254
                 /**
255 255
                  * Filter the information template path.
256 256
                  *
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $template = geodir_locate_template('add-listing');
274 274
 
275
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
275
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php';
276 276
         /**
277 277
          * Filter the add listing template path.
278 278
          *
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
         $template = geodir_locate_template('preview');
291 291
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
292
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
293 293
         /**
294 294
          * Filter the preview template path.
295 295
          *
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
         $template = geodir_locate_template('success');
307 307
 
308
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
308
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php';
309 309
         /**
310 310
          * Filter the success template path.
311 311
          *
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
         $template = geodir_locate_template('detail');
322 322
 
323
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
323
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
324 324
         /**
325 325
          * Filter the detail template path.
326 326
          *
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
         $template = geodir_locate_template('listing');
337 337
 
338
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
338
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php';
339 339
         /**
340 340
          * Filter the listing template path.
341 341
          *
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
         $template = geodir_locate_template('search');
352 352
 
353
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
353
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php';
354 354
         /**
355 355
          * Filter the search template path.
356 356
          *
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 
366 366
         $template = geodir_locate_template('author');
367 367
 
368
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
368
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php';
369 369
         /**
370 370
          * Filter the author template path.
371 371
          *
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
     }
378 378
 
379
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
379
+    if (geodir_is_page('home') || geodir_is_page('location')) {
380 380
 
381 381
         global $post, $wp_query;
382 382
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
             $template = geodir_locate_template('geodir-home');
388 388
 
389
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
389
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php';
390 390
             /**
391 391
              * Filter the home page template path.
392 392
              *
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
             $template = geodir_locate_template('location');
401 401
 
402
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
402
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php';
403 403
             /**
404 404
              * Filter the location template path.
405 405
              *
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
      */
442 442
     do_action("geodir_get_template_part_{$slug}", $slug, $name);
443 443
     $templates = array();
444
-    $name = (string)$name;
444
+    $name = (string) $name;
445 445
     if ('' !== $name) {
446 446
         $template_name = "{$slug}-{$name}.php";
447 447
 
@@ -449,14 +449,14 @@  discard block
 block discarded – undo
449 449
         $template_name = "{$slug}.php";
450 450
     }
451 451
 
452
-    if (!locate_template(array("geodirectory/" . $template_name))) :
452
+    if (!locate_template(array("geodirectory/".$template_name))) :
453 453
         /**
454 454
          * Filter the template part with slug and name.
455 455
          *
456 456
          * @since 1.0.0
457 457
          * @param string $template_name The template name.
458 458
          */
459
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
459
+        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
460 460
         /**
461 461
          * Includes the template part with slug and name.
462 462
          *
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
          */
465 465
         include($template);
466 466
     else:
467
-        locate_template(array("geodirectory/" . $template_name), true, false);
467
+        locate_template(array("geodirectory/".$template_name), true, false);
468 468
     endif;
469 469
 
470 470
 }
@@ -492,9 +492,9 @@  discard block
 block discarded – undo
492 492
     $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
493 493
 
494 494
     if ($gdp_post_id && $gdp_post_type) {
495
-        $append_class = 'gd-post-' . $gdp_post_type;
495
+        $append_class = 'gd-post-'.$gdp_post_type;
496 496
         $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
497
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
497
+        $class = $class != '' ? $class.' '.$append_class : $append_class;
498 498
     }
499 499
 
500 500
     return $class;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
528 528
 	
529
-	echo '<li class="no-listing">' . $message . '</li>';
529
+	echo '<li class="no-listing">'.$message.'</li>';
530 530
 }
531 531
 
532 532
 /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 function geodir_convert_listing_view_class($columns = '') {
556 556
 	$class = '';
557 557
 	
558
-	switch ((int)$columns) {
558
+	switch ((int) $columns) {
559 559
 		case 1:
560 560
 			$class = '';
561 561
 		break;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		$html .= '<option value=""></option>';
621 621
 		if (!empty($star_texts) && is_array($star_texts)) {
622 622
 			foreach ($star_texts as $i => $text) {
623
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
623
+				$html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>';
624 624
 			}
625 625
 		} else {
626 626
 			$html .= '<option value="1">1</option>';
@@ -649,14 +649,14 @@  discard block
 block discarded – undo
649 649
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
650 650
 	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
651 651
 		$rating = min($rating, $star_count);
652
-		$full_stars = floor( $rating );
653
-		$half_stars = ceil( $rating - $full_stars );
652
+		$full_stars = floor($rating);
653
+		$half_stars = ceil($rating - $full_stars);
654 654
 		$empty_stars = $star_count - $full_stars - $half_stars;
655 655
 		
656 656
 		$html = '<div class="gd-star-rating gd-fa-star-rating">';
657
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
658
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
659
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
657
+		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
658
+		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
659
+		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
660 660
 		$html .= '</div>';
661 661
 	}
662 662
 
@@ -675,48 +675,48 @@  discard block
 block discarded – undo
675 675
 		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
676 676
 		if ($full_color != '#757575') {
677 677
 			echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
678
-			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
678
+			.gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
679 679
 		}
680 680
 	}
681 681
 }
682 682
 
683
-function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
684
-    if ( empty( $content ) || empty( $shortcode ) ) {
683
+function geodir_parse_shortcodes($content, $shortcode, $first = true) {
684
+    if (empty($content) || empty($shortcode)) {
685 685
         return array();
686 686
     }
687 687
     
688
-    if ( false === strpos( $content, '[' ) ) {
688
+    if (false === strpos($content, '[')) {
689 689
         return array();
690 690
     }
691 691
 
692
-    if ( ! has_shortcode( $content, $shortcode ) ) {
692
+    if (!has_shortcode($content, $shortcode)) {
693 693
         return array();
694 694
     }
695 695
 
696 696
     $shortcodes = array();
697
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
698
-        foreach ( $matches as $match ) {
699
-            if ( $shortcode === $match[2] ) {
700
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
701
-                if ( ! is_array( $shortcode_attrs ) ) {
697
+    if (preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER)) {
698
+        foreach ($matches as $match) {
699
+            if ($shortcode === $match[2]) {
700
+                $shortcode_attrs = shortcode_parse_atts($match[3]);
701
+                if (!is_array($shortcode_attrs)) {
702 702
                     $shortcode_attrs = array();
703 703
                 }
704 704
                 $shortcode_attrs['shortcode_tag'] = $shortcode;
705
-                if ( !empty( $match[5] ) ) {
705
+                if (!empty($match[5])) {
706 706
                     $shortcode_attrs['shortcode_content'] = $match[5];
707 707
                 }
708 708
                 $shortcodes[] = $shortcode_attrs;
709
-                if ( $first === true ) {
709
+                if ($first === true) {
710 710
                     break;
711 711
                 }
712 712
             }
713 713
         }
714
-        if ( $first === true && !empty( $shortcodes ) ) {
714
+        if ($first === true && !empty($shortcodes)) {
715 715
             $shortcodes = $shortcodes[0];
716 716
         }
717 717
     }
718 718
 
719
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
719
+    return apply_filters('geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first);
720 720
 }
721 721
 
722 722
 /**
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
  * @param array $email_vars     The email parameters.
731 731
  * @return string Filtered email message.
732 732
  */
733
-function geodir_email_wrap_message( $message, $email_type = '', $email_vars = array() ) {
733
+function geodir_email_wrap_message($message, $email_type = '', $email_vars = array()) {
734 734
 	global $geodir_email_content, $geodir_email_type, $geodir_email_vars;
735 735
 
736 736
 	$geodir_email_content = $message;
737 737
 	$geodir_email_type = $email_type;
738 738
 	$geodir_email_vars = $email_vars;
739 739
 
740
-	$template = apply_filters( "geodir_template_part-email-content", geodir_locate_template( 'email-message' ) );
740
+	$template = apply_filters("geodir_template_part-email-content", geodir_locate_template('email-message'));
741 741
 
742 742
 	ob_start();
743 743
 	/**
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @since 1.6.26
747 747
 	 */
748
-	include( $template );
748
+	include($template);
749 749
 
750 750
 	$content = ob_get_clean();
751 751
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
  * @param string $post_id       The post ID.
771 771
  * @param string $user_id       The user ID.
772 772
  */
773
-function geodir_email_wrap_user_message( $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ) {
773
+function geodir_email_wrap_user_message($message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id) {
774 774
 	$email_vars = array();
775 775
 	$email_vars['message_type'] = $message_type;
776 776
 	$email_vars['fromEmail'] = $fromEmail;
@@ -783,9 +783,9 @@  discard block
 block discarded – undo
783 783
 	$email_vars['post_id'] = $post_id;
784 784
 	$email_vars['user_id'] = $user_id;
785 785
 
786
-	return geodir_email_wrap_message( $message, $message_type, $email_vars );
786
+	return geodir_email_wrap_message($message, $message_type, $email_vars);
787 787
 }
788
-add_filter( 'geodir_sendEmail_message', 'geodir_email_wrap_user_message', 10, 11 );
788
+add_filter('geodir_sendEmail_message', 'geodir_email_wrap_user_message', 10, 11);
789 789
 
790 790
 /**
791 791
  * Filter the admin email message.
@@ -799,13 +799,13 @@  discard block
 block discarded – undo
799 799
  * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
800 800
  * @param string $custom_1     Custom data to be sent.
801 801
  */
802
-function geodir_email_wrap_admin_message( $message, $page_id, $user_id, $message_type, $custom_1 ) {
802
+function geodir_email_wrap_admin_message($message, $page_id, $user_id, $message_type, $custom_1) {
803 803
 	$email_vars = array();
804 804
 	$email_vars['message_type'] = $message_type;
805 805
 	$email_vars['page_id'] = $page_id;
806 806
 	$email_vars['user_id'] = $user_id;
807 807
 	$email_vars['custom_1'] = $custom_1;
808 808
 
809
-	return geodir_email_wrap_message( $message, $message_type, $email_vars );
809
+	return geodir_email_wrap_message($message, $message_type, $email_vars);
810 810
 }
811
-add_filter( 'geodir_adminEmail_message', 'geodir_email_wrap_admin_message', 10, 5 );
812 811
\ No newline at end of file
812
+add_filter('geodir_adminEmail_message', 'geodir_email_wrap_admin_message', 10, 5);
813 813
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_functions.php 3 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                         global $sitepress;
264 264
                         $default_lang = $sitepress->get_default_language();
265 265
                         $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
266
-                    }else{
266
+                    } else{
267 267
                         $term_id = $cat_term->term_id;
268 268
                     }
269 269
                     if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
@@ -291,8 +291,9 @@  discard block
 block discarded – undo
291 291
 
292 292
         return $out;
293 293
     } else {
294
-        if ($cat_parent == 0)
295
-            return _e('No category', 'geodirectory');
294
+        if ($cat_parent == 0) {
295
+                    return _e('No category', 'geodirectory');
296
+        }
296 297
     }
297 298
     return;
298 299
 }
Please login to merge, or discard this patch.
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function  geodir_init_map_jason()
17 17
 {
18
-    global $map_jason;
19
-    $map_jason = array();
18
+	global $map_jason;
19
+	$map_jason = array();
20 20
 }
21 21
 
22 22
 /**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function geodir_init_map_canvas_array()
30 30
 {
31
-    global $map_canvas_arr;
32
-    $map_canvas_arr = array();
31
+	global $map_canvas_arr;
32
+	$map_canvas_arr = array();
33 33
 }
34 34
 
35 35
 
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function create_marker_jason_of_posts($post)
52 52
 {
53
-    global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
53
+	global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes;
54 54
 
55
-    if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array)) {
55
+	if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array)) {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+		if(isset($map_jason[$post->ID])){return null;}
58 58
 
59
-        $srcharr = array("'", "/", "-", '"', '\\');
60
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
59
+		$srcharr = array("'", "/", "-", '"', '\\');
60
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
61 61
 
62
-        $default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID,'default_category');
62
+		$default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID,'default_category');
63 63
 
64
-        $geodir_cat_icons = geodir_get_term_icon();
65
-        $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_category]) ? $geodir_cat_icons[$default_category] : '';
64
+		$geodir_cat_icons = geodir_get_term_icon();
65
+		$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_category]) ? $geodir_cat_icons[$default_category] : '';
66 66
 
67
-        $post_title = $post->post_title;
68
-        $title = str_replace($srcharr, $replarr, $post_title);
67
+		$post_title = $post->post_title;
68
+		$title = str_replace($srcharr, $replarr, $post_title);
69 69
 
70
-        if (is_ssl()) {
71
-            $icon = str_replace("http:","https:",$icon );
72
-        }
70
+		if (is_ssl()) {
71
+			$icon = str_replace("http:","https:",$icon );
72
+		}
73 73
         
74
-        if ($icon != '') {
75
-            $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
74
+		if ($icon != '') {
75
+			$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
76 76
             
77
-            if (isset($gd_marker_sizes[$icon])) {
78
-                $icon_size = $gd_marker_sizes[$icon];
79
-            } else {
80
-                $icon_size = geodir_get_marker_size($icon);
81
-                $gd_marker_sizes[$icon] = $icon_size;
82
-            }               
83
-        } else {
84
-            $icon_size = array('w' => 36, 'h' => 45);
85
-        }
86
-
87
-        $post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID,'post_latitude');
88
-        $post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID,'post_longitude');
89
-
90
-
91
-        $post_json = '{"id":"' . $post->ID
92
-                     . '","t": "' . $title
93
-                     . '","lt": "' . $post_latitude
94
-                     . '","ln": "' . $post_longitude
95
-                     . '","mk_id":"' . $post->ID . '_' . $default_category
96
-                     . '","i":"' . $icon
97
-                     . '","w":"' . $icon_size['w']
98
-                     . '","h":"' . $icon_size['h'] . '"}';
99
-
100
-        /**
101
-         * Filter the json data when creating output for post json marker..
102
-         *
103
-         * @since 1.5.7
104
-         * @param string $post_json JSON representation of the post marker info.
105
-         * @param object $post The post object.
106
-         */
107
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
108
-
109
-        // only assign it if it has a value
110
-        if($post_map_json){
111
-            $map_jason[$post->ID] = $post_map_json;
112
-        }
113
-
114
-    }
77
+			if (isset($gd_marker_sizes[$icon])) {
78
+				$icon_size = $gd_marker_sizes[$icon];
79
+			} else {
80
+				$icon_size = geodir_get_marker_size($icon);
81
+				$gd_marker_sizes[$icon] = $icon_size;
82
+			}               
83
+		} else {
84
+			$icon_size = array('w' => 36, 'h' => 45);
85
+		}
86
+
87
+		$post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID,'post_latitude');
88
+		$post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID,'post_longitude');
89
+
90
+
91
+		$post_json = '{"id":"' . $post->ID
92
+					 . '","t": "' . $title
93
+					 . '","lt": "' . $post_latitude
94
+					 . '","ln": "' . $post_longitude
95
+					 . '","mk_id":"' . $post->ID . '_' . $default_category
96
+					 . '","i":"' . $icon
97
+					 . '","w":"' . $icon_size['w']
98
+					 . '","h":"' . $icon_size['h'] . '"}';
99
+
100
+		/**
101
+		 * Filter the json data when creating output for post json marker..
102
+		 *
103
+		 * @since 1.5.7
104
+		 * @param string $post_json JSON representation of the post marker info.
105
+		 * @param object $post The post object.
106
+		 */
107
+		$post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
108
+
109
+		// only assign it if it has a value
110
+		if($post_map_json){
111
+			$map_jason[$post->ID] = $post_map_json;
112
+		}
113
+
114
+	}
115 115
 }
116 116
 
117 117
 /**
@@ -124,67 +124,67 @@  discard block
 block discarded – undo
124 124
  */
125 125
 function send_marker_jason_to_js()
126 126
 {
127
-    global $map_jason, $map_canvas_arr;
128
-
129
-    if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
130
-        foreach ($map_canvas_arr as $canvas => $jason) {
131
-            if (is_array($map_jason) && !empty($map_jason)) {
132
-
133
-                // on details page only show the main marker on the map
134
-                if(geodir_is_page('detail')){
135
-                    global $post;
136
-                    if(isset($map_jason[$post->ID])){
137
-                        $map_jason = array($map_jason[$post->ID]);
138
-                    }
139
-                }
140
-                $canvas_jason = $canvas . "_jason";
141
-                $map_canvas_arr[$canvas] = array_unique($map_jason);
142
-                unset($cat_content_info);
143
-                $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
144
-                $totalcount = count(array_unique($map_jason));
145
-                if (!empty($cat_content_info)) {
146
-                    $json_content = substr(implode(',', $cat_content_info), 1);
147
-                    $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
148
-                    $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
149
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
150
-                } else {
151
-                    $canvas_jason = '[{"totalcount":"0"}]';
152
-                }
153
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
154
-
155
-                /**
156
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
157
-                 *
158
-                 * You can use this filter to modify map canvas json args.
159
-                 *
160
-                 * @since 1.0.0
161
-                 * @package GeoDirectory
162
-                 * @param string $canvas Map canvas array key.
163
-                 * @param array $map_canvas_jason_args Map canvas args.
164
-                 */
165
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
166
-
167
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
168
-            } else {
169
-                $canvas_jason = '[{"totalcount":"0"}]';
170
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
171
-
172
-                /**
173
-                 * Filter the send_marker_jason_to_js() function map canvas json args.
174
-                 *
175
-                 * You can use this filter to modify map canvas json args.
176
-                 *
177
-                 * @since 1.0.0
178
-                 * @package GeoDirectory
179
-                 * @param string $canvas Map canvas array key.
180
-                 * @param array $map_canvas_jason_args Map canvas args.
181
-                 */
182
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
183
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
184
-            }
185
-        }
186
-
187
-    }
127
+	global $map_jason, $map_canvas_arr;
128
+
129
+	if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
130
+		foreach ($map_canvas_arr as $canvas => $jason) {
131
+			if (is_array($map_jason) && !empty($map_jason)) {
132
+
133
+				// on details page only show the main marker on the map
134
+				if(geodir_is_page('detail')){
135
+					global $post;
136
+					if(isset($map_jason[$post->ID])){
137
+						$map_jason = array($map_jason[$post->ID]);
138
+					}
139
+				}
140
+				$canvas_jason = $canvas . "_jason";
141
+				$map_canvas_arr[$canvas] = array_unique($map_jason);
142
+				unset($cat_content_info);
143
+				$cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
144
+				$totalcount = count(array_unique($map_jason));
145
+				if (!empty($cat_content_info)) {
146
+					$json_content = substr(implode(',', $cat_content_info), 1);
147
+					$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
148
+					$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
149
+					$canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
150
+				} else {
151
+					$canvas_jason = '[{"totalcount":"0"}]';
152
+				}
153
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
154
+
155
+				/**
156
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
157
+				 *
158
+				 * You can use this filter to modify map canvas json args.
159
+				 *
160
+				 * @since 1.0.0
161
+				 * @package GeoDirectory
162
+				 * @param string $canvas Map canvas array key.
163
+				 * @param array $map_canvas_jason_args Map canvas args.
164
+				 */
165
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
166
+
167
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
168
+			} else {
169
+				$canvas_jason = '[{"totalcount":"0"}]';
170
+				$map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
171
+
172
+				/**
173
+				 * Filter the send_marker_jason_to_js() function map canvas json args.
174
+				 *
175
+				 * You can use this filter to modify map canvas json args.
176
+				 *
177
+				 * @since 1.0.0
178
+				 * @package GeoDirectory
179
+				 * @param string $canvas Map canvas array key.
180
+				 * @param array $map_canvas_jason_args Map canvas args.
181
+				 */
182
+				$map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
183
+				wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
184
+			}
185
+		}
186
+
187
+	}
188 188
 }
189 189
 
190 190
 /**
@@ -207,99 +207,99 @@  discard block
 block discarded – undo
207 207
  */
208 208
 function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false)
209 209
 {
210
-    global $cat_count, $geodir_cat_icons, $gd_session;
210
+	global $cat_count, $geodir_cat_icons, $gd_session;
211 211
 
212
-    $exclude_categories = get_option('geodir_exclude_cat_on_map');
213
-    $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
212
+	$exclude_categories = get_option('geodir_exclude_cat_on_map');
213
+	$exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
214 214
 
215
-    // check if exclude categories saved before fix of categories identical names
216
-    if ($exclude_categories_new) {
217
-        $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
218
-        $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
219
-    }
215
+	// check if exclude categories saved before fix of categories identical names
216
+	if ($exclude_categories_new) {
217
+		$gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : '';
218
+		$exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array();
219
+	}
220 220
 
221
-    $exclude_cat_str = implode(',', $exclude_categories);
221
+	$exclude_cat_str = implode(',', $exclude_categories);
222 222
 
223
-    if ($exclude_cat_str == '') {
224
-        $exclude_cat_str = '0';
225
-    }
223
+	if ($exclude_cat_str == '') {
224
+		$exclude_cat_str = '0';
225
+	}
226 226
 
227
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
227
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
228 228
 
229
-    if ($hide_empty) {
230
-        $cat_terms = geodir_filter_empty_terms($cat_terms);
231
-    }
229
+	if ($hide_empty) {
230
+		$cat_terms = geodir_filter_empty_terms($cat_terms);
231
+	}
232 232
 
233
-    $main_list_class = '';
234
-    //If there are terms, start displaying
235
-    if (count($cat_terms) > 0) {
236
-        //Displaying as a list
237
-        $p = $pading * 15;
238
-        $pading++;
233
+	$main_list_class = '';
234
+	//If there are terms, start displaying
235
+	if (count($cat_terms) > 0) {
236
+		//Displaying as a list
237
+		$p = $pading * 15;
238
+		$pading++;
239 239
 
240
-        if ($cat_parent == 0) {
241
-            $list_class = 'main_list';
242
-            $display = '';
243
-        } else {
244
-            $list_class = 'sub_list';
245
-            $display = !$child_collapse ? '' : 'display:none';
246
-        }
240
+		if ($cat_parent == 0) {
241
+			$list_class = 'main_list';
242
+			$display = '';
243
+		} else {
244
+			$list_class = 'sub_list';
245
+			$display = !$child_collapse ? '' : 'display:none';
246
+		}
247 247
 
248
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
248
+		$out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
249 249
 
250
-        $geodir_cat_icons = geodir_get_term_icon();
250
+		$geodir_cat_icons = geodir_get_term_icon();
251 251
 
252
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
253
-        if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
254
-            $geodir_default_map_search_pt = $homemap_catlist_ptype;
255
-        }
256
-        $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt);
252
+		$geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
253
+		if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
254
+			$geodir_default_map_search_pt = $homemap_catlist_ptype;
255
+		}
256
+		$post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : $geodir_default_map_search_pt);
257 257
         
258
-        foreach ($cat_terms as $cat_term):
259
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
260
-
261
-            if (!in_array($cat_term->term_id, $exclude_categories)):
262
-                //Secret sauce.  Function calls itself to display child elements, if any
263
-                $checked = 'checked="checked"';
264
-
265
-                // Untick the category by default on home map
266
-                if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
267
-                    if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
268
-                        global $sitepress;
269
-                        $default_lang = $sitepress->get_default_language();
270
-                        $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
271
-                    }else{
272
-                        $term_id = $cat_term->term_id;
273
-                    }
274
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
275
-                        $checked = '';
276
-                    }
277
-                }
278
-
279
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
280
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
281
-                $term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
282
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
283
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
284
-
285
-            endif;
286
-
287
-
288
-            // get sub category by recursion
289
-            $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
290
-
291
-            $out .= '</li>';
292
-
293
-        endforeach;
294
-
295
-        $out .= '</ul>';
296
-
297
-        return $out;
298
-    } else {
299
-        if ($cat_parent == 0)
300
-            return _e('No category', 'geodirectory');
301
-    }
302
-    return;
258
+		foreach ($cat_terms as $cat_term):
259
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : '';
260
+
261
+			if (!in_array($cat_term->term_id, $exclude_categories)):
262
+				//Secret sauce.  Function calls itself to display child elements, if any
263
+				$checked = 'checked="checked"';
264
+
265
+				// Untick the category by default on home map
266
+				if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
267
+					if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
268
+						global $sitepress;
269
+						$default_lang = $sitepress->get_default_language();
270
+						$term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
271
+					}else{
272
+						$term_id = $cat_term->term_id;
273
+					}
274
+					if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
275
+						$checked = '';
276
+					}
277
+				}
278
+
279
+				$term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
280
+				$term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
281
+				$term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
282
+				$term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
283
+				$out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
284
+
285
+			endif;
286
+
287
+
288
+			// get sub category by recursion
289
+			$out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map);
290
+
291
+			$out .= '</li>';
292
+
293
+		endforeach;
294
+
295
+		$out .= '</ul>';
296
+
297
+		return $out;
298
+	} else {
299
+		if ($cat_parent == 0)
300
+			return _e('No category', 'geodirectory');
301
+	}
302
+	return;
303 303
 }
304 304
 
305 305
 /**
@@ -311,19 +311,19 @@  discard block
 block discarded – undo
311 311
  * @return string The map API provider name.
312 312
  */
313 313
 function geodir_map_name() {
314
-    $geodir_map_name = get_option('geodir_load_map', 'google');
314
+	$geodir_map_name = get_option('geodir_load_map', 'google');
315 315
     
316
-    if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
317
-        $geodir_map_name = 'auto';
318
-    }
319
-
320
-    /**
321
-     * Filter the map JS API provider name.
322
-     *
323
-     * @since 1.6.1
324
-     * @param string $geodir_map_name The map API provider name.
325
-     */
326
-    return apply_filters('geodir_map_name', $geodir_map_name);
316
+	if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
317
+		$geodir_map_name = 'auto';
318
+	}
319
+
320
+	/**
321
+	 * Filter the map JS API provider name.
322
+	 *
323
+	 * @since 1.6.1
324
+	 * @param string $geodir_map_name The map API provider name.
325
+	 */
326
+	return apply_filters('geodir_map_name', $geodir_map_name);
327 327
 }
328 328
 
329 329
 /**
@@ -339,48 +339,48 @@  discard block
 block discarded – undo
339 339
  * @return array The icon size.
340 340
  */
341 341
 function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
342
-    global $gd_marker_sizes;
342
+	global $gd_marker_sizes;
343 343
     
344
-    if (empty($gd_marker_sizes)) {
345
-        $gd_marker_sizes = array();
346
-    }
344
+	if (empty($gd_marker_sizes)) {
345
+		$gd_marker_sizes = array();
346
+	}
347 347
       
348
-    if (!empty($gd_marker_sizes[$icon])) {
349
-        return $gd_marker_sizes[$icon];
350
-    }
348
+	if (!empty($gd_marker_sizes[$icon])) {
349
+		return $gd_marker_sizes[$icon];
350
+	}
351 351
     
352
-    if (empty($icon)) {
353
-        $gd_marker_sizes[$icon] = $default_size;
352
+	if (empty($icon)) {
353
+		$gd_marker_sizes[$icon] = $default_size;
354 354
         
355
-        return $default_size;
356
-    }
355
+		return $default_size;
356
+	}
357 357
     
358
-    $icon_url = $icon;
358
+	$icon_url = $icon;
359 359
     
360
-    $uploads = wp_upload_dir(); // Array of key => value pairs
360
+	$uploads = wp_upload_dir(); // Array of key => value pairs
361 361
       
362
-    if (!path_is_absolute($icon)) {
363
-        $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
364
-    }
362
+	if (!path_is_absolute($icon)) {
363
+		$icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon);
364
+	}
365 365
     
366
-    if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
367
-        $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
368
-    }
366
+	if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
367
+		$icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon);
368
+	}
369 369
     
370
-    $sizes = array();
371
-    if (is_file($icon) && file_exists($icon)) {
372
-        $size = getimagesize(trim($icon));
370
+	$sizes = array();
371
+	if (is_file($icon) && file_exists($icon)) {
372
+		$size = getimagesize(trim($icon));
373 373
         
374
-        if (!empty($size[0]) && !empty($size[1])) {
375
-            $sizes = array('w' => $size[0], 'h' => $size[1]);
376
-        }
377
-    }
374
+		if (!empty($size[0]) && !empty($size[1])) {
375
+			$sizes = array('w' => $size[0], 'h' => $size[1]);
376
+		}
377
+	}
378 378
     
379
-    $sizes = !empty($sizes) ? $sizes : $default_size;
379
+	$sizes = !empty($sizes) ? $sizes : $default_size;
380 380
     
381
-    $gd_marker_sizes[$icon_url] = $sizes;
381
+	$gd_marker_sizes[$icon_url] = $sizes;
382 382
     
383
-    return $sizes;
383
+	return $sizes;
384 384
 }
385 385
 
386 386
 add_action('wp_footer', 'geodir_map_load_script', 10);
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
  * @package GeoDirectory
393 393
  */
394 394
 function geodir_map_load_script() {
395
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'google-maps-api', 'done')) {
396
-        $plugin_url = geodir_plugin_url();
395
+	if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'google-maps-api', 'done')) {
396
+		$plugin_url = geodir_plugin_url();
397 397
 ?>
398 398
 <script type="text/javascript">
399 399
 if (!(window.google && typeof google.maps !== 'undefined')) {
@@ -408,5 +408,5 @@  discard block
 block discarded – undo
408 408
 }
409 409
 </script>
410 410
 <?php
411
-    }
411
+	}
412 412
 }
413 413
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
     if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array)) {
56 56
 
57
-        if(isset($map_jason[$post->ID])){return null;}
57
+        if (isset($map_jason[$post->ID])) {return null; }
58 58
 
59 59
         $srcharr = array("'", "/", "-", '"', '\\');
60 60
         $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
61 61
 
62
-        $default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID,'default_category');
62
+        $default_category = isset($post->default_category) ? $post->default_category : geodir_get_post_meta($post->ID, 'default_category');
63 63
 
64 64
         $geodir_cat_icons = geodir_get_term_icon();
65 65
         $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_category]) ? $geodir_cat_icons[$default_category] : '';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $title = str_replace($srcharr, $replarr, $post_title);
69 69
 
70 70
         if (is_ssl()) {
71
-            $icon = str_replace("http:","https:",$icon );
71
+            $icon = str_replace("http:", "https:", $icon);
72 72
         }
73 73
         
74 74
         if ($icon != '') {
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
             $icon_size = array('w' => 36, 'h' => 45);
85 85
         }
86 86
 
87
-        $post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID,'post_latitude');
88
-        $post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID,'post_longitude');
87
+        $post_latitude = isset($post->post_latitude) ? $post->post_latitude : geodir_get_post_meta($post->ID, 'post_latitude');
88
+        $post_longitude = isset($post->post_longitude) ? $post->post_longitude : geodir_get_post_meta($post->ID, 'post_longitude');
89 89
 
90 90
 
91
-        $post_json = '{"id":"' . $post->ID
92
-                     . '","t": "' . $title
93
-                     . '","lt": "' . $post_latitude
94
-                     . '","ln": "' . $post_longitude
95
-                     . '","mk_id":"' . $post->ID . '_' . $default_category
96
-                     . '","i":"' . $icon
97
-                     . '","w":"' . $icon_size['w']
98
-                     . '","h":"' . $icon_size['h'] . '"}';
91
+        $post_json = '{"id":"'.$post->ID
92
+                     . '","t": "'.$title
93
+                     . '","lt": "'.$post_latitude
94
+                     . '","ln": "'.$post_longitude
95
+                     . '","mk_id":"'.$post->ID.'_'.$default_category
96
+                     . '","i":"'.$icon
97
+                     . '","w":"'.$icon_size['w']
98
+                     . '","h":"'.$icon_size['h'].'"}';
99 99
 
100 100
         /**
101 101
          * Filter the json data when creating output for post json marker..
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
          * @param string $post_json JSON representation of the post marker info.
105 105
          * @param object $post The post object.
106 106
          */
107
-        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
107
+        $post_map_json = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
108 108
 
109 109
         // only assign it if it has a value
110
-        if($post_map_json){
110
+        if ($post_map_json) {
111 111
             $map_jason[$post->ID] = $post_map_json;
112 112
         }
113 113
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
             if (is_array($map_jason) && !empty($map_jason)) {
132 132
 
133 133
                 // on details page only show the main marker on the map
134
-                if(geodir_is_page('detail')){
134
+                if (geodir_is_page('detail')) {
135 135
                     global $post;
136
-                    if(isset($map_jason[$post->ID])){
136
+                    if (isset($map_jason[$post->ID])) {
137 137
                         $map_jason = array($map_jason[$post->ID]);
138 138
                     }
139 139
                 }
140
-                $canvas_jason = $canvas . "_jason";
140
+                $canvas_jason = $canvas."_jason";
141 141
                 $map_canvas_arr[$canvas] = array_unique($map_jason);
142 142
                 unset($cat_content_info);
143 143
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
                     $json_content = substr(implode(',', $cat_content_info), 1);
147 147
                     $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
148 148
                     $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
149
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
149
+                    $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
150 150
                 } else {
151 151
                     $canvas_jason = '[{"totalcount":"0"}]';
152 152
                 }
153
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
153
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
154 154
 
155 155
                 /**
156 156
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
                  * @param string $canvas Map canvas array key.
163 163
                  * @param array $map_canvas_jason_args Map canvas args.
164 164
                  */
165
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
165
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
166 166
 
167
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
167
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
168 168
             } else {
169 169
                 $canvas_jason = '[{"totalcount":"0"}]';
170
-                $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
170
+                $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason);
171 171
 
172 172
                 /**
173 173
                  * Filter the send_marker_jason_to_js() function map canvas json args.
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
                  * @param string $canvas Map canvas array key.
180 180
                  * @param array $map_canvas_jason_args Map canvas args.
181 181
                  */
182
-                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
183
-                wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
182
+                $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
183
+                wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
184 184
             }
185 185
         }
186 186
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
             $display = !$child_collapse ? '' : 'display:none';
246 246
         }
247 247
 
248
-        $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">';
248
+        $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">';
249 249
 
250 250
         $geodir_cat_icons = geodir_get_term_icon();
251 251
 
252
-        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') :  'gd_place';
252
+        $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
253 253
         if ($is_home_map && $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype')) {
254 254
             $geodir_default_map_search_pt = $homemap_catlist_ptype;
255 255
         }
@@ -264,23 +264,23 @@  discard block
 block discarded – undo
264 264
 
265 265
                 // Untick the category by default on home map
266 266
                 if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
267
-                    if (geodir_wpml_is_taxonomy_translated($post_type . 'category')) { // if WPML
267
+                    if (geodir_wpml_is_taxonomy_translated($post_type.'category')) { // if WPML
268 268
                         global $sitepress;
269 269
                         $default_lang = $sitepress->get_default_language();
270 270
                         $term_id = geodir_wpml_object_id($cat_term->term_id, $post_type.'category', true, $default_lang);
271
-                    }else{
271
+                    } else {
272 272
                         $term_id = $cat_term->term_id;
273 273
                     }
274
-                    if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
274
+                    if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) {
275 275
                         $checked = '';
276 276
                     }
277 277
                 }
278 278
 
279
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
280
-                $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
281
-                $term_check .= '  title="' . esc_attr(geodir_utf8_ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
282
-                $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '"/>';
283
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . geodir_utf8_ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
279
+                $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"';
280
+                $term_check .= ' name="'.$map_canvas_name.'_cat[]" ';
281
+                $term_check .= '  title="'.esc_attr(geodir_utf8_ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">';
282
+                $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.geodir_utf8_ucfirst($cat_term->name).'"/>';
283
+                $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.geodir_utf8_ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>';
284 284
 
285 285
             endif;
286 286
 
@@ -392,19 +392,19 @@  discard block
 block discarded – undo
392 392
  * @package GeoDirectory
393 393
  */
394 394
 function geodir_map_load_script() {
395
-    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'google-maps-api', 'done')) {
395
+    if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('google-maps-api', 'done')) {
396 396
         $plugin_url = geodir_plugin_url();
397 397
 ?>
398 398
 <script type="text/javascript">
399 399
 if (!(window.google && typeof google.maps !== 'undefined')) {
400
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
400
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
401 401
     document.getElementsByTagName("head")[0].appendChild(css);
402
-    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
402
+    var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
403 403
     document.getElementsByTagName("head")[0].appendChild(css);
404
-    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
405
-    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
406
-    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
407
-    document.write('<' + 'script id="geodirectory-o-overlappingmarker-script" src="<?php echo $plugin_url;?>/geodirectory-assets/jawj/oms-leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
404
+    document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
405
+    document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
406
+    document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
407
+    document.write('<' + 'script id="geodirectory-o-overlappingmarker-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/jawj/oms-leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
408 408
 }
409 409
 </script>
410 410
 <?php
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
  * @global object $wpdb WordPress Database object.
2179 2179
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2180 2180
  * @param int $attachment_id Attachment ID.
2181
- * @return bool|void Returns false on failure.
2181
+ * @return false|null Returns false on failure.
2182 2182
  */
2183 2183
 function geodirectory_before_featured_image_delete($attachment_id)
2184 2184
 {
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
  * @since 1.6.16
2686 2686
  * @package GeoDirectory
2687 2687
  * @param array $classes The class array of the HTML element.
2688
- * @return array Modified class array.
2688
+ * @return string[] Modified class array.
2689 2689
  */
2690 2690
 function geodir_body_class_active_map($classes = array()) {
2691 2691
     $classes[] = 'gd-map-' . geodir_map_name();
Please login to merge, or discard this patch.
Braces   +89 added lines, -72 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -431,8 +432,9 @@  discard block
 block discarded – undo
431 432
      */
432 433
     do_action('geodir_after_social_sharing_buttons');
433 434
     $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
435
+    if (trim($content_html) != '') {
436
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
437
+    }
436 438
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437 439
         /**
438 440
          * Filter the geodir_social_sharing_buttons() function content.
@@ -488,8 +490,9 @@  discard block
 block discarded – undo
488 490
      */
489 491
     do_action('geodir_after_edit_post_link');
490 492
     $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+    if (trim($content_html) != '') {
494
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
495
+    }
493 496
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
494 497
         /**
495 498
          * Filter the geodir_edit_post_link() function content.
@@ -1063,8 +1066,9 @@  discard block
 block discarded – undo
1063 1066
      */
1064 1067
     do_action('geodir_after_google_analytics');
1065 1068
     $content_html = ob_get_clean();
1066
-    if (trim($content_html) != '')
1067
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1069
+    if (trim($content_html) != '') {
1070
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
+    }
1068 1072
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1069 1073
         /**
1070 1074
          * Filter the geodir_edit_post_link() function content.
@@ -1206,8 +1210,9 @@  discard block
 block discarded – undo
1206 1210
     do_action('geodir_after_detail_page_more_info');
1207 1211
 
1208 1212
     $content_html = ob_get_clean();
1209
-    if (trim($content_html) != '')
1210
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1213
+    if (trim($content_html) != '') {
1214
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1215
+    }
1211 1216
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1212 1217
         /**
1213 1218
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1334,8 +1339,9 @@  discard block
 block discarded – undo
1334 1339
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1335 1340
 
1336 1341
     foreach ($arr_alert_msg as $key => $value) {
1337
-        if (!is_scalar($value))
1338
-            continue;
1342
+        if (!is_scalar($value)) {
1343
+                    continue;
1344
+        }
1339 1345
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1340 1346
     }
1341 1347
 
@@ -1391,17 +1397,19 @@  discard block
 block discarded – undo
1391 1397
     global $geodir_sidebars;
1392 1398
     global $sidebars_widgets;
1393 1399
 
1394
-    if (!is_array($sidebars_widgets))
1395
-        $sidebars_widgets = wp_get_sidebars_widgets();
1400
+    if (!is_array($sidebars_widgets)) {
1401
+            $sidebars_widgets = wp_get_sidebars_widgets();
1402
+    }
1396 1403
     $geodir_old_sidebars = array();
1397 1404
 
1398 1405
     if (is_array($geodir_sidebars)) {
1399 1406
         foreach ($geodir_sidebars as $val) {
1400 1407
             if (is_array($sidebars_widgets)) {
1401
-                if (array_key_exists($val, $sidebars_widgets))
1402
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1403
-                else
1404
-                    $geodir_old_sidebars[$val] = array();
1408
+                if (array_key_exists($val, $sidebars_widgets)) {
1409
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1410
+                } else {
1411
+                                    $geodir_old_sidebars[$val] = array();
1412
+                }
1405 1413
             }
1406 1414
         }
1407 1415
     }
@@ -1422,16 +1430,19 @@  discard block
 block discarded – undo
1422 1430
 {
1423 1431
     global $sidebars_widgets;
1424 1432
 
1425
-    if (!is_array($sidebars_widgets))
1426
-        $sidebars_widgets = wp_get_sidebars_widgets();
1433
+    if (!is_array($sidebars_widgets)) {
1434
+            $sidebars_widgets = wp_get_sidebars_widgets();
1435
+    }
1427 1436
 
1428 1437
     if (is_array($sidebars_widgets)) {
1429 1438
         $geodir_old_sidebars = get_option('geodir_sidebars');
1430 1439
         if (is_array($geodir_old_sidebars)) {
1431 1440
             foreach ($geodir_old_sidebars as $key => $val) {
1432
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1441
+                if(0 === strpos($key, 'geodir_')) {
1442
+                	// if gd widget
1433 1443
                 {
1434
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1444
+                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1445
+                }
1435 1446
                 }
1436 1447
 
1437 1448
 
@@ -1567,20 +1578,25 @@  discard block
 block discarded – undo
1567 1578
         }
1568 1579
     }
1569 1580
     
1570
-    if ($tab == 'post_info')
1571
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1581
+    if ($tab == 'post_info') {
1582
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1583
+    }
1572 1584
     
1573
-    if ($tab == 'post_images')
1574
-        $is_display = (!empty($post_images)) ? true : false;
1585
+    if ($tab == 'post_images') {
1586
+            $is_display = (!empty($post_images)) ? true : false;
1587
+    }
1575 1588
 
1576
-    if ($tab == 'post_video')
1577
-        $is_display = (!empty($video)) ? true : false;
1589
+    if ($tab == 'post_video') {
1590
+            $is_display = (!empty($video)) ? true : false;
1591
+    }
1578 1592
 
1579
-    if ($tab == 'special_offers')
1580
-        $is_display = (!empty($special_offers)) ? true : false;
1593
+    if ($tab == 'special_offers') {
1594
+            $is_display = (!empty($special_offers)) ? true : false;
1595
+    }
1581 1596
 
1582
-    if ($tab == 'reviews')
1583
-        $is_display = (geodir_is_page('detail')) ? true : false;
1597
+    if ($tab == 'reviews') {
1598
+            $is_display = (geodir_is_page('detail')) ? true : false;
1599
+    }
1584 1600
 
1585 1601
     if ($tab == 'related_listing') {
1586 1602
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1814,11 +1830,13 @@  discard block
 block discarded – undo
1814 1830
     $region_slug = $default_location->region_slug;
1815 1831
     $city_slug = $default_location->city_slug;
1816 1832
 
1817
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1818
-        return $slug_exists = true;
1833
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1834
+            return $slug_exists = true;
1835
+    }
1819 1836
 
1820
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1821
-        return $slug_exists = true;
1837
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1838
+            return $slug_exists = true;
1839
+    }
1822 1840
 
1823 1841
     return $slug_exists;
1824 1842
 }
@@ -1861,40 +1879,31 @@  discard block
 block discarded – undo
1861 1879
     if(geodir_is_page('home')){
1862 1880
         $gd_page = 'home';
1863 1881
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1864
-    }
1865
-    elseif(geodir_is_page('detail')){
1882
+    } elseif(geodir_is_page('detail')){
1866 1883
         $gd_page = 'detail';
1867 1884
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1868
-    }
1869
-    elseif(geodir_is_page('pt')){
1885
+    } elseif(geodir_is_page('pt')){
1870 1886
         $gd_page = 'pt';
1871 1887
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('listing')){
1888
+    } elseif(geodir_is_page('listing')){
1874 1889
         $gd_page = 'listing';
1875 1890
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1876
-    }
1877
-    elseif(geodir_is_page('location')){
1891
+    } elseif(geodir_is_page('location')){
1878 1892
         $gd_page = 'location';
1879 1893
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1880
-    }
1881
-    elseif(geodir_is_page('search')){
1894
+    } elseif(geodir_is_page('search')){
1882 1895
         $gd_page = 'search';
1883 1896
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1884
-    }
1885
-    elseif(geodir_is_page('add-listing')){
1897
+    } elseif(geodir_is_page('add-listing')){
1886 1898
         $gd_page = 'add-listing';
1887 1899
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1888
-    }
1889
-    elseif(geodir_is_page('author')){
1900
+    } elseif(geodir_is_page('author')){
1890 1901
         $gd_page = 'author';
1891 1902
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1892
-    }
1893
-    elseif(geodir_is_page('login')){
1903
+    } elseif(geodir_is_page('login')){
1894 1904
         $gd_page = 'login';
1895 1905
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1896
-    }
1897
-    elseif(geodir_is_page('listing-success')){
1906
+    } elseif(geodir_is_page('listing-success')){
1898 1907
         $gd_page = 'listing-success';
1899 1908
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1900 1909
     }
@@ -1972,11 +1981,13 @@  discard block
 block discarded – undo
1972 1981
 
1973 1982
     if (!get_option('geodir_remove_url_seperator')) {
1974 1983
 
1975
-        if (get_option('geodir_listingurl_separator'))
1976
-            delete_option('geodir_listingurl_separator');
1984
+        if (get_option('geodir_listingurl_separator')) {
1985
+                    delete_option('geodir_listingurl_separator');
1986
+        }
1977 1987
 
1978
-        if (get_option('geodir_detailurl_separator'))
1979
-            delete_option('geodir_detailurl_separator');
1988
+        if (get_option('geodir_detailurl_separator')) {
1989
+                    delete_option('geodir_detailurl_separator');
1990
+        }
1980 1991
 
1981 1992
         flush_rewrite_rules(false);
1982 1993
 
@@ -2000,8 +2011,9 @@  discard block
 block discarded – undo
2000 2011
 {
2001 2012
     foreach ($permalink_arr as $key => $value) {
2002 2013
 
2003
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2004
-            unset($permalink_arr[$key]);
2014
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2015
+                    unset($permalink_arr[$key]);
2016
+        }
2005 2017
 
2006 2018
     }
2007 2019
 
@@ -2136,16 +2148,18 @@  discard block
 block discarded – undo
2136 2148
 
2137 2149
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2138 2150
 
2139
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2140
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2151
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2152
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2153
+            }
2141 2154
         }
2142 2155
 
2143 2156
         if (array_key_exists('special_offers', $tabs_arr)) {
2144 2157
 
2145 2158
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2146 2159
 
2147
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2148
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2160
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2161
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2162
+            }
2149 2163
         }
2150 2164
 
2151 2165
     }
@@ -2200,8 +2214,9 @@  discard block
 block discarded – undo
2200 2214
 
2201 2215
         $all_postypes = geodir_get_posttypes();
2202 2216
 
2203
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2204
-            return false;
2217
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2218
+                    return false;
2219
+        }
2205 2220
 
2206 2221
         $uploads = wp_upload_dir();
2207 2222
 
@@ -2275,8 +2290,9 @@  discard block
 block discarded – undo
2275 2290
                         $file_info = pathinfo($attach->file);
2276 2291
 
2277 2292
                         $sub_dir = '';
2278
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2279
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2293
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2294
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2295
+                        }
2280 2296
 
2281 2297
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2282 2298
                         $uploads_path = $uploads['basedir'];
@@ -2297,8 +2313,9 @@  discard block
 block discarded – undo
2297 2313
 
2298 2314
                     if (!empty($attachment_data)) {
2299 2315
 
2300
-                        if ($attachment_data->ID)
2301
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2316
+                        if ($attachment_data->ID) {
2317
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2318
+                        }
2302 2319
 
2303 2320
                     } else {
2304 2321
 
@@ -2489,7 +2506,7 @@  discard block
 block discarded – undo
2489 2506
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2490 2507
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2491 2508
 
2492
-                    }else{
2509
+                    } else{
2493 2510
                         $i = 0;
2494 2511
                         $fieldset_count++;
2495 2512
                         $field_set_start = 1;
@@ -2618,7 +2635,7 @@  discard block
 block discarded – undo
2618 2635
             $status_icon = '<i class="fa fa-play"></i>';
2619 2636
             if ($real_status == 'publish') {
2620 2637
                 $status .= __('Published', 'geodirectory');
2621
-            }elseif ($real_status == 'pending') {
2638
+            } elseif ($real_status == 'pending') {
2622 2639
                 $status .= __('Awaiting Review', 'geodirectory');
2623 2640
             } else {
2624 2641
                 $status .= __('Not published', 'geodirectory');
Please login to merge, or discard this patch.
Spacing   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 /* WP REVIEW COUNT ACTIONS */
177 177
 ////////////////////////
178 178
 
179
-add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
179
+add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
180 180
 //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
181
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
181
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
182 182
 //add_action('created_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
184 184
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
227 227
     if ($geodir_theme_location) {
228 228
         update_option('geodir_theme_location_nav', $geodir_theme_location);
229 229
     } else {
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     include_once('geodirectory-functions/listing_filters.php');
259 259
     
260 260
     // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
261
+    if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) {
262
+        remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts'));
263 263
     }
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
265
+    if (isset($_REQUEST['geodir_search'])) {
266
+        add_filter('geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3);
267
+        add_filter('geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3);
268 268
     }
269 269
 }
270 270
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 
332 332
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
333 333
 
334
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
335
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
334
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
335
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
336 336
 
337 337
 // Detail page sidebar content 
338 338
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
     do_action('geodir_after_social_sharing_buttons');
433 433
     $content_html = ob_get_clean();
434 434
     if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
435
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';
436
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
437 437
         /**
438 438
          * Filter the geodir_social_sharing_buttons() function content.
439 439
          *
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
             $post_id = $post->ID;
474 474
             
475 475
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
476
+                $post_id = (int) $_REQUEST['pid'];
477 477
             }
478 478
 
479 479
             $postlink = get_permalink(geodir_add_listing_page_id());
480 480
             $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
481
+            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
482 482
         }
483 483
     }// end of if, if its a preview or not
484 484
     /**
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
     do_action('geodir_after_edit_post_link');
490 490
     $content_html = ob_get_clean();
491 491
     if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
492
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';
493
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
494 494
         /**
495 495
          * Filter the geodir_edit_post_link() function content.
496 496
          *
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    if ( ! get_option( 'geodir_ga_stats' ) ) {
514
+    if (!get_option('geodir_ga_stats')) {
515 515
 		return;
516 516
 	}
517
-	global $post,$preview;
518
-    if($preview){return '';}
517
+	global $post, $preview;
518
+    if ($preview) {return ''; }
519 519
     $package_info = array();
520 520
     $package_info = geodir_post_package_info($package_info, $post);
521 521
 
@@ -547,14 +547,14 @@  discard block
 block discarded – undo
547 547
     $hide_refresh = get_option('geodir_ga_auto_refresh');
548 548
     
549 549
     $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
-    if (is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
550
+    if (is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
551 551
         $page_url = urlencode($_SERVER['REQUEST_URI']);
552 552
         ?>
553 553
         <script type="text/javascript">
554 554
             var gd_gaTimeOut;
555
-            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
556
-            var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;
557
-            var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;
555
+            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
556
+            var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;
557
+            var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;
558 558
             ga_data1 = false;
559 559
             ga_data2 = false;
560 560
             ga_data3 = false;
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
             }
696 696
 
697 697
             function gdga_noResults() {
698
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
698
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
699 699
                 jQuery('#gdga-legend-container').html('');
700 700
             }
701 701
 
@@ -727,18 +727,18 @@  discard block
 block discarded – undo
727 727
                     var data2 = results[1].rows.map(function(row) { return +row[2]; });
728 728
                     //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
729 729
 
730
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
731
-                        '<?php _e('Feb', 'geodirectory');?>',
732
-                        '<?php _e('Mar', 'geodirectory');?>',
733
-                        '<?php _e('Apr', 'geodirectory');?>',
734
-                        '<?php _e('May', 'geodirectory');?>',
735
-                        '<?php _e('Jun', 'geodirectory');?>',
736
-                        '<?php _e('Jul', 'geodirectory');?>',
737
-                        '<?php _e('Aug', 'geodirectory');?>',
738
-                        '<?php _e('Sep', 'geodirectory');?>',
739
-                        '<?php _e('Oct', 'geodirectory');?>',
740
-                        '<?php _e('Nov', 'geodirectory');?>',
741
-                        '<?php _e('Dec', 'geodirectory');?>'];
730
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
731
+                        '<?php _e('Feb', 'geodirectory'); ?>',
732
+                        '<?php _e('Mar', 'geodirectory'); ?>',
733
+                        '<?php _e('Apr', 'geodirectory'); ?>',
734
+                        '<?php _e('May', 'geodirectory'); ?>',
735
+                        '<?php _e('Jun', 'geodirectory'); ?>',
736
+                        '<?php _e('Jul', 'geodirectory'); ?>',
737
+                        '<?php _e('Aug', 'geodirectory'); ?>',
738
+                        '<?php _e('Sep', 'geodirectory'); ?>',
739
+                        '<?php _e('Oct', 'geodirectory'); ?>',
740
+                        '<?php _e('Nov', 'geodirectory'); ?>',
741
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
742 742
 
743 743
                     // Ensure the data arrays are at least as long as the labels array.
744 744
                     // Chart.js bar charts don't (yet) accept sparse datasets.
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
                         labels : labels,
752 752
                         datasets : [
753 753
                             {
754
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
754
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
755 755
                                 fillColor : "rgba(220,220,220,0.5)",
756 756
                                 strokeColor : "rgba(220,220,220,1)",
757 757
                                 data : data2
758 758
                             },
759 759
                             {
760
-                                label: '<?php _e('This Year', 'geodirectory');?>',
760
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
761 761
                                 fillColor : "rgba(151,187,205,0.5)",
762 762
                                 strokeColor : "rgba(151,187,205,1)",
763 763
                                 data : data1
@@ -802,30 +802,30 @@  discard block
 block discarded – undo
802 802
 
803 803
                     <?php
804 804
                     // Here we list the shorthand days of the week so it can be used in translation.
805
-                    __("Mon",'geodirectory');
806
-                    __("Tue",'geodirectory');
807
-                    __("Wed",'geodirectory');
808
-                    __("Thu",'geodirectory');
809
-                    __("Fri",'geodirectory');
810
-                    __("Sat",'geodirectory');
811
-                    __("Sun",'geodirectory');
805
+                    __("Mon", 'geodirectory');
806
+                    __("Tue", 'geodirectory');
807
+                    __("Wed", 'geodirectory');
808
+                    __("Thu", 'geodirectory');
809
+                    __("Fri", 'geodirectory');
810
+                    __("Sat", 'geodirectory');
811
+                    __("Sun", 'geodirectory');
812 812
                     ?>
813 813
 
814 814
                     labels = [
815
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
816
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
817
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
818
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
819
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
820
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
821
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
815
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
816
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
817
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
818
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
819
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
820
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
821
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
822 822
                     ];
823 823
 
824 824
                     var data = {
825 825
                         labels : labels,
826 826
                         datasets : [
827 827
                             {
828
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
828
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
829 829
                                 fillColor : "rgba(220,220,220,0.5)",
830 830
                                 strokeColor : "rgba(220,220,220,1)",
831 831
                                 pointColor : "rgba(220,220,220,1)",
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                                 data : data2
834 834
                             },
835 835
                             {
836
-                                label: '<?php _e('This Week', 'geodirectory');?>',
836
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
837 837
                                 fillColor : "rgba(151,187,205,0.5)",
838 838
                                 strokeColor : "rgba(151,187,205,1)",
839 839
                                 pointColor : "rgba(151,187,205,1)",
@@ -1040,18 +1040,18 @@  discard block
 block discarded – undo
1040 1040
         </style>
1041 1041
         <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
1042 1042
         <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
1043
-        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
1043
+        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
1044 1044
         <span id="ga_stats" class="gdga-analytics-box" style="display:none">
1045
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1045
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1046 1046
             <div id="gd-active-users-container">
1047
-                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
1047
+                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
1048 1048
                     <b class="gd-ActiveUsers-value">0</b>
1049 1049
                 </div>
1050 1050
             </div>
1051 1051
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1052
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1053
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1054
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1052
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1053
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1054
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1055 1055
             </select>
1056 1056
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
1057 1057
             <ol class="Chartjs-legend" id="gdga-legend-container"></ol>
@@ -1067,8 +1067,8 @@  discard block
 block discarded – undo
1067 1067
     do_action('geodir_after_google_analytics');
1068 1068
     $content_html = ob_get_clean();
1069 1069
     if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1070
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';
1071
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1072 1072
         /**
1073 1073
          * Filter the geodir_edit_post_link() function content.
1074 1074
          *
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 {
1095 1095
     global $post, $preview, $post_images;
1096 1096
     
1097
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1097
+    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) {
1098 1098
         return;
1099 1099
     }
1100 1100
     ob_start(); // Start  buffering;
@@ -1129,10 +1129,10 @@  discard block
 block discarded – undo
1129 1129
        
1130 1130
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1131 1131
 	   
1132
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1132
+	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />';
1133 1133
 
1134 1134
         $html .= '<span class="item">';
1135
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1135
+        $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';
1136 1136
 
1137 1137
         if ($post_images) {
1138 1138
             foreach ($post_images as $img) {
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
         }
1143 1143
 
1144 1144
         if (isset($post_img) && $post_img) {
1145
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1145
+            $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';
1146 1146
         }
1147 1147
 
1148 1148
         $html .= '</span>';
@@ -1169,9 +1169,9 @@  discard block
 block discarded – undo
1169 1169
     do_action('geodir_after_detail_page_review_rating');
1170 1170
     $content_html = ob_get_clean();
1171 1171
     if (trim($content_html) != '') {
1172
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1172
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';
1173 1173
     }
1174
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1174
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1175 1175
         /**
1176 1176
          * Filter the geodir_detail_page_review_rating() function content.
1177 1177
          *
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
     $content_html = ob_get_clean();
1212 1212
     if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1213
+        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';
1214
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1215 1215
         /**
1216 1216
          * Filter the output html for function geodir_detail_page_more_info().
1217 1217
          *
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1313 1313
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1314 1314
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1315
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1315
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1316 1316
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1317 1317
         'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318 1318
         'geodir_map_name' => geodir_map_name(),
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
     foreach ($arr_alert_msg as $key => $value) {
1343 1343
         if (!is_scalar($value))
1344 1344
             continue;
1345
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1345
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1346 1346
     }
1347 1347
 
1348
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1348
+    $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';
1349 1349
     echo '<script>';
1350 1350
     echo $script;
1351 1351
     echo '</script>';
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
         $geodir_old_sidebars = get_option('geodir_sidebars');
1436 1436
         if (is_array($geodir_old_sidebars)) {
1437 1437
             foreach ($geodir_old_sidebars as $key => $val) {
1438
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1438
+                if (0 === strpos($key, 'geodir_'))// if gd widget
1439 1439
                 {
1440 1440
                     $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1441 1441
                 }
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
         global $post;
1515 1515
         $term_condition = '';
1516 1516
         if (isset($_REQUEST['backandedit'])) {
1517
-            $post = (object)$gd_session->get('listing');
1517
+            $post = (object) $gd_session->get('listing');
1518 1518
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1519 1519
         }
1520 1520
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
                     echo 'checked="checked"';
1529 1529
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1530 1530
                        class="geodir_textfield" value="1"
1531
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1531
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1532 1532
 				</span>
1533 1533
             </div>
1534 1534
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
         /** This action is documented in geodirectory_template_actions.php */
1569 1569
         $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1570 1570
         
1571
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1571
+        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
1572 1572
             $is_display = false;
1573 1573
         }
1574 1574
     }
@@ -1616,16 +1616,16 @@  discard block
 block discarded – undo
1616 1616
     global $wpdb, $plugin_prefix;
1617 1617
 	
1618 1618
 	// Remove unused virtual page
1619
-	$listings_page_id = (int)get_option('geodir_listing_page');
1619
+	$listings_page_id = (int) get_option('geodir_listing_page');
1620 1620
 	if ($listings_page_id) {
1621
-		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1621
+		$wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1622 1622
         delete_option('geodir_listing_page');
1623 1623
 	}
1624 1624
 
1625 1625
     if (!get_option('geodir_changes_in_custom_fields_table')) {
1626 1626
         $wpdb->query(
1627 1627
             $wpdb->prepare(
1628
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1628
+                "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",
1629 1629
                 array('1', '1', 'admin')
1630 1630
             )
1631 1631
         );
@@ -1633,9 +1633,9 @@  discard block
 block discarded – undo
1633 1633
 
1634 1634
         /* --- terms meta value set --- */
1635 1635
 
1636
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1636
+        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
1637 1637
 
1638
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1638
+        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
1639 1639
 
1640 1640
         if (!empty($options_data)) {
1641 1641
 
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
 
1644 1644
                 $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1645 1645
 
1646
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1646
+                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1647 1647
 
1648 1648
                 if (!empty($taxonomies_data)) {
1649 1649
 
@@ -1652,17 +1652,17 @@  discard block
 block discarded – undo
1652 1652
                         $taxObject = get_taxonomy($taxobj->taxonomy);
1653 1653
                         $post_type = $taxObject->object_type[0];
1654 1654
 
1655
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1655
+                        $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;
1656 1656
 
1657
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1657
+                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
1658 1658
 
1659 1659
                         if ($duplicate_data) {
1660 1660
 
1661
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1661
+                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1662 1662
 
1663 1663
                         } else {
1664 1664
 
1665
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1665
+                            $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1666 1666
 
1667 1667
                         }
1668 1668
 
@@ -1696,14 +1696,14 @@  discard block
 block discarded – undo
1696 1696
 
1697 1697
     global $wpdb, $table_prefix;
1698 1698
 
1699
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1699
+    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
1700 1700
 
1701 1701
     if ($slug_exists) {
1702 1702
 
1703 1703
         $suffix = 1;
1704 1704
         do {
1705
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1706
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1705
+            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1706
+            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
1707 1707
             $suffix++;
1708 1708
         } while ($location_slug_check && $suffix < 100);
1709 1709
 
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
 
1719 1719
 add_action('edited_term', 'geodir_update_term_slug', '1', 3);
1720 1720
 add_action('create_term', 'geodir_update_term_slug', '1', 3);
1721
-add_action( 'delete_term', 'geodir_on_delete_term', 1, 5 );
1721
+add_action('delete_term', 'geodir_on_delete_term', 1, 5);
1722 1722
 
1723 1723
 /**
1724 1724
  * Update term slug.
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 
1758 1758
         $suffix = 1;
1759 1759
         do {
1760
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1760
+            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
1761 1761
 
1762 1762
             /** This action is documented in geodirectory_hooks_actions.php */
1763 1763
             $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
 
1770 1770
         //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1771 1771
 
1772
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1772
+        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1773 1773
 
1774 1774
     }
1775 1775
 	
@@ -1778,18 +1778,18 @@  discard block
 block discarded – undo
1778 1778
 	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1779 1779
 	
1780 1780
 	$post_types = geodir_get_posttypes();
1781
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1782
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1781
+	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
1782
+		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
1783 1783
 		
1784 1784
 		if (!empty($posts_obj)) {
1785 1785
 			foreach ($posts_obj as $post_obj) {
1786 1786
 				$post_id = $post_obj->object_id;
1787 1787
 				
1788
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1788
+				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
1789 1789
 				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1790 1790
 				
1791
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1792
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1791
+				$listing_table = $plugin_prefix.$post_type.'_detail';
1792
+				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1793 1793
 			}
1794 1794
 		}
1795 1795
 	}
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
     if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1824 1824
         return $slug_exists = true;
1825 1825
 
1826
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1826
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1827 1827
         return $slug_exists = true;
1828 1828
 
1829 1829
     return $slug_exists;
@@ -1864,43 +1864,43 @@  discard block
 block discarded – undo
1864 1864
 
1865 1865
 
1866 1866
     $gd_page = '';
1867
-    if(geodir_is_page('home')){
1867
+    if (geodir_is_page('home')) {
1868 1868
         $gd_page = 'home';
1869 1869
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1870 1870
     }
1871
-    elseif(geodir_is_page('detail')){
1871
+    elseif (geodir_is_page('detail')) {
1872 1872
         $gd_page = 'detail';
1873 1873
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1874 1874
     }
1875
-    elseif(geodir_is_page('pt')){
1875
+    elseif (geodir_is_page('pt')) {
1876 1876
         $gd_page = 'pt';
1877 1877
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1878 1878
     }
1879
-    elseif(geodir_is_page('listing')){
1879
+    elseif (geodir_is_page('listing')) {
1880 1880
         $gd_page = 'listing';
1881 1881
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1882 1882
     }
1883
-    elseif(geodir_is_page('location')){
1883
+    elseif (geodir_is_page('location')) {
1884 1884
         $gd_page = 'location';
1885 1885
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1886 1886
     }
1887
-    elseif(geodir_is_page('search')){
1887
+    elseif (geodir_is_page('search')) {
1888 1888
         $gd_page = 'search';
1889 1889
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1890 1890
     }
1891
-    elseif(geodir_is_page('add-listing')){
1891
+    elseif (geodir_is_page('add-listing')) {
1892 1892
         $gd_page = 'add-listing';
1893 1893
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1894 1894
     }
1895
-    elseif(geodir_is_page('author')){
1895
+    elseif (geodir_is_page('author')) {
1896 1896
         $gd_page = 'author';
1897 1897
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1898 1898
     }
1899
-    elseif(geodir_is_page('login')){
1899
+    elseif (geodir_is_page('login')) {
1900 1900
         $gd_page = 'login';
1901 1901
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1902 1902
     }
1903
-    elseif(geodir_is_page('listing-success')){
1903
+    elseif (geodir_is_page('listing-success')) {
1904 1904
         $gd_page = 'listing-success';
1905 1905
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1906 1906
     }
@@ -1932,12 +1932,12 @@  discard block
 block discarded – undo
1932 1932
 
1933 1933
     if (!get_option('geodir_set_post_attachments')) {
1934 1934
 
1935
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1936
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1935
+        require_once(ABSPATH.'wp-admin/includes/image.php');
1936
+        require_once(ABSPATH.'wp-admin/includes/file.php');
1937 1937
 
1938 1938
         $all_postypes = geodir_get_posttypes();
1939 1939
 
1940
-        foreach($all_postypes as $post_type){
1940
+        foreach ($all_postypes as $post_type) {
1941 1941
             $args = array(
1942 1942
                 'posts_per_page' => -1,
1943 1943
                 'post_type' => $post_type,
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
 {
2032 2032
     $user_id = get_current_user_id();
2033 2033
 
2034
-    if(!$user_id){return $post;}
2034
+    if (!$user_id) {return $post; }
2035 2035
 
2036 2036
     $gd_post_types = geodir_get_posttypes();
2037 2037
 
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
 
2141 2141
         if (array_key_exists('post_video', $tabs_arr)) {
2142 2142
 
2143
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2143
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2144 2144
 
2145 2145
             if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2146 2146
                 $tabs_arr['post_video']['heading_text'] = $field_title;
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
 
2149 2149
         if (array_key_exists('special_offers', $tabs_arr)) {
2150 2150
 
2151
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2151
+            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2152 2152
 
2153 2153
             if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2154 2154
                 $tabs_arr['special_offers']['heading_text'] = $field_title;
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
  */
2170 2170
 function geodir_remove_template_redirect_actions()
2171 2171
 {
2172
-    if (geodir_is_page('login')){
2172
+    if (geodir_is_page('login')) {
2173 2173
         remove_all_actions('template_redirect');
2174 2174
         remove_action('init', 'avia_modify_front', 10);
2175 2175
     }
@@ -2216,25 +2216,25 @@  discard block
 block discarded – undo
2216 2216
         $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2217 2217
 
2218 2218
         $wpdb->query(
2219
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2219
+            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
2220 2220
                 array($post_id, $split_img_file_path)
2221 2221
             )
2222 2222
         );
2223 2223
 
2224 2224
         $attachment_data = $wpdb->get_row(
2225
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2225
+            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
2226 2226
                 array($post_id)
2227 2227
             )
2228 2228
         );
2229 2229
 
2230 2230
         if (!empty($attachment_data)) {
2231
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2231
+            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2232 2232
         }
2233 2233
 
2234 2234
 
2235
-        $table_name = $plugin_prefix . $post_type . '_detail';
2235
+        $table_name = $plugin_prefix.$post_type.'_detail';
2236 2236
 
2237
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2237
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
2238 2238
 
2239 2239
         geodir_set_wp_featured_image($post_id);
2240 2240
 
@@ -2262,9 +2262,9 @@  discard block
 block discarded – undo
2262 2262
 
2263 2263
     foreach ($all_postypes as $posttype) {
2264 2264
 
2265
-        $tablename = $plugin_prefix . $posttype . '_detail';
2265
+        $tablename = $plugin_prefix.$posttype.'_detail';
2266 2266
 
2267
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2267
+        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
2268 2268
 
2269 2269
         if (!empty($get_post_data)) {
2270 2270
 
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 
2273 2273
                 $post_id = $data->post_id;
2274 2274
 
2275
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2275
+                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
2276 2276
 
2277 2277
                 if (!empty($attachment_data)) {
2278 2278
 
@@ -2289,22 +2289,22 @@  discard block
 block discarded – undo
2289 2289
 
2290 2290
                         $file_name = $file_info['basename'];
2291 2291
 
2292
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2292
+                        $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;
2293 2293
 
2294 2294
                         if (!file_exists($img_arr['path'])) {
2295 2295
 
2296
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2296
+                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
2297 2297
 
2298 2298
                         }
2299 2299
 
2300 2300
                     }
2301 2301
 
2302
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2302
+                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
2303 2303
 
2304 2304
                     if (!empty($attachment_data)) {
2305 2305
 
2306 2306
                         if ($attachment_data->ID)
2307
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2307
+                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
2308 2308
 
2309 2309
                     } else {
2310 2310
 
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
 
2319 2319
                     }
2320 2320
 
2321
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2321
+                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
2322 2322
 
2323 2323
                     geodir_set_wp_featured_image($post_id);
2324 2324
 
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
 {
2348 2348
 
2349 2349
     if (!get_option('geodir_default_rating_star_icon')) {
2350
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2350
+        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
2351 2351
     }
2352 2352
 
2353 2353
 }
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 function geodir_user_post_listing_count($user_id = 0)
2368 2368
 {
2369 2369
     global $wpdb, $plugin_prefix, $current_user;
2370
-    if(!$user_id){
2370
+    if (!$user_id) {
2371 2371
         $user_id = $current_user->ID;
2372 2372
     }
2373 2373
 
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
     $user_listing = array();
2377 2377
     if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2378 2378
         foreach ($all_posts as $ptype) {
2379
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2379
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2380 2380
 
2381 2381
             if ($total_posts > 0) {
2382 2382
                 $user_listing[$ptype] = $total_posts;
@@ -2417,19 +2417,19 @@  discard block
 block discarded – undo
2417 2417
 
2418 2418
         $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2419 2419
         //remove video and special offers if it is already set to show
2420
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2420
+        if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) {
2421 2421
             $unset_video = true;
2422 2422
         }
2423 2423
 
2424
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2424
+        if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) {
2425 2425
             $unset_special_offers = true;
2426 2426
         }
2427
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2428
-            foreach($custom_fields as $key => $custom_field){
2429
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2427
+        if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) {
2428
+            foreach ($custom_fields as $key => $custom_field) {
2429
+                if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) {
2430 2430
                     unset($custom_fields[$key]);
2431 2431
                 }
2432
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2432
+                if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) {
2433 2433
                     unset($custom_fields[$key]);
2434 2434
                 }
2435 2435
             }
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
                     $post->{$field_name} = $_REQUEST[$field_name];
2447 2447
                 }
2448 2448
 
2449
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2449
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2450 2450
                     if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2451 2451
                         continue;
2452 2452
                     }
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
                     $post->{$field_name} = $_REQUEST[$field_name];
2480 2480
                 }
2481 2481
 
2482
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2482
+                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
2483 2483
                     $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2484 2484
                     $site_title = trim($field['site_title']);
2485 2485
                     $type = $field;
@@ -2495,21 +2495,21 @@  discard block
 block discarded – undo
2495 2495
                         $variables_array['label'] = __($type['site_title'], 'geodirectory');
2496 2496
                         $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2497 2497
 
2498
-                    }else{
2498
+                    } else {
2499 2499
                         $i = 0;
2500 2500
                         $fieldset_count++;
2501 2501
                         $field_set_start = 1;
2502
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2502
+                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;
2503 2503
                         $fieldset_arr[$fieldset_count]['label'] = $label;
2504 2504
                     }
2505 2505
 
2506 2506
 
2507
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2507
+                    if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
2508 2508
                     $type = stripslashes_deep($type); // strip slashes
2509
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2509
+                    if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
2510 2510
                     $html = '';
2511 2511
                     $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2512
-                    if($html_var=='post'){$html_var='post_address';}
2512
+                    if ($html_var == 'post') {$html_var = 'post_address'; }
2513 2513
                     $field_icon = geodir_field_icon_proccess($type);
2514 2514
                     $filed_type = $type['type'];
2515 2515
 
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
                      * @param string $fields_location The location the field is to be show.
2523 2523
                      * @param array $type The array of field values.
2524 2524
                      */
2525
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2525
+                    $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
2526 2526
 
2527 2527
 
2528 2528
                     /**
@@ -2568,7 +2568,7 @@  discard block
 block discarded – undo
2568 2568
                                  * @param string $htmlvar_name The field HTML var name.
2569 2569
                                  */
2570 2570
                                 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2571
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2571
+                                'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>'
2572 2572
                             );
2573 2573
                         }
2574 2574
                     } else {
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
             }
2633 2633
             $status .= ")</strong>";
2634 2634
 
2635
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2635
+            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
2636 2636
         }
2637 2637
     }
2638 2638
 
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
  * @return array Modified class array.
2702 2702
  */
2703 2703
 function geodir_body_class_active_map($classes = array()) {
2704
-    $classes[] = 'gd-map-' . geodir_map_name();
2704
+    $classes[] = 'gd-map-'.geodir_map_name();
2705 2705
 
2706 2706
     return $classes;
2707 2707
 }
@@ -2716,7 +2716,7 @@  discard block
 block discarded – undo
2716 2716
  * @return string Modified class string.
2717 2717
  */
2718 2718
 function geodir_admin_body_class_active_map($class = '') {    
2719
-    $class .= ' gd-map-' . geodir_map_name();
2719
+    $class .= ' gd-map-'.geodir_map_name();
2720 2720
 
2721 2721
     return $class;
2722 2722
 }
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
  * @return array Translation texts.
2737 2737
  */
2738 2738
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2739
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2739
+    $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
2740 2740
 
2741 2741
     $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2742 2742
 
@@ -2802,17 +2802,17 @@  discard block
 block discarded – undo
2802 2802
  * @param array $args The array of menu arguments.
2803 2803
  * @return array The modified arguments.
2804 2804
  */
2805
-function geodir_add_nav_menu_class( $args )
2805
+function geodir_add_nav_menu_class($args)
2806 2806
 {
2807 2807
 
2808
-        if(isset($args['menu_class'])){
2808
+        if (isset($args['menu_class'])) {
2809 2809
             $args['menu_class'] = $args['menu_class']." gd-menu-z";
2810 2810
         }
2811 2811
     
2812 2812
     return $args;
2813 2813
 }
2814 2814
 
2815
-add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
2815
+add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class');
2816 2816
 
2817 2817
 /**
2818 2818
  * Filters WordPress locale ID.
@@ -2852,10 +2852,10 @@  discard block
 block discarded – undo
2852 2852
         }
2853 2853
         
2854 2854
         add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2855
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2856
-		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2855
+        add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1);
2856
+		add_action('geodir_after_search_form', 'geodir_wpml_add_language_input_field');
2857 2857
         if (is_admin()) {
2858
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2858
+            add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1);
2859 2859
         }
2860 2860
     }
2861 2861
 }
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
         }        
2885 2885
         
2886 2886
         if (!empty($keep_vars)) {
2887
-            foreach ( $languages as $code => $url) {
2887
+            foreach ($languages as $code => $url) {
2888 2888
                 $filter_url = $url['url'];
2889 2889
                 
2890 2890
                 foreach ($keep_vars as $var) {
@@ -2903,7 +2903,7 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
     return $languages;
2905 2905
 }
2906
-add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2906
+add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1);
2907 2907
 
2908 2908
 /**
2909 2909
  * Remove Yoast SEO hook if disabled on GD pages.
@@ -2911,18 +2911,18 @@  discard block
 block discarded – undo
2911 2911
  * @since 1.6.18
2912 2912
  *
2913 2913
  */
2914
-function geodir_remove_yoast_seo_metas(){
2915
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2914
+function geodir_remove_yoast_seo_metas() {
2915
+    if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) {
2916 2916
         $wpseo = WPSEO_Frontend::get_instance();
2917 2917
         
2918
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2919
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2920
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2921
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2922
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2923
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2918
+        remove_action('wp_head', array($wpseo, 'metadesc'), 6);
2919
+        remove_action('wp_head', array($wpseo, 'metakeywords'), 11);
2920
+        remove_filter('pre_get_document_title', array($wpseo, 'title'), 15);
2921
+        remove_filter('wp_title', array($wpseo, 'title'), 15, 3);
2922
+        remove_filter('thematic_doctitle', array($wpseo, 'title'), 15);
2923
+        remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99);
2924 2924
         
2925
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2925
+        remove_action('template_redirect', 'wpseo_frontend_head_init', 999);
2926 2926
     }
2927 2927
 }
2928 2928
 
@@ -2937,22 +2937,22 @@  discard block
 block discarded – undo
2937 2937
  *
2938 2938
  */
2939 2939
  function geodir_wpml_ajax_set_guest_lang() {    
2940
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2941
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2940
+    if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) {
2941
+        if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) {
2942 2942
             global $sitepress;
2943 2943
             
2944 2944
             $referer = wp_get_referer();
2945 2945
             
2946 2946
             $current_lang = $sitepress->get_current_language();
2947
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2947
+            $referrer_lang = $sitepress->get_language_from_url($referer);
2948 2948
             
2949
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2949
+            if ($referrer_lang && $current_lang != $referrer_lang) {
2950 2950
                 $_GET['lang'] = $referrer_lang;
2951 2951
             }
2952 2952
         }
2953 2953
     }
2954 2954
 }
2955
-add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2955
+add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1);
2956 2956
 
2957 2957
 /**
2958 2958
  * Change country slug czech-republic to czechia and redirect.
@@ -2973,18 +2973,18 @@  discard block
 block discarded – undo
2973 2973
         }
2974 2974
         
2975 2975
         $redirect = false;
2976
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2976
+        if (strpos($current_url, '/'.$search.'/') !== false) {
2977 2977
             $redirect = true;
2978
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2978
+            $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1);
2979 2979
         }
2980 2980
         
2981 2981
         if ($has_slash != "/") {
2982 2982
             $current_url = trim($current_url, '/');
2983 2983
         }
2984 2984
         
2985
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2985
+        if (strpos($current_url, 'gd_country='.$search) !== false) {
2986 2986
             $redirect = true;
2987
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2987
+            $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url);
2988 2988
         }
2989 2989
 
2990 2990
         if ($redirect) {
@@ -3010,10 +3010,10 @@  discard block
 block discarded – undo
3010 3010
  * @param int    $post_parent   Post parent ID
3011 3011
  * @param string $original_slug The original post slug.
3012 3012
  */
3013
-function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3013
+function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
3014 3014
     global $wpdb, $sitepress;
3015 3015
     
3016
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3016
+    if ($post_type && strpos($post_type, 'gd_') === 0) {
3017 3017
         $wpml_post_join = "";
3018 3018
         $wpml_post_where = "";
3019 3019
         $wpml_term_join = "";
@@ -3027,28 +3027,28 @@  discard block
 block discarded – undo
3027 3027
             }
3028 3028
             
3029 3029
             $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3030
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3030
+            $wpml_post_where = " AND icl_t.language_code = '".$post_language."'";
3031 3031
             
3032 3032
             $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3033
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3033
+            $wpml_term_where = " AND icl_t.language_code = '".$post_language."'";
3034 3034
         }
3035 3035
 
3036
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3036
+        $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug));
3037 3037
 
3038
-        if ( $term_slug_check ) {
3038
+        if ($term_slug_check) {
3039 3039
             $suffix = 1;
3040 3040
             
3041 3041
             do {
3042
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3042
+                $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix";
3043 3043
                 
3044
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3044
+                $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug));
3045 3045
                 
3046
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3046
+                $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID));
3047 3047
                 
3048 3048
                 $term_slug_check = $term_check || $post_check;
3049 3049
                 
3050 3050
                 $suffix++;
3051
-            } while ( $term_slug_check );
3051
+            } while ($term_slug_check);
3052 3052
             
3053 3053
             $slug = $alt_slug;
3054 3054
         }
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
     
3057 3057
     return $slug;
3058 3058
 }
3059
-add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3059
+add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6);
3060 3060
 
3061 3061
 /**
3062 3062
  * Check whether a post name with slug exists or not.
@@ -3073,51 +3073,51 @@  discard block
 block discarded – undo
3073 3073
  * @param int $term_id The term ID.
3074 3074
  * @return bool true when exists. false when not exists.
3075 3075
  */
3076
-function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3076
+function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) {
3077 3077
     global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3078 3078
     
3079
-    if ( $slug_exists ) {
3079
+    if ($slug_exists) {
3080 3080
         return $slug_exists;
3081 3081
     }
3082 3082
     
3083
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3083
+    if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) {
3084 3084
         $taxonomy = $gd_term_taxonomy[$term_id];
3085 3085
     } else {
3086
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3086
+        $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
3087 3087
         $gd_term_taxonomy[$term_id] = $taxonomy;
3088 3088
     }
3089 3089
     
3090
-    if ( empty($taxonomy) ) {
3090
+    if (empty($taxonomy)) {
3091 3091
         return $slug_exists;
3092 3092
     }
3093 3093
     
3094
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3094
+    if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) {
3095 3095
         $post_type = $gd_term_post_type[$term_id];
3096 3096
     } else {
3097
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3098
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3097
+        $taxonomy_obj = get_taxonomy($taxonomy);
3098
+        $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL;
3099 3099
     }
3100 3100
     
3101 3101
     $wpml_post_join = "";
3102 3102
     $wpml_post_where = "";
3103 3103
     
3104 3104
     if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3105
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3105
+        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language();
3106 3106
         if (!$term_language) {
3107 3107
             $term_language = $sitepress->get_current_language();
3108 3108
         }
3109 3109
         
3110 3110
         $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3111
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3111
+        $wpml_post_where = " AND icl_t.language_code = '".$term_language."'";
3112 3112
     }
3113 3113
     
3114
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3114
+    if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type))) {
3115 3115
         $slug_exists = true;
3116 3116
     }
3117 3117
 
3118 3118
     return $slug_exists;
3119 3119
 }
3120
-add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3120
+add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3);
3121 3121
 
3122 3122
 /**
3123 3123
  * Add hidden WPML language input field.
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 function geodir_wpml_add_language_input_field() {
3132 3132
 	global $sitepress;
3133 3133
 
3134
-	if ( function_exists( 'wpml_add_language_form_field_action' ) && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting( 'language_negotiation_type' ) ) {
3134
+	if (function_exists('wpml_add_language_form_field_action') && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting('language_negotiation_type')) {
3135 3135
 		wpml_add_language_form_field_action();
3136 3136
 	}
3137 3137
 }
@@ -3151,21 +3151,21 @@  discard block
 block discarded – undo
3151 3151
  *                              by the parent function. WP_Error otherwise.
3152 3152
  * @param array   $object_ids   List of term object IDs.
3153 3153
  */
3154
-function geodir_on_delete_term( $term, $tt_id, $taxonomy = '', $deleted_term = array(), $object_ids = array() ) {
3154
+function geodir_on_delete_term($term, $tt_id, $taxonomy = '', $deleted_term = array(), $object_ids = array()) {
3155 3155
 	global $wpdb, $plugin_prefix;
3156 3156
 
3157
-	if ( ! empty( $object_ids ) && strpos( $taxonomy, 'gd_' ) === 0 && substr( $taxonomy , -5 ) == '_tags' && ( $taxonomy_obj = get_taxonomy( $taxonomy ) ) ) {
3158
-		$post_type = !empty( $taxonomy_obj ) ? $taxonomy_obj->object_type[0] : '';
3157
+	if (!empty($object_ids) && strpos($taxonomy, 'gd_') === 0 && substr($taxonomy, -5) == '_tags' && ($taxonomy_obj = get_taxonomy($taxonomy))) {
3158
+		$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : '';
3159 3159
 
3160
-		if ( $post_type ) {
3161
-			$table = $plugin_prefix . $post_type . '_detail';
3160
+		if ($post_type) {
3161
+			$table = $plugin_prefix.$post_type.'_detail';
3162 3162
 		
3163
-			foreach ( $object_ids as $post_id ) {
3164
-				$post_tags = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'names' ) );
3165
-				$post_tags = ! empty( $post_tags ) && ! is_wp_error( $post_tags ) ? array_map( 'trim', $post_tags ) : '';
3166
-				$post_tags = ! empty( $post_tags ) ? implode( ',', array_filter( array_unique( $post_tags ) ) ) : '';
3163
+			foreach ($object_ids as $post_id) {
3164
+				$post_tags = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'names'));
3165
+				$post_tags = !empty($post_tags) && !is_wp_error($post_tags) ? array_map('trim', $post_tags) : '';
3166
+				$post_tags = !empty($post_tags) ? implode(',', array_filter(array_unique($post_tags))) : '';
3167 3167
 
3168
-				$wpdb->query( $wpdb->prepare( "UPDATE {$table} SET post_tags = %s WHERE post_id = %d", array( $post_tags, $post_id ) ) );
3168
+				$wpdb->query($wpdb->prepare("UPDATE {$table} SET post_tags = %s WHERE post_id = %d", array($post_tags, $post_id)));
3169 3169
 			}
3170 3170
 		}
3171 3171
 	}
Please login to merge, or discard this patch.
Indentation   +1212 added lines, -1212 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function geodir_unset_prev_theme_nav_location($newname)
225 225
 {
226
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
-    if ($geodir_theme_location) {
228
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
229
-    } else {
230
-        update_option('geodir_theme_location_nav', '');
231
-    }
226
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
227
+	if ($geodir_theme_location) {
228
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
229
+	} else {
230
+		update_option('geodir_theme_location_nav', '');
231
+	}
232 232
 }
233 233
 
234 234
 /// add action for theme switch to blank previous theme navigation location setting
@@ -249,42 +249,42 @@  discard block
 block discarded – undo
249 249
  */
250 250
 function geodir_add_post_filters()
251 251
 {
252
-    /**
253
-     * Contains all function for filtering listing.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     */
258
-    include_once('geodirectory-functions/listing_filters.php');
252
+	/**
253
+	 * Contains all function for filtering listing.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 */
258
+	include_once('geodirectory-functions/listing_filters.php');
259 259
     
260
-    // Theme My Login compatibility fix
261
-    if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
-        remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
-    }
260
+	// Theme My Login compatibility fix
261
+	if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
262
+		remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) );
263
+	}
264 264
     
265
-    if ( isset( $_REQUEST['geodir_search'] ) ) {
266
-        add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
-        add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
-    }
265
+	if ( isset( $_REQUEST['geodir_search'] ) ) {
266
+		add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 );
267
+		add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 );
268
+	}
269 269
 }
270 270
 
271 271
 
272 272
 if (!function_exists('geodir_init_defaults')) {
273
-    /**
274
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
-     *
276
-     * @since 1.0.0
277
-     * @package GeoDirectory
278
-     */
279
-    function geodir_init_defaults()
280
-    {
281
-        if (function_exists('geodir_register_defaults')) {
273
+	/**
274
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
275
+	 *
276
+	 * @since 1.0.0
277
+	 * @package GeoDirectory
278
+	 */
279
+	function geodir_init_defaults()
280
+	{
281
+		if (function_exists('geodir_register_defaults')) {
282 282
 
283
-            geodir_register_defaults();
283
+			geodir_register_defaults();
284 284
 
285
-        }
285
+		}
286 286
 
287
-    }
287
+	}
288 288
 }
289 289
 
290 290
 
@@ -306,26 +306,26 @@  discard block
 block discarded – undo
306 306
 // CALLED ON 'sidebars_widgets' FILTER
307 307
 
308 308
 if (!function_exists('geodir_restrict_widget')) {
309
-    /**
310
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
-     *
312
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
-     * @since 1.0.0
315
-     * @package GeoDirectory
316
-     */
317
-    function geodir_restrict_widget()
318
-    {
319
-        global $is_listing, $is_single_place;
309
+	/**
310
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
311
+	 *
312
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
313
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
314
+	 * @since 1.0.0
315
+	 * @package GeoDirectory
316
+	 */
317
+	function geodir_restrict_widget()
318
+	{
319
+		global $is_listing, $is_single_place;
320 320
 
321
-        // set is listing	
322
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
321
+		// set is listing	
322
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
323 323
 
324
-        // set is single place
325
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
324
+		// set is single place
325
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
326 326
 
327 327
 
328
-    }
328
+	}
329 329
 }
330 330
 
331 331
 
@@ -346,31 +346,31 @@  discard block
 block discarded – undo
346 346
  */
347 347
 function geodir_detail_page_sidebar_content_sorting()
348 348
 {
349
-    $arr_detail_page_sidebar_content =
350
-        /**
351
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
352
-         *
353
-         * This filter can be used to remove sections of the details page sidebar,
354
-         * add new sections or rearrange the order of the sections.
355
-         *
356
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
357
-         * @since 1.0.0
358
-         */
359
-        apply_filters('geodir_detail_page_sidebar_content',
360
-            array('geodir_social_sharing_buttons',
361
-                'geodir_detail_page_google_analytics',
362
-                'geodir_edit_post_link',
363
-                'geodir_detail_page_review_rating',
364
-                'geodir_detail_page_more_info'
365
-            ) // end of array 
366
-        ); // end of apply filter
367
-    if (!empty($arr_detail_page_sidebar_content)) {
368
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
369
-            if (function_exists($content_function)) {
370
-                add_action('geodir_detail_page_sidebar', $content_function);
371
-            }
372
-        }
373
-    }
349
+	$arr_detail_page_sidebar_content =
350
+		/**
351
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
352
+		 *
353
+		 * This filter can be used to remove sections of the details page sidebar,
354
+		 * add new sections or rearrange the order of the sections.
355
+		 *
356
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
357
+		 * @since 1.0.0
358
+		 */
359
+		apply_filters('geodir_detail_page_sidebar_content',
360
+			array('geodir_social_sharing_buttons',
361
+				'geodir_detail_page_google_analytics',
362
+				'geodir_edit_post_link',
363
+				'geodir_detail_page_review_rating',
364
+				'geodir_detail_page_more_info'
365
+			) // end of array 
366
+		); // end of apply filter
367
+	if (!empty($arr_detail_page_sidebar_content)) {
368
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
369
+			if (function_exists($content_function)) {
370
+				add_action('geodir_detail_page_sidebar', $content_function);
371
+			}
372
+		}
373
+	}
374 374
 }
375 375
 
376 376
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_add_to_favourite_link()
387 387
 {
388
-    global $post, $preview;
389
-    if (!$preview && geodir_is_page('detail')) {
390
-        ?>
388
+	global $post, $preview;
389
+	if (!$preview && geodir_is_page('detail')) {
390
+		?>
391 391
         <p class="edit_link">
392 392
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
393 393
         </p>
394 394
     <?php
395
-    }
395
+	}
396 396
 }
397 397
 
398 398
 /**
@@ -406,41 +406,41 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function geodir_social_sharing_buttons()
408 408
 {
409
-    global $preview;
410
-    ob_start(); // Start  buffering;
411
-    /**
412
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
-     *
414
-     * @since 1.0.0
415
-     */
416
-    do_action('geodir_before_social_sharing_buttons');
417
-    if (!$preview) {
418
-        ?>
409
+	global $preview;
410
+	ob_start(); // Start  buffering;
411
+	/**
412
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
413
+	 *
414
+	 * @since 1.0.0
415
+	 */
416
+	do_action('geodir_before_social_sharing_buttons');
417
+	if (!$preview) {
418
+		?>
419 419
         <div class="likethis">
420 420
             <?php geodir_twitter_tweet_button(); ?>
421 421
             <?php geodir_fb_like_button(); ?>
422 422
             <?php geodir_google_plus_button(); ?>
423 423
         </div>
424 424
     <?php
425
-    }// end of if, if its a preview or not
426
-
427
-    /**
428
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
-     *
430
-     * @since 1.0.0
431
-     */
432
-    do_action('geodir_after_social_sharing_buttons');
433
-    $content_html = ob_get_clean();
434
-    if (trim($content_html) != '')
435
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
-        /**
438
-         * Filter the geodir_social_sharing_buttons() function content.
439
-         *
440
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
-         */
442
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
-    }
425
+	}// end of if, if its a preview or not
426
+
427
+	/**
428
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
429
+	 *
430
+	 * @since 1.0.0
431
+	 */
432
+	do_action('geodir_after_social_sharing_buttons');
433
+	$content_html = ob_get_clean();
434
+	if (trim($content_html) != '')
435
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
436
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
437
+		/**
438
+		 * Filter the geodir_social_sharing_buttons() function content.
439
+		 *
440
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
441
+		 */
442
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
443
+	}
444 444
 
445 445
 
446 446
 }
@@ -458,46 +458,46 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_edit_post_link()
460 460
 {
461
-    global $post, $preview;
462
-    ob_start(); // Start buffering;
463
-    /**
464
-     * This is called before the edit post link html in the function geodir_edit_post_link()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_before_edit_post_link');
469
-    if (!$preview) {
470
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
461
+	global $post, $preview;
462
+	ob_start(); // Start buffering;
463
+	/**
464
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_before_edit_post_link');
469
+	if (!$preview) {
470
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
471 471
         
472
-        if ($is_current_user_owner) {
473
-            $post_id = $post->ID;
472
+		if ($is_current_user_owner) {
473
+			$post_id = $post->ID;
474 474
             
475
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
-                $post_id = (int)$_REQUEST['pid'];
477
-            }
475
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
476
+				$post_id = (int)$_REQUEST['pid'];
477
+			}
478 478
 
479
-            $postlink = get_permalink(geodir_add_listing_page_id());
480
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
-        }
483
-    }// end of if, if its a preview or not
484
-    /**
485
-     * This is called after the edit post link html in the function geodir_edit_post_link()
486
-     *
487
-     * @since 1.0.0
488
-     */
489
-    do_action('geodir_after_edit_post_link');
490
-    $content_html = ob_get_clean();
491
-    if (trim($content_html) != '')
492
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
-        /**
495
-         * Filter the geodir_edit_post_link() function content.
496
-         *
497
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
498
-         */
499
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
-    }
479
+			$postlink = get_permalink(geodir_add_listing_page_id());
480
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
481
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
482
+		}
483
+	}// end of if, if its a preview or not
484
+	/**
485
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
486
+	 *
487
+	 * @since 1.0.0
488
+	 */
489
+	do_action('geodir_after_edit_post_link');
490
+	$content_html = ob_get_clean();
491
+	if (trim($content_html) != '')
492
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
493
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
494
+		/**
495
+		 * Filter the geodir_edit_post_link() function content.
496
+		 *
497
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
498
+		 */
499
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
500
+	}
501 501
 }
502 502
 
503 503
 /**
@@ -511,45 +511,45 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    if ( ! get_option( 'geodir_ga_stats' ) ) {
514
+	if ( ! get_option( 'geodir_ga_stats' ) ) {
515 515
 		return;
516 516
 	}
517 517
 	global $post,$preview;
518
-    if($preview){return '';}
519
-    $package_info = array();
520
-    $package_info = geodir_post_package_info($package_info, $post);
518
+	if($preview){return '';}
519
+	$package_info = array();
520
+	$package_info = geodir_post_package_info($package_info, $post);
521 521
 
522
-    $id = trim(get_option('geodir_ga_account_id'));
522
+	$id = trim(get_option('geodir_ga_account_id'));
523 523
 
524
-    if (!$id) {
525
-        return; //if no Google Analytics ID then bail.
526
-    }
524
+	if (!$id) {
525
+		return; //if no Google Analytics ID then bail.
526
+	}
527 527
 
528
-    ob_start(); // Start buffering;
529
-    /**
530
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
531
-     *
532
-     * @since 1.0.0
533
-     */
534
-    do_action('geodir_before_google_analytics');
528
+	ob_start(); // Start buffering;
529
+	/**
530
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
531
+	 *
532
+	 * @since 1.0.0
533
+	 */
534
+	do_action('geodir_before_google_analytics');
535 535
     
536
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
537
-    /**
538
-     * Filter the time interval to check & refresh new users results.
539
-     *
540
-     * @since 1.5.9
541
-     *
542
-     * @param int $refresh_time Time interval to check & refresh new users results.
543
-     */
544
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
545
-    $refresh_time = absint($refresh_time * 1000);
536
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
537
+	/**
538
+	 * Filter the time interval to check & refresh new users results.
539
+	 *
540
+	 * @since 1.5.9
541
+	 *
542
+	 * @param int $refresh_time Time interval to check & refresh new users results.
543
+	 */
544
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
545
+	$refresh_time = absint($refresh_time * 1000);
546 546
     
547
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
547
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
548 548
     
549
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
-    if (is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
551
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
552
-        ?>
549
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
+	if (is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
551
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
552
+		?>
553 553
         <script type="text/javascript">
554 554
             var gd_gaTimeOut;
555 555
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -801,15 +801,15 @@  discard block
 block discarded – undo
801 801
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
802 802
 
803 803
                     <?php
804
-                    // Here we list the shorthand days of the week so it can be used in translation.
805
-                    __("Mon",'geodirectory');
806
-                    __("Tue",'geodirectory');
807
-                    __("Wed",'geodirectory');
808
-                    __("Thu",'geodirectory');
809
-                    __("Fri",'geodirectory');
810
-                    __("Sat",'geodirectory');
811
-                    __("Sun",'geodirectory');
812
-                    ?>
804
+					// Here we list the shorthand days of the week so it can be used in translation.
805
+					__("Mon",'geodirectory');
806
+					__("Tue",'geodirectory');
807
+					__("Wed",'geodirectory');
808
+					__("Thu",'geodirectory');
809
+					__("Fri",'geodirectory');
810
+					__("Sat",'geodirectory');
811
+					__("Sun",'geodirectory');
812
+					?>
813 813
 
814 814
                     labels = [
815 815
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1058,24 +1058,24 @@  discard block
 block discarded – undo
1058 1058
         </span>
1059 1059
 
1060 1060
     <?php
1061
-    }
1062
-    /**
1063
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1064
-     *
1065
-     * @since 1.0.0
1066
-     */
1067
-    do_action('geodir_after_google_analytics');
1068
-    $content_html = ob_get_clean();
1069
-    if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072
-        /**
1073
-         * Filter the geodir_edit_post_link() function content.
1074
-         *
1075
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1076
-         */
1077
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1078
-    }
1061
+	}
1062
+	/**
1063
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1064
+	 *
1065
+	 * @since 1.0.0
1066
+	 */
1067
+	do_action('geodir_after_google_analytics');
1068
+	$content_html = ob_get_clean();
1069
+	if (trim($content_html) != '')
1070
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072
+		/**
1073
+		 * Filter the geodir_edit_post_link() function content.
1074
+		 *
1075
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1076
+		 */
1077
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1078
+	}
1079 1079
 }
1080 1080
 
1081 1081
 /**
@@ -1092,94 +1092,94 @@  discard block
 block discarded – undo
1092 1092
  */
1093 1093
 function geodir_detail_page_review_rating()
1094 1094
 {
1095
-    global $post, $preview, $post_images;
1095
+	global $post, $preview, $post_images;
1096 1096
     
1097
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1098
-        return;
1099
-    }
1100
-    ob_start(); // Start  buffering;
1101
-    /**
1102
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1103
-     *
1104
-     * This is called outside the check for an actual rating and the check for preview page.
1105
-     *
1106
-     * @since 1.0.0
1107
-     */
1108
-    do_action('geodir_before_detail_page_review_rating');
1109
-
1110
-    $comment_count = geodir_get_review_count_total($post->ID);
1111
-    $post_avgratings = geodir_get_post_rating($post->ID);
1112
-
1113
-    if ($post_avgratings != 0 && !$preview) {
1114
-        /**
1115
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1116
-         *
1117
-         * This is called inside the check for an actual rating and the check for preview page.
1118
-         *
1119
-         * @since 1.0.0
1120
-         * @param float $post_avgratings Average rating for the current post.
1121
-         * @param int $post->ID Current post ID.
1122
-         */
1123
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
-
1125
-        $html = '<p style=" float:left;">';
1126
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1127
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1128
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1097
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1098
+		return;
1099
+	}
1100
+	ob_start(); // Start  buffering;
1101
+	/**
1102
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1103
+	 *
1104
+	 * This is called outside the check for an actual rating and the check for preview page.
1105
+	 *
1106
+	 * @since 1.0.0
1107
+	 */
1108
+	do_action('geodir_before_detail_page_review_rating');
1109
+
1110
+	$comment_count = geodir_get_review_count_total($post->ID);
1111
+	$post_avgratings = geodir_get_post_rating($post->ID);
1112
+
1113
+	if ($post_avgratings != 0 && !$preview) {
1114
+		/**
1115
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1116
+		 *
1117
+		 * This is called inside the check for an actual rating and the check for preview page.
1118
+		 *
1119
+		 * @since 1.0.0
1120
+		 * @param float $post_avgratings Average rating for the current post.
1121
+		 * @param int $post->ID Current post ID.
1122
+		 */
1123
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
+
1125
+		$html = '<p style=" float:left;">';
1126
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1127
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1128
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1129 1129
        
1130 1130
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1131 1131
 	   
1132 1132
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1133 1133
 
1134
-        $html .= '<span class="item">';
1135
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1134
+		$html .= '<span class="item">';
1135
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1136 1136
 
1137
-        if ($post_images) {
1138
-            foreach ($post_images as $img) {
1139
-                $post_img = $img->src;
1140
-                break;
1141
-            }
1142
-        }
1143
-
1144
-        if (isset($post_img) && $post_img) {
1145
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1146
-        }
1147
-
1148
-        $html .= '</span>';
1149
-
1150
-        echo $html .= '</div>';
1151
-        /**
1152
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1153
-         *
1154
-         * This is called inside the check for an actual rating and the check for preview page.
1155
-         *
1156
-         * @since 1.0.0
1157
-         * @param float $post_avgratings Average rating for the current post.
1158
-         * @param int $post->ID Current post ID.
1159
-         */
1160
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1161
-    }
1162
-    /**
1163
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1164
-     *
1165
-     * This is called outside the check for an actual rating and the check for preview page.
1166
-     *
1167
-     * @since 1.0.0
1168
-     */
1169
-    do_action('geodir_after_detail_page_review_rating');
1170
-    $content_html = ob_get_clean();
1171
-    if (trim($content_html) != '') {
1172
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1173
-    }
1174
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1175
-        /**
1176
-         * Filter the geodir_detail_page_review_rating() function content.
1177
-         *
1178
-         * @since 1.0.0
1179
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1180
-         */
1181
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1182
-    }
1137
+		if ($post_images) {
1138
+			foreach ($post_images as $img) {
1139
+				$post_img = $img->src;
1140
+				break;
1141
+			}
1142
+		}
1143
+
1144
+		if (isset($post_img) && $post_img) {
1145
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1146
+		}
1147
+
1148
+		$html .= '</span>';
1149
+
1150
+		echo $html .= '</div>';
1151
+		/**
1152
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1153
+		 *
1154
+		 * This is called inside the check for an actual rating and the check for preview page.
1155
+		 *
1156
+		 * @since 1.0.0
1157
+		 * @param float $post_avgratings Average rating for the current post.
1158
+		 * @param int $post->ID Current post ID.
1159
+		 */
1160
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1161
+	}
1162
+	/**
1163
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1164
+	 *
1165
+	 * This is called outside the check for an actual rating and the check for preview page.
1166
+	 *
1167
+	 * @since 1.0.0
1168
+	 */
1169
+	do_action('geodir_after_detail_page_review_rating');
1170
+	$content_html = ob_get_clean();
1171
+	if (trim($content_html) != '') {
1172
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1173
+	}
1174
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1175
+		/**
1176
+		 * Filter the geodir_detail_page_review_rating() function content.
1177
+		 *
1178
+		 * @since 1.0.0
1179
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1180
+		 */
1181
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1182
+	}
1183 1183
 }
1184 1184
 
1185 1185
 /**
@@ -1191,35 +1191,35 @@  discard block
 block discarded – undo
1191 1191
  */
1192 1192
 function geodir_detail_page_more_info()
1193 1193
 {
1194
-    ob_start(); // Start  buffering;
1195
-    /**
1196
-     * This is called before the info section html.
1197
-     *
1198
-     * @since 1.0.0
1199
-     */
1200
-    do_action('geodir_before_detail_page_more_info');
1201
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1202
-        echo $geodir_post_detail_fields;
1203
-    }
1204
-    /**
1205
-     * This is called after the info section html.
1206
-     *
1207
-     * @since 1.0.0
1208
-     */
1209
-    do_action('geodir_after_detail_page_more_info');
1210
-
1211
-    $content_html = ob_get_clean();
1212
-    if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215
-        /**
1216
-         * Filter the output html for function geodir_detail_page_more_info().
1217
-         *
1218
-         * @since 1.0.0
1219
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1220
-         */
1221
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1222
-    }
1194
+	ob_start(); // Start  buffering;
1195
+	/**
1196
+	 * This is called before the info section html.
1197
+	 *
1198
+	 * @since 1.0.0
1199
+	 */
1200
+	do_action('geodir_before_detail_page_more_info');
1201
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1202
+		echo $geodir_post_detail_fields;
1203
+	}
1204
+	/**
1205
+	 * This is called after the info section html.
1206
+	 *
1207
+	 * @since 1.0.0
1208
+	 */
1209
+	do_action('geodir_after_detail_page_more_info');
1210
+
1211
+	$content_html = ob_get_clean();
1212
+	if (trim($content_html) != '')
1213
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215
+		/**
1216
+		 * Filter the output html for function geodir_detail_page_more_info().
1217
+		 *
1218
+		 * @since 1.0.0
1219
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1220
+		 */
1221
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1222
+	}
1223 1223
 }
1224 1224
 
1225 1225
 
@@ -1233,15 +1233,15 @@  discard block
 block discarded – undo
1233 1233
  */
1234 1234
 function geodir_localize_all_js_msg()
1235 1235
 {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
1236
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1237
-        $ajax_url = admin_url('admin-ajax.php');
1238
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1239
-        $ajax_url = admin_url('admin-ajax.php');
1240
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1241
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1242
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1243
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1244
-    }
1236
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1237
+		$ajax_url = admin_url('admin-ajax.php');
1238
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1239
+		$ajax_url = admin_url('admin-ajax.php');
1240
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1241
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1242
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1243
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1244
+	}
1245 1245
 	
1246 1246
 	/**
1247 1247
 	 * Filter the allowed image type extensions for post images.
@@ -1251,62 +1251,62 @@  discard block
 block discarded – undo
1251 1251
 	 */
1252 1252
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1253 1253
 	
1254
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1255
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1256
-    $default_marker_width = $default_marker_size['w'];
1257
-    $default_marker_height = $default_marker_size['h'];
1254
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1255
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1256
+	$default_marker_width = $default_marker_size['w'];
1257
+	$default_marker_height = $default_marker_size['h'];
1258 1258
     
1259
-    $arr_alert_msg = array(
1260
-        'geodir_plugin_url' => geodir_plugin_url(),
1261
-        'geodir_admin_ajax_url' => $ajax_url,
1262
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1263
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1264
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1265
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1266
-        //start not show alert msg
1267
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1268
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1269
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1270
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1271
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1272
-        // end not show alert msg
1273
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1274
-        'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1275
-        //start not show alert msg
1276
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1277
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1278
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1279
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1280
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1281
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1282
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1283
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1284
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1285
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1286
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1287
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1288
-        'geodir_default_marker_icon' => $default_marker_icon,
1289
-        'geodir_default_marker_w' => $default_marker_width,
1290
-        'geodir_default_marker_h' => $default_marker_height,
1291
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1292
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1293
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1294
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1295
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1296
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1297
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1298
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1299
-        'err_empty_review' => __('Please type a review.', 'geodirectory'),
1300
-        'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1301
-        /* on/off dragging for phone devices */
1302
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1303
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1304
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1305
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1306
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1307
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1308
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1309
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1259
+	$arr_alert_msg = array(
1260
+		'geodir_plugin_url' => geodir_plugin_url(),
1261
+		'geodir_admin_ajax_url' => $ajax_url,
1262
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1263
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1264
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1265
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1266
+		//start not show alert msg
1267
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1268
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1269
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1270
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1271
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1272
+		// end not show alert msg
1273
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1274
+		'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
1275
+		//start not show alert msg
1276
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1277
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1278
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1279
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1280
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1281
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1282
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1283
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1284
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1285
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1286
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1287
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1288
+		'geodir_default_marker_icon' => $default_marker_icon,
1289
+		'geodir_default_marker_w' => $default_marker_width,
1290
+		'geodir_default_marker_h' => $default_marker_height,
1291
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1292
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1293
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1294
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1295
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1296
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1297
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1298
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1299
+		'err_empty_review' => __('Please type a review.', 'geodirectory'),
1300
+		'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1301
+		/* on/off dragging for phone devices */
1302
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1303
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1304
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1305
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1306
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1307
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1308
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1309
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1310 1310
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1311 1311
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1312 1312
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1314,43 +1314,43 @@  discard block
 block discarded – undo
1314 1314
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1315 1315
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1316 1316
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1317
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318
-        'geodir_map_name' => geodir_map_name(),
1319
-        'osmStart' => __('Start', 'geodirectory'),
1320
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1321
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1322
-        'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1323
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1324
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1325
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1326
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1327
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1328
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1317
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318
+		'geodir_map_name' => geodir_map_name(),
1319
+		'osmStart' => __('Start', 'geodirectory'),
1320
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1321
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1322
+		'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1323
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1324
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1325
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1326
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1327
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1328
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1329 1329
 		'mapLanguage' => geodir_get_map_default_language(),
1330 1330
 		'lightBox_txtImage' => addslashes(__('Image', 'geodirectory')),
1331 1331
 		'lightBox_txtOf' => addslashes(__('of', 'geodirectory')),
1332
-    );
1333
-
1334
-    /**
1335
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1336
-     *
1337
-     * With this filter you can add, remove or change translated JS strings.
1338
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1339
-     *
1340
-     * @since 1.0.0
1341
-     */
1342
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1343
-
1344
-    foreach ($arr_alert_msg as $key => $value) {
1345
-        if (!is_scalar($value))
1346
-            continue;
1347
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1348
-    }
1332
+	);
1333
+
1334
+	/**
1335
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1336
+	 *
1337
+	 * With this filter you can add, remove or change translated JS strings.
1338
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1339
+	 *
1340
+	 * @since 1.0.0
1341
+	 */
1342
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1349 1343
 
1350
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1351
-    echo '<script>';
1352
-    echo $script;
1353
-    echo '</script>';
1344
+	foreach ($arr_alert_msg as $key => $value) {
1345
+		if (!is_scalar($value))
1346
+			continue;
1347
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1348
+	}
1349
+
1350
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1351
+	echo '<script>';
1352
+	echo $script;
1353
+	echo '</script>';
1354 1354
 }
1355 1355
 
1356 1356
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1366,11 +1366,11 @@  discard block
 block discarded – undo
1366 1366
  */
1367 1367
 function geodir_admin_bar_site_menu($wp_admin_bar)
1368 1368
 {
1369
-    if (get_option("geodir_installed")) {
1370
-        if (current_user_can('manage_options')) {
1371
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1372
-        }
1373
-    }
1369
+	if (get_option("geodir_installed")) {
1370
+		if (current_user_can('manage_options')) {
1371
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1372
+		}
1373
+	}
1374 1374
 }
1375 1375
 
1376 1376
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1396,25 +1396,25 @@  discard block
 block discarded – undo
1396 1396
  */
1397 1397
 function geodir_store_sidebars()
1398 1398
 {
1399
-    global $geodir_sidebars;
1400
-    global $sidebars_widgets;
1401
-
1402
-    if (!is_array($sidebars_widgets))
1403
-        $sidebars_widgets = wp_get_sidebars_widgets();
1404
-    $geodir_old_sidebars = array();
1405
-
1406
-    if (is_array($geodir_sidebars)) {
1407
-        foreach ($geodir_sidebars as $val) {
1408
-            if (is_array($sidebars_widgets)) {
1409
-                if (array_key_exists($val, $sidebars_widgets))
1410
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1411
-                else
1412
-                    $geodir_old_sidebars[$val] = array();
1413
-            }
1414
-        }
1415
-    }
1416
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1417
-    geodir_option_version_backup('geodir_sidebars');
1399
+	global $geodir_sidebars;
1400
+	global $sidebars_widgets;
1401
+
1402
+	if (!is_array($sidebars_widgets))
1403
+		$sidebars_widgets = wp_get_sidebars_widgets();
1404
+	$geodir_old_sidebars = array();
1405
+
1406
+	if (is_array($geodir_sidebars)) {
1407
+		foreach ($geodir_sidebars as $val) {
1408
+			if (is_array($sidebars_widgets)) {
1409
+				if (array_key_exists($val, $sidebars_widgets))
1410
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1411
+				else
1412
+					$geodir_old_sidebars[$val] = array();
1413
+			}
1414
+		}
1415
+	}
1416
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1417
+	geodir_option_version_backup('geodir_sidebars');
1418 1418
 
1419 1419
 }
1420 1420
 
@@ -1428,28 +1428,28 @@  discard block
 block discarded – undo
1428 1428
  */
1429 1429
 function geodir_restore_sidebars()
1430 1430
 {
1431
-    global $sidebars_widgets;
1432
-
1433
-    if (!is_array($sidebars_widgets))
1434
-        $sidebars_widgets = wp_get_sidebars_widgets();
1435
-
1436
-    if (is_array($sidebars_widgets)) {
1437
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1438
-        if (is_array($geodir_old_sidebars)) {
1439
-            foreach ($geodir_old_sidebars as $key => $val) {
1440
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1441
-                {
1442
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1443
-                }
1431
+	global $sidebars_widgets;
1444 1432
 
1433
+	if (!is_array($sidebars_widgets))
1434
+		$sidebars_widgets = wp_get_sidebars_widgets();
1445 1435
 
1446
-            }
1447
-        }
1436
+	if (is_array($sidebars_widgets)) {
1437
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1438
+		if (is_array($geodir_old_sidebars)) {
1439
+			foreach ($geodir_old_sidebars as $key => $val) {
1440
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1441
+				{
1442
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1443
+				}
1448 1444
 
1449
-    }
1450 1445
 
1451
-    update_option('sidebars_widgets', $sidebars_widgets);
1452
-    update_option('geodir_sidebars', '');
1446
+			}
1447
+		}
1448
+
1449
+	}
1450
+
1451
+	update_option('sidebars_widgets', $sidebars_widgets);
1452
+	update_option('geodir_sidebars', '');
1453 1453
 }
1454 1454
 
1455 1455
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1462,9 +1462,9 @@  discard block
 block discarded – undo
1462 1462
  */
1463 1463
 function geodir_after_listing_post_gridview()
1464 1464
 {
1465
-    global $gridview_columns;
1465
+	global $gridview_columns;
1466 1466
 
1467
-    $gridview_columns = '';
1467
+	$gridview_columns = '';
1468 1468
 
1469 1469
 }
1470 1470
 
@@ -1492,11 +1492,11 @@  discard block
 block discarded – undo
1492 1492
  */
1493 1493
 function so_handle_038($url, $original_url, $_context)
1494 1494
 {
1495
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1496
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1497
-    }
1495
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1496
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1497
+	}
1498 1498
 
1499
-    return $url;
1499
+	return $url;
1500 1500
 }
1501 1501
 
1502 1502
 
@@ -1512,34 +1512,34 @@  discard block
 block discarded – undo
1512 1512
 function geodir_after_main_form_fields() {
1513 1513
 	global $gd_session;
1514 1514
 	
1515
-    if (get_option('geodir_accept_term_condition')) {
1516
-        global $post;
1517
-        $term_condition = '';
1518
-        if (isset($_REQUEST['backandedit'])) {
1519
-            $post = (object)$gd_session->get('listing');
1520
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1521
-        }
1522
-
1523
-        ?>
1515
+	if (get_option('geodir_accept_term_condition')) {
1516
+		global $post;
1517
+		$term_condition = '';
1518
+		if (isset($_REQUEST['backandedit'])) {
1519
+			$post = (object)$gd_session->get('listing');
1520
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1521
+		}
1522
+
1523
+		?>
1524 1524
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1525 1525
             <label>&nbsp;</label>
1526 1526
 
1527 1527
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1528 1528
 				<span style="display:block"> 
1529 1529
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1530
-                    echo 'checked="checked"';
1531
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1530
+					echo 'checked="checked"';
1531
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1532 1532
                        class="geodir_textfield" value="1"
1533 1533
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1534 1534
 				</span>
1535 1535
             </div>
1536 1536
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1537
-                    _e($required_msg, 'geodirectory');
1538
-                } ?></span>
1537
+					_e($required_msg, 'geodirectory');
1538
+				} ?></span>
1539 1539
         </div>
1540 1540
     <?php
1541 1541
 
1542
-    }
1542
+	}
1543 1543
 }
1544 1544
 
1545 1545
 
@@ -1564,42 +1564,42 @@  discard block
 block discarded – undo
1564 1564
  */
1565 1565
 function geodir_detail_page_tab_is_display($is_display, $tab)
1566 1566
 {
1567
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1567
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1568 1568
 
1569
-    if ($tab == 'post_profile') {
1570
-        /** This action is documented in geodirectory_template_actions.php */
1571
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1569
+	if ($tab == 'post_profile') {
1570
+		/** This action is documented in geodirectory_template_actions.php */
1571
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1572 1572
         
1573
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1574
-            $is_display = false;
1575
-        }
1576
-    }
1573
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1574
+			$is_display = false;
1575
+		}
1576
+	}
1577 1577
     
1578
-    if ($tab == 'post_info')
1579
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1578
+	if ($tab == 'post_info')
1579
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1580 1580
     
1581
-    if ($tab == 'post_images')
1582
-        $is_display = (!empty($post_images)) ? true : false;
1581
+	if ($tab == 'post_images')
1582
+		$is_display = (!empty($post_images)) ? true : false;
1583 1583
 
1584
-    if ($tab == 'post_video')
1585
-        $is_display = (!empty($video)) ? true : false;
1584
+	if ($tab == 'post_video')
1585
+		$is_display = (!empty($video)) ? true : false;
1586 1586
 
1587
-    if ($tab == 'special_offers')
1588
-        $is_display = (!empty($special_offers)) ? true : false;
1587
+	if ($tab == 'special_offers')
1588
+		$is_display = (!empty($special_offers)) ? true : false;
1589 1589
 
1590
-    if ($tab == 'reviews')
1591
-        $is_display = (geodir_is_page('detail')) ? true : false;
1590
+	if ($tab == 'reviews')
1591
+		$is_display = (geodir_is_page('detail')) ? true : false;
1592 1592
 
1593
-    if ($tab == 'related_listing') {
1594
-       $message = __('No listings found which match your selection.', 'geodirectory');
1593
+	if ($tab == 'related_listing') {
1594
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1595 1595
        
1596
-       /** This action is documented in geodirectory-functions/template_functions.php */
1597
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1596
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1597
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1598 1598
        
1599
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1600
-    }
1599
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1600
+	}
1601 1601
 
1602
-    return $is_display;
1602
+	return $is_display;
1603 1603
 }
1604 1604
 
1605 1605
 
@@ -1615,69 +1615,69 @@  discard block
 block discarded – undo
1615 1615
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1616 1616
  */
1617 1617
 function geodir_changes_in_custom_fields_table() {
1618
-    global $wpdb, $plugin_prefix;
1618
+	global $wpdb, $plugin_prefix;
1619 1619
 	
1620 1620
 	// Remove unused virtual page
1621 1621
 	$listings_page_id = (int)get_option('geodir_listing_page');
1622 1622
 	if ($listings_page_id) {
1623 1623
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1624
-        delete_option('geodir_listing_page');
1624
+		delete_option('geodir_listing_page');
1625 1625
 	}
1626 1626
 
1627
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1628
-        $wpdb->query(
1629
-            $wpdb->prepare(
1630
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1631
-                array('1', '1', 'admin')
1632
-            )
1633
-        );
1627
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1628
+		$wpdb->query(
1629
+			$wpdb->prepare(
1630
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1631
+				array('1', '1', 'admin')
1632
+			)
1633
+		);
1634 1634
 
1635 1635
 
1636
-        /* --- terms meta value set --- */
1636
+		/* --- terms meta value set --- */
1637 1637
 
1638
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1638
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1639 1639
 
1640
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1640
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1641 1641
 
1642
-        if (!empty($options_data)) {
1642
+		if (!empty($options_data)) {
1643 1643
 
1644
-            foreach ($options_data as $optobj) {
1644
+			foreach ($options_data as $optobj) {
1645 1645
 
1646
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1646
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1647 1647
 
1648
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1648
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1649 1649
 
1650
-                if (!empty($taxonomies_data)) {
1650
+				if (!empty($taxonomies_data)) {
1651 1651
 
1652
-                    foreach ($taxonomies_data as $taxobj) {
1652
+					foreach ($taxonomies_data as $taxobj) {
1653 1653
 
1654
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1655
-                        $post_type = $taxObject->object_type[0];
1654
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1655
+						$post_type = $taxObject->object_type[0];
1656 1656
 
1657
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1657
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1658 1658
 
1659
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1659
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1660 1660
 
1661
-                        if ($duplicate_data) {
1661
+						if ($duplicate_data) {
1662 1662
 
1663
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1663
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1664 1664
 
1665
-                        } else {
1665
+						} else {
1666 1666
 
1667
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1667
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1668 1668
 
1669
-                        }
1669
+						}
1670 1670
 
1671
-                    }
1671
+					}
1672 1672
 
1673
-                }
1673
+				}
1674 1674
 
1675
-            }
1676
-        }
1675
+			}
1676
+		}
1677 1677
 
1678
-        update_option('geodir_changes_in_custom_fields_table', '1');
1678
+		update_option('geodir_changes_in_custom_fields_table', '1');
1679 1679
 
1680
-    }
1680
+	}
1681 1681
 
1682 1682
 }
1683 1683
 
@@ -1696,24 +1696,24 @@  discard block
 block discarded – undo
1696 1696
 function geodir_location_slug_check($slug)
1697 1697
 {
1698 1698
 
1699
-    global $wpdb, $table_prefix;
1699
+	global $wpdb, $table_prefix;
1700 1700
 
1701
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1701
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1702 1702
 
1703
-    if ($slug_exists) {
1703
+	if ($slug_exists) {
1704 1704
 
1705
-        $suffix = 1;
1706
-        do {
1707
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1708
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1709
-            $suffix++;
1710
-        } while ($location_slug_check && $suffix < 100);
1705
+		$suffix = 1;
1706
+		do {
1707
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1708
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1709
+			$suffix++;
1710
+		} while ($location_slug_check && $suffix < 100);
1711 1711
 
1712
-        $slug = $alt_location_name;
1712
+		$slug = $alt_location_name;
1713 1713
 
1714
-    }
1714
+	}
1715 1715
 
1716
-    return $slug;
1716
+	return $slug;
1717 1717
 
1718 1718
 }
1719 1719
 
@@ -1738,42 +1738,42 @@  discard block
 block discarded – undo
1738 1738
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1739 1739
 {
1740 1740
 
1741
-    global $wpdb, $plugin_prefix, $table_prefix;
1741
+	global $wpdb, $plugin_prefix, $table_prefix;
1742 1742
 
1743
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1743
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1744 1744
 
1745
-    $slug = $tern_data->slug;
1745
+	$slug = $tern_data->slug;
1746 1746
 
1747
-    /**
1748
-     * Filter if a term slug exists.
1749
-     *
1750
-     * @since 1.0.0
1751
-     * @package GeoDirectory
1752
-     * @param bool $bool Default: false.
1753
-     * @param string $slug The term slug.
1754
-     * @param int $term_id The term ID.
1755
-     */
1756
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1747
+	/**
1748
+	 * Filter if a term slug exists.
1749
+	 *
1750
+	 * @since 1.0.0
1751
+	 * @package GeoDirectory
1752
+	 * @param bool $bool Default: false.
1753
+	 * @param string $slug The term slug.
1754
+	 * @param int $term_id The term ID.
1755
+	 */
1756
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1757 1757
 
1758
-    if ($slug_exists) {
1758
+	if ($slug_exists) {
1759 1759
 
1760
-        $suffix = 1;
1761
-        do {
1762
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1760
+		$suffix = 1;
1761
+		do {
1762
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1763 1763
 
1764
-            /** This action is documented in geodirectory_hooks_actions.php */
1765
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1764
+			/** This action is documented in geodirectory_hooks_actions.php */
1765
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1766 1766
 
1767
-            $suffix++;
1768
-        } while ($term_slug_check && $suffix < 100);
1767
+			$suffix++;
1768
+		} while ($term_slug_check && $suffix < 100);
1769 1769
 
1770
-        $slug = $new_slug;
1770
+		$slug = $new_slug;
1771 1771
 
1772
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1772
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1773 1773
 
1774
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1774
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1775 1775
 
1776
-    }
1776
+	}
1777 1777
 	
1778 1778
 	// Update tag in detail table.
1779 1779
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1814,21 +1814,21 @@  discard block
 block discarded – undo
1814 1814
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1815 1815
 {
1816 1816
 
1817
-    global $wpdb, $table_prefix;
1817
+	global $wpdb, $table_prefix;
1818 1818
 
1819
-    $default_location = geodir_get_default_location();
1819
+	$default_location = geodir_get_default_location();
1820 1820
 
1821
-    $country_slug = $default_location->country_slug;
1822
-    $region_slug = $default_location->region_slug;
1823
-    $city_slug = $default_location->city_slug;
1821
+	$country_slug = $default_location->country_slug;
1822
+	$region_slug = $default_location->region_slug;
1823
+	$city_slug = $default_location->city_slug;
1824 1824
 
1825
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1826
-        return $slug_exists = true;
1825
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1826
+		return $slug_exists = true;
1827 1827
 
1828
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1829
-        return $slug_exists = true;
1828
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1829
+		return $slug_exists = true;
1830 1830
 
1831
-    return $slug_exists;
1831
+	return $slug_exists;
1832 1832
 }
1833 1833
 
1834 1834
 
@@ -1848,75 +1848,75 @@  discard block
 block discarded – undo
1848 1848
  */
1849 1849
 function geodir_custom_page_title($title = '', $sep = '')
1850 1850
 {
1851
-    global $wp;
1852
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1853
-        return $title;
1854
-    }
1851
+	global $wp;
1852
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1853
+		return $title;
1854
+	}
1855 1855
 
1856
-    if ($sep == '') {
1857
-        /**
1858
-         * Filter the page title separator.
1859
-         *
1860
-         * @since 1.0.0
1861
-         * @package GeoDirectory
1862
-         * @param string $sep The separator, default: `|`.
1863
-         */
1864
-        $sep = apply_filters('geodir_page_title_separator', '|');
1865
-    }
1856
+	if ($sep == '') {
1857
+		/**
1858
+		 * Filter the page title separator.
1859
+		 *
1860
+		 * @since 1.0.0
1861
+		 * @package GeoDirectory
1862
+		 * @param string $sep The separator, default: `|`.
1863
+		 */
1864
+		$sep = apply_filters('geodir_page_title_separator', '|');
1865
+	}
1866 1866
 
1867 1867
 
1868
-    $gd_page = '';
1869
-    if(geodir_is_page('home')){
1870
-        $gd_page = 'home';
1871
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1872
-    }
1873
-    elseif(geodir_is_page('detail')){
1874
-        $gd_page = 'detail';
1875
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1876
-    }
1877
-    elseif(geodir_is_page('pt')){
1878
-        $gd_page = 'pt';
1879
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1880
-    }
1881
-    elseif(geodir_is_page('listing')){
1882
-        $gd_page = 'listing';
1883
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1884
-    }
1885
-    elseif(geodir_is_page('location')){
1886
-        $gd_page = 'location';
1887
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1888
-    }
1889
-    elseif(geodir_is_page('search')){
1890
-        $gd_page = 'search';
1891
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1892
-    }
1893
-    elseif(geodir_is_page('add-listing')){
1894
-        $gd_page = 'add-listing';
1895
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1896
-    }
1897
-    elseif(geodir_is_page('author')){
1898
-        $gd_page = 'author';
1899
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1900
-    }
1901
-    elseif(geodir_is_page('login')){
1902
-        $gd_page = 'login';
1903
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1904
-    }
1905
-    elseif(geodir_is_page('listing-success')){
1906
-        $gd_page = 'listing-success';
1907
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1908
-    }
1868
+	$gd_page = '';
1869
+	if(geodir_is_page('home')){
1870
+		$gd_page = 'home';
1871
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1872
+	}
1873
+	elseif(geodir_is_page('detail')){
1874
+		$gd_page = 'detail';
1875
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1876
+	}
1877
+	elseif(geodir_is_page('pt')){
1878
+		$gd_page = 'pt';
1879
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1880
+	}
1881
+	elseif(geodir_is_page('listing')){
1882
+		$gd_page = 'listing';
1883
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1884
+	}
1885
+	elseif(geodir_is_page('location')){
1886
+		$gd_page = 'location';
1887
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1888
+	}
1889
+	elseif(geodir_is_page('search')){
1890
+		$gd_page = 'search';
1891
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1892
+	}
1893
+	elseif(geodir_is_page('add-listing')){
1894
+		$gd_page = 'add-listing';
1895
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1896
+	}
1897
+	elseif(geodir_is_page('author')){
1898
+		$gd_page = 'author';
1899
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1900
+	}
1901
+	elseif(geodir_is_page('login')){
1902
+		$gd_page = 'login';
1903
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1904
+	}
1905
+	elseif(geodir_is_page('listing-success')){
1906
+		$gd_page = 'listing-success';
1907
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1908
+	}
1909 1909
 
1910 1910
 
1911
-    /**
1912
-     * Filter page meta title to replace variables.
1913
-     *
1914
-     * @since 1.5.4
1915
-     * @param string $title The page title including variables.
1916
-     * @param string $gd_page The GeoDirectory page type if any.
1917
-     * @param string $sep The title separator symbol.
1918
-     */
1919
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1911
+	/**
1912
+	 * Filter page meta title to replace variables.
1913
+	 *
1914
+	 * @since 1.5.4
1915
+	 * @param string $title The page title including variables.
1916
+	 * @param string $gd_page The GeoDirectory page type if any.
1917
+	 * @param string $sep The title separator symbol.
1918
+	 */
1919
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1920 1920
 
1921 1921
 }
1922 1922
 
@@ -1932,36 +1932,36 @@  discard block
 block discarded – undo
1932 1932
 function geodir_set_post_attachment()
1933 1933
 {
1934 1934
 
1935
-    if (!get_option('geodir_set_post_attachments')) {
1935
+	if (!get_option('geodir_set_post_attachments')) {
1936 1936
 
1937
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1938
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1937
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1938
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1939 1939
 
1940
-        $all_postypes = geodir_get_posttypes();
1940
+		$all_postypes = geodir_get_posttypes();
1941 1941
 
1942
-        foreach($all_postypes as $post_type){
1943
-            $args = array(
1944
-                'posts_per_page' => -1,
1945
-                'post_type' => $post_type,
1946
-                'post_status' => 'publish');
1942
+		foreach($all_postypes as $post_type){
1943
+			$args = array(
1944
+				'posts_per_page' => -1,
1945
+				'post_type' => $post_type,
1946
+				'post_status' => 'publish');
1947 1947
 
1948
-            $posts_array = get_posts($args);
1948
+			$posts_array = get_posts($args);
1949 1949
 
1950
-            if (!empty($posts_array)) {
1950
+			if (!empty($posts_array)) {
1951 1951
 
1952
-                foreach ($posts_array as $post) {
1952
+				foreach ($posts_array as $post) {
1953 1953
 
1954
-                    geodir_set_wp_featured_image($post->ID);
1954
+					geodir_set_wp_featured_image($post->ID);
1955 1955
 
1956
-                }
1956
+				}
1957 1957
 
1958
-            }
1959
-        }
1958
+			}
1959
+		}
1960 1960
 
1961 1961
 
1962
-        update_option('geodir_set_post_attachments', '1');
1962
+		update_option('geodir_set_post_attachments', '1');
1963 1963
 
1964
-    }
1964
+	}
1965 1965
 
1966 1966
 }
1967 1967
 
@@ -1978,19 +1978,19 @@  discard block
 block discarded – undo
1978 1978
 function geodir_remove_url_seperator()
1979 1979
 {
1980 1980
 
1981
-    if (!get_option('geodir_remove_url_seperator')) {
1981
+	if (!get_option('geodir_remove_url_seperator')) {
1982 1982
 
1983
-        if (get_option('geodir_listingurl_separator'))
1984
-            delete_option('geodir_listingurl_separator');
1983
+		if (get_option('geodir_listingurl_separator'))
1984
+			delete_option('geodir_listingurl_separator');
1985 1985
 
1986
-        if (get_option('geodir_detailurl_separator'))
1987
-            delete_option('geodir_detailurl_separator');
1986
+		if (get_option('geodir_detailurl_separator'))
1987
+			delete_option('geodir_detailurl_separator');
1988 1988
 
1989
-        flush_rewrite_rules(false);
1989
+		flush_rewrite_rules(false);
1990 1990
 
1991
-        update_option('geodir_remove_url_seperator', '1');
1991
+		update_option('geodir_remove_url_seperator', '1');
1992 1992
 
1993
-    }
1993
+	}
1994 1994
 
1995 1995
 }
1996 1996
 
@@ -2006,19 +2006,19 @@  discard block
 block discarded – undo
2006 2006
  */
2007 2007
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2008 2008
 {
2009
-    foreach ($permalink_arr as $key => $value) {
2009
+	foreach ($permalink_arr as $key => $value) {
2010 2010
 
2011
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2012
-            unset($permalink_arr[$key]);
2011
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2012
+			unset($permalink_arr[$key]);
2013 2013
 
2014
-    }
2014
+	}
2015 2015
 
2016
-    return $permalink_arr;
2016
+	return $permalink_arr;
2017 2017
 
2018 2018
 }
2019 2019
 
2020 2020
 if (!is_admin()) {
2021
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2021
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2022 2022
 }
2023 2023
 /**
2024 2024
  * Set status from draft to publish.
@@ -2031,16 +2031,16 @@  discard block
 block discarded – undo
2031 2031
  */
2032 2032
 function geodir_set_status_draft_to_publish_for_own_post($post)
2033 2033
 {
2034
-    $user_id = get_current_user_id();
2034
+	$user_id = get_current_user_id();
2035 2035
 
2036
-    if(!$user_id){return $post;}
2036
+	if(!$user_id){return $post;}
2037 2037
 
2038
-    $gd_post_types = geodir_get_posttypes();
2038
+	$gd_post_types = geodir_get_posttypes();
2039 2039
 
2040
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2041
-        $post[0]->post_status = 'publish';
2042
-    }
2043
-    return $post;
2040
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2041
+		$post[0]->post_status = 'publish';
2042
+	}
2043
+	return $post;
2044 2044
 }
2045 2045
 
2046 2046
 
@@ -2132,33 +2132,33 @@  discard block
 block discarded – undo
2132 2132
  */
2133 2133
 function geodir_detail_page_tab_headings_change($tabs_arr)
2134 2134
 {
2135
-    global $wpdb;
2135
+	global $wpdb;
2136 2136
 
2137
-    $post_type = geodir_get_current_posttype();
2137
+	$post_type = geodir_get_current_posttype();
2138 2138
 
2139
-    $all_postypes = geodir_get_posttypes();
2139
+	$all_postypes = geodir_get_posttypes();
2140 2140
 
2141
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2141
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2142 2142
 
2143
-        if (array_key_exists('post_video', $tabs_arr)) {
2143
+		if (array_key_exists('post_video', $tabs_arr)) {
2144 2144
 
2145
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2145
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2146 2146
 
2147
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2148
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2149
-        }
2147
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2148
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2149
+		}
2150 2150
 
2151
-        if (array_key_exists('special_offers', $tabs_arr)) {
2151
+		if (array_key_exists('special_offers', $tabs_arr)) {
2152 2152
 
2153
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2153
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2154 2154
 
2155
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2156
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2157
-        }
2155
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2156
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2157
+		}
2158 2158
 
2159
-    }
2159
+	}
2160 2160
 
2161
-    return $tabs_arr;
2161
+	return $tabs_arr;
2162 2162
 
2163 2163
 }
2164 2164
 
@@ -2171,10 +2171,10 @@  discard block
 block discarded – undo
2171 2171
  */
2172 2172
 function geodir_remove_template_redirect_actions()
2173 2173
 {
2174
-    if (geodir_is_page('login')){
2175
-        remove_all_actions('template_redirect');
2176
-        remove_action('init', 'avia_modify_front', 10);
2177
-    }
2174
+	if (geodir_is_page('login')){
2175
+		remove_all_actions('template_redirect');
2176
+		remove_action('init', 'avia_modify_front', 10);
2177
+	}
2178 2178
 }
2179 2179
 
2180 2180
 
@@ -2196,51 +2196,51 @@  discard block
 block discarded – undo
2196 2196
 function geodirectory_before_featured_image_delete($attachment_id)
2197 2197
 {
2198 2198
 
2199
-    global $wpdb, $plugin_prefix;
2199
+	global $wpdb, $plugin_prefix;
2200 2200
 
2201
-    $post_id = get_post_field('post_parent', $attachment_id);
2201
+	$post_id = get_post_field('post_parent', $attachment_id);
2202 2202
 
2203
-    $attachment_url = wp_get_attachment_url($attachment_id);
2203
+	$attachment_url = wp_get_attachment_url($attachment_id);
2204 2204
 
2205
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2205
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2206 2206
 
2207
-        $post_type = get_post_type($post_id);
2207
+		$post_type = get_post_type($post_id);
2208 2208
 
2209
-        $all_postypes = geodir_get_posttypes();
2209
+		$all_postypes = geodir_get_posttypes();
2210 2210
 
2211
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2212
-            return false;
2211
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2212
+			return false;
2213 2213
 
2214
-        $uploads = wp_upload_dir();
2214
+		$uploads = wp_upload_dir();
2215 2215
 
2216
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2216
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2217 2217
 
2218
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2218
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2219 2219
 
2220
-        $wpdb->query(
2221
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2222
-                array($post_id, $split_img_file_path)
2223
-            )
2224
-        );
2220
+		$wpdb->query(
2221
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2222
+				array($post_id, $split_img_file_path)
2223
+			)
2224
+		);
2225 2225
 
2226
-        $attachment_data = $wpdb->get_row(
2227
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2228
-                array($post_id)
2229
-            )
2230
-        );
2226
+		$attachment_data = $wpdb->get_row(
2227
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2228
+				array($post_id)
2229
+			)
2230
+		);
2231 2231
 
2232
-        if (!empty($attachment_data)) {
2233
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2234
-        }
2232
+		if (!empty($attachment_data)) {
2233
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2234
+		}
2235 2235
 
2236 2236
 
2237
-        $table_name = $plugin_prefix . $post_type . '_detail';
2237
+		$table_name = $plugin_prefix . $post_type . '_detail';
2238 2238
 
2239
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2239
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2240 2240
 
2241
-        geodir_set_wp_featured_image($post_id);
2241
+		geodir_set_wp_featured_image($post_id);
2242 2242
 
2243
-    }
2243
+	}
2244 2244
 
2245 2245
 }
2246 2246
 
@@ -2258,79 +2258,79 @@  discard block
 block discarded – undo
2258 2258
 function geodir_temp_set_post_attachment()
2259 2259
 {
2260 2260
 
2261
-    global $wpdb, $plugin_prefix;
2261
+	global $wpdb, $plugin_prefix;
2262 2262
 
2263
-    $all_postypes = geodir_get_posttypes();
2263
+	$all_postypes = geodir_get_posttypes();
2264 2264
 
2265
-    foreach ($all_postypes as $posttype) {
2265
+	foreach ($all_postypes as $posttype) {
2266 2266
 
2267
-        $tablename = $plugin_prefix . $posttype . '_detail';
2267
+		$tablename = $plugin_prefix . $posttype . '_detail';
2268 2268
 
2269
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2269
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2270 2270
 
2271
-        if (!empty($get_post_data)) {
2271
+		if (!empty($get_post_data)) {
2272 2272
 
2273
-            foreach ($get_post_data as $data) {
2273
+			foreach ($get_post_data as $data) {
2274 2274
 
2275
-                $post_id = $data->post_id;
2275
+				$post_id = $data->post_id;
2276 2276
 
2277
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2277
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2278 2278
 
2279
-                if (!empty($attachment_data)) {
2279
+				if (!empty($attachment_data)) {
2280 2280
 
2281
-                    foreach ($attachment_data as $attach) {
2281
+					foreach ($attachment_data as $attach) {
2282 2282
 
2283
-                        $file_info = pathinfo($attach->file);
2283
+						$file_info = pathinfo($attach->file);
2284 2284
 
2285
-                        $sub_dir = '';
2286
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2287
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2285
+						$sub_dir = '';
2286
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2287
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2288 2288
 
2289
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2290
-                        $uploads_path = $uploads['basedir'];
2289
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2290
+						$uploads_path = $uploads['basedir'];
2291 2291
 
2292
-                        $file_name = $file_info['basename'];
2292
+						$file_name = $file_info['basename'];
2293 2293
 
2294
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2294
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2295 2295
 
2296
-                        if (!file_exists($img_arr['path'])) {
2296
+						if (!file_exists($img_arr['path'])) {
2297 2297
 
2298
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2298
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2299 2299
 
2300
-                        }
2300
+						}
2301 2301
 
2302
-                    }
2302
+					}
2303 2303
 
2304
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2304
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2305 2305
 
2306
-                    if (!empty($attachment_data)) {
2306
+					if (!empty($attachment_data)) {
2307 2307
 
2308
-                        if ($attachment_data->ID)
2309
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2308
+						if ($attachment_data->ID)
2309
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2310 2310
 
2311
-                    } else {
2311
+					} else {
2312 2312
 
2313
-                        if (has_post_thumbnail($post_id)) {
2313
+						if (has_post_thumbnail($post_id)) {
2314 2314
 
2315
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2315
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2316 2316
 
2317
-                            wp_delete_attachment($post_thumbnail_id);
2317
+							wp_delete_attachment($post_thumbnail_id);
2318 2318
 
2319
-                        }
2319
+						}
2320 2320
 
2321
-                    }
2321
+					}
2322 2322
 
2323
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2323
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2324 2324
 
2325
-                    geodir_set_wp_featured_image($post_id);
2325
+					geodir_set_wp_featured_image($post_id);
2326 2326
 
2327
-                }
2327
+				}
2328 2328
 
2329
-            }
2329
+			}
2330 2330
 
2331
-        }
2331
+		}
2332 2332
 
2333
-    }
2333
+	}
2334 2334
 
2335 2335
 }
2336 2336
 
@@ -2348,9 +2348,9 @@  discard block
 block discarded – undo
2348 2348
 function geodir_default_rating_star_icon()
2349 2349
 {
2350 2350
 
2351
-    if (!get_option('geodir_default_rating_star_icon')) {
2352
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2353
-    }
2351
+	if (!get_option('geodir_default_rating_star_icon')) {
2352
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2353
+	}
2354 2354
 
2355 2355
 }
2356 2356
 
@@ -2368,25 +2368,25 @@  discard block
 block discarded – undo
2368 2368
  */
2369 2369
 function geodir_user_post_listing_count($user_id = 0)
2370 2370
 {
2371
-    global $wpdb, $plugin_prefix, $current_user;
2372
-    if(!$user_id){
2373
-        $user_id = $current_user->ID;
2374
-    }
2371
+	global $wpdb, $plugin_prefix, $current_user;
2372
+	if(!$user_id){
2373
+		$user_id = $current_user->ID;
2374
+	}
2375 2375
 
2376
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2376
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2377 2377
 
2378
-    $user_listing = array();
2379
-    if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2380
-        foreach ($all_posts as $ptype) {
2381
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2378
+	$user_listing = array();
2379
+	if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2380
+		foreach ($all_posts as $ptype) {
2381
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )");
2382 2382
 
2383
-            if ($total_posts > 0) {
2384
-                $user_listing[$ptype] = $total_posts;
2385
-            }
2386
-        }
2387
-    }
2383
+			if ($total_posts > 0) {
2384
+				$user_listing[$ptype] = $total_posts;
2385
+			}
2386
+		}
2387
+	}
2388 2388
 
2389
-    return $user_listing;
2389
+	return $user_listing;
2390 2390
 }
2391 2391
 
2392 2392
 
@@ -2406,189 +2406,189 @@  discard block
 block discarded – undo
2406 2406
  */
2407 2407
 function geodir_detail_page_custom_field_tab($tabs_arr)
2408 2408
 {
2409
-    global $post;
2410
-
2411
-    $post_type = geodir_get_current_posttype();
2412
-    $all_postypes = geodir_get_posttypes();
2413
-
2414
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2415
-        $package_info = array();
2416
-        $package_info = geodir_post_package_info($package_info, $post);
2417
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2418
-        $fields_location = 'owntab';
2419
-
2420
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2421
-        //remove video and special offers if it is already set to show
2422
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2423
-            $unset_video = true;
2424
-        }
2425
-
2426
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2427
-            $unset_special_offers = true;
2428
-        }
2429
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2430
-            foreach($custom_fields as $key => $custom_field){
2431
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2432
-                    unset($custom_fields[$key]);
2433
-                }
2434
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2435
-                    unset($custom_fields[$key]);
2436
-                }
2437
-            }
2438
-        }
2439
-
2440
-
2441
-        if (!empty($custom_fields)) {
2442
-            $parse_custom_fields = array();
2443
-            foreach ($custom_fields as $field) {
2444
-                $field = stripslashes_deep($field); // strip slashes
2445
-                $type = $field;
2446
-                $field_name = $field['htmlvar_name'];
2447
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2448
-                    $post->{$field_name} = $_REQUEST[$field_name];
2449
-                }
2409
+	global $post;
2450 2410
 
2451
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2452
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2453
-                        continue;
2454
-                    }
2411
+	$post_type = geodir_get_current_posttype();
2412
+	$all_postypes = geodir_get_posttypes();
2455 2413
 
2456
-                    $parse_custom_fields[] = $field;
2457
-                }
2458
-            }
2459
-            $custom_fields = $parse_custom_fields;
2460
-        }
2461
-        //print_r($custom_fields);
2462
-        if (!empty($custom_fields)) {
2414
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2415
+		$package_info = array();
2416
+		$package_info = geodir_post_package_info($package_info, $post);
2417
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2418
+		$fields_location = 'owntab';
2463 2419
 
2464
-            global $field_set_start;
2420
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2421
+		//remove video and special offers if it is already set to show
2422
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2423
+			$unset_video = true;
2424
+		}
2465 2425
 
2466
-            $post = stripslashes_deep($post); // strip slashes
2467
-            
2468
-            $field_set_start = 0;
2469
-            $fieldset_count = 0;
2470
-            $fieldset = '';
2471
-            $total_fields = count($custom_fields);
2472
-            $count_field = 0;
2473
-            $fieldset_arr = array();
2474
-            $i = 0;
2475
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2476
-
2477
-            foreach ($custom_fields as $field) {
2478
-                $count_field++;
2479
-                $field_name = $field['htmlvar_name'];
2480
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2481
-                    $post->{$field_name} = $_REQUEST[$field_name];
2482
-                }
2426
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2427
+			$unset_special_offers = true;
2428
+		}
2429
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2430
+			foreach($custom_fields as $key => $custom_field){
2431
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2432
+					unset($custom_fields[$key]);
2433
+				}
2434
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2435
+					unset($custom_fields[$key]);
2436
+				}
2437
+			}
2438
+		}
2483 2439
 
2484
-                if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2485
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2486
-                    $site_title = trim($field['site_title']);
2487
-                    $type = $field;
2488
-                    $variables_array = array();
2489 2440
 
2490
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2491
-                        continue;
2492
-                    }
2441
+		if (!empty($custom_fields)) {
2442
+			$parse_custom_fields = array();
2443
+			foreach ($custom_fields as $field) {
2444
+				$field = stripslashes_deep($field); // strip slashes
2445
+				$type = $field;
2446
+				$field_name = $field['htmlvar_name'];
2447
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2448
+					$post->{$field_name} = $_REQUEST[$field_name];
2449
+				}
2493 2450
 
2494
-                    if ($type['type'] != 'fieldset') {
2495
-                        $i++;
2496
-                        $variables_array['post_id'] = $post->ID;
2497
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2498
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2499
-
2500
-                    }else{
2501
-                        $i = 0;
2502
-                        $fieldset_count++;
2503
-                        $field_set_start = 1;
2504
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2505
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2506
-                    }
2451
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false  && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2452
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2453
+						continue;
2454
+					}
2507 2455
 
2456
+					$parse_custom_fields[] = $field;
2457
+				}
2458
+			}
2459
+			$custom_fields = $parse_custom_fields;
2460
+		}
2461
+		//print_r($custom_fields);
2462
+		if (!empty($custom_fields)) {
2508 2463
 
2509
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2510
-                    $type = stripslashes_deep($type); // strip slashes
2511
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2512
-                    $html = '';
2513
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2514
-                    if($html_var=='post'){$html_var='post_address';}
2515
-                    $field_icon = geodir_field_icon_proccess($type);
2516
-                    $filed_type = $type['type'];
2517
-
2518
-                    /**
2519
-                     * Filter the output for custom fields.
2520
-                     *
2521
-                     * Here we can remove or add new functions depending on the field type.
2522
-                     *
2523
-                     * @param string $html The html to be filtered (blank).
2524
-                     * @param string $fields_location The location the field is to be show.
2525
-                     * @param array $type The array of field values.
2526
-                     */
2527
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2528
-
2529
-
2530
-                    /**
2531
-                     * Filter custom field output in tab.
2532
-                     *
2533
-                     * @since 1.5.6
2534
-                     *
2535
-                     * @param string $html_var The HTML variable name for the field.
2536
-                     * @param string $html Custom field unfiltered HTML.
2537
-                     * @param array $variables_array Custom field variables array.
2538
-                     */
2539
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2540
-
2541
-                    $fieldset_html = '';
2542
-                    if ($field_set_start == 1) {
2543
-                        $add_html = false;
2544
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2545
-                            if ($fieldset != '') {
2546
-                                $add_html = true;
2547
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2548
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2549
-                            }
2550
-                            $fieldset_html = $fieldset;
2551
-                            $fieldset = '';
2552
-                        } else {
2553
-                            $fieldset .= $html;
2554
-                            if ($total_fields == $count_field && $fieldset != '') {
2555
-                                $add_html = true;
2556
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2557
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2558
-                                $fieldset_html = $fieldset;
2559
-                            }
2560
-                        }
2464
+			global $field_set_start;
2561 2465
 
2562
-                        if ($add_html) {
2563
-                            $tabs_arr[$htmlvar_name] = array(
2564
-                                'heading_text' => __($label, 'geodirectory'),
2565
-                                'is_active_tab' => false,
2566
-                                /**
2567
-                                 * Filter if a custom field should be displayed on the details page tab.
2568
-                                 *
2569
-                                 * @since 1.0.0
2570
-                                 * @param string $htmlvar_name The field HTML var name.
2571
-                                 */
2572
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2573
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2574
-                            );
2575
-                        }
2576
-                    } else {
2577
-                        if ($html != '') {
2578
-                            $tabs_arr[$html_var] = array(
2579
-                                'heading_text' => __($label, 'geodirectory'),
2580
-                                'is_active_tab' => false,
2581
-                                /** This action is documented in geodirectory_hooks_actions.php */
2582
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2583
-                                'tab_content' => $html
2584
-                            );
2585
-                        }
2586
-                    }
2587
-                }
2588
-            }
2589
-        }
2590
-    }
2591
-    return $tabs_arr;
2466
+			$post = stripslashes_deep($post); // strip slashes
2467
+            
2468
+			$field_set_start = 0;
2469
+			$fieldset_count = 0;
2470
+			$fieldset = '';
2471
+			$total_fields = count($custom_fields);
2472
+			$count_field = 0;
2473
+			$fieldset_arr = array();
2474
+			$i = 0;
2475
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2476
+
2477
+			foreach ($custom_fields as $field) {
2478
+				$count_field++;
2479
+				$field_name = $field['htmlvar_name'];
2480
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2481
+					$post->{$field_name} = $_REQUEST[$field_name];
2482
+				}
2483
+
2484
+				if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
2485
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2486
+					$site_title = trim($field['site_title']);
2487
+					$type = $field;
2488
+					$variables_array = array();
2489
+
2490
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2491
+						continue;
2492
+					}
2493
+
2494
+					if ($type['type'] != 'fieldset') {
2495
+						$i++;
2496
+						$variables_array['post_id'] = $post->ID;
2497
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2498
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2499
+
2500
+					}else{
2501
+						$i = 0;
2502
+						$fieldset_count++;
2503
+						$field_set_start = 1;
2504
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2505
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2506
+					}
2507
+
2508
+
2509
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2510
+					$type = stripslashes_deep($type); // strip slashes
2511
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2512
+					$html = '';
2513
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2514
+					if($html_var=='post'){$html_var='post_address';}
2515
+					$field_icon = geodir_field_icon_proccess($type);
2516
+					$filed_type = $type['type'];
2517
+
2518
+					/**
2519
+					 * Filter the output for custom fields.
2520
+					 *
2521
+					 * Here we can remove or add new functions depending on the field type.
2522
+					 *
2523
+					 * @param string $html The html to be filtered (blank).
2524
+					 * @param string $fields_location The location the field is to be show.
2525
+					 * @param array $type The array of field values.
2526
+					 */
2527
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2528
+
2529
+
2530
+					/**
2531
+					 * Filter custom field output in tab.
2532
+					 *
2533
+					 * @since 1.5.6
2534
+					 *
2535
+					 * @param string $html_var The HTML variable name for the field.
2536
+					 * @param string $html Custom field unfiltered HTML.
2537
+					 * @param array $variables_array Custom field variables array.
2538
+					 */
2539
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2540
+
2541
+					$fieldset_html = '';
2542
+					if ($field_set_start == 1) {
2543
+						$add_html = false;
2544
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2545
+							if ($fieldset != '') {
2546
+								$add_html = true;
2547
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2548
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2549
+							}
2550
+							$fieldset_html = $fieldset;
2551
+							$fieldset = '';
2552
+						} else {
2553
+							$fieldset .= $html;
2554
+							if ($total_fields == $count_field && $fieldset != '') {
2555
+								$add_html = true;
2556
+								$label = $fieldset_arr[$fieldset_count]['label'];
2557
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2558
+								$fieldset_html = $fieldset;
2559
+							}
2560
+						}
2561
+
2562
+						if ($add_html) {
2563
+							$tabs_arr[$htmlvar_name] = array(
2564
+								'heading_text' => __($label, 'geodirectory'),
2565
+								'is_active_tab' => false,
2566
+								/**
2567
+								 * Filter if a custom field should be displayed on the details page tab.
2568
+								 *
2569
+								 * @since 1.0.0
2570
+								 * @param string $htmlvar_name The field HTML var name.
2571
+								 */
2572
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2573
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2574
+							);
2575
+						}
2576
+					} else {
2577
+						if ($html != '') {
2578
+							$tabs_arr[$html_var] = array(
2579
+								'heading_text' => __($label, 'geodirectory'),
2580
+								'is_active_tab' => false,
2581
+								/** This action is documented in geodirectory_hooks_actions.php */
2582
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2583
+								'tab_content' => $html
2584
+							);
2585
+						}
2586
+					}
2587
+				}
2588
+			}
2589
+		}
2590
+	}
2591
+	return $tabs_arr;
2592 2592
 }
2593 2593
 
2594 2594
 /* display add listing page for wpml */
@@ -2612,41 +2612,41 @@  discard block
 block discarded – undo
2612 2612
  */
2613 2613
 function geodir_add_post_status_author_page()
2614 2614
 {
2615
-    global $wpdb, $post;
2616
-
2617
-    $html = '';
2618
-    if (get_current_user_id()) {
2619
-
2620
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2621
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2622
-
2623
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2624
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2625
-            $status = "<strong>(";
2626
-            $status_icon = '<i class="fa fa-play"></i>';
2627
-            if ($real_status == 'publish') {
2628
-                $status .= __('Published', 'geodirectory');
2629
-            }elseif ($real_status == 'pending') {
2630
-                $status .= __('Awaiting Review', 'geodirectory');
2631
-            } else {
2632
-                $status .= __('Not published', 'geodirectory');
2633
-                $status_icon = '<i class="fa fa-pause"></i>';
2634
-            }
2635
-            $status .= ")</strong>";
2615
+	global $wpdb, $post;
2616
+
2617
+	$html = '';
2618
+	if (get_current_user_id()) {
2619
+
2620
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2621
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2622
+
2623
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
2624
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2625
+			$status = "<strong>(";
2626
+			$status_icon = '<i class="fa fa-play"></i>';
2627
+			if ($real_status == 'publish') {
2628
+				$status .= __('Published', 'geodirectory');
2629
+			}elseif ($real_status == 'pending') {
2630
+				$status .= __('Awaiting Review', 'geodirectory');
2631
+			} else {
2632
+				$status .= __('Not published', 'geodirectory');
2633
+				$status_icon = '<i class="fa fa-pause"></i>';
2634
+			}
2635
+			$status .= ")</strong>";
2636 2636
 
2637
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2638
-        }
2639
-    }
2637
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2638
+		}
2639
+	}
2640 2640
 
2641
-    if ($html != '') {
2642
-        /**
2643
-         * Filter the post status text on the author page.
2644
-         *
2645
-         * @since 1.0.0
2646
-         * @param string $html The HTML of the status.
2647
-         */
2648
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2649
-    }
2641
+	if ($html != '') {
2642
+		/**
2643
+		 * Filter the post status text on the author page.
2644
+		 *
2645
+		 * @since 1.0.0
2646
+		 * @param string $html The HTML of the status.
2647
+		 */
2648
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2649
+	}
2650 2650
 
2651 2651
 
2652 2652
 }
@@ -2660,9 +2660,9 @@  discard block
 block discarded – undo
2660 2660
  * @package GeoDirectory
2661 2661
  */
2662 2662
 function geodir_init_no_rating() {
2663
-    if (geodir_rating_disabled_post_types()) {
2664
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2665
-    }
2663
+	if (geodir_rating_disabled_post_types()) {
2664
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2665
+	}
2666 2666
 }
2667 2667
 
2668 2668
 /**
@@ -2676,22 +2676,22 @@  discard block
 block discarded – undo
2676 2676
  * @return array Modified sort options array.
2677 2677
  */
2678 2678
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2679
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2680
-        $new_options = array();
2679
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2680
+		$new_options = array();
2681 2681
         
2682
-        if (!empty($options)) {
2683
-            foreach ($options as $option) {
2684
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2685
-                    continue;
2686
-                }
2687
-                $new_options[] = $option;
2688
-            }
2682
+		if (!empty($options)) {
2683
+			foreach ($options as $option) {
2684
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2685
+					continue;
2686
+				}
2687
+				$new_options[] = $option;
2688
+			}
2689 2689
 
2690
-            $options = $new_options;
2691
-        }
2692
-    }
2690
+			$options = $new_options;
2691
+		}
2692
+	}
2693 2693
 
2694
-    return $options;
2694
+	return $options;
2695 2695
 }
2696 2696
 
2697 2697
 /**
@@ -2703,9 +2703,9 @@  discard block
 block discarded – undo
2703 2703
  * @return array Modified class array.
2704 2704
  */
2705 2705
 function geodir_body_class_active_map($classes = array()) {
2706
-    $classes[] = 'gd-map-' . geodir_map_name();
2706
+	$classes[] = 'gd-map-' . geodir_map_name();
2707 2707
 
2708
-    return $classes;
2708
+	return $classes;
2709 2709
 }
2710 2710
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2711 2711
 
@@ -2718,9 +2718,9 @@  discard block
 block discarded – undo
2718 2718
  * @return string Modified class string.
2719 2719
  */
2720 2720
 function geodir_admin_body_class_active_map($class = '') {    
2721
-    $class .= ' gd-map-' . geodir_map_name();
2721
+	$class .= ' gd-map-' . geodir_map_name();
2722 2722
 
2723
-    return $class;
2723
+	return $class;
2724 2724
 }
2725 2725
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2726 2726
 
@@ -2738,36 +2738,36 @@  discard block
 block discarded – undo
2738 2738
  * @return array Translation texts.
2739 2739
  */
2740 2740
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2741
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2742
-
2743
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2744
-
2745
-    /**
2746
-     * Filters the geodirectory option names that requires to add for translation.
2747
-     *
2748
-     * @since 1.5.7
2749
-     * @package GeoDirectory
2750
-     *
2751
-     * @param  array $gd_options Array of option names.
2752
-     */
2753
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2754
-    $gd_options = array_unique($gd_options);
2755
-
2756
-    if (!empty($gd_options)) {
2757
-        foreach ($gd_options as $gd_option) {
2758
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2759
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2741
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2742
+
2743
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2744
+
2745
+	/**
2746
+	 * Filters the geodirectory option names that requires to add for translation.
2747
+	 *
2748
+	 * @since 1.5.7
2749
+	 * @package GeoDirectory
2750
+	 *
2751
+	 * @param  array $gd_options Array of option names.
2752
+	 */
2753
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2754
+	$gd_options = array_unique($gd_options);
2755
+
2756
+	if (!empty($gd_options)) {
2757
+		foreach ($gd_options as $gd_option) {
2758
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2759
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2760 2760
                 
2761
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2762
-                    $translation_texts[] = stripslashes_deep($option_value);
2763
-                }
2764
-            }
2765
-        }
2766
-    }
2761
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2762
+					$translation_texts[] = stripslashes_deep($option_value);
2763
+				}
2764
+			}
2765
+		}
2766
+	}
2767 2767
 
2768
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2768
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2769 2769
 
2770
-    return $translation_texts;
2770
+	return $translation_texts;
2771 2771
 }
2772 2772
 
2773 2773
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2781,15 +2781,15 @@  discard block
 block discarded – undo
2781 2781
 
2782 2782
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2783 2783
 function gd_get_comments_link($comments_link, $post_id) {
2784
-    $post_type = get_post_type($post_id);
2784
+	$post_type = get_post_type($post_id);
2785 2785
 
2786
-    $all_postypes = geodir_get_posttypes();
2787
-    if (in_array($post_type, $all_postypes)) {
2788
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2789
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2790
-    }
2786
+	$all_postypes = geodir_get_posttypes();
2787
+	if (in_array($post_type, $all_postypes)) {
2788
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2789
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2790
+	}
2791 2791
 
2792
-    return $comments_link;
2792
+	return $comments_link;
2793 2793
 }
2794 2794
 
2795 2795
 
@@ -2807,11 +2807,11 @@  discard block
 block discarded – undo
2807 2807
 function geodir_add_nav_menu_class( $args )
2808 2808
 {
2809 2809
 
2810
-        if(isset($args['menu_class'])){
2811
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2812
-        }
2810
+		if(isset($args['menu_class'])){
2811
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2812
+		}
2813 2813
     
2814
-    return $args;
2814
+	return $args;
2815 2815
 }
2816 2816
 
2817 2817
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2828,15 +2828,15 @@  discard block
 block discarded – undo
2828 2828
  * @return string Filtered locale ID.
2829 2829
  */
2830 2830
 function geodir_wpml_filter_locale($locale) {
2831
-    global $sitepress;
2831
+	global $sitepress;
2832 2832
     
2833
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2833
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2834 2834
     
2835
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2836
-        $locale = $sitepress->get_locale($current_lang);
2837
-    }
2835
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2836
+		$locale = $sitepress->get_locale($current_lang);
2837
+	}
2838 2838
     
2839
-    return $locale;
2839
+	return $locale;
2840 2840
 }
2841 2841
 
2842 2842
 /**
@@ -2846,20 +2846,20 @@  discard block
 block discarded – undo
2846 2846
  * @package GeoDirectory
2847 2847
  */
2848 2848
 function geodir_wpml_set_filter() {
2849
-    if (geodir_is_wpml()) {
2850
-        global $sitepress;
2849
+	if (geodir_is_wpml()) {
2850
+		global $sitepress;
2851 2851
         
2852
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2853
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2854
-        }
2852
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2853
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2854
+		}
2855 2855
         
2856
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2857
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2856
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2857
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2858 2858
 		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2859
-        if (is_admin()) {
2860
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2861
-        }
2862
-    }
2859
+		if (is_admin()) {
2860
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2861
+		}
2862
+	}
2863 2863
 }
2864 2864
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2865 2865
 
@@ -2872,38 +2872,38 @@  discard block
 block discarded – undo
2872 2872
  * @return array Filtered languages.
2873 2873
  */
2874 2874
 function geodir_wpml_filter_ls_languages($languages) {    
2875
-    if (geodir_is_geodir_page()) {        
2876
-        $keep_vars = array();
2875
+	if (geodir_is_geodir_page()) {        
2876
+		$keep_vars = array();
2877 2877
         
2878
-        if (geodir_is_page('add-listing')) {
2879
-            $keep_vars = array('listing_type', 'package_id');
2880
-        } else if (geodir_is_page('search')) {
2881
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2882
-        } else if (geodir_is_page('author')) {
2883
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2884
-        } else if (geodir_is_page('login')) {
2885
-            $keep_vars = array('forgot', 'signup');
2886
-        }        
2878
+		if (geodir_is_page('add-listing')) {
2879
+			$keep_vars = array('listing_type', 'package_id');
2880
+		} else if (geodir_is_page('search')) {
2881
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2882
+		} else if (geodir_is_page('author')) {
2883
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2884
+		} else if (geodir_is_page('login')) {
2885
+			$keep_vars = array('forgot', 'signup');
2886
+		}        
2887 2887
         
2888
-        if (!empty($keep_vars)) {
2889
-            foreach ( $languages as $code => $url) {
2890
-                $filter_url = $url['url'];
2888
+		if (!empty($keep_vars)) {
2889
+			foreach ( $languages as $code => $url) {
2890
+				$filter_url = $url['url'];
2891 2891
                 
2892
-                foreach ($keep_vars as $var) {
2893
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2894
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2895
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2896
-                    }
2897
-                }
2892
+				foreach ($keep_vars as $var) {
2893
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2894
+						$filter_url = remove_query_arg(array($var), $filter_url);
2895
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2896
+					}
2897
+				}
2898 2898
                 
2899
-                if ($filter_url != $url['url']) {
2900
-                    $languages[$code]['url'] = $filter_url;
2901
-                }
2902
-            }
2903
-        }
2904
-    }
2899
+				if ($filter_url != $url['url']) {
2900
+					$languages[$code]['url'] = $filter_url;
2901
+				}
2902
+			}
2903
+		}
2904
+	}
2905 2905
 
2906
-    return $languages;
2906
+	return $languages;
2907 2907
 }
2908 2908
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2909 2909
 
@@ -2914,18 +2914,18 @@  discard block
 block discarded – undo
2914 2914
  *
2915 2915
  */
2916 2916
 function geodir_remove_yoast_seo_metas(){
2917
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2918
-        $wpseo = WPSEO_Frontend::get_instance();
2917
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2918
+		$wpseo = WPSEO_Frontend::get_instance();
2919 2919
         
2920
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2921
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2922
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2923
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2924
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2925
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2920
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2921
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2922
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2923
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2924
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2925
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2926 2926
         
2927
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2928
-    }
2927
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2928
+	}
2929 2929
 }
2930 2930
 
2931 2931
 /**
@@ -2939,20 +2939,20 @@  discard block
 block discarded – undo
2939 2939
  *
2940 2940
  */
2941 2941
  function geodir_wpml_ajax_set_guest_lang() {    
2942
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2943
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2944
-            global $sitepress;
2942
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2943
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2944
+			global $sitepress;
2945 2945
             
2946
-            $referer = wp_get_referer();
2946
+			$referer = wp_get_referer();
2947 2947
             
2948
-            $current_lang = $sitepress->get_current_language();
2949
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2948
+			$current_lang = $sitepress->get_current_language();
2949
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2950 2950
             
2951
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2952
-                $_GET['lang'] = $referrer_lang;
2953
-            }
2954
-        }
2955
-    }
2951
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2952
+				$_GET['lang'] = $referrer_lang;
2953
+			}
2954
+		}
2955
+	}
2956 2956
 }
2957 2957
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2958 2958
 
@@ -2964,36 +2964,36 @@  discard block
 block discarded – undo
2964 2964
  * @param object $wp The WordPress object.
2965 2965
  */
2966 2966
 function geodir_check_redirect($wp) {
2967
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2968
-        $current_url = geodir_curPageURL();
2969
-        $search = 'czech-republic';
2970
-        $replace = 'czechia';        
2967
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2968
+		$current_url = geodir_curPageURL();
2969
+		$search = 'czech-republic';
2970
+		$replace = 'czechia';        
2971 2971
         
2972
-        $has_slash = substr($current_url, -1);
2973
-        if ($has_slash != "/") {
2974
-            $current_url .= '/';
2975
-        }
2972
+		$has_slash = substr($current_url, -1);
2973
+		if ($has_slash != "/") {
2974
+			$current_url .= '/';
2975
+		}
2976 2976
         
2977
-        $redirect = false;
2978
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2979
-            $redirect = true;
2980
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2981
-        }
2977
+		$redirect = false;
2978
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2979
+			$redirect = true;
2980
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2981
+		}
2982 2982
         
2983
-        if ($has_slash != "/") {
2984
-            $current_url = trim($current_url, '/');
2985
-        }
2983
+		if ($has_slash != "/") {
2984
+			$current_url = trim($current_url, '/');
2985
+		}
2986 2986
         
2987
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2988
-            $redirect = true;
2989
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2990
-        }
2991
-
2992
-        if ($redirect) {
2993
-            wp_redirect($current_url);
2994
-            exit;
2995
-        }
2996
-    }
2987
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2988
+			$redirect = true;
2989
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2990
+		}
2991
+
2992
+		if ($redirect) {
2993
+			wp_redirect($current_url);
2994
+			exit;
2995
+		}
2996
+	}
2997 2997
 }
2998 2998
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2999 2999
 
@@ -3013,50 +3013,50 @@  discard block
 block discarded – undo
3013 3013
  * @param string $original_slug The original post slug.
3014 3014
  */
3015 3015
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3016
-    global $wpdb, $sitepress;
3016
+	global $wpdb, $sitepress;
3017 3017
     
3018
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3019
-        $wpml_post_join = "";
3020
-        $wpml_post_where = "";
3021
-        $wpml_term_join = "";
3022
-        $wpml_term_where = "";
3018
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3019
+		$wpml_post_join = "";
3020
+		$wpml_post_where = "";
3021
+		$wpml_term_join = "";
3022
+		$wpml_term_where = "";
3023 3023
         
3024
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3025
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3026
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3027
-            if (!$post_language) {
3028
-                $post_language = $sitepress->get_current_language();
3029
-            }
3024
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3025
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3026
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3027
+			if (!$post_language) {
3028
+				$post_language = $sitepress->get_current_language();
3029
+			}
3030 3030
             
3031
-            $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3032
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3031
+			$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3032
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3033 3033
             
3034
-            $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3035
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3036
-        }
3034
+			$wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
3035
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3036
+		}
3037 3037
 
3038
-        $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3038
+		$term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
3039 3039
 
3040
-        if ( $term_slug_check ) {
3041
-            $suffix = 1;
3040
+		if ( $term_slug_check ) {
3041
+			$suffix = 1;
3042 3042
             
3043
-            do {
3044
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3043
+			do {
3044
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3045 3045
                 
3046
-                $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3046
+				$term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
3047 3047
                 
3048
-                $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3048
+				$post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
3049 3049
                 
3050
-                $term_slug_check = $term_check || $post_check;
3050
+				$term_slug_check = $term_check || $post_check;
3051 3051
                 
3052
-                $suffix++;
3053
-            } while ( $term_slug_check );
3052
+				$suffix++;
3053
+			} while ( $term_slug_check );
3054 3054
             
3055
-            $slug = $alt_slug;
3056
-        }
3057
-    }
3055
+			$slug = $alt_slug;
3056
+		}
3057
+	}
3058 3058
     
3059
-    return $slug;
3059
+	return $slug;
3060 3060
 }
3061 3061
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3062 3062
 
@@ -3076,48 +3076,48 @@  discard block
 block discarded – undo
3076 3076
  * @return bool true when exists. false when not exists.
3077 3077
  */
3078 3078
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3079
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3079
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3080 3080
     
3081
-    if ( $slug_exists ) {
3082
-        return $slug_exists;
3083
-    }
3081
+	if ( $slug_exists ) {
3082
+		return $slug_exists;
3083
+	}
3084 3084
     
3085
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3086
-        $taxonomy = $gd_term_taxonomy[$term_id];
3087
-    } else {
3088
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3089
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3090
-    }
3085
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3086
+		$taxonomy = $gd_term_taxonomy[$term_id];
3087
+	} else {
3088
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3089
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3090
+	}
3091 3091
     
3092
-    if ( empty($taxonomy) ) {
3093
-        return $slug_exists;
3094
-    }
3092
+	if ( empty($taxonomy) ) {
3093
+		return $slug_exists;
3094
+	}
3095 3095
     
3096
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3097
-        $post_type = $gd_term_post_type[$term_id];
3098
-    } else {
3099
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3100
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3101
-    }
3096
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3097
+		$post_type = $gd_term_post_type[$term_id];
3098
+	} else {
3099
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3100
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3101
+	}
3102 3102
     
3103
-    $wpml_post_join = "";
3104
-    $wpml_post_where = "";
3103
+	$wpml_post_join = "";
3104
+	$wpml_post_where = "";
3105 3105
     
3106
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3107
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3108
-        if (!$term_language) {
3109
-            $term_language = $sitepress->get_current_language();
3110
-        }
3106
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3107
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3108
+		if (!$term_language) {
3109
+			$term_language = $sitepress->get_current_language();
3110
+		}
3111 3111
         
3112
-        $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3113
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3114
-    }
3112
+		$wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
3113
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3114
+	}
3115 3115
     
3116
-    if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3117
-        $slug_exists = true;
3118
-    }
3116
+	if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s  {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
3117
+		$slug_exists = true;
3118
+	}
3119 3119
 
3120
-    return $slug_exists;
3120
+	return $slug_exists;
3121 3121
 }
3122 3122
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3123 3123
 
Please login to merge, or discard this patch.
geodirectory-templates/geodir-signup.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@
 block discarded – undo
14 14
  */
15 15
 if (get_current_user_id()) {
16 16
 
17
-    $_redirect = home_url();
18
-    if (isset($_REQUEST['redirect_add_listing'])) {
19
-        $_redirect = $_REQUEST['redirect_add_listing'];
20
-    } elseif (!empty($_REQUEST['redirect_to'])) {
21
-        $_redirect = $_REQUEST['redirect_to'];
22
-    }
23
-
24
-    wp_safe_redirect($_redirect , 302);
25
-    exit;
17
+	$_redirect = home_url();
18
+	if (isset($_REQUEST['redirect_add_listing'])) {
19
+		$_redirect = $_REQUEST['redirect_add_listing'];
20
+	} elseif (!empty($_REQUEST['redirect_to'])) {
21
+		$_redirect = $_REQUEST['redirect_to'];
22
+	}
23
+
24
+	wp_safe_redirect($_redirect , 302);
25
+	exit;
26 26
 }
27 27
 
28 28
 // call header
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         $_redirect = $_REQUEST['redirect_to'];
22 22
     }
23 23
 
24
-    wp_safe_redirect($_redirect , 302);
24
+    wp_safe_redirect($_redirect, 302);
25 25
     exit;
26 26
 }
27 27
 
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
  *
82 82
  * @param string $map_json The map marker json.
83 83
  * @since 1.6.22
84
- * @return mixed
84
+ * @return string
85 85
  */
86 86
 function geodir_save_map_cache($map_json){
87 87
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -247,11 +247,13 @@  discard block
 block discarded – undo
247 247
         }
248 248
     }
249 249
 
250
-    if (!empty($field_default_cat))
251
-        $field_default_cat = '';
250
+    if (!empty($field_default_cat)) {
251
+            $field_default_cat = '';
252
+    }
252 253
 
253
-    if (!empty($cat_find_array))
254
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
254
+    if (!empty($cat_find_array)) {
255
+            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
256
+    }
255 257
 
256 258
     $main_query_array = $map_cat_ids_array;
257 259
   
@@ -283,8 +285,9 @@  discard block
 block discarded – undo
283 285
         $gd_posttype = " AND p.post_type = %s";
284 286
         $main_query_array[] = $_REQUEST['gd_posttype'];
285 287
 
286
-    } else
287
-        $table = $plugin_prefix . 'gd_place_detail';
288
+    } else {
289
+            $table = $plugin_prefix . 'gd_place_detail';
290
+    }
288 291
 
289 292
     $join = ", " . $table . " AS pd ";
290 293
 
@@ -606,8 +609,7 @@  discard block
 block discarded – undo
606 609
 
607 610
     if (!empty($cat_content_info)) {
608 611
         $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
609
-    }
610
-    else {
612
+    } else {
611 613
         $map_json =  '[{"totalcount":"0"}]';
612 614
     }
613 615
 
Please login to merge, or discard this patch.
Indentation   +432 added lines, -432 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Enable map cache if set
10 10
 if(get_option('geodir_enable_map_cache')){
11
-    add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
-    add_filter('geodir_markers_json','geodir_save_map_cache',10);
11
+	add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
+	add_filter('geodir_markers_json','geodir_save_map_cache',10);
13 13
 }
14 14
 
15 15
 
@@ -23,61 +23,61 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function geodir_get_map_cache($cache){
25 25
 
26
-    // if a search is going on then dont even try to check for cache.
27
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
28
-        return $cache;
29
-    }
30
-
31
-    $url_params = array();
32
-    $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
33
-    $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
34
-    $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
35
-    $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
36
-    $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
37
-    $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
38
-    $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
39
-    $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
40
-    $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
41
-    $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
42
-    $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
43
-    $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44
-    $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
26
+	// if a search is going on then dont even try to check for cache.
27
+	if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
28
+		return $cache;
29
+	}
30
+
31
+	$url_params = array();
32
+	$url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
33
+	$url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
34
+	$url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
35
+	$url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
36
+	$url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
37
+	$url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
38
+	$url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
39
+	$url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
40
+	$url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
41
+	$url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
42
+	$url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
43
+	$url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
44
+	$url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
45 45
 	$url_params[] = isset($_REQUEST['my_lat']) ? $_REQUEST['my_lat'] : '';
46 46
 	$url_params[] = isset($_REQUEST['my_lon']) ? $_REQUEST['my_lon'] : '';
47 47
 
48
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
48
+	$file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
49 49
 
50
-    $blog_id = get_current_blog_id();
51
-    if($blog_id>1){
52
-        $file_name = $blog_id."_".$file_name;
53
-    }
50
+	$blog_id = get_current_blog_id();
51
+	if($blog_id>1){
52
+		$file_name = $blog_id."_".$file_name;
53
+	}
54 54
 
55
-    $file_path = realpath(dirname(__FILE__))."/map-cache/";
55
+	$file_path = realpath(dirname(__FILE__))."/map-cache/";
56 56
 
57 57
 
58
-    if(file_exists($file_path.$file_name.".json")){
58
+	if(file_exists($file_path.$file_name.".json")){
59 59
 
60 60
 
61
-        ob_start();
62
-        readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents
63
-        $content = ob_get_clean();
61
+		ob_start();
62
+		readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents
63
+		$content = ob_get_clean();
64 64
 
65
-        // do the cache delete stuff
66
-        $cache_time = get_option('geodir_map_cache');
67
-        if(!$cache_time){
68
-            $cache_time = time();
69
-            update_option('geodir_map_cache', $cache_time);
70
-        }
65
+		// do the cache delete stuff
66
+		$cache_time = get_option('geodir_map_cache');
67
+		if(!$cache_time){
68
+			$cache_time = time();
69
+			update_option('geodir_map_cache', $cache_time);
70
+		}
71 71
 
72
-        if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
73
-            geodir_delete_map_cache();
74
-        }
72
+		if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
73
+			geodir_delete_map_cache();
74
+		}
75 75
 
76
-        return $content;
76
+		return $content;
77 77
 
78
-    }
78
+	}
79 79
 
80
-    return $cache;
80
+	return $cache;
81 81
 }
82 82
 
83 83
 
@@ -90,103 +90,103 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function geodir_save_map_cache($map_json){
92 92
 
93
-    // if a search is going on then dont even try to check for cache.
94
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
95
-        return $map_json;
96
-    }
97
-
98
-    $url_params = array();
99
-    $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
100
-    $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
101
-    $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
102
-    $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
103
-    $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
104
-    $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
105
-    $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
106
-    $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
107
-    $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
108
-    $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
109
-    $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
110
-    $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
111
-    $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
93
+	// if a search is going on then dont even try to check for cache.
94
+	if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
95
+		return $map_json;
96
+	}
97
+
98
+	$url_params = array();
99
+	$url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : '';
100
+	$url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : '';
101
+	$url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : '';
102
+	$url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : '';
103
+	$url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : '';
104
+	$url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : '';
105
+	$url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : '';
106
+	$url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : '';
107
+	$url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : '';
108
+	$url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : '';
109
+	$url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : '';
110
+	$url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : '';
111
+	$url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : '';
112 112
 	$url_params[] = isset($_REQUEST['my_lat']) ? $_REQUEST['my_lat'] : '';
113 113
 	$url_params[] = isset($_REQUEST['my_lon']) ? $_REQUEST['my_lon'] : '';
114 114
 
115
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
115
+	$file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
116 116
 
117
-    $blog_id = get_current_blog_id();
118
-    if($blog_id>1){
119
-        $file_name = $blog_id."_".$file_name;
120
-    }
117
+	$blog_id = get_current_blog_id();
118
+	if($blog_id>1){
119
+		$file_name = $blog_id."_".$file_name;
120
+	}
121 121
 
122
-    $file_path = realpath(dirname(__FILE__))."/map-cache/";
122
+	$file_path = realpath(dirname(__FILE__))."/map-cache/";
123 123
 
124 124
 
125
-    global $wp_filesystem;
126
-    if (empty($wp_filesystem)) {
127
-        require_once (ABSPATH . '/wp-admin/includes/file.php');
128
-        WP_Filesystem();
129
-    }
130
-    $wp_filesystem->put_contents(
131
-        $file_path.$file_name.".json",
132
-        $map_json,
133
-        FS_CHMOD_FILE // predefined mode settings for WP files
134
-    );
125
+	global $wp_filesystem;
126
+	if (empty($wp_filesystem)) {
127
+		require_once (ABSPATH . '/wp-admin/includes/file.php');
128
+		WP_Filesystem();
129
+	}
130
+	$wp_filesystem->put_contents(
131
+		$file_path.$file_name.".json",
132
+		$map_json,
133
+		FS_CHMOD_FILE // predefined mode settings for WP files
134
+	);
135 135
 
136 136
 
137
-    return $map_json;
137
+	return $map_json;
138 138
 
139 139
 }
140 140
 
141 141
 
142 142
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
143
-    global $gd_session;
144
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
145
-    $gd_session->set('homemap_catlist_ptype', $gd_post_type);
146
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
147
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
148
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
149
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
150
-    die;
143
+	global $gd_session;
144
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
145
+	$gd_session->set('homemap_catlist_ptype', $gd_post_type);
146
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
147
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
148
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
149
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
150
+	die;
151 151
 }
152 152
 
153 153
 // Send the content-type header with correct encoding
154 154
 header("Content-type: text/javascript; charset=utf-8");
155 155
 
156 156
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
157
-    echo get_markers();
158
-    exit;
157
+	echo get_markers();
158
+	exit;
159 159
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
160
-    /**
161
-     * @global object $wpdb WordPress Database object.
162
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
163
-     * @global object $gd_session GeoDirectory Session object.
164
-     */
165
-    global $wpdb, $plugin_prefix, $gd_session, $sitepress;
160
+	/**
161
+	 * @global object $wpdb WordPress Database object.
162
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
163
+	 * @global object $gd_session GeoDirectory Session object.
164
+	 */
165
+	global $wpdb, $plugin_prefix, $gd_session, $sitepress;
166 166
 
167
-    if ($_REQUEST['m_id'] != '') {
168
-        $pid = (int)$_REQUEST['m_id'];
169
-    } else {
170
-        echo __('No marker data found', 'geodirectory');
171
-        exit;
172
-    }
167
+	if ($_REQUEST['m_id'] != '') {
168
+		$pid = (int)$_REQUEST['m_id'];
169
+	} else {
170
+		echo __('No marker data found', 'geodirectory');
171
+		exit;
172
+	}
173 173
 
174
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
175
-        $post = (object)$gd_ses_listing;
176
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
177
-    } else {
178
-        $geodir_post_type = get_post_type($pid);
174
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
175
+		$post = (object)$gd_ses_listing;
176
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
177
+	} else {
178
+		$geodir_post_type = get_post_type($pid);
179 179
 
180
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
180
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
181 181
 
182
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
182
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
183 183
 
184
-        $postinfo = $wpdb->get_results($sql);
184
+		$postinfo = $wpdb->get_results($sql);
185 185
 
186
-        $data_arr = array();
186
+		$data_arr = array();
187 187
 
188
-        if ($postinfo) {
189
-            $switch_lang = false;
188
+		if ($postinfo) {
189
+			$switch_lang = false;
190 190
 			if ( geodir_is_wpml() && is_post_type_translated( $geodir_post_type ) ) {
191 191
 				$post_lang = $sitepress->get_language_for_element( $pid, 'post_' . $geodir_post_type );
192 192
 				$current_lang = $sitepress->get_current_language();
@@ -197,18 +197,18 @@  discard block
 block discarded – undo
197 197
 			}
198 198
 
199 199
 			$srcharr = array("'", "/", "-", '"', '\\');
200
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
200
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
201 201
 
202
-            foreach ($postinfo as $postinfo_obj) {
203
-                echo geodir_get_infowindow_html($postinfo_obj);
204
-            }
202
+			foreach ($postinfo as $postinfo_obj) {
203
+				echo geodir_get_infowindow_html($postinfo_obj);
204
+			}
205 205
 
206 206
 			if ( $switch_lang !== false ) {
207 207
 				$sitepress->switch_lang( $switch_lang, true );
208 208
 			}
209
-        }
210
-    }
211
-    exit;
209
+		}
210
+	}
211
+	exit;
212 212
 }
213 213
 
214 214
 /**
@@ -227,93 +227,93 @@  discard block
 block discarded – undo
227 227
  */
228 228
 function get_markers() {
229 229
     
230
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
230
+	global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
231 231
 
232 232
 
233
-    /**
234
-     * Filter to allow for any map caching to be output before queries.
235
-     *
236
-     * @since 1.6.22
237
-     */
238
-    $map_cache = apply_filters('geodir_get_markers_cache','');
239
-    if($map_cache){
240
-        return $map_cache;
241
-        wp_die();
242
-    }
233
+	/**
234
+	 * Filter to allow for any map caching to be output before queries.
235
+	 *
236
+	 * @since 1.6.22
237
+	 */
238
+	$map_cache = apply_filters('geodir_get_markers_cache','');
239
+	if($map_cache){
240
+		return $map_cache;
241
+		wp_die();
242
+	}
243 243
 
244 244
 
245 245
 
246
-    $search = '';
246
+	$search = '';
247 247
 
248
-    $srcharr = array("'", "/", "-", '"', '\\', '&#39;');
249
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
248
+	$srcharr = array("'", "/", "-", '"', '\\', '&#39;');
249
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
250 250
 
251
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
251
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
252 252
 
253
-    $map_cat_ids_array = array('0');
254
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
253
+	$map_cat_ids_array = array('0');
254
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
255 255
 
256 256
 
257
-    $field_default_cat = '';
258
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
259
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
257
+	$field_default_cat = '';
258
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
259
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
260 260
 
261
-        if (!empty($map_cat_arr)) {
262
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
261
+		if (!empty($map_cat_arr)) {
262
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
263 263
 
264
-            $map_cat_ids_array = explode(',', $map_cat_arr);
265
-            $cat_find_array = array();
266
-            foreach ($map_cat_ids_array as $cat_id) {
267
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
268
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
269
-                $main_query_array[] = $cat_id;
270
-            }
264
+			$map_cat_ids_array = explode(',', $map_cat_arr);
265
+			$cat_find_array = array();
266
+			foreach ($map_cat_ids_array as $cat_id) {
267
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
268
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
269
+				$main_query_array[] = $cat_id;
270
+			}
271 271
 
272
-        }
273
-    }
272
+		}
273
+	}
274 274
 
275
-    if (!empty($field_default_cat))
276
-        $field_default_cat = '';
275
+	if (!empty($field_default_cat))
276
+		$field_default_cat = '';
277 277
 
278
-    if (!empty($cat_find_array))
279
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
278
+	if (!empty($cat_find_array))
279
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
280 280
 
281
-    $main_query_array = $map_cat_ids_array;
281
+	$main_query_array = $map_cat_ids_array;
282 282
   
283
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
284
-        $search .= " AND p.post_title LIKE %s";
285
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
286
-    }
287
-
288
-    /**
289
-     * Filter the marker query search SQL, values are replaces with %s or %d.
290
-     *
291
-     * @since 1.5.3
292
-     *
293
-     * @param string $search The SQL query for search/where.
294
-     */
295
-    $search = apply_filters('geodir_marker_search', $search);
296
-    /**
297
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
298
-     *
299
-     * @since 1.5.3
300
-     *
301
-     * @param array $main_query_array The SQL query values for search/where.
302
-     */
303
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
304
-
305
-    $gd_posttype = '';
306
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
307
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
308
-        $gd_posttype = " AND p.post_type = %s";
309
-        $main_query_array[] = $_REQUEST['gd_posttype'];
310
-
311
-    } else
312
-        $table = $plugin_prefix . 'gd_place_detail';
313
-
314
-    $join = ", " . $table . " AS pd ";
315
-
316
-    /**
283
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
284
+		$search .= " AND p.post_title LIKE %s";
285
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
286
+	}
287
+
288
+	/**
289
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
290
+	 *
291
+	 * @since 1.5.3
292
+	 *
293
+	 * @param string $search The SQL query for search/where.
294
+	 */
295
+	$search = apply_filters('geodir_marker_search', $search);
296
+	/**
297
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
298
+	 *
299
+	 * @since 1.5.3
300
+	 *
301
+	 * @param array $main_query_array The SQL query values for search/where.
302
+	 */
303
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
304
+
305
+	$gd_posttype = '';
306
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
307
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
308
+		$gd_posttype = " AND p.post_type = %s";
309
+		$main_query_array[] = $_REQUEST['gd_posttype'];
310
+
311
+	} else
312
+		$table = $plugin_prefix . 'gd_place_detail';
313
+
314
+	$join = ", " . $table . " AS pd ";
315
+
316
+	/**
317 317
 	 * Filter the SQL JOIN clause for the markers data
318 318
 	 *
319 319
 	 * @since 1.0.0
@@ -330,16 +330,16 @@  discard block
 block discarded – undo
330 330
 	 * @param string $search Row of searched fields to use in WHERE clause.
331 331
 	 */
332 332
 	$search = apply_filters('geodir_home_map_listing_where', $search);
333
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
334
-    $cat_type = $post_type . 'category';
335
-    if ($post_type == 'gd_event') {
336
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
337
-    } else {
338
-        $event_select = "";
339
-    }
340
-
341
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
342
-    /**
333
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
334
+	$cat_type = $post_type . 'category';
335
+	if ($post_type == 'gd_event') {
336
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
337
+	} else {
338
+		$event_select = "";
339
+	}
340
+
341
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
342
+	/**
343 343
 	 * Filter the SQL SELECT clause to retrive fields data
344 344
 	 *
345 345
 	 * @since 1.0.0
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
360 360
 
361
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
361
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
362 362
     
363 363
 	/**
364 364
 	 * Filter the SQL query to retrive markers data
@@ -374,276 +374,276 @@  discard block
 block discarded – undo
374 374
 //    print_r($gd_session);
375 375
 //    print_r($_SESSION);
376 376
 
377
-    $catinfo = $wpdb->get_results($catsql);
377
+	$catinfo = $wpdb->get_results($catsql);
378 378
 	
379
-    $cat_content_info = array();
380
-    $content_data = array();
381
-    $post_ids = array();
382
-
383
-    /**
384
-     * Called before marker data is processed into JSON.
385
-     *
386
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
387
-     *
388
-     * @since 1.5.3
389
-     * @param object $catinfo The posts object containing all marker data.
390
-     * @see 'geodir_after_marker_post_process'
391
-     */
392
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
393
-
394
-    /**
395
-     * Called before marker data is processed into JSON.
396
-     *
397
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
398
-     *
399
-     * @since 1.4.9
400
-     * @param object $catinfo The posts object containing all marker data.
401
-     * @see 'geodir_after_marker_post_process'
402
-     */
403
-    do_action('geodir_before_marker_post_process_action', $catinfo);
404
-
405
-    // Sort any posts into a ajax array
406
-    if (!empty($catinfo)) {
407
-        $geodir_cat_icons = geodir_get_term_icon();
408
-        global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
409
-
410
-        $today = strtotime(date_i18n('Y-m-d'));
411
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
379
+	$cat_content_info = array();
380
+	$content_data = array();
381
+	$post_ids = array();
382
+
383
+	/**
384
+	 * Called before marker data is processed into JSON.
385
+	 *
386
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
387
+	 *
388
+	 * @since 1.5.3
389
+	 * @param object $catinfo The posts object containing all marker data.
390
+	 * @see 'geodir_after_marker_post_process'
391
+	 */
392
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
393
+
394
+	/**
395
+	 * Called before marker data is processed into JSON.
396
+	 *
397
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
398
+	 *
399
+	 * @since 1.4.9
400
+	 * @param object $catinfo The posts object containing all marker data.
401
+	 * @see 'geodir_after_marker_post_process'
402
+	 */
403
+	do_action('geodir_before_marker_post_process_action', $catinfo);
404
+
405
+	// Sort any posts into a ajax array
406
+	if (!empty($catinfo)) {
407
+		$geodir_cat_icons = geodir_get_term_icon();
408
+		global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
409
+
410
+		$today = strtotime(date_i18n('Y-m-d'));
411
+		$show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
412 412
         
413
-        foreach ($catinfo as $catinfo_obj) {
414
-            $post_title = $catinfo_obj->post_title;
413
+		foreach ($catinfo as $catinfo_obj) {
414
+			$post_title = $catinfo_obj->post_title;
415 415
             
416
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
417
-                $event_dates = '';
418
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
416
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
417
+				$event_dates = '';
418
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
419 419
 
420
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
420
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
421 421
                 
422
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
423
-                    $starttimes = '';
424
-                    $endtimes = '';
425
-                    $astarttimes = array();
426
-                    $aendtimes = array();
427
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
428
-                        $recurring_data['repeat_type'] = 'custom';
429
-                    }
430
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
431
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
422
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
423
+					$starttimes = '';
424
+					$endtimes = '';
425
+					$astarttimes = array();
426
+					$aendtimes = array();
427
+					if ( !isset( $recurring_data['repeat_type'] ) ) {
428
+						$recurring_data['repeat_type'] = 'custom';
429
+					}
430
+					$repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
431
+					$different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
432 432
         
433
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
433
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
434 434
                     
435
-                    if ( !empty( $recurring_dates ) ) {
436
-                        if ( empty( $recurring_data['all_day'] ) ) {
437
-                            if ( $repeat_type == 'custom' && $different_times ) {
438
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
439
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
440
-                            } else {
441
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
442
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
443
-                            }
444
-                        }
435
+					if ( !empty( $recurring_dates ) ) {
436
+						if ( empty( $recurring_data['all_day'] ) ) {
437
+							if ( $repeat_type == 'custom' && $different_times ) {
438
+								$astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
439
+								$aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
440
+							} else {
441
+								$starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
442
+								$endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
443
+							}
444
+						}
445 445
                         
446
-                        $e = 0;
447
-                        foreach( $recurring_dates as $key => $date ) {
448
-                            if ( $repeat_type == 'custom' && $different_times ) {
449
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
450
-                                    $starttimes = $astarttimes[$key];
451
-                                    $endtimes = $aendtimes[$key];
452
-                                } else {
453
-                                    $starttimes = '';
454
-                                    $endtimes = '';
455
-                                }
456
-                            }
446
+						$e = 0;
447
+						foreach( $recurring_dates as $key => $date ) {
448
+							if ( $repeat_type == 'custom' && $different_times ) {
449
+								if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
450
+									$starttimes = $astarttimes[$key];
451
+									$endtimes = $aendtimes[$key];
452
+								} else {
453
+									$starttimes = '';
454
+									$endtimes = '';
455
+								}
456
+							}
457 457
                             
458
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
459
-                            $duration--;
460
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
458
+							$duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
459
+							$duration--;
460
+							$enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
461 461
                             
462
-                            // Hide past dates
463
-                            if ( strtotime( $enddate ) < $today ) {
464
-                                continue;
465
-                            }
462
+							// Hide past dates
463
+							if ( strtotime( $enddate ) < $today ) {
464
+								continue;
465
+							}
466 466
                                     
467
-                            $sdate = strtotime( $date . ' ' . $starttimes );
468
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
467
+							$sdate = strtotime( $date . ' ' . $starttimes );
468
+							$edate = strtotime( $enddate . ' ' . $endtimes );
469 469
                                         
470
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
471
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
470
+							$start_date = date_i18n( $geodir_date_time_format, $sdate );
471
+							$end_date = date_i18n( $geodir_date_time_format, $edate );
472 472
                             
473
-                            $same_day = false;
474
-                            $full_day = false;
475
-                            $same_datetime = false;
473
+							$same_day = false;
474
+							$full_day = false;
475
+							$same_datetime = false;
476 476
                             
477
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
478
-                                $full_day = true;
479
-                            }
477
+							if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
478
+								$full_day = true;
479
+							}
480 480
                             
481
-                            if ( $start_date == $end_date && $full_day ) {
482
-                                $same_datetime = true;
483
-                            }
484
-
485
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
486
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
487
-                            if ( $full_day ) {
488
-                                $start_date = $title_date;
489
-                                $end_date = date_i18n( $geodir_date_format, $edate );
490
-                            }
481
+							if ( $start_date == $end_date && $full_day ) {
482
+								$same_datetime = true;
483
+							}
484
+
485
+							$link_date = date_i18n( 'Y-m-d', $sdate );
486
+							$title_date = date_i18n( $geodir_date_format, $sdate );
487
+							if ( $full_day ) {
488
+								$start_date = $title_date;
489
+								$end_date = date_i18n( $geodir_date_format, $edate );
490
+							}
491 491
                             
492
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
493
-                                $same_day = true;
492
+							if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
493
+								$same_day = true;
494 494
                                 
495
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
496
-                            }
495
+								$start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
496
+							}
497 497
                             
498
-                            $event_dates .= ' :: ' . $start_date;
498
+							$event_dates .= ' :: ' . $start_date;
499 499
                         
500
-                            if ( !$same_day && !$same_datetime ) {
501
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
502
-                            }
500
+							if ( !$same_day && !$same_datetime ) {
501
+								$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
502
+							}
503 503
                             
504
-                            $e++;
504
+							$e++;
505 505
                             
506
-                            if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
507
-                                break;
508
-                            }
509
-                        }
510
-                    }
511
-                } else {
512
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
513
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
514
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
515
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
516
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
506
+							if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
507
+								break;
508
+							}
509
+						}
510
+					}
511
+				} else {
512
+					$start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
513
+					$end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
514
+					$all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
515
+					$starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
516
+					$endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
517 517
                 
518
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
519
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
520
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
518
+					$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
519
+					$starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
520
+					$endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
521 521
                     
522
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
523
-                        $start_date = $event_recurring_dates[0];
524
-                    }
522
+					if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
523
+						$start_date = $event_recurring_dates[0];
524
+					}
525 525
                                 
526
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
527
-                        $end_date = $start_date;
528
-                    }
526
+					if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
527
+						$end_date = $start_date;
528
+					}
529 529
                     
530
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
531
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
532
-                            $starttime = $starttimes[0];
533
-                            $endtime = $endtimes[0];
534
-                        }
530
+					if ($end_date != '' && strtotime($end_date) >= $today) {
531
+						if ( $starttime == '' && !empty( $starttimes ) ) {
532
+							$starttime = $starttimes[0];
533
+							$endtime = $endtimes[0];
534
+						}
535 535
                         
536
-                        $same_day = false;
537
-                        $one_day = false;
538
-                        if ( $start_date == $end_date && $all_day ) {
539
-                            $one_day = true;
540
-                        }
541
-
542
-                        if ( $all_day ) {
543
-                            $start_datetime = strtotime( $start_date );
544
-                            $end_datetime = strtotime( $end_date );
536
+						$same_day = false;
537
+						$one_day = false;
538
+						if ( $start_date == $end_date && $all_day ) {
539
+							$one_day = true;
540
+						}
541
+
542
+						if ( $all_day ) {
543
+							$start_datetime = strtotime( $start_date );
544
+							$end_datetime = strtotime( $end_date );
545 545
                             
546
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
547
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
548
-                            if ( $start_date == $end_date ) {
549
-                                $one_day = true;
550
-                            }
551
-                        } else {
552
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
553
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
554
-                                $one_day = false;
555
-                            }
556
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
557
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
546
+							$start_date = date_i18n( $geodir_date_format, $start_datetime );
547
+							$end_date = date_i18n( $geodir_date_format, $end_datetime );
548
+							if ( $start_date == $end_date ) {
549
+								$one_day = true;
550
+							}
551
+						} else {
552
+							if ( $start_date == $end_date && $starttime == $endtime ) {
553
+								$end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
554
+								$one_day = false;
555
+							}
556
+							$start_datetime = strtotime( $start_date . ' ' . $starttime );
557
+							$end_datetime = strtotime( $end_date . ' ' . $endtime );
558 558
                             
559
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
560
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
561
-                        }
559
+							$start_date = date_i18n( $geodir_date_time_format, $start_datetime );
560
+							$end_date = date_i18n( $geodir_date_time_format, $end_datetime );
561
+						}
562 562
 
563
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
564
-                            $same_day = true;
563
+						if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
564
+							$same_day = true;
565 565
                             
566
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
567
-                        }
566
+							$start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
567
+						}
568 568
                         
569
-                        $event_dates .= ' :: ' . $start_date;
569
+						$event_dates .= ' :: ' . $start_date;
570 570
                         
571
-                        if ( !$same_day && !$one_day ) {
572
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
573
-                        }
574
-                    }
575
-                }
576
-
577
-                if (empty($event_dates)) {
578
-                    continue;
579
-                }
571
+						if ( !$same_day && !$one_day ) {
572
+							$event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
573
+						}
574
+					}
575
+				}
576
+
577
+				if (empty($event_dates)) {
578
+					continue;
579
+				}
580 580
                 
581
-                $post_title .= $event_dates;
582
-            }
581
+				$post_title .= $event_dates;
582
+			}
583 583
 
584
-            $map_cat_ids_array;
585
-            $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
584
+			$map_cat_ids_array;
585
+			$default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
586 586
 
587
-            // if single cat lets just show that icon
588
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
589
-                $default_cat = (int)$map_cat_ids_array[0];
590
-            }
587
+			// if single cat lets just show that icon
588
+			if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
589
+				$default_cat = (int)$map_cat_ids_array[0];
590
+			}
591 591
 
592
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
593
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
594
-            $title = str_replace($srcharr, $replarr, $post_title);
592
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
593
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
594
+			$title = str_replace($srcharr, $replarr, $post_title);
595 595
             
596
-            if ($icon != '') {
597
-                $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
596
+			if ($icon != '') {
597
+				$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
598 598
                 
599
-                if (isset($gd_marker_sizes[$icon])) {
600
-                    $icon_size = $gd_marker_sizes[$icon];
601
-                } else {
602
-                    $icon_size = geodir_get_marker_size($icon);
603
-                    $gd_marker_sizes[$icon] = $icon_size;
604
-                }               
605
-            } else {
606
-                $icon_size = array('w' => 36, 'h' => 45);
607
-            }
608
-
609
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
610
-            $post_ids[] = $catinfo_obj->post_id;
611
-        }
612
-    }
613
-
614
-    /**
615
-     * Called after marker data is processed into JSON.
616
-     *
617
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
618
-     *
619
-     * @since 1.4.9
620
-     * @param array $content_data The array containing all markers in JSON format.
621
-     * @param object $catinfo The posts object containing all marker data.
622
-     * @see 'geodir_before_marker_post_process'
623
-     */
624
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
625
-
626
-    if (!empty($content_data)) {
627
-        $cat_content_info[] = implode(',', $content_data);
628
-    }
629
-
630
-    $totalcount = count(array_unique($post_ids));
631
-
632
-    if (!empty($cat_content_info)) {
633
-        $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
634
-    }
635
-    else {
636
-        $map_json =  '[{"totalcount":"0"}]';
637
-    }
638
-
639
-
640
-    /**
641
-     * Filter the marker json return.
642
-     *
643
-     * @since 1.6.22
644
-     * @param string $map_json The JSON string of the map markers results.
645
-     */
646
-    return apply_filters('geodir_markers_json',$map_json);
599
+				if (isset($gd_marker_sizes[$icon])) {
600
+					$icon_size = $gd_marker_sizes[$icon];
601
+				} else {
602
+					$icon_size = geodir_get_marker_size($icon);
603
+					$gd_marker_sizes[$icon] = $icon_size;
604
+				}               
605
+			} else {
606
+				$icon_size = array('w' => 36, 'h' => 45);
607
+			}
608
+
609
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
610
+			$post_ids[] = $catinfo_obj->post_id;
611
+		}
612
+	}
613
+
614
+	/**
615
+	 * Called after marker data is processed into JSON.
616
+	 *
617
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
618
+	 *
619
+	 * @since 1.4.9
620
+	 * @param array $content_data The array containing all markers in JSON format.
621
+	 * @param object $catinfo The posts object containing all marker data.
622
+	 * @see 'geodir_before_marker_post_process'
623
+	 */
624
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
625
+
626
+	if (!empty($content_data)) {
627
+		$cat_content_info[] = implode(',', $content_data);
628
+	}
629
+
630
+	$totalcount = count(array_unique($post_ids));
631
+
632
+	if (!empty($cat_content_info)) {
633
+		$map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
634
+	}
635
+	else {
636
+		$map_json =  '[{"totalcount":"0"}]';
637
+	}
638
+
639
+
640
+	/**
641
+	 * Filter the marker json return.
642
+	 *
643
+	 * @since 1.6.22
644
+	 * @param string $map_json The JSON string of the map markers results.
645
+	 */
646
+	return apply_filters('geodir_markers_json',$map_json);
647 647
 }
648 648
 
649 649
 
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Enable map cache if set
10
-if(get_option('geodir_enable_map_cache')){
11
-    add_filter('geodir_get_markers_cache','geodir_get_map_cache');
12
-    add_filter('geodir_markers_json','geodir_save_map_cache',10);
10
+if (get_option('geodir_enable_map_cache')) {
11
+    add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
12
+    add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
13 13
 }
14 14
 
15 15
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  * @since 1.6.22
22 22
  * @return string
23 23
  */
24
-function geodir_get_map_cache($cache){
24
+function geodir_get_map_cache($cache) {
25 25
 
26 26
     // if a search is going on then dont even try to check for cache.
27
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
27
+    if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
28 28
         return $cache;
29 29
     }
30 30
 
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	$url_params[] = isset($_REQUEST['my_lat']) ? $_REQUEST['my_lat'] : '';
46 46
 	$url_params[] = isset($_REQUEST['my_lon']) ? $_REQUEST['my_lon'] : '';
47 47
 
48
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
48
+    $file_name = sanitize_file_name(md5(implode("-", $url_params)));
49 49
 
50 50
     $blog_id = get_current_blog_id();
51
-    if($blog_id>1){
51
+    if ($blog_id > 1) {
52 52
         $file_name = $blog_id."_".$file_name;
53 53
     }
54 54
 
55 55
     $file_path = realpath(dirname(__FILE__))."/map-cache/";
56 56
 
57 57
 
58
-    if(file_exists($file_path.$file_name.".json")){
58
+    if (file_exists($file_path.$file_name.".json")) {
59 59
 
60 60
 
61 61
         ob_start();
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 
65 65
         // do the cache delete stuff
66 66
         $cache_time = get_option('geodir_map_cache');
67
-        if(!$cache_time){
67
+        if (!$cache_time) {
68 68
             $cache_time = time();
69 69
             update_option('geodir_map_cache', $cache_time);
70 70
         }
71 71
 
72
-        if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
72
+        if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
73 73
             geodir_delete_map_cache();
74 74
         }
75 75
 
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
  * @since 1.6.22
89 89
  * @return mixed
90 90
  */
91
-function geodir_save_map_cache($map_json){
91
+function geodir_save_map_cache($map_json) {
92 92
 
93 93
     // if a search is going on then dont even try to check for cache.
94
-    if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
94
+    if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
95 95
         return $map_json;
96 96
     }
97 97
 
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 	$url_params[] = isset($_REQUEST['my_lat']) ? $_REQUEST['my_lat'] : '';
113 113
 	$url_params[] = isset($_REQUEST['my_lon']) ? $_REQUEST['my_lon'] : '';
114 114
 
115
-    $file_name = sanitize_file_name( md5( implode("-",$url_params) )  );
115
+    $file_name = sanitize_file_name(md5(implode("-", $url_params)));
116 116
 
117 117
     $blog_id = get_current_blog_id();
118
-    if($blog_id>1){
118
+    if ($blog_id > 1) {
119 119
         $file_name = $blog_id."_".$file_name;
120 120
     }
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     global $wp_filesystem;
126 126
     if (empty($wp_filesystem)) {
127
-        require_once (ABSPATH . '/wp-admin/includes/file.php');
127
+        require_once (ABSPATH.'/wp-admin/includes/file.php');
128 128
         WP_Filesystem();
129 129
     }
130 130
     $wp_filesystem->put_contents(
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     $gd_session->set('homemap_catlist_ptype', $gd_post_type);
146 146
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
147 147
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
148
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
148
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
149 149
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
150 150
     die;
151 151
 }
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
     global $wpdb, $plugin_prefix, $gd_session, $sitepress;
166 166
 
167 167
     if ($_REQUEST['m_id'] != '') {
168
-        $pid = (int)$_REQUEST['m_id'];
168
+        $pid = (int) $_REQUEST['m_id'];
169 169
     } else {
170 170
         echo __('No marker data found', 'geodirectory');
171 171
         exit;
172 172
     }
173 173
 
174 174
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
175
-        $post = (object)$gd_ses_listing;
175
+        $post = (object) $gd_ses_listing;
176 176
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
177 177
     } else {
178 178
         $geodir_post_type = get_post_type($pid);
179 179
 
180
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
180
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
181 181
 
182
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
182
+        $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
183 183
 
184 184
         $postinfo = $wpdb->get_results($sql);
185 185
 
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 
188 188
         if ($postinfo) {
189 189
             $switch_lang = false;
190
-			if ( geodir_is_wpml() && is_post_type_translated( $geodir_post_type ) ) {
191
-				$post_lang = $sitepress->get_language_for_element( $pid, 'post_' . $geodir_post_type );
190
+			if (geodir_is_wpml() && is_post_type_translated($geodir_post_type)) {
191
+				$post_lang = $sitepress->get_language_for_element($pid, 'post_'.$geodir_post_type);
192 192
 				$current_lang = $sitepress->get_current_language();
193
-				if ( $post_lang !== $current_lang ) {
194
-					$sitepress->switch_lang( $post_lang, true );
193
+				if ($post_lang !== $current_lang) {
194
+					$sitepress->switch_lang($post_lang, true);
195 195
 					$switch_lang = $current_lang;
196 196
 				}
197 197
 			}
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
                 echo geodir_get_infowindow_html($postinfo_obj);
204 204
             }
205 205
 
206
-			if ( $switch_lang !== false ) {
207
-				$sitepress->switch_lang( $switch_lang, true );
206
+			if ($switch_lang !== false) {
207
+				$sitepress->switch_lang($switch_lang, true);
208 208
 			}
209 209
         }
210 210
     }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
  */
228 228
 function get_markers() {
229 229
     
230
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session;
230
+    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session;
231 231
 
232 232
 
233 233
     /**
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @since 1.6.22
237 237
      */
238
-    $map_cache = apply_filters('geodir_get_markers_cache','');
239
-    if($map_cache){
238
+    $map_cache = apply_filters('geodir_get_markers_cache', '');
239
+    if ($map_cache) {
240 240
         return $map_cache;
241 241
         wp_die();
242 242
     }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
252 252
 
253 253
     $map_cat_ids_array = array('0');
254
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
254
+    $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
255 255
 
256 256
 
257 257
     $field_default_cat = '';
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
         $map_cat_arr = trim($_REQUEST['cat_id'], ',');
260 260
 
261 261
         if (!empty($map_cat_arr)) {
262
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
262
+            $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
263 263
 
264 264
             $map_cat_ids_array = explode(',', $map_cat_arr);
265 265
             $cat_find_array = array();
266 266
             foreach ($map_cat_ids_array as $cat_id) {
267
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
268
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
267
+                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id ";
268
+                $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)";
269 269
                 $main_query_array[] = $cat_id;
270 270
             }
271 271
 
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
         $field_default_cat = '';
277 277
 
278 278
     if (!empty($cat_find_array))
279
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
279
+        $search .= "AND (".implode(' OR ', $cat_find_array).")";
280 280
 
281 281
     $main_query_array = $map_cat_ids_array;
282 282
   
283 283
     if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
284 284
         $search .= " AND p.post_title LIKE %s";
285
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
285
+        $main_query_array[] = "%".$_REQUEST['search']."%";
286 286
     }
287 287
 
288 288
     /**
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 
305 305
     $gd_posttype = '';
306 306
     if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
307
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
307
+        $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail';
308 308
         $gd_posttype = " AND p.post_type = %s";
309 309
         $main_query_array[] = $_REQUEST['gd_posttype'];
310 310
 
311 311
     } else
312
-        $table = $plugin_prefix . 'gd_place_detail';
312
+        $table = $plugin_prefix.'gd_place_detail';
313 313
 
314
-    $join = ", " . $table . " AS pd ";
314
+    $join = ", ".$table." AS pd ";
315 315
 
316 316
     /**
317 317
 	 * Filter the SQL JOIN clause for the markers data
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	$search = apply_filters('geodir_home_map_listing_where', $search);
333 333
     $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
334
-    $cat_type = $post_type . 'category';
334
+    $cat_type = $post_type.'category';
335 335
     if ($post_type == 'gd_event') {
336 336
         $event_select = ", pd.recurring_dates, pd.is_recurring";
337 337
     } else {
338 338
         $event_select = "";
339 339
     }
340 340
 
341
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
341
+    $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select;
342 342
     /**
343 343
 	 * Filter the SQL SELECT clause to retrive fields data
344 344
 	 *
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
360 360
 
361
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
361
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
362 362
     
363 363
 	/**
364 364
 	 * Filter the SQL query to retrive markers data
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
         global $geodir_date_time_format, $geodir_date_format, $geodir_time_format;
409 409
 
410 410
         $today = strtotime(date_i18n('Y-m-d'));
411
-        $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
411
+        $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
412 412
         
413 413
         foreach ($catinfo as $catinfo_obj) {
414 414
             $post_title = $catinfo_obj->post_title;
@@ -424,29 +424,29 @@  discard block
 block discarded – undo
424 424
                     $endtimes = '';
425 425
                     $astarttimes = array();
426 426
                     $aendtimes = array();
427
-                    if ( !isset( $recurring_data['repeat_type'] ) ) {
427
+                    if (!isset($recurring_data['repeat_type'])) {
428 428
                         $recurring_data['repeat_type'] = 'custom';
429 429
                     }
430
-                    $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
431
-                    $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false;
430
+                    $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
431
+                    $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false;
432 432
         
433 433
                     $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
434 434
                     
435
-                    if ( !empty( $recurring_dates ) ) {
436
-                        if ( empty( $recurring_data['all_day'] ) ) {
437
-                            if ( $repeat_type == 'custom' && $different_times ) {
438
-                                $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
439
-                                $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
435
+                    if (!empty($recurring_dates)) {
436
+                        if (empty($recurring_data['all_day'])) {
437
+                            if ($repeat_type == 'custom' && $different_times) {
438
+                                $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array();
439
+                                $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array();
440 440
                             } else {
441
-                                $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
442
-                                $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
441
+                                $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : '';
442
+                                $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : '';
443 443
                             }
444 444
                         }
445 445
                         
446 446
                         $e = 0;
447
-                        foreach( $recurring_dates as $key => $date ) {
448
-                            if ( $repeat_type == 'custom' && $different_times ) {
449
-                                if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
447
+                        foreach ($recurring_dates as $key => $date) {
448
+                            if ($repeat_type == 'custom' && $different_times) {
449
+                                if (!empty($astarttimes) && isset($astarttimes[$key])) {
450 450
                                     $starttimes = $astarttimes[$key];
451 451
                                     $endtimes = $aendtimes[$key];
452 452
                                 } else {
@@ -455,50 +455,50 @@  discard block
 block discarded – undo
455 455
                                 }
456 456
                             }
457 457
                             
458
-                            $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1;
458
+                            $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1;
459 459
                             $duration--;
460
-                            $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) );
460
+                            $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
461 461
                             
462 462
                             // Hide past dates
463
-                            if ( strtotime( $enddate ) < $today ) {
463
+                            if (strtotime($enddate) < $today) {
464 464
                                 continue;
465 465
                             }
466 466
                                     
467
-                            $sdate = strtotime( $date . ' ' . $starttimes );
468
-                            $edate = strtotime( $enddate . ' ' . $endtimes );
467
+                            $sdate = strtotime($date.' '.$starttimes);
468
+                            $edate = strtotime($enddate.' '.$endtimes);
469 469
                                         
470
-                            $start_date = date_i18n( $geodir_date_time_format, $sdate );
471
-                            $end_date = date_i18n( $geodir_date_time_format, $edate );
470
+                            $start_date = date_i18n($geodir_date_time_format, $sdate);
471
+                            $end_date = date_i18n($geodir_date_time_format, $edate);
472 472
                             
473 473
                             $same_day = false;
474 474
                             $full_day = false;
475 475
                             $same_datetime = false;
476 476
                             
477
-                            if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
477
+                            if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
478 478
                                 $full_day = true;
479 479
                             }
480 480
                             
481
-                            if ( $start_date == $end_date && $full_day ) {
481
+                            if ($start_date == $end_date && $full_day) {
482 482
                                 $same_datetime = true;
483 483
                             }
484 484
 
485
-                            $link_date = date_i18n( 'Y-m-d', $sdate );
486
-                            $title_date = date_i18n( $geodir_date_format, $sdate );
487
-                            if ( $full_day ) {
485
+                            $link_date = date_i18n('Y-m-d', $sdate);
486
+                            $title_date = date_i18n($geodir_date_format, $sdate);
487
+                            if ($full_day) {
488 488
                                 $start_date = $title_date;
489
-                                $end_date = date_i18n( $geodir_date_format, $edate );
489
+                                $end_date = date_i18n($geodir_date_format, $edate);
490 490
                             }
491 491
                             
492
-                            if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
492
+                            if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
493 493
                                 $same_day = true;
494 494
                                 
495
-                                $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate );
495
+                                $start_date .= ' - '.date_i18n($geodir_time_format, $edate);
496 496
                             }
497 497
                             
498
-                            $event_dates .= ' :: ' . $start_date;
498
+                            $event_dates .= ' :: '.$start_date;
499 499
                         
500
-                            if ( !$same_day && !$same_datetime ) {
501
-                                $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
500
+                            if (!$same_day && !$same_datetime) {
501
+                                $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
502 502
                             }
503 503
                             
504 504
                             $e++;
@@ -509,67 +509,67 @@  discard block
 block discarded – undo
509 509
                         }
510 510
                     }
511 511
                 } else {
512
-                    $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : '';
513
-                    $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date;
514
-                    $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false;
515
-                    $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : '';
516
-                    $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : '';
512
+                    $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : '';
513
+                    $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date;
514
+                    $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false;
515
+                    $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : '';
516
+                    $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : '';
517 517
                 
518
-                    $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
519
-                    $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array();
520
-                    $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array();
518
+                    $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
519
+                    $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array();
520
+                    $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array();
521 521
                     
522
-                    if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
522
+                    if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
523 523
                         $start_date = $event_recurring_dates[0];
524 524
                     }
525 525
                                 
526
-                    if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
526
+                    if (strtotime($end_date) < strtotime($start_date)) {
527 527
                         $end_date = $start_date;
528 528
                     }
529 529
                     
530 530
                     if ($end_date != '' && strtotime($end_date) >= $today) {
531
-                        if ( $starttime == '' && !empty( $starttimes ) ) {
531
+                        if ($starttime == '' && !empty($starttimes)) {
532 532
                             $starttime = $starttimes[0];
533 533
                             $endtime = $endtimes[0];
534 534
                         }
535 535
                         
536 536
                         $same_day = false;
537 537
                         $one_day = false;
538
-                        if ( $start_date == $end_date && $all_day ) {
538
+                        if ($start_date == $end_date && $all_day) {
539 539
                             $one_day = true;
540 540
                         }
541 541
 
542
-                        if ( $all_day ) {
543
-                            $start_datetime = strtotime( $start_date );
544
-                            $end_datetime = strtotime( $end_date );
542
+                        if ($all_day) {
543
+                            $start_datetime = strtotime($start_date);
544
+                            $end_datetime = strtotime($end_date);
545 545
                             
546
-                            $start_date = date_i18n( $geodir_date_format, $start_datetime );
547
-                            $end_date = date_i18n( $geodir_date_format, $end_datetime );
548
-                            if ( $start_date == $end_date ) {
546
+                            $start_date = date_i18n($geodir_date_format, $start_datetime);
547
+                            $end_date = date_i18n($geodir_date_format, $end_datetime);
548
+                            if ($start_date == $end_date) {
549 549
                                 $one_day = true;
550 550
                             }
551 551
                         } else {
552
-                            if ( $start_date == $end_date && $starttime == $endtime ) {
553
-                                $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) );
552
+                            if ($start_date == $end_date && $starttime == $endtime) {
553
+                                $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
554 554
                                 $one_day = false;
555 555
                             }
556
-                            $start_datetime = strtotime( $start_date . ' ' . $starttime );
557
-                            $end_datetime = strtotime( $end_date . ' ' . $endtime );
556
+                            $start_datetime = strtotime($start_date.' '.$starttime);
557
+                            $end_datetime = strtotime($end_date.' '.$endtime);
558 558
                             
559
-                            $start_date = date_i18n( $geodir_date_time_format, $start_datetime );
560
-                            $end_date = date_i18n( $geodir_date_time_format, $end_datetime );
559
+                            $start_date = date_i18n($geodir_date_time_format, $start_datetime);
560
+                            $end_date = date_i18n($geodir_date_time_format, $end_datetime);
561 561
                         }
562 562
 
563
-                        if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
563
+                        if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
564 564
                             $same_day = true;
565 565
                             
566
-                            $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime );
566
+                            $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime);
567 567
                         }
568 568
                         
569
-                        $event_dates .= ' :: ' . $start_date;
569
+                        $event_dates .= ' :: '.$start_date;
570 570
                         
571
-                        if ( !$same_day && !$one_day ) {
572
-                            $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date;
571
+                        if (!$same_day && !$one_day) {
572
+                            $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
573 573
                         }
574 574
                     }
575 575
                 }
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
             $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : '';
586 586
 
587 587
             // if single cat lets just show that icon
588
-            if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
589
-                $default_cat = (int)$map_cat_ids_array[0];
588
+            if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
589
+                $default_cat = (int) $map_cat_ids_array[0];
590 590
             }
591 591
 
592 592
             $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : '';
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
                 $icon_size = array('w' => 36, 'h' => 45);
607 607
             }
608 608
 
609
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
609
+            $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
610 610
             $post_ids[] = $catinfo_obj->post_id;
611 611
         }
612 612
     }
@@ -630,10 +630,10 @@  discard block
 block discarded – undo
630 630
     $totalcount = count(array_unique($post_ids));
631 631
 
632 632
     if (!empty($cat_content_info)) {
633
-        $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
633
+        $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
634 634
     }
635 635
     else {
636
-        $map_json =  '[{"totalcount":"0"}]';
636
+        $map_json = '[{"totalcount":"0"}]';
637 637
     }
638 638
 
639 639
 
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
      * @since 1.6.22
644 644
      * @param string $map_json The JSON string of the map markers results.
645 645
      */
646
-    return apply_filters('geodir_markers_json',$map_json);
646
+    return apply_filters('geodir_markers_json', $map_json);
647 647
 }
648 648
 
649 649
 
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 3 patches
Braces   +27 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
27 26
 
28 27
     if(!is_array($cf) && $cf!=''){
29 28
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -77,8 +76,10 @@  discard block
 block discarded – undo
77 76
 
78 77
             if ( $post->{$html_var} == '1' ):
79 78
                 $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
79
+            else {
80
+            	:
81 81
                 $html_val = __( 'No', 'geodirectory' );
82
+            }
82 83
             endif;
83 84
 
84 85
             $field_icon = geodir_field_icon_proccess($cf);
@@ -116,8 +117,7 @@  discard block
 block discarded – undo
116 117
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 118
 
118 119
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
120
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
121 121
 
122 122
     if(!is_array($cf) && $cf!=''){
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
202 201
 
203 202
     if(!is_array($cf) && $cf!=''){
204 203
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -313,8 +312,7 @@  discard block
 block discarded – undo
313 312
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 313
 
315 314
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
315
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
318 316
 
319 317
     if(!is_array($cf) && $cf!=''){
320 318
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -403,8 +401,7 @@  discard block
 block discarded – undo
403 401
 function geodir_cf_time($html,$location,$cf,$p=''){
404 402
 
405 403
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
404
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
408 405
 
409 406
     if(!is_array($cf) && $cf!=''){
410 407
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -457,9 +454,10 @@  discard block
 block discarded – undo
457 454
         if ($post->{$cf['htmlvar_name']}):
458 455
 
459 456
             $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457
+            if ($post->{$cf['htmlvar_name']} != '') {
458
+                            //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462 459
                 $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
460
+            }
463 461
 
464 462
             $field_icon = geodir_field_icon_proccess($cf);
465 463
             if (strpos($field_icon, 'http') !== false) {
@@ -498,8 +496,7 @@  discard block
 block discarded – undo
498 496
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499 497
     global $preview;
500 498
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
499
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
503 500
 
504 501
     if(!is_array($cf) && $cf!=''){
505 502
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -566,7 +563,7 @@  discard block
 block discarded – undo
566 563
                 $date_format = str_replace($search, $replace, $date_format);
567 564
 
568 565
                 $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
566
+            } else{
570 567
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 568
             }
572 569
 
@@ -575,7 +572,7 @@  discard block
 block discarded – undo
575 572
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 573
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 574
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
575
+            } else{
579 576
                 return '';
580 577
             }
581 578
 
@@ -618,8 +615,7 @@  discard block
 block discarded – undo
618 615
 function geodir_cf_text($html,$location,$cf,$p=''){
619 616
 
620 617
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
618
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
623 619
 
624 620
     if(!is_array($cf) && $cf!=''){
625 621
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -725,8 +721,7 @@  discard block
 block discarded – undo
725 721
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 722
 
727 723
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
724
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
730 725
 
731 726
     if(!is_array($cf) && $cf!=''){
732 727
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -834,8 +829,7 @@  discard block
 block discarded – undo
834 829
 function geodir_cf_select($html,$location,$cf,$p=''){
835 830
 
836 831
     // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
832
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
839 833
 
840 834
     if(!is_array($cf) && $cf!=''){
841 835
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -936,8 +930,7 @@  discard block
 block discarded – undo
936 930
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 931
 
938 932
     // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
933
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
941 934
 
942 935
     if(!is_array($cf) && $cf!=''){
943 936
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1063,8 +1056,7 @@  discard block
 block discarded – undo
1063 1056
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1057
 
1065 1058
     // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1059
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1068 1060
 
1069 1061
     if(!is_array($cf) && $cf!=''){
1070 1062
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1201,11 +1193,11 @@  discard block
 block discarded – undo
1201 1193
                     $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202 1194
                     if($location=='mapbubble'){
1203 1195
                         $html .=  "<a href=\"mailto:$email\">$email_name</a>";
1204
-                    }else{
1196
+                    } else{
1205 1197
                         $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1206 1198
                     }
1207 1199
 
1208
-                }else{
1200
+                } else{
1209 1201
                     $html .=  $email;
1210 1202
                 }
1211 1203
                 $html .= '</span></div>';
@@ -1233,8 +1225,7 @@  discard block
 block discarded – undo
1233 1225
 function geodir_cf_file($html,$location,$cf,$p=''){
1234 1226
 
1235 1227
     // check we have the post value
1236
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1237
-    else{ global $post;}
1228
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1238 1229
 
1239 1230
     if(!is_array($cf) && $cf!=''){
1240 1231
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1327,7 +1318,7 @@  discard block
 block discarded – undo
1327 1318
                             $file_paths .= '</a>';
1328 1319
                             //$file_paths .= '<img src="'.$file.'"  />';	
1329 1320
                             $file_paths .= '</div>';
1330
-                        }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1321
+                        } elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1331 1322
                             $ext_path = '_' . $html_var . '_';
1332 1323
                             $filename = explode($ext_path, $filename);
1333 1324
                             $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
@@ -1380,8 +1371,7 @@  discard block
 block discarded – undo
1380 1371
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1381 1372
 
1382 1373
     // check we have the post value
1383
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1384
-    else{ global $post;}
1374
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1385 1375
 
1386 1376
     if(!is_array($cf) && $cf!=''){
1387 1377
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1471,8 +1461,7 @@  discard block
 block discarded – undo
1471 1461
 function geodir_cf_html($html,$location,$cf,$p=''){
1472 1462
 
1473 1463
     // check we have the post value
1474
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1475
-    else{ global $post;}
1464
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1476 1465
 
1477 1466
     if(!is_array($cf) && $cf!=''){
1478 1467
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1561,8 +1550,7 @@  discard block
 block discarded – undo
1561 1550
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1562 1551
 
1563 1552
     // check we have the post value
1564
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1565
-    else{ global $post;}
1553
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1566 1554
 
1567 1555
     if(!is_array($cf) && $cf!=''){
1568 1556
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1685,8 +1673,7 @@  discard block
 block discarded – undo
1685 1673
 function geodir_cf_address($html,$location,$cf,$p=''){
1686 1674
 
1687 1675
     // check we have the post value
1688
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1689
-    else{ global $post;}
1676
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1690 1677
 
1691 1678
     if(!is_array($cf) && $cf!=''){
1692 1679
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
Please login to merge, or discard this patch.
Indentation   +1558 added lines, -1558 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_html_class(sanitize_title_with_dashes($cf['site_title']));
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_html_class(sanitize_title_with_dashes($cf['site_title']));
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,97 +617,97 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>';
692 692
 
693
-            $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
-                $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
699
-                }
700
-            }
693
+			$value = $post->{$cf['htmlvar_name']};
694
+			if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
+				$extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
+				if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
+					if(!ceil($value) > 0){return '';}// dont output blank prices
698
+					$value = geodir_currency_format_number($value,$cf);
699
+				}
700
+			}
701 701
 
702 702
 
703
-            $html .= $value;
704
-            $html .= '</div>';
703
+			$html .= $value;
704
+			$html .= '</div>';
705 705
 
706
-        endif;
706
+		endif;
707 707
 
708
-    }
708
+	}
709 709
 
710
-    return $html;
710
+	return $html;
711 711
 }
712 712
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
713 713
 
@@ -724,98 +724,98 @@  discard block
 block discarded – undo
724 724
  */
725 725
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 726
 
727
-    // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
730
-
731
-    if(!is_array($cf) && $cf!=''){
732
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
734
-    }
735
-
736
-    $html_var = $cf['htmlvar_name'];
737
-
738
-    // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
-        /**
741
-         * Filter the radio html by location.
742
-         *
743
-         * @param string $html The html to filter.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
-        /**
753
-         * Filter the radio html by individual custom field.
754
-         *
755
-         * @param string $html The html to filter.
756
-         * @param string $location The location to output the html.
757
-         * @param array $cf The custom field array.
758
-         * @since 1.6.6
759
-         */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
-    }
762
-
763
-    // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
-        /**
766
-         * Filter the radio html by field type key.
767
-         *
768
-         * @param string $html The html to filter.
769
-         * @param string $location The location to output the html.
770
-         * @param array $cf The custom field array.
771
-         * @since 1.6.6
772
-         */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
-    }
775
-
776
-    // If not html then we run the standard output.
777
-    if(empty($html)){
778
-
779
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
-
782
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
-                $html_val = __('No', 'geodirectory');
784
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
-                $html_val = __('Yes', 'geodirectory');
786
-            } else {
787
-                if (!empty($cf['option_values'])) {
788
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
-
790
-                    if (!empty($cf_option_values)) {
791
-                        foreach ($cf_option_values as $cf_option_value) {
792
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
-                                $html_val = $cf_option_value['label'];
794
-                            }
795
-                        }
796
-                    }
797
-                }
798
-            }
799
-
800
-            $field_icon = geodir_field_icon_proccess($cf);
801
-            if (strpos($field_icon, 'http') !== false) {
802
-                $field_icon_af = '';
803
-            } elseif ($field_icon == '') {
804
-                $field_icon_af = '';
805
-            } else {
806
-                $field_icon_af = $field_icon;
807
-                $field_icon = '';
808
-            }
809
-
810
-
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
814
-        endif;
815
-
816
-    }
817
-
818
-    return $html;
727
+	// check we have the post value
728
+	if(is_int($p)){$post = geodir_get_post_info($p);}
729
+	else{ global $post;}
730
+
731
+	if(!is_array($cf) && $cf!=''){
732
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
+		if(!$cf){return NULL;}
734
+	}
735
+
736
+	$html_var = $cf['htmlvar_name'];
737
+
738
+	// Check if there is a location specific filter.
739
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
+		/**
741
+		 * Filter the radio html by location.
742
+		 *
743
+		 * @param string $html The html to filter.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
+		/**
753
+		 * Filter the radio html by individual custom field.
754
+		 *
755
+		 * @param string $html The html to filter.
756
+		 * @param string $location The location to output the html.
757
+		 * @param array $cf The custom field array.
758
+		 * @since 1.6.6
759
+		 */
760
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
+	}
762
+
763
+	// Check if there is a custom field key specific filter.
764
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
+		/**
766
+		 * Filter the radio html by field type key.
767
+		 *
768
+		 * @param string $html The html to filter.
769
+		 * @param string $location The location to output the html.
770
+		 * @param array $cf The custom field array.
771
+		 * @since 1.6.6
772
+		 */
773
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
+	}
775
+
776
+	// If not html then we run the standard output.
777
+	if(empty($html)){
778
+
779
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
+
782
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
+				$html_val = __('No', 'geodirectory');
784
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
+				$html_val = __('Yes', 'geodirectory');
786
+			} else {
787
+				if (!empty($cf['option_values'])) {
788
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
+
790
+					if (!empty($cf_option_values)) {
791
+						foreach ($cf_option_values as $cf_option_value) {
792
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
+								$html_val = $cf_option_value['label'];
794
+							}
795
+						}
796
+					}
797
+				}
798
+			}
799
+
800
+			$field_icon = geodir_field_icon_proccess($cf);
801
+			if (strpos($field_icon, 'http') !== false) {
802
+				$field_icon_af = '';
803
+			} elseif ($field_icon == '') {
804
+				$field_icon_af = '';
805
+			} else {
806
+				$field_icon_af = $field_icon;
807
+				$field_icon = '';
808
+			}
809
+
810
+
811
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
+			$html .= '</span>' . $html_val . '</div>';
814
+		endif;
815
+
816
+	}
817
+
818
+	return $html;
819 819
 }
820 820
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
821 821
 
@@ -833,92 +833,92 @@  discard block
 block discarded – undo
833 833
  */
834 834
 function geodir_cf_select($html,$location,$cf,$p=''){
835 835
 
836
-    // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
839
-
840
-    if(!is_array($cf) && $cf!=''){
841
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
843
-    }
844
-
845
-    $html_var = $cf['htmlvar_name'];
846
-
847
-    // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
-        /**
850
-         * Filter the select html by location.
851
-         *
852
-         * @param string $html The html to filter.
853
-         * @param array $cf The custom field array.
854
-         * @since 1.6.6
855
-         */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
-    }
858
-
859
-    // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
-        /**
862
-         * Filter the select html by individual custom field.
863
-         *
864
-         * @param string $html The html to filter.
865
-         * @param string $location The location to output the html.
866
-         * @param array $cf The custom field array.
867
-         * @since 1.6.6
868
-         */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
-    }
871
-
872
-    // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
-        /**
875
-         * Filter the select html by field type key.
876
-         *
877
-         * @param string $html The html to filter.
878
-         * @param string $location The location to output the html.
879
-         * @param array $cf The custom field array.
880
-         * @since 1.6.6
881
-         */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
-    }
884
-
885
-    // If not html then we run the standard output.
886
-    if(empty($html)){
887
-
888
-        if ($post->{$cf['htmlvar_name']}):
889
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
-
891
-            if (!empty($cf['option_values'])) {
892
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
-
894
-                if (!empty($cf_option_values)) {
895
-                    foreach ($cf_option_values as $cf_option_value) {
896
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
-                            $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
-                        }
899
-                    }
900
-                }
901
-            }
902
-
903
-            $field_icon = geodir_field_icon_proccess($cf);
904
-            if (strpos($field_icon, 'http') !== false) {
905
-                $field_icon_af = '';
906
-            } elseif ($field_icon == '') {
907
-                $field_icon_af = '';
908
-            } else {
909
-                $field_icon_af = $field_icon;
910
-                $field_icon = '';
911
-            }
912
-
913
-
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
917
-        endif;
918
-
919
-    }
920
-
921
-    return $html;
836
+	// check we have the post value
837
+	if(is_int($p)){$post = geodir_get_post_info($p);}
838
+	else{ global $post;}
839
+
840
+	if(!is_array($cf) && $cf!=''){
841
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
+		if(!$cf){return NULL;}
843
+	}
844
+
845
+	$html_var = $cf['htmlvar_name'];
846
+
847
+	// Check if there is a location specific filter.
848
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
+		/**
850
+		 * Filter the select html by location.
851
+		 *
852
+		 * @param string $html The html to filter.
853
+		 * @param array $cf The custom field array.
854
+		 * @since 1.6.6
855
+		 */
856
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
+	}
858
+
859
+	// Check if there is a custom field specific filter.
860
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
+		/**
862
+		 * Filter the select html by individual custom field.
863
+		 *
864
+		 * @param string $html The html to filter.
865
+		 * @param string $location The location to output the html.
866
+		 * @param array $cf The custom field array.
867
+		 * @since 1.6.6
868
+		 */
869
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
+	}
871
+
872
+	// Check if there is a custom field key specific filter.
873
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
+		/**
875
+		 * Filter the select html by field type key.
876
+		 *
877
+		 * @param string $html The html to filter.
878
+		 * @param string $location The location to output the html.
879
+		 * @param array $cf The custom field array.
880
+		 * @since 1.6.6
881
+		 */
882
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
+	}
884
+
885
+	// If not html then we run the standard output.
886
+	if(empty($html)){
887
+
888
+		if ($post->{$cf['htmlvar_name']}):
889
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
+
891
+			if (!empty($cf['option_values'])) {
892
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
+
894
+				if (!empty($cf_option_values)) {
895
+					foreach ($cf_option_values as $cf_option_value) {
896
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
+							$field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
+						}
899
+					}
900
+				}
901
+			}
902
+
903
+			$field_icon = geodir_field_icon_proccess($cf);
904
+			if (strpos($field_icon, 'http') !== false) {
905
+				$field_icon_af = '';
906
+			} elseif ($field_icon == '') {
907
+				$field_icon_af = '';
908
+			} else {
909
+				$field_icon_af = $field_icon;
910
+				$field_icon = '';
911
+			}
912
+
913
+
914
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
+			$html .= '</span>' . $field_value . '</div>';
917
+		endif;
918
+
919
+	}
920
+
921
+	return $html;
922 922
 }
923 923
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
924 924
 
@@ -935,117 +935,117 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 937
 
938
-    // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
941
-
942
-    if(!is_array($cf) && $cf!=''){
943
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
945
-    }
946
-
947
-    $html_var = $cf['htmlvar_name'];
948
-
949
-    // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
-        /**
952
-         * Filter the multiselect html by location.
953
-         *
954
-         * @param string $html The html to filter.
955
-         * @param array $cf The custom field array.
956
-         * @since 1.6.6
957
-         */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
-    }
960
-
961
-    // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
-        /**
964
-         * Filter the multiselect html by individual custom field.
965
-         *
966
-         * @param string $html The html to filter.
967
-         * @param string $location The location to output the html.
968
-         * @param array $cf The custom field array.
969
-         * @since 1.6.6
970
-         */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
-    }
973
-
974
-    // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
-        /**
977
-         * Filter the multiselect html by field type key.
978
-         *
979
-         * @param string $html The html to filter.
980
-         * @param string $location The location to output the html.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
-    }
986
-
987
-    // If not html then we run the standard output.
988
-    if(empty($html)){
989
-
990
-
991
-        if (!empty($post->{$cf['htmlvar_name']})):
992
-
993
-            if (is_array($post->{$cf['htmlvar_name']})) {
994
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
-            }
996
-
997
-            $field_icon = geodir_field_icon_proccess($cf);
998
-            if (strpos($field_icon, 'http') !== false) {
999
-                $field_icon_af = '';
1000
-            } elseif ($field_icon == '') {
1001
-                $field_icon_af = '';
1002
-            } else {
1003
-                $field_icon_af = $field_icon;
1004
-                $field_icon = '';
1005
-            }
1006
-
1007
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
-
1009
-            if(is_array($field_values)){
1010
-                $field_values = array_map('trim', $field_values);
1011
-            }
1012
-
1013
-            $option_values = array();
1014
-            if (!empty($cf['option_values'])) {
1015
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
-
1017
-                if (!empty($cf_option_values)) {
1018
-                    foreach ($cf_option_values as $cf_option_value) {
1019
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
-                            $option_values[] = $cf_option_value['label'];
1021
-                        }
1022
-                    }
1023
-                }
1024
-            }
1025
-
1026
-
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
-            $html .= '</span>';
1030
-
1031
-            if (count($option_values) > 1) {
1032
-                $html .= '<ul>';
1033
-
1034
-                foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1036
-                }
1037
-
1038
-                $html .= '</ul>';
1039
-            } else {
1040
-                $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
-            }
1042
-
1043
-            $html .= '</div>';
1044
-        endif;
1045
-
1046
-    }
1047
-
1048
-    return $html;
938
+	// check we have the post value
939
+	if(is_int($p)){$post = geodir_get_post_info($p);}
940
+	else{ global $post;}
941
+
942
+	if(!is_array($cf) && $cf!=''){
943
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
+		if(!$cf){return NULL;}
945
+	}
946
+
947
+	$html_var = $cf['htmlvar_name'];
948
+
949
+	// Check if there is a location specific filter.
950
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
+		/**
952
+		 * Filter the multiselect html by location.
953
+		 *
954
+		 * @param string $html The html to filter.
955
+		 * @param array $cf The custom field array.
956
+		 * @since 1.6.6
957
+		 */
958
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
+	}
960
+
961
+	// Check if there is a custom field specific filter.
962
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
+		/**
964
+		 * Filter the multiselect html by individual custom field.
965
+		 *
966
+		 * @param string $html The html to filter.
967
+		 * @param string $location The location to output the html.
968
+		 * @param array $cf The custom field array.
969
+		 * @since 1.6.6
970
+		 */
971
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
+	}
973
+
974
+	// Check if there is a custom field key specific filter.
975
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
+		/**
977
+		 * Filter the multiselect html by field type key.
978
+		 *
979
+		 * @param string $html The html to filter.
980
+		 * @param string $location The location to output the html.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
+	}
986
+
987
+	// If not html then we run the standard output.
988
+	if(empty($html)){
989
+
990
+
991
+		if (!empty($post->{$cf['htmlvar_name']})):
992
+
993
+			if (is_array($post->{$cf['htmlvar_name']})) {
994
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
+			}
996
+
997
+			$field_icon = geodir_field_icon_proccess($cf);
998
+			if (strpos($field_icon, 'http') !== false) {
999
+				$field_icon_af = '';
1000
+			} elseif ($field_icon == '') {
1001
+				$field_icon_af = '';
1002
+			} else {
1003
+				$field_icon_af = $field_icon;
1004
+				$field_icon = '';
1005
+			}
1006
+
1007
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
+
1009
+			if(is_array($field_values)){
1010
+				$field_values = array_map('trim', $field_values);
1011
+			}
1012
+
1013
+			$option_values = array();
1014
+			if (!empty($cf['option_values'])) {
1015
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
+
1017
+				if (!empty($cf_option_values)) {
1018
+					foreach ($cf_option_values as $cf_option_value) {
1019
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
+							$option_values[] = $cf_option_value['label'];
1021
+						}
1022
+					}
1023
+				}
1024
+			}
1025
+
1026
+
1027
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
+			$html .= '</span>';
1030
+
1031
+			if (count($option_values) > 1) {
1032
+				$html .= '<ul>';
1033
+
1034
+				foreach ($option_values as $val) {
1035
+					$html .= '<li>' . $val . '</li>';
1036
+				}
1037
+
1038
+				$html .= '</ul>';
1039
+			} else {
1040
+				$html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
+			}
1042
+
1043
+			$html .= '</div>';
1044
+		endif;
1045
+
1046
+	}
1047
+
1048
+	return $html;
1049 1049
 }
1050 1050
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1051 1051
 
@@ -1062,148 +1062,148 @@  discard block
 block discarded – undo
1062 1062
  */
1063 1063
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1064
 
1065
-    // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1068
-
1069
-    if(!is_array($cf) && $cf!=''){
1070
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1072
-    }
1073
-
1074
-    $html_var = $cf['htmlvar_name'];
1075
-
1076
-    // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
-        /**
1079
-         * Filter the email html by location.
1080
-         *
1081
-         * @param string $html The html to filter.
1082
-         * @param array $cf The custom field array.
1083
-         * @since 1.6.6
1084
-         */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
-    }
1087
-
1088
-    // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
-        /**
1091
-         * Filter the email html by individual custom field.
1092
-         *
1093
-         * @param string $html The html to filter.
1094
-         * @param string $location The location to output the html.
1095
-         * @param array $cf The custom field array.
1096
-         * @since 1.6.6
1097
-         */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
-    }
1100
-
1101
-    // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
-        /**
1104
-         * Filter the email html by field type key.
1105
-         *
1106
-         * @param string $html The html to filter.
1107
-         * @param string $location The location to output the html.
1108
-         * @param array $cf The custom field array.
1109
-         * @since 1.6.6
1110
-         */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
-    }
1113
-
1114
-    // If not html then we run the standard output.
1115
-    if(empty($html)){
1116
-
1117
-        global $preview;
1118
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
-            return ''; // Remove Send Enquiry from listings page
1120
-        }
1121
-
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
-
1124
-        if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) {
1125
-            $b_send_inquiry = '';
1126
-
1127
-            $html = '';
1128
-            if (!$preview) {
1129
-                $b_send_inquiry = 'b_send_inquiry';
1130
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1131
-            }
1132
-
1133
-            $field_icon = geodir_field_icon_proccess($cf);
1134
-            if (strpos($field_icon, 'http') !== false) {
1135
-                $field_icon_af = '';
1136
-            } elseif ($field_icon == '') {
1137
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1138
-            } else {
1139
-                $field_icon_af = $field_icon;
1140
-                $field_icon = '';
1141
-            }
1142
-
1143
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1144
-            $seperator = '';
1145
-            if ($post->{$cf['htmlvar_name']}) {
1146
-                $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1147
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1148
-            }
1149
-
1150
-            $html .= '</span></div>';
1151
-
1152
-
1153
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1154
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1155
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1156
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1157
-            }
1158
-
1159
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1160
-
1161
-        } else {
1162
-
1163
-            if ($post->{$cf['htmlvar_name']}) {
1164
-
1165
-                $field_icon = geodir_field_icon_proccess($cf);
1166
-                if (strpos($field_icon, 'http') !== false) {
1167
-                    $field_icon_af = '';
1168
-                } elseif ($field_icon == '') {
1169
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1170
-                } else {
1171
-                    $field_icon_af = $field_icon;
1172
-                    $field_icon = '';
1173
-                }
1174
-
1175
-
1176
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1177
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1178
-                $html .= '</span><span class="geodir-email-address-output">';
1179
-                $email = $post->{$cf['htmlvar_name']} ;
1180
-                if($e_split = explode('@',$email)){
1181
-                    /**
1182
-                     * Filter email custom field name output.
1183
-                     *
1184
-                     * @since 1.5.3
1185
-                     *
1186
-                     * @param string $email The email string being output.
1187
-                     * @param array $cf Custom field variables array.
1188
-                     */
1189
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1190
-                    if($location=='mapbubble'){
1191
-                        $html .=  "<a href=\"mailto:$email\">$email_name</a>";
1192
-                    }else{
1193
-                        $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1194
-                    }
1195
-
1196
-                }else{
1197
-                    $html .=  $email;
1198
-                }
1199
-                $html .= '</span></div>';
1200
-            }
1201
-
1202
-        }
1203
-
1204
-    }
1205
-
1206
-    return $html;
1065
+	// check we have the post value
1066
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1067
+	else{ global $post;}
1068
+
1069
+	if(!is_array($cf) && $cf!=''){
1070
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
+		if(!$cf){return NULL;}
1072
+	}
1073
+
1074
+	$html_var = $cf['htmlvar_name'];
1075
+
1076
+	// Check if there is a location specific filter.
1077
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
+		/**
1079
+		 * Filter the email html by location.
1080
+		 *
1081
+		 * @param string $html The html to filter.
1082
+		 * @param array $cf The custom field array.
1083
+		 * @since 1.6.6
1084
+		 */
1085
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
+	}
1087
+
1088
+	// Check if there is a custom field specific filter.
1089
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
+		/**
1091
+		 * Filter the email html by individual custom field.
1092
+		 *
1093
+		 * @param string $html The html to filter.
1094
+		 * @param string $location The location to output the html.
1095
+		 * @param array $cf The custom field array.
1096
+		 * @since 1.6.6
1097
+		 */
1098
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
+	}
1100
+
1101
+	// Check if there is a custom field key specific filter.
1102
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
+		/**
1104
+		 * Filter the email html by field type key.
1105
+		 *
1106
+		 * @param string $html The html to filter.
1107
+		 * @param string $location The location to output the html.
1108
+		 * @param array $cf The custom field array.
1109
+		 * @since 1.6.6
1110
+		 */
1111
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
+	}
1113
+
1114
+	// If not html then we run the standard output.
1115
+	if(empty($html)){
1116
+
1117
+		global $preview;
1118
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
+			return ''; // Remove Send Enquiry from listings page
1120
+		}
1121
+
1122
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
+
1124
+		if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) {
1125
+			$b_send_inquiry = '';
1126
+
1127
+			$html = '';
1128
+			if (!$preview) {
1129
+				$b_send_inquiry = 'b_send_inquiry';
1130
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1131
+			}
1132
+
1133
+			$field_icon = geodir_field_icon_proccess($cf);
1134
+			if (strpos($field_icon, 'http') !== false) {
1135
+				$field_icon_af = '';
1136
+			} elseif ($field_icon == '') {
1137
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1138
+			} else {
1139
+				$field_icon_af = $field_icon;
1140
+				$field_icon = '';
1141
+			}
1142
+
1143
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1144
+			$seperator = '';
1145
+			if ($post->{$cf['htmlvar_name']}) {
1146
+				$b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1147
+				$html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1148
+			}
1149
+
1150
+			$html .= '</span></div>';
1151
+
1152
+
1153
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1154
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1155
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1156
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1157
+			}
1158
+
1159
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1160
+
1161
+		} else {
1162
+
1163
+			if ($post->{$cf['htmlvar_name']}) {
1164
+
1165
+				$field_icon = geodir_field_icon_proccess($cf);
1166
+				if (strpos($field_icon, 'http') !== false) {
1167
+					$field_icon_af = '';
1168
+				} elseif ($field_icon == '') {
1169
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1170
+				} else {
1171
+					$field_icon_af = $field_icon;
1172
+					$field_icon = '';
1173
+				}
1174
+
1175
+
1176
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1177
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1178
+				$html .= '</span><span class="geodir-email-address-output">';
1179
+				$email = $post->{$cf['htmlvar_name']} ;
1180
+				if($e_split = explode('@',$email)){
1181
+					/**
1182
+					 * Filter email custom field name output.
1183
+					 *
1184
+					 * @since 1.5.3
1185
+					 *
1186
+					 * @param string $email The email string being output.
1187
+					 * @param array $cf Custom field variables array.
1188
+					 */
1189
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1190
+					if($location=='mapbubble'){
1191
+						$html .=  "<a href=\"mailto:$email\">$email_name</a>";
1192
+					}else{
1193
+						$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1194
+					}
1195
+
1196
+				}else{
1197
+					$html .=  $email;
1198
+				}
1199
+				$html .= '</span></div>';
1200
+			}
1201
+
1202
+		}
1203
+
1204
+	}
1205
+
1206
+	return $html;
1207 1207
 }
1208 1208
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1209 1209
 
@@ -1220,136 +1220,136 @@  discard block
 block discarded – undo
1220 1220
  */
1221 1221
 function geodir_cf_file($html,$location,$cf,$p=''){
1222 1222
 
1223
-    // check we have the post value
1224
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1225
-    else{ global $post;}
1226
-
1227
-    if(!is_array($cf) && $cf!=''){
1228
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1229
-        if(!$cf){return NULL;}
1230
-    }
1231
-
1232
-    $html_var = $cf['htmlvar_name'];
1233
-
1234
-    // Check if there is a location specific filter.
1235
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1236
-        /**
1237
-         * Filter the file html by location.
1238
-         *
1239
-         * @param string $html The html to filter.
1240
-         * @param array $cf The custom field array.
1241
-         * @since 1.6.6
1242
-         */
1243
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1244
-    }
1245
-
1246
-    // Check if there is a custom field specific filter.
1247
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1248
-        /**
1249
-         * Filter the file html by individual custom field.
1250
-         *
1251
-         * @param string $html The html to filter.
1252
-         * @param string $location The location to output the html.
1253
-         * @param array $cf The custom field array.
1254
-         * @since 1.6.6
1255
-         */
1256
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1257
-    }
1258
-
1259
-    // Check if there is a custom field key specific filter.
1260
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1261
-        /**
1262
-         * Filter the file html by field type key.
1263
-         *
1264
-         * @param string $html The html to filter.
1265
-         * @param string $location The location to output the html.
1266
-         * @param array $cf The custom field array.
1267
-         * @since 1.6.6
1268
-         */
1269
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1270
-    }
1271
-
1272
-    // If not html then we run the standard output.
1273
-    if(empty($html)){
1274
-
1275
-        if (!empty($post->{$cf['htmlvar_name']})):
1276
-
1277
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1278
-            if (!empty($files)):
1279
-
1280
-                $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1281
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1282
-
1283
-                $file_paths = '';
1284
-                foreach ($files as $file) {
1285
-                    if (!empty($file)) {
1286
-
1287
-                        // $filetype = wp_check_filetype($file);
1288
-
1289
-                        $image_name_arr = explode('/', $file);
1290
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1291
-                        $filename = end($image_name_arr);
1292
-                        $img_name_arr = explode('.', $filename);
1293
-
1294
-                        $arr_file_type = wp_check_filetype($filename);
1295
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1296
-                            continue;
1297
-                        }
1298
-
1299
-                        $uploaded_file_type = $arr_file_type['type'];
1300
-                        $uploaded_file_ext = $arr_file_type['ext'];
1301
-
1302
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1303
-                            continue; // Invalid file type.
1304
-                        }
1305
-
1306
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1307
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1308
-                        $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
1309
-
1310
-                        // If the uploaded file is image
1311
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1312
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1313
-                            $file_paths .= '<a href="'.$file.'">';
1314
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1315
-                            $file_paths .= '</a>';
1316
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1317
-                            $file_paths .= '</div>';
1318
-                        }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1319
-                            $ext_path = '_' . $html_var . '_';
1320
-                            $filename = explode($ext_path, $filename);
1321
-                            $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1322
-                            $file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1323
-                        } else {
1324
-                            $ext_path = '_' . $html_var . '_';
1325
-                            $filename = explode($ext_path, $filename);
1326
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1327
-                        }
1328
-                    }
1329
-                }
1330
-
1331
-                $field_icon = geodir_field_icon_proccess($cf);
1332
-                if (strpos($field_icon, 'http') !== false) {
1333
-                    $field_icon_af = '';
1334
-                } elseif ($field_icon == '') {
1335
-                    $field_icon_af = '';
1336
-                } else {
1337
-                    $field_icon_af = $field_icon;
1338
-                    $field_icon = '';
1339
-                }
1340
-
1341
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1342
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1343
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1344
-                $html .= '</span>';
1345
-                $html .= $file_paths . '</div></div>';
1346
-
1347
-            endif;
1348
-        endif;
1349
-
1350
-    }
1351
-
1352
-    return $html;
1223
+	// check we have the post value
1224
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1225
+	else{ global $post;}
1226
+
1227
+	if(!is_array($cf) && $cf!=''){
1228
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1229
+		if(!$cf){return NULL;}
1230
+	}
1231
+
1232
+	$html_var = $cf['htmlvar_name'];
1233
+
1234
+	// Check if there is a location specific filter.
1235
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1236
+		/**
1237
+		 * Filter the file html by location.
1238
+		 *
1239
+		 * @param string $html The html to filter.
1240
+		 * @param array $cf The custom field array.
1241
+		 * @since 1.6.6
1242
+		 */
1243
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1244
+	}
1245
+
1246
+	// Check if there is a custom field specific filter.
1247
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1248
+		/**
1249
+		 * Filter the file html by individual custom field.
1250
+		 *
1251
+		 * @param string $html The html to filter.
1252
+		 * @param string $location The location to output the html.
1253
+		 * @param array $cf The custom field array.
1254
+		 * @since 1.6.6
1255
+		 */
1256
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1257
+	}
1258
+
1259
+	// Check if there is a custom field key specific filter.
1260
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1261
+		/**
1262
+		 * Filter the file html by field type key.
1263
+		 *
1264
+		 * @param string $html The html to filter.
1265
+		 * @param string $location The location to output the html.
1266
+		 * @param array $cf The custom field array.
1267
+		 * @since 1.6.6
1268
+		 */
1269
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1270
+	}
1271
+
1272
+	// If not html then we run the standard output.
1273
+	if(empty($html)){
1274
+
1275
+		if (!empty($post->{$cf['htmlvar_name']})):
1276
+
1277
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1278
+			if (!empty($files)):
1279
+
1280
+				$extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1281
+				$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1282
+
1283
+				$file_paths = '';
1284
+				foreach ($files as $file) {
1285
+					if (!empty($file)) {
1286
+
1287
+						// $filetype = wp_check_filetype($file);
1288
+
1289
+						$image_name_arr = explode('/', $file);
1290
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1291
+						$filename = end($image_name_arr);
1292
+						$img_name_arr = explode('.', $filename);
1293
+
1294
+						$arr_file_type = wp_check_filetype($filename);
1295
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1296
+							continue;
1297
+						}
1298
+
1299
+						$uploaded_file_type = $arr_file_type['type'];
1300
+						$uploaded_file_ext = $arr_file_type['ext'];
1301
+
1302
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1303
+							continue; // Invalid file type.
1304
+						}
1305
+
1306
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1307
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1308
+						$audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
1309
+
1310
+						// If the uploaded file is image
1311
+						if (in_array($uploaded_file_type, $image_file_types)) {
1312
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1313
+							$file_paths .= '<a href="'.$file.'">';
1314
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1315
+							$file_paths .= '</a>';
1316
+							//$file_paths .= '<img src="'.$file.'"  />';	
1317
+							$file_paths .= '</div>';
1318
+						}elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1319
+							$ext_path = '_' . $html_var . '_';
1320
+							$filename = explode($ext_path, $filename);
1321
+							$file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1322
+							$file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1323
+						} else {
1324
+							$ext_path = '_' . $html_var . '_';
1325
+							$filename = explode($ext_path, $filename);
1326
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1327
+						}
1328
+					}
1329
+				}
1330
+
1331
+				$field_icon = geodir_field_icon_proccess($cf);
1332
+				if (strpos($field_icon, 'http') !== false) {
1333
+					$field_icon_af = '';
1334
+				} elseif ($field_icon == '') {
1335
+					$field_icon_af = '';
1336
+				} else {
1337
+					$field_icon_af = $field_icon;
1338
+					$field_icon = '';
1339
+				}
1340
+
1341
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1342
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1343
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1344
+				$html .= '</span>';
1345
+				$html .= $file_paths . '</div></div>';
1346
+
1347
+			endif;
1348
+		endif;
1349
+
1350
+	}
1351
+
1352
+	return $html;
1353 1353
 }
1354 1354
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1355 1355
 
@@ -1367,80 +1367,80 @@  discard block
 block discarded – undo
1367 1367
  */
1368 1368
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1369 1369
 
1370
-    // check we have the post value
1371
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1372
-    else{ global $post;}
1373
-
1374
-    if(!is_array($cf) && $cf!=''){
1375
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1376
-        if(!$cf){return NULL;}
1377
-    }
1378
-
1379
-    $html_var = $cf['htmlvar_name'];
1380
-
1381
-    // Check if there is a location specific filter.
1382
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1383
-        /**
1384
-         * Filter the textarea html by location.
1385
-         *
1386
-         * @param string $html The html to filter.
1387
-         * @param array $cf The custom field array.
1388
-         * @since 1.6.6
1389
-         */
1390
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1391
-    }
1392
-
1393
-    // Check if there is a custom field specific filter.
1394
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1395
-        /**
1396
-         * Filter the textarea html by individual custom field.
1397
-         *
1398
-         * @param string $html The html to filter.
1399
-         * @param string $location The location to output the html.
1400
-         * @param array $cf The custom field array.
1401
-         * @since 1.6.6
1402
-         */
1403
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1404
-    }
1405
-
1406
-    // Check if there is a custom field key specific filter.
1407
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1408
-        /**
1409
-         * Filter the textarea html by field type key.
1410
-         *
1411
-         * @param string $html The html to filter.
1412
-         * @param string $location The location to output the html.
1413
-         * @param array $cf The custom field array.
1414
-         * @since 1.6.6
1415
-         */
1416
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1417
-    }
1418
-
1419
-    // If not html then we run the standard output.
1420
-    if(empty($html)){
1421
-
1422
-        if (!empty($post->{$cf['htmlvar_name']})) {
1423
-
1424
-            $field_icon = geodir_field_icon_proccess($cf);
1425
-            if (strpos($field_icon, 'http') !== false) {
1426
-                $field_icon_af = '';
1427
-            } elseif ($field_icon == '') {
1428
-                $field_icon_af = '';
1429
-            } else {
1430
-                $field_icon_af = $field_icon;
1431
-                $field_icon = '';
1432
-            }
1433
-
1434
-
1435
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1436
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1437
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1438
-
1439
-        }
1440
-
1441
-    }
1442
-
1443
-    return $html;
1370
+	// check we have the post value
1371
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1372
+	else{ global $post;}
1373
+
1374
+	if(!is_array($cf) && $cf!=''){
1375
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1376
+		if(!$cf){return NULL;}
1377
+	}
1378
+
1379
+	$html_var = $cf['htmlvar_name'];
1380
+
1381
+	// Check if there is a location specific filter.
1382
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1383
+		/**
1384
+		 * Filter the textarea html by location.
1385
+		 *
1386
+		 * @param string $html The html to filter.
1387
+		 * @param array $cf The custom field array.
1388
+		 * @since 1.6.6
1389
+		 */
1390
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1391
+	}
1392
+
1393
+	// Check if there is a custom field specific filter.
1394
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1395
+		/**
1396
+		 * Filter the textarea html by individual custom field.
1397
+		 *
1398
+		 * @param string $html The html to filter.
1399
+		 * @param string $location The location to output the html.
1400
+		 * @param array $cf The custom field array.
1401
+		 * @since 1.6.6
1402
+		 */
1403
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1404
+	}
1405
+
1406
+	// Check if there is a custom field key specific filter.
1407
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1408
+		/**
1409
+		 * Filter the textarea html by field type key.
1410
+		 *
1411
+		 * @param string $html The html to filter.
1412
+		 * @param string $location The location to output the html.
1413
+		 * @param array $cf The custom field array.
1414
+		 * @since 1.6.6
1415
+		 */
1416
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1417
+	}
1418
+
1419
+	// If not html then we run the standard output.
1420
+	if(empty($html)){
1421
+
1422
+		if (!empty($post->{$cf['htmlvar_name']})) {
1423
+
1424
+			$field_icon = geodir_field_icon_proccess($cf);
1425
+			if (strpos($field_icon, 'http') !== false) {
1426
+				$field_icon_af = '';
1427
+			} elseif ($field_icon == '') {
1428
+				$field_icon_af = '';
1429
+			} else {
1430
+				$field_icon_af = $field_icon;
1431
+				$field_icon = '';
1432
+			}
1433
+
1434
+
1435
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1436
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1437
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1438
+
1439
+		}
1440
+
1441
+	}
1442
+
1443
+	return $html;
1444 1444
 }
1445 1445
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1446 1446
 
@@ -1458,79 +1458,79 @@  discard block
 block discarded – undo
1458 1458
  */
1459 1459
 function geodir_cf_html($html,$location,$cf,$p=''){
1460 1460
 
1461
-    // check we have the post value
1462
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1463
-    else{ global $post;}
1464
-
1465
-    if(!is_array($cf) && $cf!=''){
1466
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1467
-        if(!$cf){return NULL;}
1468
-    }
1469
-
1470
-    $html_var = $cf['htmlvar_name'];
1471
-
1472
-    // Check if there is a location specific filter.
1473
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1474
-        /**
1475
-         * Filter the html html by location.
1476
-         *
1477
-         * @param string $html The html to filter.
1478
-         * @param array $cf The custom field array.
1479
-         * @since 1.6.6
1480
-         */
1481
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1482
-    }
1483
-
1484
-    // Check if there is a custom field specific filter.
1485
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1486
-        /**
1487
-         * Filter the html html by individual custom field.
1488
-         *
1489
-         * @param string $html The html to filter.
1490
-         * @param string $location The location to output the html.
1491
-         * @param array $cf The custom field array.
1492
-         * @since 1.6.6
1493
-         */
1494
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1495
-    }
1496
-
1497
-    // Check if there is a custom field key specific filter.
1498
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1499
-        /**
1500
-         * Filter the html html by field type key.
1501
-         *
1502
-         * @param string $html The html to filter.
1503
-         * @param string $location The location to output the html.
1504
-         * @param array $cf The custom field array.
1505
-         * @since 1.6.6
1506
-         */
1507
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1508
-    }
1509
-
1510
-    // If not html then we run the standard output.
1511
-    if(empty($html)){
1512
-
1513
-        if (!empty($post->{$cf['htmlvar_name']})) {
1514
-
1515
-            $field_icon = geodir_field_icon_proccess($cf);
1516
-            if (strpos($field_icon, 'http') !== false) {
1517
-                $field_icon_af = '';
1518
-            } elseif ($field_icon == '') {
1519
-                $field_icon_af = '';
1520
-            } else {
1521
-                $field_icon_af = $field_icon;
1522
-                $field_icon = '';
1523
-            }
1524
-
1525
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1526
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1527
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1528
-
1529
-        }
1530
-
1531
-    }
1532
-
1533
-    return $html;
1461
+	// check we have the post value
1462
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1463
+	else{ global $post;}
1464
+
1465
+	if(!is_array($cf) && $cf!=''){
1466
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1467
+		if(!$cf){return NULL;}
1468
+	}
1469
+
1470
+	$html_var = $cf['htmlvar_name'];
1471
+
1472
+	// Check if there is a location specific filter.
1473
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1474
+		/**
1475
+		 * Filter the html html by location.
1476
+		 *
1477
+		 * @param string $html The html to filter.
1478
+		 * @param array $cf The custom field array.
1479
+		 * @since 1.6.6
1480
+		 */
1481
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1482
+	}
1483
+
1484
+	// Check if there is a custom field specific filter.
1485
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1486
+		/**
1487
+		 * Filter the html html by individual custom field.
1488
+		 *
1489
+		 * @param string $html The html to filter.
1490
+		 * @param string $location The location to output the html.
1491
+		 * @param array $cf The custom field array.
1492
+		 * @since 1.6.6
1493
+		 */
1494
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1495
+	}
1496
+
1497
+	// Check if there is a custom field key specific filter.
1498
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1499
+		/**
1500
+		 * Filter the html html by field type key.
1501
+		 *
1502
+		 * @param string $html The html to filter.
1503
+		 * @param string $location The location to output the html.
1504
+		 * @param array $cf The custom field array.
1505
+		 * @since 1.6.6
1506
+		 */
1507
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1508
+	}
1509
+
1510
+	// If not html then we run the standard output.
1511
+	if(empty($html)){
1512
+
1513
+		if (!empty($post->{$cf['htmlvar_name']})) {
1514
+
1515
+			$field_icon = geodir_field_icon_proccess($cf);
1516
+			if (strpos($field_icon, 'http') !== false) {
1517
+				$field_icon_af = '';
1518
+			} elseif ($field_icon == '') {
1519
+				$field_icon_af = '';
1520
+			} else {
1521
+				$field_icon_af = $field_icon;
1522
+				$field_icon = '';
1523
+			}
1524
+
1525
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1526
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1527
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1528
+
1529
+		}
1530
+
1531
+	}
1532
+
1533
+	return $html;
1534 1534
 }
1535 1535
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1536 1536
 
@@ -1548,113 +1548,113 @@  discard block
 block discarded – undo
1548 1548
  */
1549 1549
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1550 1550
 
1551
-    // check we have the post value
1552
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1553
-    else{ global $post;}
1554
-
1555
-    if(!is_array($cf) && $cf!=''){
1556
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1557
-        if(!$cf){return NULL;}
1558
-    }
1559
-
1560
-    $html_var = $cf['htmlvar_name'];
1561
-
1562
-    // Check if there is a location specific filter.
1563
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1564
-        /**
1565
-         * Filter the taxonomy html by location.
1566
-         *
1567
-         * @param string $html The html to filter.
1568
-         * @param array $cf The custom field array.
1569
-         * @since 1.6.6
1570
-         */
1571
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1572
-    }
1573
-
1574
-    // Check if there is a custom field specific filter.
1575
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1576
-        /**
1577
-         * Filter the taxonomy html by individual custom field.
1578
-         *
1579
-         * @param string $html The html to filter.
1580
-         * @param string $location The location to output the html.
1581
-         * @param array $cf The custom field array.
1582
-         * @since 1.6.6
1583
-         */
1584
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1585
-    }
1586
-
1587
-    // Check if there is a custom field key specific filter.
1588
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1589
-        /**
1590
-         * Filter the taxonomy html by field type key.
1591
-         *
1592
-         * @param string $html The html to filter.
1593
-         * @param string $location The location to output the html.
1594
-         * @param array $cf The custom field array.
1595
-         * @since 1.6.6
1596
-         */
1597
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1598
-    }
1599
-
1600
-    // If not html then we run the standard output.
1601
-    if(empty($html)){
1602
-
1603
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1604
-            $post_taxonomy = $post->post_type . 'category';
1605
-            $field_value = $post->{$html_var};
1606
-            $links = array();
1607
-            $terms = array();
1608
-            $termsOrdered = array();
1609
-            if (!is_array($field_value)) {
1610
-                $field_value = explode(",", trim($field_value, ","));
1611
-            }
1612
-
1613
-            $field_value = array_unique($field_value);
1614
-
1615
-            if (!empty($field_value)) {
1616
-                foreach ($field_value as $term) {
1617
-                    $term = trim($term);
1618
-
1619
-                    if ($term != '') {
1620
-                        $term = get_term_by('id', $term, $html_var);
1621
-                        if (is_object($term)) {
1622
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1623
-                            $terms[] = $term;
1624
-                        }
1625
-                    }
1626
-                }
1627
-                if (!empty($links)) {
1628
-                    // order alphabetically
1629
-                    asort($links);
1630
-                    foreach (array_keys($links) as $key) {
1631
-                        $termsOrdered[$key] = $terms[$key];
1632
-                    }
1633
-                    $terms = $termsOrdered;
1634
-                }
1635
-            }
1636
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1637
-
1638
-            if ($html_value != '') {
1639
-                $field_icon = geodir_field_icon_proccess($cf);
1640
-                if (strpos($field_icon, 'http') !== false) {
1641
-                    $field_icon_af = '';
1642
-                } else if ($field_icon == '') {
1643
-                    $field_icon_af = '';
1644
-                } else {
1645
-                    $field_icon_af = $field_icon;
1646
-                    $field_icon = '';
1647
-                }
1648
-
1649
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1650
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1651
-                $html .= '</span> ' . $html_value . '</div>';
1652
-            }
1653
-        }
1654
-
1655
-    }
1656
-
1657
-    return $html;
1551
+	// check we have the post value
1552
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1553
+	else{ global $post;}
1554
+
1555
+	if(!is_array($cf) && $cf!=''){
1556
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1557
+		if(!$cf){return NULL;}
1558
+	}
1559
+
1560
+	$html_var = $cf['htmlvar_name'];
1561
+
1562
+	// Check if there is a location specific filter.
1563
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1564
+		/**
1565
+		 * Filter the taxonomy html by location.
1566
+		 *
1567
+		 * @param string $html The html to filter.
1568
+		 * @param array $cf The custom field array.
1569
+		 * @since 1.6.6
1570
+		 */
1571
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1572
+	}
1573
+
1574
+	// Check if there is a custom field specific filter.
1575
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1576
+		/**
1577
+		 * Filter the taxonomy html by individual custom field.
1578
+		 *
1579
+		 * @param string $html The html to filter.
1580
+		 * @param string $location The location to output the html.
1581
+		 * @param array $cf The custom field array.
1582
+		 * @since 1.6.6
1583
+		 */
1584
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1585
+	}
1586
+
1587
+	// Check if there is a custom field key specific filter.
1588
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1589
+		/**
1590
+		 * Filter the taxonomy html by field type key.
1591
+		 *
1592
+		 * @param string $html The html to filter.
1593
+		 * @param string $location The location to output the html.
1594
+		 * @param array $cf The custom field array.
1595
+		 * @since 1.6.6
1596
+		 */
1597
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1598
+	}
1599
+
1600
+	// If not html then we run the standard output.
1601
+	if(empty($html)){
1602
+
1603
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1604
+			$post_taxonomy = $post->post_type . 'category';
1605
+			$field_value = $post->{$html_var};
1606
+			$links = array();
1607
+			$terms = array();
1608
+			$termsOrdered = array();
1609
+			if (!is_array($field_value)) {
1610
+				$field_value = explode(",", trim($field_value, ","));
1611
+			}
1612
+
1613
+			$field_value = array_unique($field_value);
1614
+
1615
+			if (!empty($field_value)) {
1616
+				foreach ($field_value as $term) {
1617
+					$term = trim($term);
1618
+
1619
+					if ($term != '') {
1620
+						$term = get_term_by('id', $term, $html_var);
1621
+						if (is_object($term)) {
1622
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1623
+							$terms[] = $term;
1624
+						}
1625
+					}
1626
+				}
1627
+				if (!empty($links)) {
1628
+					// order alphabetically
1629
+					asort($links);
1630
+					foreach (array_keys($links) as $key) {
1631
+						$termsOrdered[$key] = $terms[$key];
1632
+					}
1633
+					$terms = $termsOrdered;
1634
+				}
1635
+			}
1636
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1637
+
1638
+			if ($html_value != '') {
1639
+				$field_icon = geodir_field_icon_proccess($cf);
1640
+				if (strpos($field_icon, 'http') !== false) {
1641
+					$field_icon_af = '';
1642
+				} else if ($field_icon == '') {
1643
+					$field_icon_af = '';
1644
+				} else {
1645
+					$field_icon_af = $field_icon;
1646
+					$field_icon = '';
1647
+				}
1648
+
1649
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1650
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1651
+				$html .= '</span> ' . $html_value . '</div>';
1652
+			}
1653
+		}
1654
+
1655
+	}
1656
+
1657
+	return $html;
1658 1658
 }
1659 1659
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1660 1660
 
@@ -1672,176 +1672,176 @@  discard block
 block discarded – undo
1672 1672
  */
1673 1673
 function geodir_cf_address($html,$location,$cf,$p=''){
1674 1674
 
1675
-    // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1678
-
1679
-    if(!is_array($cf) && $cf!=''){
1680
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1682
-    }
1683
-
1684
-    $html_var = $cf['htmlvar_name'];
1685
-
1686
-    // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
-        /**
1689
-         * Filter the address html by location.
1690
-         *
1691
-         * @param string $html The html to filter.
1692
-         * @param array $cf The custom field array.
1693
-         * @since 1.6.6
1694
-         */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
-    }
1697
-
1698
-    // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
-        /**
1701
-         * Filter the address html by individual custom field.
1702
-         *
1703
-         * @param string $html The html to filter.
1704
-         * @param string $location The location to output the html.
1705
-         * @param array $cf The custom field array.
1706
-         * @since 1.6.6
1707
-         */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
-    }
1710
-
1711
-    // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
-        /**
1714
-         * Filter the address html by field type key.
1715
-         *
1716
-         * @param string $html The html to filter.
1717
-         * @param string $location The location to output the html.
1718
-         * @param array $cf The custom field array.
1719
-         * @since 1.6.6
1720
-         */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
-    }
1723
-
1724
-    // If not html then we run the standard output.
1725
-    if(empty($html)){
1726
-
1727
-        global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1729
-
1730
-        if ($cf['extra_fields']) {
1731
-
1732
-            $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
-
1734
-            $addition_fields = '';
1735
-
1736
-            if (!empty($extra_fields)) {
1737
-
1738
-                $show_city_in_address = false;
1739
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
-                    $show_city_in_address = true;
1741
-                }
1742
-                /**
1743
-                 * Filter "show city in address" value.
1744
-                 *
1745
-                 * @since 1.0.0
1746
-                 */
1747
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
-
1749
-
1750
-                $show_region_in_address = false;
1751
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
-                    $show_region_in_address = true;
1753
-                }
1754
-                /**
1755
-                 * Filter "show region in address" value.
1756
-                 *
1757
-                 * @since 1.6.6
1758
-                 */
1759
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
-
1761
-                $show_country_in_address = false;
1762
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
-                    $show_country_in_address = true;
1764
-                }
1765
-                /**
1766
-                 * Filter "show country in address" value.
1767
-                 *
1768
-                 * @since 1.6.6
1769
-                 */
1770
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
-
1772
-                $show_zip_in_address = false;
1773
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
-                    $show_zip_in_address = true;
1775
-                }
1776
-                /**
1777
-                 * Filter "show zip in address" value.
1778
-                 *
1779
-                 * @since 1.6.6
1780
-                 */
1781
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
-
1783
-
1784
-            }
1785
-
1786
-        }
1787
-
1788
-
1789
-        if ($post->{$html_var}) {
1790
-
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1793
-                $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1795
-                $field_icon_af = '<i class="fa fa-home"></i>';
1796
-            } else {
1797
-                $field_icon_af = $field_icon;
1798
-                $field_icon    = '';
1799
-            }
1675
+	// check we have the post value
1676
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1677
+	else{ global $post;}
1678
+
1679
+	if(!is_array($cf) && $cf!=''){
1680
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
+		if(!$cf){return NULL;}
1682
+	}
1683
+
1684
+	$html_var = $cf['htmlvar_name'];
1685
+
1686
+	// Check if there is a location specific filter.
1687
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
+		/**
1689
+		 * Filter the address html by location.
1690
+		 *
1691
+		 * @param string $html The html to filter.
1692
+		 * @param array $cf The custom field array.
1693
+		 * @since 1.6.6
1694
+		 */
1695
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
+	}
1697
+
1698
+	// Check if there is a custom field specific filter.
1699
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
+		/**
1701
+		 * Filter the address html by individual custom field.
1702
+		 *
1703
+		 * @param string $html The html to filter.
1704
+		 * @param string $location The location to output the html.
1705
+		 * @param array $cf The custom field array.
1706
+		 * @since 1.6.6
1707
+		 */
1708
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
+	}
1710
+
1711
+	// Check if there is a custom field key specific filter.
1712
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
+		/**
1714
+		 * Filter the address html by field type key.
1715
+		 *
1716
+		 * @param string $html The html to filter.
1717
+		 * @param string $location The location to output the html.
1718
+		 * @param array $cf The custom field array.
1719
+		 * @since 1.6.6
1720
+		 */
1721
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
+	}
1723
+
1724
+	// If not html then we run the standard output.
1725
+	if(empty($html)){
1726
+
1727
+		global $preview;
1728
+		$html_var = $cf['htmlvar_name'] . '_address';
1729
+
1730
+		if ($cf['extra_fields']) {
1731
+
1732
+			$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
+
1734
+			$addition_fields = '';
1735
+
1736
+			if (!empty($extra_fields)) {
1737
+
1738
+				$show_city_in_address = false;
1739
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
+					$show_city_in_address = true;
1741
+				}
1742
+				/**
1743
+				 * Filter "show city in address" value.
1744
+				 *
1745
+				 * @since 1.0.0
1746
+				 */
1747
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
+
1749
+
1750
+				$show_region_in_address = false;
1751
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
+					$show_region_in_address = true;
1753
+				}
1754
+				/**
1755
+				 * Filter "show region in address" value.
1756
+				 *
1757
+				 * @since 1.6.6
1758
+				 */
1759
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
+
1761
+				$show_country_in_address = false;
1762
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
+					$show_country_in_address = true;
1764
+				}
1765
+				/**
1766
+				 * Filter "show country in address" value.
1767
+				 *
1768
+				 * @since 1.6.6
1769
+				 */
1770
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
+
1772
+				$show_zip_in_address = false;
1773
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
+					$show_zip_in_address = true;
1775
+				}
1776
+				/**
1777
+				 * Filter "show zip in address" value.
1778
+				 *
1779
+				 * @since 1.6.6
1780
+				 */
1781
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
+
1783
+
1784
+			}
1785
+
1786
+		}
1787
+
1788
+
1789
+		if ($post->{$html_var}) {
1790
+
1791
+			$field_icon = geodir_field_icon_proccess( $cf );
1792
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1793
+				$field_icon_af = '';
1794
+			} elseif ( $field_icon == '' ) {
1795
+				$field_icon_af = '<i class="fa fa-home"></i>';
1796
+			} else {
1797
+				$field_icon_af = $field_icon;
1798
+				$field_icon    = '';
1799
+			}
1800 1800
             
1801
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1802
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1803
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1804
-            $html .= '</span>';
1801
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1802
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1803
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1804
+			$html .= '</span>';
1805 1805
             
1806
-            $address_fields = array();
1807
-
1808
-            if ( isset($post->post_address) ) {
1809
-                $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1810
-            }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1813
-            }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1816
-            }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1819
-            }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1822
-            }
1806
+			$address_fields = array();
1807
+
1808
+			if ( isset($post->post_address) ) {
1809
+				$address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1810
+			}
1811
+			if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
+				$address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1813
+			}
1814
+			if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
+				$address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1816
+			}
1817
+			if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
+				$address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1819
+			}
1820
+			if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
+				$address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1822
+			}
1823 1823
             
1824
-            /**
1825
-             * Filter the address fields array being displayed.
1826
-             *
1827
-             * @param array $address_fields The array of address fields.
1828
-             * @param object $post The current post object.
1829
-             * @param array $cf The custom field array details.
1830
-             * @param string $location The location to output the html.
1831
-             * 
1832
-             * @since 1.6.21
1833
-             */
1834
-            $address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location);
1824
+			/**
1825
+			 * Filter the address fields array being displayed.
1826
+			 *
1827
+			 * @param array $address_fields The array of address fields.
1828
+			 * @param object $post The current post object.
1829
+			 * @param array $cf The custom field array details.
1830
+			 * @param string $location The location to output the html.
1831
+			 * 
1832
+			 * @since 1.6.21
1833
+			 */
1834
+			$address_fields = apply_filters('geodir_custom_field_output_address_fields', $address_fields, $post, $cf, $location);
1835 1835
             
1836
-            if (!empty($address_fields) && is_array($address_fields)) {
1837
-                $address_fields = array_values($address_fields);
1838
-                $html .= implode('<br>', $address_fields);
1839
-            }
1836
+			if (!empty($address_fields) && is_array($address_fields)) {
1837
+				$address_fields = array_values($address_fields);
1838
+				$html .= implode('<br>', $address_fields);
1839
+			}
1840 1840
             
1841
-            $html .= '</div>';
1842
-        }
1843
-    }
1841
+			$html .= '</div>';
1842
+		}
1843
+	}
1844 1844
 
1845
-    return $html;
1845
+	return $html;
1846 1846
 }
1847 1847
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1848 1848
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +304 added lines, -304 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_html_class(sanitize_title_with_dashes($cf['site_title']));
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,16 +686,16 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
690
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
691 691
             $html .= '</span>';
692 692
 
693 693
             $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
694
+            if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) {
695 695
                 $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
696
+                if (isset($extra_fields['is_price']) && $extra_fields['is_price']) {
697
+                    if (!ceil($value) > 0) {return ''; }// dont output blank prices
698
+                    $value = geodir_currency_format_number($value, $cf);
699 699
                 }
700 700
             }
701 701
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
     return $html;
711 711
 }
712
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
712
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
713 713
 
714 714
 
715 715
 /**
@@ -722,21 +722,21 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return string The html to output for the custom field.
724 724
  */
725
-function geodir_cf_radio($html,$location,$cf,$p=''){
725
+function geodir_cf_radio($html, $location, $cf, $p = '') {
726 726
 
727 727
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
728
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
729
+    else { global $post; }
730 730
 
731
-    if(!is_array($cf) && $cf!=''){
731
+    if (!is_array($cf) && $cf != '') {
732 732
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
733
+        if (!$cf) {return NULL; }
734 734
     }
735 735
 
736 736
     $html_var = $cf['htmlvar_name'];
737 737
 
738 738
     // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
740 740
         /**
741 741
          * Filter the radio html by location.
742 742
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
748 748
     }
749 749
 
750 750
     // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
752 752
         /**
753 753
          * Filter the radio html by individual custom field.
754 754
          *
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
          * @param array $cf The custom field array.
758 758
          * @since 1.6.6
759 759
          */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
761 761
     }
762 762
 
763 763
     // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
765 765
         /**
766 766
          * Filter the radio html by field type key.
767 767
          *
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
          * @param array $cf The custom field array.
771 771
          * @since 1.6.6
772 772
          */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
774 774
     }
775 775
 
776 776
     // If not html then we run the standard output.
777
-    if(empty($html)){
777
+    if (empty($html)) {
778 778
 
779 779
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780 780
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -808,16 +808,16 @@  discard block
 block discarded – undo
808 808
             }
809 809
 
810 810
 
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
811
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
812
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
813
+            $html .= '</span>'.$html_val.'</div>';
814 814
         endif;
815 815
 
816 816
     }
817 817
 
818 818
     return $html;
819 819
 }
820
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
820
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
821 821
 
822 822
 
823 823
 /**
@@ -831,21 +831,21 @@  discard block
 block discarded – undo
831 831
  *
832 832
  * @return string The html to output for the custom field.
833 833
  */
834
-function geodir_cf_select($html,$location,$cf,$p=''){
834
+function geodir_cf_select($html, $location, $cf, $p = '') {
835 835
 
836 836
     // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
837
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
838
+    else { global $post; }
839 839
 
840
-    if(!is_array($cf) && $cf!=''){
840
+    if (!is_array($cf) && $cf != '') {
841 841
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
842
+        if (!$cf) {return NULL; }
843 843
     }
844 844
 
845 845
     $html_var = $cf['htmlvar_name'];
846 846
 
847 847
     // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
848
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
849 849
         /**
850 850
          * Filter the select html by location.
851 851
          *
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
          * @param array $cf The custom field array.
854 854
          * @since 1.6.6
855 855
          */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
856
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
857 857
     }
858 858
 
859 859
     // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
860
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
861 861
         /**
862 862
          * Filter the select html by individual custom field.
863 863
          *
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
          * @param array $cf The custom field array.
867 867
          * @since 1.6.6
868 868
          */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
869
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
870 870
     }
871 871
 
872 872
     // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
873
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
874 874
         /**
875 875
          * Filter the select html by field type key.
876 876
          *
@@ -879,11 +879,11 @@  discard block
 block discarded – undo
879 879
          * @param array $cf The custom field array.
880 880
          * @since 1.6.6
881 881
          */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
882
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
883 883
     }
884 884
 
885 885
     // If not html then we run the standard output.
886
-    if(empty($html)){
886
+    if (empty($html)) {
887 887
 
888 888
         if ($post->{$cf['htmlvar_name']}):
889 889
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
             }
912 912
 
913 913
 
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
914
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
915
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
916
+            $html .= '</span>'.$field_value.'</div>';
917 917
         endif;
918 918
 
919 919
     }
920 920
 
921 921
     return $html;
922 922
 }
923
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
923
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
924 924
 
925 925
 
926 926
 /**
@@ -933,21 +933,21 @@  discard block
 block discarded – undo
933 933
  *
934 934
  * @return string The html to output for the custom field.
935 935
  */
936
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
936
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
937 937
 
938 938
     // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
939
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
940
+    else { global $post; }
941 941
 
942
-    if(!is_array($cf) && $cf!=''){
942
+    if (!is_array($cf) && $cf != '') {
943 943
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
944
+        if (!$cf) {return NULL; }
945 945
     }
946 946
 
947 947
     $html_var = $cf['htmlvar_name'];
948 948
 
949 949
     // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
950
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
951 951
         /**
952 952
          * Filter the multiselect html by location.
953 953
          *
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
          * @param array $cf The custom field array.
956 956
          * @since 1.6.6
957 957
          */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
958
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
959 959
     }
960 960
 
961 961
     // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
962
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
963 963
         /**
964 964
          * Filter the multiselect html by individual custom field.
965 965
          *
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
          * @param array $cf The custom field array.
969 969
          * @since 1.6.6
970 970
          */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
971
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
972 972
     }
973 973
 
974 974
     // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
975
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
976 976
         /**
977 977
          * Filter the multiselect html by field type key.
978 978
          *
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
          * @param array $cf The custom field array.
982 982
          * @since 1.6.6
983 983
          */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
984
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
985 985
     }
986 986
 
987 987
     // If not html then we run the standard output.
988
-    if(empty($html)){
988
+    if (empty($html)) {
989 989
 
990 990
 
991 991
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
             $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008 1008
 
1009
-            if(is_array($field_values)){
1009
+            if (is_array($field_values)) {
1010 1010
                 $field_values = array_map('trim', $field_values);
1011 1011
             }
1012 1012
 
@@ -1024,15 +1024,15 @@  discard block
 block discarded – undo
1024 1024
             }
1025 1025
 
1026 1026
 
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1027
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1028
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1029 1029
             $html .= '</span>';
1030 1030
 
1031 1031
             if (count($option_values) > 1) {
1032 1032
                 $html .= '<ul>';
1033 1033
 
1034 1034
                 foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1035
+                    $html .= '<li>'.$val.'</li>';
1036 1036
                 }
1037 1037
 
1038 1038
                 $html .= '</ul>';
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
     return $html;
1049 1049
 }
1050
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1050
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1051 1051
 
1052 1052
 
1053 1053
 /**
@@ -1060,21 +1060,21 @@  discard block
 block discarded – undo
1060 1060
  *
1061 1061
  * @return string The html to output for the custom field.
1062 1062
  */
1063
-function geodir_cf_email($html,$location,$cf,$p=''){
1063
+function geodir_cf_email($html, $location, $cf, $p = '') {
1064 1064
 
1065 1065
     // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1066
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1067
+    else { global $post; }
1068 1068
 
1069
-    if(!is_array($cf) && $cf!=''){
1069
+    if (!is_array($cf) && $cf != '') {
1070 1070
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1071
+        if (!$cf) {return NULL; }
1072 1072
     }
1073 1073
 
1074 1074
     $html_var = $cf['htmlvar_name'];
1075 1075
 
1076 1076
     // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1077
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1078 1078
         /**
1079 1079
          * Filter the email html by location.
1080 1080
          *
@@ -1082,11 +1082,11 @@  discard block
 block discarded – undo
1082 1082
          * @param array $cf The custom field array.
1083 1083
          * @since 1.6.6
1084 1084
          */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1085
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1086 1086
     }
1087 1087
 
1088 1088
     // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1089
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1090 1090
         /**
1091 1091
          * Filter the email html by individual custom field.
1092 1092
          *
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
          * @param array $cf The custom field array.
1096 1096
          * @since 1.6.6
1097 1097
          */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1098
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1099 1099
     }
1100 1100
 
1101 1101
     // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1102
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1103 1103
         /**
1104 1104
          * Filter the email html by field type key.
1105 1105
          *
@@ -1108,18 +1108,18 @@  discard block
 block discarded – undo
1108 1108
          * @param array $cf The custom field array.
1109 1109
          * @since 1.6.6
1110 1110
          */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1111
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1112 1112
     }
1113 1113
 
1114 1114
     // If not html then we run the standard output.
1115
-    if(empty($html)){
1115
+    if (empty($html)) {
1116 1116
 
1117 1117
         global $preview;
1118 1118
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119 1119
             return ''; // Remove Send Enquiry from listings page
1120 1120
         }
1121 1121
 
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1122
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1123 1123
 
1124 1124
         if ($cf['htmlvar_name'] == 'geodir_email' && $post->{$cf['htmlvar_name']}) {
1125 1125
             $b_send_inquiry = '';
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
             $html = '';
1128 1128
             if (!$preview) {
1129 1129
                 $b_send_inquiry = 'b_send_inquiry';
1130
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1130
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1131 1131
             }
1132 1132
 
1133 1133
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1140,20 +1140,20 @@  discard block
 block discarded – undo
1140 1140
                 $field_icon = '';
1141 1141
             }
1142 1142
 
1143
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1143
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1144 1144
             $seperator = '';
1145 1145
             if ($post->{$cf['htmlvar_name']}) {
1146 1146
                 $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1147
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1147
+                $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1148 1148
             }
1149 1149
 
1150 1150
             $html .= '</span></div>';
1151 1151
 
1152 1152
 
1153 1153
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1154
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1154
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1155 1155
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1156
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1156
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1157 1157
             }
1158 1158
 
1159 1159
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1173,11 +1173,11 @@  discard block
 block discarded – undo
1173 1173
                 }
1174 1174
 
1175 1175
 
1176
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1177
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1176
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1177
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1178 1178
                 $html .= '</span><span class="geodir-email-address-output">';
1179 1179
                 $email = $post->{$cf['htmlvar_name']} ;
1180
-                if($e_split = explode('@',$email)){
1180
+                if ($e_split = explode('@', $email)) {
1181 1181
                     /**
1182 1182
                      * Filter email custom field name output.
1183 1183
                      *
@@ -1186,15 +1186,15 @@  discard block
 block discarded – undo
1186 1186
                      * @param string $email The email string being output.
1187 1187
                      * @param array $cf Custom field variables array.
1188 1188
                      */
1189
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1190
-                    if($location=='mapbubble'){
1191
-                        $html .=  "<a href=\"mailto:$email\">$email_name</a>";
1192
-                    }else{
1193
-                        $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1189
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1190
+                    if ($location == 'mapbubble') {
1191
+                        $html .= "<a href=\"mailto:$email\">$email_name</a>";
1192
+                    } else {
1193
+                        $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1194 1194
                     }
1195 1195
 
1196
-                }else{
1197
-                    $html .=  $email;
1196
+                } else {
1197
+                    $html .= $email;
1198 1198
                 }
1199 1199
                 $html .= '</span></div>';
1200 1200
             }
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
     return $html;
1207 1207
 }
1208
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1208
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1209 1209
 
1210 1210
 
1211 1211
 /**
@@ -1218,21 +1218,21 @@  discard block
 block discarded – undo
1218 1218
  *
1219 1219
  * @return string The html to output for the custom field.
1220 1220
  */
1221
-function geodir_cf_file($html,$location,$cf,$p=''){
1221
+function geodir_cf_file($html, $location, $cf, $p = '') {
1222 1222
 
1223 1223
     // check we have the post value
1224
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1225
-    else{ global $post;}
1224
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1225
+    else { global $post; }
1226 1226
 
1227
-    if(!is_array($cf) && $cf!=''){
1227
+    if (!is_array($cf) && $cf != '') {
1228 1228
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1229
-        if(!$cf){return NULL;}
1229
+        if (!$cf) {return NULL; }
1230 1230
     }
1231 1231
 
1232 1232
     $html_var = $cf['htmlvar_name'];
1233 1233
 
1234 1234
     // Check if there is a location specific filter.
1235
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1235
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1236 1236
         /**
1237 1237
          * Filter the file html by location.
1238 1238
          *
@@ -1240,11 +1240,11 @@  discard block
 block discarded – undo
1240 1240
          * @param array $cf The custom field array.
1241 1241
          * @since 1.6.6
1242 1242
          */
1243
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1243
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1244 1244
     }
1245 1245
 
1246 1246
     // Check if there is a custom field specific filter.
1247
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1247
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1248 1248
         /**
1249 1249
          * Filter the file html by individual custom field.
1250 1250
          *
@@ -1253,11 +1253,11 @@  discard block
 block discarded – undo
1253 1253
          * @param array $cf The custom field array.
1254 1254
          * @since 1.6.6
1255 1255
          */
1256
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1256
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1257 1257
     }
1258 1258
 
1259 1259
     // Check if there is a custom field key specific filter.
1260
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1260
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1261 1261
         /**
1262 1262
          * Filter the file html by field type key.
1263 1263
          *
@@ -1266,11 +1266,11 @@  discard block
 block discarded – undo
1266 1266
          * @param array $cf The custom field array.
1267 1267
          * @since 1.6.6
1268 1268
          */
1269
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1269
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1270 1270
     }
1271 1271
 
1272 1272
     // If not html then we run the standard output.
1273
-    if(empty($html)){
1273
+    if (empty($html)) {
1274 1274
 
1275 1275
         if (!empty($post->{$cf['htmlvar_name']})):
1276 1276
 
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
             if (!empty($files)):
1279 1279
 
1280 1280
                 $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1281
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1281
+                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1282 1282
 
1283 1283
                 $file_paths = '';
1284 1284
                 foreach ($files as $file) {
@@ -1316,14 +1316,14 @@  discard block
 block discarded – undo
1316 1316
                             //$file_paths .= '<img src="'.$file.'"  />';	
1317 1317
                             $file_paths .= '</div>';
1318 1318
                         }elseif (in_array($uploaded_file_type, $audio_file_types)) {// if audio
1319
-                            $ext_path = '_' . $html_var . '_';
1319
+                            $ext_path = '_'.$html_var.'_';
1320 1320
                             $filename = explode($ext_path, $filename);
1321 1321
                             $file_paths .= '<span class="gd-audio-name">'.$filename[count($filename) - 1].'</span>';
1322 1322
                             $file_paths .= do_shortcode('[audio src="'.$file.'" ]');
1323 1323
                         } else {
1324
-                            $ext_path = '_' . $html_var . '_';
1324
+                            $ext_path = '_'.$html_var.'_';
1325 1325
                             $filename = explode($ext_path, $filename);
1326
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1326
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1327 1327
                         }
1328 1328
                     }
1329 1329
                 }
@@ -1338,11 +1338,11 @@  discard block
 block discarded – undo
1338 1338
                     $field_icon = '';
1339 1339
                 }
1340 1340
 
1341
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1341
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1342 1342
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1343
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1343
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1344 1344
                 $html .= '</span>';
1345
-                $html .= $file_paths . '</div></div>';
1345
+                $html .= $file_paths.'</div></div>';
1346 1346
 
1347 1347
             endif;
1348 1348
         endif;
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
     return $html;
1353 1353
 }
1354
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1354
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1355 1355
 
1356 1356
 
1357 1357
 
@@ -1365,21 +1365,21 @@  discard block
 block discarded – undo
1365 1365
  *
1366 1366
  * @return string The html to output for the custom field.
1367 1367
  */
1368
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1368
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1369 1369
 
1370 1370
     // check we have the post value
1371
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1372
-    else{ global $post;}
1371
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1372
+    else { global $post; }
1373 1373
 
1374
-    if(!is_array($cf) && $cf!=''){
1374
+    if (!is_array($cf) && $cf != '') {
1375 1375
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1376
-        if(!$cf){return NULL;}
1376
+        if (!$cf) {return NULL; }
1377 1377
     }
1378 1378
 
1379 1379
     $html_var = $cf['htmlvar_name'];
1380 1380
 
1381 1381
     // Check if there is a location specific filter.
1382
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1382
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1383 1383
         /**
1384 1384
          * Filter the textarea html by location.
1385 1385
          *
@@ -1387,11 +1387,11 @@  discard block
 block discarded – undo
1387 1387
          * @param array $cf The custom field array.
1388 1388
          * @since 1.6.6
1389 1389
          */
1390
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1390
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1391 1391
     }
1392 1392
 
1393 1393
     // Check if there is a custom field specific filter.
1394
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1394
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1395 1395
         /**
1396 1396
          * Filter the textarea html by individual custom field.
1397 1397
          *
@@ -1400,11 +1400,11 @@  discard block
 block discarded – undo
1400 1400
          * @param array $cf The custom field array.
1401 1401
          * @since 1.6.6
1402 1402
          */
1403
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1403
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1404 1404
     }
1405 1405
 
1406 1406
     // Check if there is a custom field key specific filter.
1407
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1407
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1408 1408
         /**
1409 1409
          * Filter the textarea html by field type key.
1410 1410
          *
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
          * @param array $cf The custom field array.
1414 1414
          * @since 1.6.6
1415 1415
          */
1416
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1416
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1417 1417
     }
1418 1418
 
1419 1419
     // If not html then we run the standard output.
1420
-    if(empty($html)){
1420
+    if (empty($html)) {
1421 1421
 
1422 1422
         if (!empty($post->{$cf['htmlvar_name']})) {
1423 1423
 
@@ -1432,9 +1432,9 @@  discard block
 block discarded – undo
1432 1432
             }
1433 1433
 
1434 1434
 
1435
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1436
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1437
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1435
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1436
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1437
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1438 1438
 
1439 1439
         }
1440 1440
 
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 
1443 1443
     return $html;
1444 1444
 }
1445
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1445
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1446 1446
 
1447 1447
 
1448 1448
 
@@ -1456,21 +1456,21 @@  discard block
 block discarded – undo
1456 1456
  *
1457 1457
  * @return string The html to output for the custom field.
1458 1458
  */
1459
-function geodir_cf_html($html,$location,$cf,$p=''){
1459
+function geodir_cf_html($html, $location, $cf, $p = '') {
1460 1460
 
1461 1461
     // check we have the post value
1462
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1463
-    else{ global $post;}
1462
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1463
+    else { global $post; }
1464 1464
 
1465
-    if(!is_array($cf) && $cf!=''){
1465
+    if (!is_array($cf) && $cf != '') {
1466 1466
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1467
-        if(!$cf){return NULL;}
1467
+        if (!$cf) {return NULL; }
1468 1468
     }
1469 1469
 
1470 1470
     $html_var = $cf['htmlvar_name'];
1471 1471
 
1472 1472
     // Check if there is a location specific filter.
1473
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1473
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1474 1474
         /**
1475 1475
          * Filter the html html by location.
1476 1476
          *
@@ -1478,11 +1478,11 @@  discard block
 block discarded – undo
1478 1478
          * @param array $cf The custom field array.
1479 1479
          * @since 1.6.6
1480 1480
          */
1481
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1481
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1482 1482
     }
1483 1483
 
1484 1484
     // Check if there is a custom field specific filter.
1485
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1485
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1486 1486
         /**
1487 1487
          * Filter the html html by individual custom field.
1488 1488
          *
@@ -1491,11 +1491,11 @@  discard block
 block discarded – undo
1491 1491
          * @param array $cf The custom field array.
1492 1492
          * @since 1.6.6
1493 1493
          */
1494
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1494
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1495 1495
     }
1496 1496
 
1497 1497
     // Check if there is a custom field key specific filter.
1498
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1498
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1499 1499
         /**
1500 1500
          * Filter the html html by field type key.
1501 1501
          *
@@ -1504,11 +1504,11 @@  discard block
 block discarded – undo
1504 1504
          * @param array $cf The custom field array.
1505 1505
          * @since 1.6.6
1506 1506
          */
1507
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1507
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1508 1508
     }
1509 1509
 
1510 1510
     // If not html then we run the standard output.
1511
-    if(empty($html)){
1511
+    if (empty($html)) {
1512 1512
 
1513 1513
         if (!empty($post->{$cf['htmlvar_name']})) {
1514 1514
 
@@ -1522,9 +1522,9 @@  discard block
 block discarded – undo
1522 1522
                 $field_icon = '';
1523 1523
             }
1524 1524
 
1525
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1526
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1527
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1525
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1526
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1527
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1528 1528
 
1529 1529
         }
1530 1530
 
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
     return $html;
1534 1534
 }
1535
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1535
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1536 1536
 
1537 1537
 
1538 1538
 
@@ -1546,21 +1546,21 @@  discard block
 block discarded – undo
1546 1546
  *
1547 1547
  * @return string The html to output for the custom field.
1548 1548
  */
1549
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1549
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1550 1550
 
1551 1551
     // check we have the post value
1552
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1553
-    else{ global $post;}
1552
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1553
+    else { global $post; }
1554 1554
 
1555
-    if(!is_array($cf) && $cf!=''){
1555
+    if (!is_array($cf) && $cf != '') {
1556 1556
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1557
-        if(!$cf){return NULL;}
1557
+        if (!$cf) {return NULL; }
1558 1558
     }
1559 1559
 
1560 1560
     $html_var = $cf['htmlvar_name'];
1561 1561
 
1562 1562
     // Check if there is a location specific filter.
1563
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1563
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1564 1564
         /**
1565 1565
          * Filter the taxonomy html by location.
1566 1566
          *
@@ -1568,11 +1568,11 @@  discard block
 block discarded – undo
1568 1568
          * @param array $cf The custom field array.
1569 1569
          * @since 1.6.6
1570 1570
          */
1571
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1571
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1572 1572
     }
1573 1573
 
1574 1574
     // Check if there is a custom field specific filter.
1575
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1575
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1576 1576
         /**
1577 1577
          * Filter the taxonomy html by individual custom field.
1578 1578
          *
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
          * @param array $cf The custom field array.
1582 1582
          * @since 1.6.6
1583 1583
          */
1584
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1584
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1585 1585
     }
1586 1586
 
1587 1587
     // Check if there is a custom field key specific filter.
1588
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1588
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1589 1589
         /**
1590 1590
          * Filter the taxonomy html by field type key.
1591 1591
          *
@@ -1594,14 +1594,14 @@  discard block
 block discarded – undo
1594 1594
          * @param array $cf The custom field array.
1595 1595
          * @since 1.6.6
1596 1596
          */
1597
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1597
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1598 1598
     }
1599 1599
 
1600 1600
     // If not html then we run the standard output.
1601
-    if(empty($html)){
1601
+    if (empty($html)) {
1602 1602
 
1603
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1604
-            $post_taxonomy = $post->post_type . 'category';
1603
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1604
+            $post_taxonomy = $post->post_type.'category';
1605 1605
             $field_value = $post->{$html_var};
1606 1606
             $links = array();
1607 1607
             $terms = array();
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
                     if ($term != '') {
1620 1620
                         $term = get_term_by('id', $term, $html_var);
1621 1621
                         if (is_object($term)) {
1622
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1622
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1623 1623
                             $terms[] = $term;
1624 1624
                         }
1625 1625
                     }
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
                     $terms = $termsOrdered;
1634 1634
                 }
1635 1635
             }
1636
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1636
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1637 1637
 
1638 1638
             if ($html_value != '') {
1639 1639
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1646,9 +1646,9 @@  discard block
 block discarded – undo
1646 1646
                     $field_icon = '';
1647 1647
                 }
1648 1648
 
1649
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1650
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1651
-                $html .= '</span> ' . $html_value . '</div>';
1649
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1650
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1651
+                $html .= '</span> '.$html_value.'</div>';
1652 1652
             }
1653 1653
         }
1654 1654
 
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 
1657 1657
     return $html;
1658 1658
 }
1659
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1659
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1660 1660
 
1661 1661
 
1662 1662
 /**
@@ -1670,21 +1670,21 @@  discard block
 block discarded – undo
1670 1670
  *
1671 1671
  * @return string The html to output for the custom field.
1672 1672
  */
1673
-function geodir_cf_address($html,$location,$cf,$p=''){
1673
+function geodir_cf_address($html, $location, $cf, $p = '') {
1674 1674
 
1675 1675
     // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1676
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1677
+    else { global $post; }
1678 1678
 
1679
-    if(!is_array($cf) && $cf!=''){
1679
+    if (!is_array($cf) && $cf != '') {
1680 1680
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1681
+        if (!$cf) {return NULL; }
1682 1682
     }
1683 1683
 
1684 1684
     $html_var = $cf['htmlvar_name'];
1685 1685
 
1686 1686
     // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1687
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1688 1688
         /**
1689 1689
          * Filter the address html by location.
1690 1690
          *
@@ -1692,11 +1692,11 @@  discard block
 block discarded – undo
1692 1692
          * @param array $cf The custom field array.
1693 1693
          * @since 1.6.6
1694 1694
          */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1695
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1696 1696
     }
1697 1697
 
1698 1698
     // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1699
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1700 1700
         /**
1701 1701
          * Filter the address html by individual custom field.
1702 1702
          *
@@ -1705,11 +1705,11 @@  discard block
 block discarded – undo
1705 1705
          * @param array $cf The custom field array.
1706 1706
          * @since 1.6.6
1707 1707
          */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1708
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1709 1709
     }
1710 1710
 
1711 1711
     // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1712
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1713 1713
         /**
1714 1714
          * Filter the address html by field type key.
1715 1715
          *
@@ -1718,14 +1718,14 @@  discard block
 block discarded – undo
1718 1718
          * @param array $cf The custom field array.
1719 1719
          * @since 1.6.6
1720 1720
          */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1721
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1722 1722
     }
1723 1723
 
1724 1724
     // If not html then we run the standard output.
1725
-    if(empty($html)){
1725
+    if (empty($html)) {
1726 1726
 
1727 1727
         global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1728
+        $html_var = $cf['htmlvar_name'].'_address';
1729 1729
 
1730 1730
         if ($cf['extra_fields']) {
1731 1731
 
@@ -1788,37 +1788,37 @@  discard block
 block discarded – undo
1788 1788
 
1789 1789
         if ($post->{$html_var}) {
1790 1790
 
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1791
+            $field_icon = geodir_field_icon_proccess($cf);
1792
+            if (strpos($field_icon, 'http') !== false) {
1793 1793
                 $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1794
+            } elseif ($field_icon == '') {
1795 1795
                 $field_icon_af = '<i class="fa fa-home"></i>';
1796 1796
             } else {
1797 1797
                 $field_icon_af = $field_icon;
1798 1798
                 $field_icon    = '';
1799 1799
             }
1800 1800
             
1801
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1802
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1803
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1801
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1802
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1803
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1804 1804
             $html .= '</span>';
1805 1805
             
1806 1806
             $address_fields = array();
1807 1807
 
1808
-            if ( isset($post->post_address) ) {
1809
-                $address_fields['post_address'] = '<span itemprop="streetAddress">' . $post->post_address . '</span>';
1808
+            if (isset($post->post_address)) {
1809
+                $address_fields['post_address'] = '<span itemprop="streetAddress">'.$post->post_address.'</span>';
1810 1810
             }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $address_fields['post_city'] = '<span itemprop="addressLocality">' . $post->post_city . '</span>';
1811
+            if ($show_city_in_address && isset($post->post_city) && $post->post_city) {
1812
+                $address_fields['post_city'] = '<span itemprop="addressLocality">'.$post->post_city.'</span>';
1813 1813
             }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $address_fields['post_region'] = '<span itemprop="addressRegion">' . $post->post_region . '</span>';
1814
+            if ($show_region_in_address && isset($post->post_region) && $post->post_region) {
1815
+                $address_fields['post_region'] = '<span itemprop="addressRegion">'.$post->post_region.'</span>';
1816 1816
             }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $address_fields['post_zip'] = '<span itemprop="postalCode">' . $post->post_zip . '</span>';
1817
+            if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) {
1818
+                $address_fields['post_zip'] = '<span itemprop="postalCode">'.$post->post_zip.'</span>';
1819 1819
             }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $address_fields['post_country'] = '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span>';
1820
+            if ($show_country_in_address && isset($post->post_country) && $post->post_country) {
1821
+                $address_fields['post_country'] = '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span>';
1822 1822
             }
1823 1823
             
1824 1824
             /**
@@ -1844,4 +1844,4 @@  discard block
 block discarded – undo
1844 1844
 
1845 1845
     return $html;
1846 1846
 }
1847
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1848 1847
\ No newline at end of file
1848
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1849 1849
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 4 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 		$author_id  = $p_post->post_author;
244 244
 
245
-	}else{
245
+	} else{
246 246
 		gd_die();
247 247
 	}
248 248
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
 		check_ajax_referer( 'send_to_frnd_'.$pid );
389 389
 
390
-	}else{
390
+	} else{
391 391
 		gd_die();
392 392
 	}
393 393
 
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 
2275 2275
 	if ( $new_style ) {
2276 2276
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2277
-	}else{
2277
+	} else{
2278 2278
 		$default_search_button_label = 'Search';
2279 2279
 	}
2280 2280
 	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 	if ( $new_style ) {
2302 2302
 		?>
2303 2303
 		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2304
-	<?php }else{?>
2304
+	<?php } else{?>
2305 2305
 		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2306 2306
 		       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2307 2307
 	<?php }
@@ -2351,17 +2351,17 @@  discard block
 block discarded – undo
2351 2351
 			if ( $new_style ) {
2352 2352
 				echo "</div>";
2353 2353
 			}
2354
-		}else{
2354
+		} else{
2355 2355
 			if(! empty( $post_types )){
2356 2356
 				$pt_arr = (array)$post_types;
2357 2357
 				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2358
-			}else{
2358
+			} else{
2359 2359
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2360 2360
 			}
2361 2361
 
2362 2362
 		}
2363 2363
 
2364
-	}elseif ( ! empty( $post_types ) ) {
2364
+	} elseif ( ! empty( $post_types ) ) {
2365 2365
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2366 2366
 	}
2367 2367
 }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
  * @param object|string $post The post object.
162 162
  * @param string $post_type   The post type.
163 163
  *
164
- * @return object Returns filtered package info as an object.
164
+ * @return string Returns filtered package info as an object.
165 165
  */
166 166
 function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
167 167
 	$package_info['pid']              = 0;
@@ -2507,7 +2507,7 @@  discard block
 block discarded – undo
2507 2507
  *
2508 2508
  * @since 1.5.0
2509 2509
  *
2510
- * @return True if WPML is active else False.
2510
+ * @return boolean if WPML is active else False.
2511 2511
  */
2512 2512
 function geodir_is_wpml() {
2513 2513
 	if (class_exists('SitePress') && function_exists('icl_object_id')) {
@@ -2583,7 +2583,6 @@  discard block
 block discarded – undo
2583 2583
  * @since 1.6.25 "geodir_wpml_listing_duplicated" action added.
2584 2584
  *
2585 2585
  * @param int $post_id The Post ID.
2586
- * @param string $lang Language code for translating post.
2587 2586
  * @param array $request_info The post details in an array.
2588 2587
  */
2589 2588
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
@@ -2673,7 +2672,7 @@  discard block
 block discarded – undo
2673 2672
  * @param int $master_post_id Original Post ID.
2674 2673
  * @param int $tr_post_id Translation Post ID.
2675 2674
  * @param string $lang Language code for translating post.
2676
- * @return bool True for success, False for fail.
2675
+ * @return boolean|null True for success, False for fail.
2677 2676
  */
2678 2677
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2679 2678
 	global $sitepress, $wpdb;
@@ -2916,8 +2915,6 @@  discard block
 block discarded – undo
2916 2915
  *
2917 2916
  * @since 1.6.16
2918 2917
  *
2919
- * @param string $post_type WP post type or WP texonomy. Ex: gd_place.
2920
- * @param bool $taxonomy Whether $post_type is taxonomy or not.
2921 2918
  * @return bool True if review star disabled, otherwise false.
2922 2919
  */
2923 2920
 function geodir_rating_disabled_post_types() {
@@ -3189,7 +3186,7 @@  discard block
 block discarded – undo
3189 3186
  * @param string      $element_type               Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc.
3190 3187
  *                                                You can also pass 'any', to let WPML guess the type, but this will only work for posts.
3191 3188
  * @param bool        $return_original_if_missing Optional, default is FALSE. If set to true it will always return a value (the original value, if translation is missing).
3192
- * @param string|NULL $language_code              Optional, default is NULL. If missing, it will use the current language.
3189
+ * @param string|NULL $ulanguage_code              Optional, default is NULL. If missing, it will use the current language.
3193 3190
  *                                                If set to a language code, it will return a translation for that language code or
3194 3191
  *                                                the original if the translation is missing and $return_original_if_missing is set to TRUE.
3195 3192
  *
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2389,11 +2389,11 @@
 block discarded – undo
2389 2389
 	?>
2390 2390
 	<input class="search_text" name="s"
2391 2391
 	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2392
-		       $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2393
-		       echo $search_term;
2394
-	       } else {
2395
-		       echo $default_search_for_text;
2396
-	       } ?>" type="text"
2392
+			   $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2393
+			   echo $search_term;
2394
+		   } else {
2395
+			   echo $default_search_for_text;
2396
+		   } ?>" type="text"
2397 2397
 	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2398 2398
 	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2399 2399
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
Please login to merge, or discard this patch.
Spacing   +718 added lines, -718 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = sanitize_text_field($request['inq_name']);
230 230
 	$youremail     = sanitize_email($request['inq_email']);
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
 	$frnd_comments = sanitize_text_field($request['inq_msg']);
233 233
 	$pid           = absint($request['pid']);
234 234
 
235
-	$author_id  = '';
235
+	$author_id = '';
236 236
 
237
-	if ( $pid && 'publish' == get_post_status ( $pid  ) ) {
237
+	if ($pid && 'publish' == get_post_status($pid)) {
238 238
 
239
-		check_ajax_referer( 'send_inquiry_'.$pid );
239
+		check_ajax_referer('send_inquiry_'.$pid);
240 240
 
241 241
 		$p_post = get_post($pid);
242 242
 
243
-		$author_id  = $p_post->post_author;
243
+		$author_id = $p_post->post_author;
244 244
 
245
-	}else{
245
+	} else {
246 246
 		gd_die();
247 247
 	}
248 248
 
249
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
250
-	$to_name   = geodir_get_client_name( $author_id );
249
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
250
+	$to_name   = geodir_get_client_name($author_id);
251 251
 
252
-	if ( $to_email == '' ) {
253
-		$to_email = get_option( 'admin_email' );
252
+	if ($to_email == '') {
253
+		$to_email = get_option('admin_email');
254 254
 	}
255 255
 
256 256
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * }
272 272
 	 * @param string $type     The form type, default: `Enquiry`.
273 273
 	 */
274
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
274
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
275 275
 
276 276
 	$client_message = $frnd_comments;
277
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
277
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
278 278
 	/**
279 279
 	 * Filter client message text.
280 280
 	 *
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @param string $client_message Client message text.
284 284
 	 */
285
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
285
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
286 286
 
287 287
 	/**
288 288
 	 * Called before the send enquiry email is sent.
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 	 *
302 302
 	 * }
303 303
 	 */
304
-	do_action( 'geodir_before_send_enquiry_email', $request );
305
-	if ( $to_email ) {
304
+	do_action('geodir_before_send_enquiry_email', $request);
305
+	if ($to_email) {
306 306
 		// strip slashes message
307
-		$client_message = stripslashes_deep( $client_message );
307
+		$client_message = stripslashes_deep($client_message);
308 308
 
309
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
309
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
310 310
 	}
311 311
 
312 312
 	/**
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * }
328 328
 	 */
329
-	do_action( 'geodir_after_send_enquiry_email', $request );
330
-	$url = get_permalink( $pid );
331
-	if ( strstr( $url, '?' ) ) {
332
-		$url = $url . "&send_inquiry=success";
329
+	do_action('geodir_after_send_enquiry_email', $request);
330
+	$url = get_permalink($pid);
331
+	if (strstr($url, '?')) {
332
+		$url = $url."&send_inquiry=success";
333 333
 	} else {
334
-		$url = $url . "?send_inquiry=success";
334
+		$url = $url."?send_inquiry=success";
335 335
 	}
336 336
 	/**
337 337
 	 * Filter redirect url after the send enquiry email is sent.
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @param string $url Redirect url.
342 342
 	 */
343
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
344
-	wp_redirect( $url );
343
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
344
+	wp_redirect($url);
345 345
 	gd_die();
346 346
 
347 347
 }
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
  *
373 373
  * @deprecated 1.6.26
374 374
  */
375
-function geodir_send_friend( $request ) {
375
+function geodir_send_friend($request) {
376 376
 	global $wpdb;
377 377
 
378 378
 	// strip slashes from text
379
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
379
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
380 380
 
381 381
 	$yourname      = sanitize_text_field($request['yourname']);
382 382
 	$youremail     = sanitize_email($request['youremail']);
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
 	$pid           = absint($request['pid']);
386 386
 	$to_email      = sanitize_email($request['to_email']);
387 387
 	$to_name       = sanitize_text_field($request['to_name']);
388
-	if ( $pid && 'publish' == get_post_status ( $pid  ) ) {
388
+	if ($pid && 'publish' == get_post_status($pid)) {
389 389
 
390
-		check_ajax_referer( 'send_to_frnd_'.$pid );
390
+		check_ajax_referer('send_to_frnd_'.$pid);
391 391
 
392
-	}else{
392
+	} else {
393 393
 		gd_die();
394 394
 	}
395 395
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * }
414 414
 	 */
415
-	do_action( 'geodir_before_send_to_friend_email', $request );
416
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
415
+	do_action('geodir_before_send_to_friend_email', $request);
416
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
417 417
 
418 418
 	/**
419 419
 	 * Called after the send to friend email is sent.
@@ -434,13 +434,13 @@  discard block
 block discarded – undo
434 434
 	 *
435 435
 	 * }
436 436
 	 */
437
-	do_action( 'geodir_after_send_to_friend_email', $request );
437
+	do_action('geodir_after_send_to_friend_email', $request);
438 438
 
439
-	$url = get_permalink( $pid );
440
-	if ( strstr( $url, '?' ) ) {
441
-		$url = $url . "&sendtofrnd=success";
439
+	$url = get_permalink($pid);
440
+	if (strstr($url, '?')) {
441
+		$url = $url."&sendtofrnd=success";
442 442
 	} else {
443
-		$url = $url . "?sendtofrnd=success";
443
+		$url = $url."?sendtofrnd=success";
444 444
 	}
445 445
 	/**
446 446
 	 * Filter redirect url after the send to friend email is sent.
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 	 *
450 450
 	 * @param string $url Redirect url.
451 451
 	 */
452
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
453
-	wp_redirect( $url );
452
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
453
+	wp_redirect($url);
454 454
 	gd_die();
455 455
 }
456 456
 
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
  *
465 465
  * @param string $hash_key
466 466
  */
467
-function geodir_before_tab_content( $hash_key ) {
468
-	switch ( $hash_key ) {
467
+function geodir_before_tab_content($hash_key) {
468
+	switch ($hash_key) {
469 469
 		case 'post_info' :
470 470
 			echo '<div class="geodir-company_info field-group">';
471 471
 			break;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			 *
476 476
 			 * @since 1.0.0
477 477
 			 */
478
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
478
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
479 479
 			break;
480 480
 		case 'reviews' :
481 481
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
  *
500 500
  * @param string $hash_key
501 501
  */
502
-function geodir_after_tab_content( $hash_key ) {
503
-	switch ( $hash_key ) {
502
+function geodir_after_tab_content($hash_key) {
503
+	switch ($hash_key) {
504 504
 		case 'post_info' :
505 505
 			echo '</div>';
506 506
 			break;
@@ -531,25 +531,25 @@  discard block
 block discarded – undo
531 531
  * @global object $wpdb     WordPress Database object.
532 532
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
533 533
  */
534
-function geodir_get_posts_default_sort( $post_type ) {
534
+function geodir_get_posts_default_sort($post_type) {
535 535
 
536 536
 	global $wpdb;
537 537
 
538
-	if ( $post_type != '' ) {
538
+	if ($post_type != '') {
539 539
 
540 540
 		$all_postypes = geodir_get_posttypes();
541 541
 
542
-		if ( ! in_array( $post_type, $all_postypes ) ) {
542
+		if (!in_array($post_type, $all_postypes)) {
543 543
 			return false;
544 544
 		}
545 545
 
546
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
546
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
547 547
 			$post_type,
548 548
 			1,
549 549
 			1
550
-		) ) );
550
+		)));
551 551
 
552
-		if ( ! empty( $sort_field_info ) ) {
552
+		if (!empty($sort_field_info)) {
553 553
 			return $sort_field_info;
554 554
 		}
555 555
 
@@ -569,20 +569,20 @@  discard block
 block discarded – undo
569 569
  * @global object $wpdb     WordPress Database object.
570 570
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
571 571
  */
572
-function geodir_get_sort_options( $post_type ) {
572
+function geodir_get_sort_options($post_type) {
573 573
 	global $wpdb;
574 574
 
575
-	if ( $post_type != '' ) {
575
+	if ($post_type != '') {
576 576
 		$all_postypes = geodir_get_posttypes();
577 577
 
578
-		if ( ! in_array( $post_type, $all_postypes ) ) {
578
+		if (!in_array($post_type, $all_postypes)) {
579 579
 			return false;
580 580
 		}
581 581
 
582
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
582
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
583 583
 			$post_type,
584 584
 			1
585
-		) ) );
585
+		)));
586 586
 
587 587
 		/**
588 588
 		 * Filter post sort options.
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		 * @param array $sort_field_info Unfiltered sort field array.
593 593
 		 * @param string $post_type      Post type.
594 594
 		 */
595
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
595
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
596 596
 	}
597 597
 
598 598
 }
@@ -613,63 +613,63 @@  discard block
 block discarded – undo
613 613
 	 *
614 614
 	 * @since 1.4.4
615 615
 	 */
616
-	if ( is_search() ) {
616
+	if (is_search()) {
617 617
 		return;
618 618
 	}
619 619
 
620 620
 	$sort_by = '';
621 621
 
622
-	if ( isset( $_REQUEST['sort_by'] ) ) {
622
+	if (isset($_REQUEST['sort_by'])) {
623 623
 		$sort_by = $_REQUEST['sort_by'];
624 624
 	}
625 625
 
626 626
 	$gd_post_type = geodir_get_current_posttype();
627 627
 
628
-	$sort_options = geodir_get_sort_options( $gd_post_type );
628
+	$sort_options = geodir_get_sort_options($gd_post_type);
629 629
 
630 630
 
631 631
 	$sort_field_options = '';
632 632
 
633
-	if ( ! empty( $sort_options ) ) {
634
-		foreach ( $sort_options as $sort ) {
635
-			$sort = stripslashes_deep( $sort ); // strip slashes
633
+	if (!empty($sort_options)) {
634
+		foreach ($sort_options as $sort) {
635
+			$sort = stripslashes_deep($sort); // strip slashes
636 636
 
637
-			$label = __( $sort->site_title, 'geodirectory' );
637
+			$label = __($sort->site_title, 'geodirectory');
638 638
 
639
-			if ( $sort->field_type == 'random' ) {
639
+			if ($sort->field_type == 'random') {
640 640
 				$key = $sort->field_type;
641
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
642
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
641
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
642
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
643 643
 			}
644 644
 
645
-			if ( $sort->htmlvar_name == 'comment_count' ) {
645
+			if ($sort->htmlvar_name == 'comment_count') {
646 646
 				$sort->htmlvar_name = 'rating_count';
647 647
 			}
648 648
 
649
-			if ( $sort->sort_asc ) {
650
-				$key   = $sort->htmlvar_name . '_asc';
649
+			if ($sort->sort_asc) {
650
+				$key   = $sort->htmlvar_name.'_asc';
651 651
 				$label = $sort->site_title;
652
-				if ( $sort->asc_title ) {
652
+				if ($sort->asc_title) {
653 653
 					$label = $sort->asc_title;
654 654
 				}
655
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
656
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
655
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
656
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
657 657
 			}
658 658
 
659
-			if ( $sort->sort_desc ) {
660
-				$key   = $sort->htmlvar_name . '_desc';
659
+			if ($sort->sort_desc) {
660
+				$key   = $sort->htmlvar_name.'_desc';
661 661
 				$label = $sort->site_title;
662
-				if ( $sort->desc_title ) {
662
+				if ($sort->desc_title) {
663 663
 					$label = $sort->desc_title;
664 664
 				}
665
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
666
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
665
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
666
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
667 667
 			}
668 668
 
669 669
 		}
670 670
 	}
671 671
 
672
-	if ( $sort_field_options != '' ) {
672
+	if ($sort_field_options != '') {
673 673
 
674 674
 		?>
675 675
 
@@ -678,9 +678,9 @@  discard block
 block discarded – undo
678 678
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
679 679
 
680 680
 				<option
681
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
681
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
682 682
 					echo 'selected="selected"';
683
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
683
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
684 684
 
685 685
 				echo $sort_field_options; ?>
686 686
 
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
  *
709 709
  * @return string Returns the section title.
710 710
  */
711
-function geodir_advance_customfields_heading( $title, $field_type ) {
711
+function geodir_advance_customfields_heading($title, $field_type) {
712 712
 
713
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
713
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
714 714
 		$title = '';
715 715
 	}
716 716
 
@@ -732,34 +732,34 @@  discard block
 block discarded – undo
732 732
  * @global object $gd_session       GeoDirectory Session object.
733 733
  * @return string Returns related posts html.
734 734
  */
735
-function geodir_related_posts_display( $request ) {
736
-	if ( ! empty( $request ) ) {
737
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
738
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
739
-
740
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
741
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
742
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
743
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
744
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
745
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
746
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
747
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
735
+function geodir_related_posts_display($request) {
736
+	if (!empty($request)) {
737
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
738
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
739
+
740
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
741
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
742
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
743
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
744
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
745
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
746
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
747
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
748 748
 
749 749
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
750
-		$related_parent_lat   = !empty($post->post_latitude) && geodir_is_page( 'detail' ) ? $post->post_latitude : '';
751
-		$related_parent_lon   = !empty($post->post_longitude) && geodir_is_page( 'detail' ) ? $post->post_longitude : '';
750
+		$related_parent_lat   = !empty($post->post_latitude) && geodir_is_page('detail') ? $post->post_latitude : '';
751
+		$related_parent_lon   = !empty($post->post_longitude) && geodir_is_page('detail') ? $post->post_longitude : '';
752 752
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
753 753
 
754 754
 		$related_listing_array = array();
755
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
756
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
755
+		if (get_option('geodir_add_related_listing_posttypes')) {
756
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
757 757
 		}
758
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
758
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
759 759
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
760 760
 		}
761 761
 
762
-		$is_display        = ! empty( $arr_detail_page_tabs['related_listing'] ) && isset( $arr_detail_page_tabs['related_listing']['is_display'] ) ? $arr_detail_page_tabs['related_listing']['is_display'] : false;
762
+		$is_display        = !empty($arr_detail_page_tabs['related_listing']) && isset($arr_detail_page_tabs['related_listing']['is_display']) ? $arr_detail_page_tabs['related_listing']['is_display'] : false;
763 763
 		$origi_post        = $post;
764 764
 		$post_type         = '';
765 765
 		$post_id           = '';
@@ -767,90 +767,90 @@  discard block
 block discarded – undo
767 767
 		$tax_field         = 'id';
768 768
 		$category          = array();
769 769
 
770
-		if ( isset( $_REQUEST['backandedit'] ) ) {
771
-			$post      = (object) $gd_session->get( 'listing' );
770
+		if (isset($_REQUEST['backandedit'])) {
771
+			$post      = (object) $gd_session->get('listing');
772 772
 			$post_type = $post->listing_type;
773
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
773
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
774 774
 				$post_id = $_REQUEST['pid'];
775 775
 			}
776
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
777
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
776
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
777
+			$post      = geodir_get_post_info($_REQUEST['pid']);
778 778
 			$post_type = $post->post_type;
779 779
 			$post_id   = $_REQUEST['pid'];
780
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
780
+		} elseif (isset($post->post_type) && $post->post_type != '') {
781 781
 			$post_type = $post->post_type;
782 782
 			$post_id   = $post->ID;
783 783
 		}
784 784
 
785
-		if ( $relate_to == 'category' ) {
785
+		if ($relate_to == 'category') {
786 786
 
787
-			$category_taxonomy = $post_type . $relate_to;
788
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
789
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
787
+			$category_taxonomy = $post_type.$relate_to;
788
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
789
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
790 790
 			}
791 791
 
792
-		} elseif ( $relate_to == 'tags' ) {
792
+		} elseif ($relate_to == 'tags') {
793 793
 
794
-			$category_taxonomy = $post_type . '_' . $relate_to;
795
-			if ( $post->post_tags != '' ) {
796
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
794
+			$category_taxonomy = $post_type.'_'.$relate_to;
795
+			if ($post->post_tags != '') {
796
+				$category = explode(',', trim($post->post_tags, ','));
797 797
 			}
798 798
 			$tax_field = 'name';
799 799
 		}
800 800
 
801 801
 		/* --- return false in invalid request --- */
802
-		if ( empty( $category ) ) {
802
+		if (empty($category)) {
803 803
 			return false;
804 804
 		}
805 805
 
806 806
 		$all_postypes = geodir_get_posttypes();
807 807
 
808
-		if ( ! in_array( $post_type, $all_postypes ) ) {
808
+		if (!in_array($post_type, $all_postypes)) {
809 809
 			return false;
810 810
 		}
811 811
 
812 812
 		/* --- return false in invalid request --- */
813 813
 
814 814
 		$location_url = '';
815
-		if ( $add_location_filter != '0' ) {
815
+		if ($add_location_filter != '0') {
816 816
 			$location_url             = array();
817
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
817
+			$geodir_show_location_url = get_option('geodir_show_location_url');
818 818
 
819
-			$gd_city = get_query_var( 'gd_city' );
819
+			$gd_city = get_query_var('gd_city');
820 820
 
821
-			if ( $gd_city ) {
822
-				$gd_country = get_query_var( 'gd_country' );
823
-				$gd_region  = get_query_var( 'gd_region' );
821
+			if ($gd_city) {
822
+				$gd_country = get_query_var('gd_country');
823
+				$gd_region  = get_query_var('gd_region');
824 824
 			} else {
825 825
 				$location = geodir_get_default_location();
826 826
 
827
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
828
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
829
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
827
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
828
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
829
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
830 830
 			}
831 831
 
832
-			if ( $geodir_show_location_url == 'all' ) {
832
+			if ($geodir_show_location_url == 'all') {
833 833
 				$location_url[] = $gd_country;
834 834
 				$location_url[] = $gd_region;
835
-			} else if ( $geodir_show_location_url == 'country_city' ) {
835
+			} else if ($geodir_show_location_url == 'country_city') {
836 836
 				$location_url[] = $gd_country;
837
-			} else if ( $geodir_show_location_url == 'region_city' ) {
837
+			} else if ($geodir_show_location_url == 'region_city') {
838 838
 				$location_url[] = $gd_region;
839 839
 			}
840 840
 
841 841
 			$location_url[] = $gd_city;
842 842
 
843
-			$location_url = implode( '/', $location_url );
843
+			$location_url = implode('/', $location_url);
844 844
 		}
845 845
 
846 846
 
847
-		if ( ! empty( $category ) ) {
847
+		if (!empty($category)) {
848 848
 			global $geodir_add_location_url;
849 849
 			$geodir_add_location_url = '0';
850
-			if ( $add_location_filter != '0' ) {
850
+			if ($add_location_filter != '0') {
851 851
 				$geodir_add_location_url = '1';
852 852
 			}
853
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
853
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
854 854
 			$geodir_add_location_url = null;
855 855
 		}
856 856
 		ob_start();
@@ -860,24 +860,24 @@  discard block
 block discarded – undo
860 860
 		<div class="geodir_locations geodir_location_listing">
861 861
 
862 862
 			<?php
863
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
863
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
864 864
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
865
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
865
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
866 866
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
867
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
867
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
868 868
 				?>
869 869
 				<div class="location_list_heading clearfix">
870
-					<?php echo $before_title . $title . $after_title; ?>
870
+					<?php echo $before_title.$title.$after_title; ?>
871 871
 				</div>
872 872
 				<?php
873 873
 			}
874 874
 			$query_args = array(
875 875
 				'posts_per_page'   => $post_number,
876 876
 				'is_geodir_loop'   => true,
877
-				'gd_location'      => ( $add_location_filter ) ? true : false,
877
+				'gd_location'      => ($add_location_filter) ? true : false,
878 878
 				'post_type'        => $post_type,
879 879
 				'order_by'         => $list_sort,
880
-				'post__not_in'     => array( $post_id ),
880
+				'post__not_in'     => array($post_id),
881 881
 				'excerpt_length'   => $character_count,
882 882
 				'related_listings' => $is_display
883 883
 			);
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 				'terms'    => $category
889 889
 			);
890 890
 
891
-			$query_args['tax_query'] = array( $tax_query );
891
+			$query_args['tax_query'] = array($tax_query);
892 892
 
893 893
 			global $gridview_columns_widget, $post;
894 894
 
@@ -900,21 +900,21 @@  discard block
 block discarded – undo
900 900
 			 * @param array $query_args The query array.
901 901
 			 * @param array $request Related posts request array.
902 902
 			 */
903
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
903
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
904 904
 
905
-			query_posts( $query_args );
905
+			query_posts($query_args);
906 906
 
907
-			if ( strstr( $layout, 'gridview' ) ) {
908
-				$listing_view_exp = explode( '_', $layout );
907
+			if (strstr($layout, 'gridview')) {
908
+				$listing_view_exp = explode('_', $layout);
909 909
 				$gridview_columns_widget = $layout;
910 910
 				$layout           = $listing_view_exp[0];
911
-			} else if ( $layout == 'list' ) {
911
+			} else if ($layout == 'list') {
912 912
 				$gridview_columns_widget = '';
913 913
 			}
914 914
 			$related_posts = true;
915 915
 
916 916
 			$related_nearest = false;
917
-			if ( $list_sort == 'nearest' ) {
917
+			if ($list_sort == 'nearest') {
918 918
 				$related_nearest = true;
919 919
 			}
920 920
 
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
 			 *
932 932
 			 * @since 1.0.0
933 933
 			 */
934
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
934
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('widget-listing-listview'));
935 935
 
936 936
 			/**
937 937
 			 * Includes related listing listview template.
938 938
 			 *
939 939
 			 * @since 1.0.0
940 940
 			 */
941
-			include( $template );
941
+			include($template);
942 942
 
943 943
 			wp_reset_query();
944 944
 			$post            = $origi_post;
@@ -966,12 +966,12 @@  discard block
 block discarded – undo
966 966
 function geodir_category_count_script() {
967 967
 	global $geodir_post_category_str;
968 968
 
969
-	if ( ! empty( $geodir_post_category_str ) ) {
970
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
969
+	if (!empty($geodir_post_category_str)) {
970
+		$geodir_post_category_str = serialize($geodir_post_category_str);
971 971
 	}
972 972
 
973
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
974
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
973
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
974
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
975 975
 	echo '<script>';
976 976
 	echo $script;
977 977
 	echo '</script>';
@@ -986,8 +986,8 @@  discard block
 block discarded – undo
986 986
  * @return string Returns the default language.
987 987
  */
988 988
 function geodir_get_map_default_language() {
989
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
990
-	if ( empty( $geodir_default_map_language ) ) {
989
+	$geodir_default_map_language = get_option('geodir_default_map_language');
990
+	if (empty($geodir_default_map_language)) {
991 991
 		$geodir_default_map_language = 'en';
992 992
 	}
993 993
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	 *
999 999
 	 * @param string $geodir_default_map_language Default map language.
1000 1000
 	 */
1001
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
1001
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1002 1002
 }
1003 1003
 
1004 1004
 /**
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  * @return string Returns the api key.
1010 1010
  */
1011 1011
 function geodir_get_map_api_key() {
1012
-	$key = get_option( 'geodir_google_api_key' );
1012
+	$key = get_option('geodir_google_api_key');
1013 1013
 
1014 1014
 	/**
1015 1015
 	 * Filter Google maps api key.
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	 *
1019 1019
 	 * @param string $key Google maps api key.
1020 1020
 	 */
1021
-	return apply_filters( 'geodir_google_api_key', $key );
1021
+	return apply_filters('geodir_google_api_key', $key);
1022 1022
 }
1023 1023
 
1024 1024
 
@@ -1038,20 +1038,20 @@  discard block
 block discarded – undo
1038 1038
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1039 1039
 
1040 1040
 	$is_geodir_page = geodir_is_geodir_page();
1041
-	if ( ! $is_geodir_page ) {
1041
+	if (!$is_geodir_page) {
1042 1042
 		return;
1043 1043
 	}// if non GD page, bail
1044 1044
 
1045 1045
 	$use_gd_meta = true;
1046
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1046
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1047 1047
 		$use_gd_meta = false;
1048 1048
 
1049
-		if ( geodir_is_page( 'search' ) ) {
1049
+		if (geodir_is_page('search')) {
1050 1050
 			$use_gd_meta = true;
1051 1051
 		}
1052 1052
 	}
1053 1053
 
1054
-	if ( ! $use_gd_meta ) {
1054
+	if (!$use_gd_meta) {
1055 1055
 		return;
1056 1056
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1057 1057
 
@@ -1059,68 +1059,68 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 	$all_postypes = geodir_get_posttypes();
1061 1061
 
1062
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1062
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1063 1063
 
1064 1064
 	$meta_desc = '';
1065 1065
 	$meta_key  = '';
1066
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1066
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1067 1067
 		/**
1068 1068
 		 * Filter SEO meta location description.
1069 1069
 		 *
1070 1070
 		 * @since 1.0.0
1071 1071
 		 */
1072
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1072
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1073 1073
 		$meta_desc .= '';
1074 1074
 	}
1075
-	if ( have_posts() && is_single() OR is_page() ) {
1076
-		while ( have_posts() ) {
1075
+	if (have_posts() && is_single() OR is_page()) {
1076
+		while (have_posts()) {
1077 1077
 			the_post();
1078 1078
 
1079
-			if ( has_excerpt() ) {
1080
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1081
-				if ( empty( $out_excerpt ) ) {
1082
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1079
+			if (has_excerpt()) {
1080
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1081
+				if (empty($out_excerpt)) {
1082
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1083 1083
 				}
1084
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1084
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1085 1085
 			} else {
1086
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1087
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1088
-				if ( empty( $out_excerpt ) ) {
1089
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1086
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1087
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1088
+				if (empty($out_excerpt)) {
1089
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1090 1090
 				}
1091
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1091
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1092 1092
 			}
1093 1093
 
1094 1094
 			$meta_desc .= $out_excerpt;
1095 1095
 		}
1096
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1097
-		if ( is_category() ) {
1098
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1099
-		} elseif ( is_tag() ) {
1100
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1096
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1097
+		if (is_category()) {
1098
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1099
+		} elseif (is_tag()) {
1100
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1101 1101
 		}
1102
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1103
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1102
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1103
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1104 1104
 	}
1105 1105
 
1106 1106
 
1107 1107
 	$geodir_post_type       = geodir_get_current_posttype();
1108
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1109
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1110
-
1111
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1112
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1113
-
1114
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1115
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1116
-
1117
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1118
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1119
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1120
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1121
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1122
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1123
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1108
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1109
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1110
+
1111
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1112
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1113
+
1114
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1115
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1116
+
1117
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1118
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1119
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1120
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1121
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1122
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1123
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1124 1124
 	/**
1125 1125
 	 * Filter the Everywhere text in location description.
1126 1126
 	 *
@@ -1128,108 +1128,108 @@  discard block
 block discarded – undo
1128 1128
 	 *
1129 1129
 	 * @param string $replace_location Everywhere text.
1130 1130
 	 */
1131
-	$replace_location        = apply_filters( 'geodir_location_description_everywhere_text', __( 'Everywhere', 'geodirectory' ) );
1131
+	$replace_location        = apply_filters('geodir_location_description_everywhere_text', __('Everywhere', 'geodirectory'));
1132 1132
 	$location_id             = null;
1133
-	if ( $geodir_location_manager ) {
1134
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1135
-		$location_id   = (int) $wpdb->get_var( $sql );
1133
+	if ($geodir_location_manager) {
1134
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1135
+		$location_id   = (int) $wpdb->get_var($sql);
1136 1136
 		$location_type = geodir_what_is_current_location();
1137
-		if ( $location_type == 'city' ) {
1138
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1139
-		} elseif ( $location_type == 'region' ) {
1140
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1141
-		} elseif ( $location_type == 'country' ) {
1142
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1143
-			$replace_location = __( $replace_location, 'geodirectory' );
1144
-		}
1145
-		$country          = get_query_var( 'gd_country' );
1146
-		$region           = get_query_var( 'gd_region' );
1147
-		$city             = get_query_var( 'gd_city' );
1137
+		if ($location_type == 'city') {
1138
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1139
+		} elseif ($location_type == 'region') {
1140
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1141
+		} elseif ($location_type == 'country') {
1142
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1143
+			$replace_location = __($replace_location, 'geodirectory');
1144
+		}
1145
+		$country          = get_query_var('gd_country');
1146
+		$region           = get_query_var('gd_region');
1147
+		$city             = get_query_var('gd_city');
1148 1148
 		$current_location = '';
1149
-		if ( $country != '' ) {
1150
-			$current_location = get_actual_location_name( 'country', $country, true );
1149
+		if ($country != '') {
1150
+			$current_location = get_actual_location_name('country', $country, true);
1151 1151
 		}
1152
-		if ( $region != '' ) {
1153
-			$current_location = get_actual_location_name( 'region', $region );
1152
+		if ($region != '') {
1153
+			$current_location = get_actual_location_name('region', $region);
1154 1154
 		}
1155
-		if ( $city != '' ) {
1156
-			$current_location = get_actual_location_name( 'city', $city );
1155
+		if ($city != '') {
1156
+			$current_location = get_actual_location_name('city', $city);
1157 1157
 		}
1158 1158
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1159 1159
 	}
1160 1160
 
1161 1161
 	$geodir_meta_keys = '';
1162 1162
 	$geodir_meta_desc = '';
1163
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1164
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1165
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1163
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1164
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1165
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1166 1166
 
1167
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1168
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1167
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1168
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1169 1169
 
1170
-			if ( $geodir_is_category ) {
1171
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1172
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1170
+			if ($geodir_is_category) {
1171
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1172
+				if (isset($category->term_id) && !empty($category->term_id)) {
1173 1173
 					$category_id   = $category->term_id;
1174
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1175
-					if ( $location_id ) {
1176
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1177
-						$cat_loc_option = get_option( $option_name );
1178
-
1179
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1180
-						if ( ! $gd_cat_loc_default ) {
1181
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1182
-							$option        = get_option( $option_name );
1183
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1174
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1175
+					if ($location_id) {
1176
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1177
+						$cat_loc_option = get_option($option_name);
1178
+
1179
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1180
+						if (!$gd_cat_loc_default) {
1181
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1182
+							$option        = get_option($option_name);
1183
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1184 1184
 						}
1185 1185
 					}
1186
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1186
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1187 1187
 				}
1188
-			} else if ( $geodir_is_tag ) {
1189
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1188
+			} else if ($geodir_is_tag) {
1189
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1190 1190
 			}
1191 1191
 		}
1192 1192
 	}
1193 1193
 
1194 1194
 
1195 1195
 	$gd_page = '';
1196
-	if ( geodir_is_page( 'home' ) ) {
1196
+	if (geodir_is_page('home')) {
1197 1197
 		$gd_page   = 'home';
1198
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1199
-	} elseif ( geodir_is_page( 'detail' ) ) {
1198
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1199
+	} elseif (geodir_is_page('detail')) {
1200 1200
 		$gd_page   = 'detail';
1201
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1202
-	} elseif ( geodir_is_page( 'pt' ) ) {
1201
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1202
+	} elseif (geodir_is_page('pt')) {
1203 1203
 		$gd_page   = 'pt';
1204
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1205
-	} elseif ( geodir_is_page( 'listing' ) ) {
1204
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1205
+	} elseif (geodir_is_page('listing')) {
1206 1206
 		$gd_page   = 'listing';
1207
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1208
-	} elseif ( geodir_is_page( 'location' ) ) {
1207
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1208
+	} elseif (geodir_is_page('location')) {
1209 1209
 		$gd_page   = 'location';
1210
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1211
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1210
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1211
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1212 1212
 
1213
-	} elseif ( geodir_is_page( 'search' ) ) {
1213
+	} elseif (geodir_is_page('search')) {
1214 1214
 		$gd_page   = 'search';
1215
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1216
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1215
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1216
+	} elseif (geodir_is_page('add-listing')) {
1217 1217
 		$gd_page   = 'add-listing';
1218
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1219
-	} elseif ( geodir_is_page( 'author' ) ) {
1218
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1219
+	} elseif (geodir_is_page('author')) {
1220 1220
 		$gd_page   = 'author';
1221
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1222
-	} elseif ( geodir_is_page( 'login' ) ) {
1221
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1222
+	} elseif (geodir_is_page('login')) {
1223 1223
 		$gd_page   = 'login';
1224
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1225
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1224
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1225
+	} elseif (geodir_is_page('listing-success')) {
1226 1226
 		$gd_page   = 'listing-success';
1227
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1227
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1228 1228
 	}
1229 1229
 
1230 1230
 
1231
-	if ( $meta_desc ) {
1232
-		$meta_desc = stripslashes_deep( $meta_desc );
1231
+	if ($meta_desc) {
1232
+		$meta_desc = stripslashes_deep($meta_desc);
1233 1233
 		/**
1234 1234
 		 * Filter page description to replace variables.
1235 1235
 		 *
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 		 * @param string $title   The page description including variables.
1239 1239
 		 * @param string $gd_page The GeoDirectory page type if any.
1240 1240
 		 */
1241
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1241
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1242 1242
 
1243 1243
 		/**
1244 1244
 		 * Filter SEO meta description.
@@ -1247,20 +1247,20 @@  discard block
 block discarded – undo
1247 1247
 		 *
1248 1248
 		 * @param string $meta_desc Meta description content.
1249 1249
 		 */
1250
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1250
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1251 1251
 	}
1252 1252
 
1253 1253
 	// meta keywords
1254
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1255
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1256
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1254
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1255
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1256
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1257 1257
 
1258
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1258
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1259 1259
 	} else {
1260 1260
 		$posttags = get_the_tags();
1261
-		if ( $posttags ) {
1262
-			foreach ( $posttags as $tag ) {
1263
-				$meta_key .= $tag->name . ' ';
1261
+		if ($posttags) {
1262
+			foreach ($posttags as $tag) {
1263
+				$meta_key .= $tag->name.' ';
1264 1264
 			}
1265 1265
 		} else {
1266 1266
 //			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
@@ -1276,20 +1276,20 @@  discard block
 block discarded – undo
1276 1276
 		}
1277 1277
 	}
1278 1278
 
1279
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1280
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1281
-	if ( $geodir_meta_keys != '' ) {
1282
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1283
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1284
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1285
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1286
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1279
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1280
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1281
+	if ($geodir_meta_keys != '') {
1282
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1283
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1284
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1285
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1286
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1287 1287
 
1288
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1288
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1289 1289
 	}
1290 1290
 
1291
-	if ( $meta_key ) {
1292
-		$meta_key = stripslashes_deep( $meta_key );
1291
+	if ($meta_key) {
1292
+		$meta_key = stripslashes_deep($meta_key);
1293 1293
 		/**
1294 1294
 		 * Filter SEO meta keywords.
1295 1295
 		 *
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 		 *
1298 1298
 		 * @param string $meta_desc Meta keywords.
1299 1299
 		 */
1300
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1300
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1301 1301
 	}
1302 1302
 
1303 1303
 }
@@ -1317,8 +1317,8 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1319 1319
 
1320
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1321
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1320
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1321
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1322 1322
 	}
1323 1323
 
1324 1324
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1340,57 +1340,57 @@  discard block
 block discarded – undo
1340 1340
 	 * @since 1.0.0
1341 1341
 	 */
1342 1342
 	$arr_tabs['post_profile'] = array(
1343
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1343
+		'heading_text'  => __('Profile', 'geodirectory'),
1344 1344
 		'is_active_tab' => true,
1345
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1345
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1346 1346
 		'tab_content'   => ''
1347 1347
 	);
1348
-	$arr_tabs['post_info']    = array(
1349
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1348
+	$arr_tabs['post_info'] = array(
1349
+		'heading_text'  => __('More Info', 'geodirectory'),
1350 1350
 		'is_active_tab' => false,
1351
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1351
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1352 1352
 		'tab_content'   => ''
1353 1353
 	);
1354 1354
 
1355 1355
 	$arr_tabs['post_images'] = array(
1356
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1356
+		'heading_text'  => __('Photos', 'geodirectory'),
1357 1357
 		'is_active_tab' => false,
1358
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1358
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1359 1359
 		'tab_content'   => ''
1360 1360
 	);
1361 1361
 
1362 1362
 	$arr_tabs['post_video'] = array(
1363
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1363
+		'heading_text'  => __('Video', 'geodirectory'),
1364 1364
 		'is_active_tab' => false,
1365
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1365
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1366 1366
 		'tab_content'   => ''
1367 1367
 	);
1368 1368
 
1369 1369
 	$arr_tabs['special_offers'] = array(
1370
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1370
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1371 1371
 		'is_active_tab' => false,
1372
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1372
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1373 1373
 		'tab_content'   => ''
1374 1374
 	);
1375 1375
 
1376 1376
 	$arr_tabs['post_map'] = array(
1377
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1377
+		'heading_text'  => __('Map', 'geodirectory'),
1378 1378
 		'is_active_tab' => false,
1379
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1379
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1380 1380
 		'tab_content'   => ''
1381 1381
 	);
1382 1382
 
1383 1383
 	$arr_tabs['reviews'] = array(
1384
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1384
+		'heading_text'  => __('Reviews', 'geodirectory'),
1385 1385
 		'is_active_tab' => false,
1386
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1386
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1387 1387
 		'tab_content'   => 'review display'
1388 1388
 	);
1389 1389
 
1390 1390
 	$arr_tabs['related_listing'] = array(
1391
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1391
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1392 1392
 		'is_active_tab' => false,
1393
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1393
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1394 1394
 		'tab_content'   => ''
1395 1395
 	);
1396 1396
 
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 	 *
1400 1400
 	 * @since 1.0.0
1401 1401
 	 */
1402
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1402
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1403 1403
 
1404 1404
 
1405 1405
 }
@@ -1413,13 +1413,13 @@  discard block
 block discarded – undo
1413 1413
  * @return mixed|array Tabs array.
1414 1414
  */
1415 1415
 function geodir_detail_page_tabs_list() {
1416
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1416
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1417 1417
 	$tabs_array    = geodir_detail_page_tabs_array();
1418 1418
 
1419
-	if ( ! empty( $tabs_excluded ) ) {
1420
-		foreach ( $tabs_excluded as $tab ) {
1421
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1422
-				unset( $tabs_array[ $tab ] );
1419
+	if (!empty($tabs_excluded)) {
1420
+		foreach ($tabs_excluded as $tab) {
1421
+			if (array_key_exists($tab, $tabs_array)) {
1422
+				unset($tabs_array[$tab]);
1423 1423
 			}
1424 1424
 		}
1425 1425
 	}
@@ -1443,66 +1443,66 @@  discard block
 block discarded – undo
1443 1443
 function geodir_show_detail_page_tabs() {
1444 1444
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1445 1445
 
1446
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1447
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1448
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1446
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1447
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1448
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1449 1449
 
1450
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1451
-		$post = geodir_get_post_info( $request_post_id );
1452
-		setup_postdata( $post );
1450
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1451
+		$post = geodir_get_post_info($request_post_id);
1452
+		setup_postdata($post);
1453 1453
 	}
1454 1454
 
1455
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1455
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1456 1456
 
1457 1457
 	$package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1458 1458
 	$image_limit = '';
1459 1459
 	if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1460
-		$image_limit = (int)$package_info->image_limit;
1460
+		$image_limit = (int) $package_info->image_limit;
1461 1461
 	}
1462 1462
 
1463
-	if ( geodir_is_page( 'detail' ) ) {
1464
-		$video                 = geodir_get_video( $post->ID );
1465
-		$special_offers        = geodir_get_special_offers( $post->ID );
1463
+	if (geodir_is_page('detail')) {
1464
+		$video                 = geodir_get_video($post->ID);
1465
+		$special_offers        = geodir_get_special_offers($post->ID);
1466 1466
 		$related_listing_array = array();
1467
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1468
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1467
+		if (get_option('geodir_add_related_listing_posttypes')) {
1468
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1469 1469
 		}
1470 1470
 
1471
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1472
-		if ( ! $excluded_tabs ) {
1471
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1472
+		if (!$excluded_tabs) {
1473 1473
 			$excluded_tabs = array();
1474 1474
 		}
1475 1475
 
1476 1476
 		$related_listing = '';
1477
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1477
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1478 1478
 			$request = array(
1479
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1480
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1481
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1482
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1483
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1484
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1479
+				'post_number'         => get_option('geodir_related_post_count'),
1480
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1481
+				'layout'              => get_option('geodir_related_post_listing_view'),
1482
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1483
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1484
+				'character_count'     => get_option('geodir_related_post_excerpt')
1485 1485
 			);
1486 1486
 
1487
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1488
-				$related_listing = geodir_get_detail_page_related_events( $request );
1487
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1488
+				$related_listing = geodir_get_detail_page_related_events($request);
1489 1489
 			} else {
1490
-				$related_listing = geodir_related_posts_display( $request );
1490
+				$related_listing = geodir_related_posts_display($request);
1491 1491
 			}
1492 1492
 
1493 1493
 		}
1494 1494
 
1495
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1495
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1496 1496
 		$thumb_image = '';
1497
-		if ( ! empty( $post_images ) ) {
1497
+		if (!empty($post_images)) {
1498 1498
 			$count = 1;
1499
-			foreach ( $post_images as $image ) {
1499
+			foreach ($post_images as $image) {
1500 1500
 				if ($image_limit !== '' && $count > $image_limit) {
1501 1501
 					break;
1502 1502
 				}
1503
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1504
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1505
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1503
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1504
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1505
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1506 1506
 				$thumb_image .= '</a>';
1507 1507
 				$count++;
1508 1508
 			}
@@ -1512,11 +1512,11 @@  discard block
 block discarded – undo
1512 1512
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1513 1513
 		$map_args['width']           = '600';
1514 1514
 		$map_args['height']          = '300';
1515
-		if ( $post->post_mapzoom ) {
1516
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1515
+		if ($post->post_mapzoom) {
1516
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1517 1517
 		}
1518 1518
 		$map_args['autozoom']                 = false;
1519
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1519
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1520 1520
 		$map_args['child_collapse']           = '0';
1521 1521
 		$map_args['enable_cat_filters']       = false;
1522 1522
 		$map_args['enable_text_search']       = false;
@@ -1525,29 +1525,29 @@  discard block
 block discarded – undo
1525 1525
 		$map_args['enable_jason_on_load']     = true;
1526 1526
 		$map_args['enable_map_direction']     = true;
1527 1527
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1528
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1529
-	} else if ( geodir_is_page( 'preview' ) ) {
1530
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1531
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1528
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1529
+	} else if (geodir_is_page('preview')) {
1530
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1531
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1532 1532
 
1533
-		if ( isset( $post->post_images ) ) {
1534
-			$post->post_images = trim( $post->post_images, "," );
1533
+		if (isset($post->post_images)) {
1534
+			$post->post_images = trim($post->post_images, ",");
1535 1535
 		}
1536 1536
 
1537
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1538
-			$post_images = explode( ",", $post->post_images );
1537
+		if (isset($post->post_images) && !empty($post->post_images)) {
1538
+			$post_images = explode(",", $post->post_images);
1539 1539
 		}
1540 1540
 
1541 1541
 		$thumb_image = '';
1542
-		if ( ! empty( $post_images ) ) {
1542
+		if (!empty($post_images)) {
1543 1543
 			$count = 1;
1544
-			foreach ( $post_images as $image ) {
1545
-				if ( $image != '' ) {
1544
+			foreach ($post_images as $image) {
1545
+				if ($image != '') {
1546 1546
 					if ($image_limit !== '' && $count > $image_limit) {
1547 1547
 						break;
1548 1548
 					}
1549
-					$thumb_image .= '<a href="' . $image . '">';
1550
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1549
+					$thumb_image .= '<a href="'.$image.'">';
1550
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1551 1551
 					$thumb_image .= '</a>';
1552 1552
 					$count++;
1553 1553
 				}
@@ -1555,18 +1555,18 @@  discard block
 block discarded – undo
1555 1555
 		}
1556 1556
 
1557 1557
 		global $map_jason;
1558
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1559
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1560
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1558
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1559
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1560
+		$icon_size        = geodir_get_marker_size($marker_icon);
1561 1561
 		$marker_json['w'] = $icon_size['w'];
1562 1562
 		$marker_json['h'] = $icon_size['h'];
1563
-		$map_jason[]      = json_encode( $marker_json );
1563
+		$map_jason[]      = json_encode($marker_json);
1564 1564
 
1565
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1566
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1567
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1568
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1569
-		if ( ! $mapzoom ) {
1565
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1566
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1567
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1568
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1569
+		if (!$mapzoom) {
1570 1570
 			$mapzoom = 12;
1571 1571
 		}
1572 1572
 
@@ -1589,37 +1589,37 @@  discard block
 block discarded – undo
1589 1589
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1590 1590
 	}
1591 1591
 
1592
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1592
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1593 1593
 
1594 1594
 	$active_tab       = '';
1595 1595
 	$active_tab_name  = '';
1596 1596
 	$default_tab      = '';
1597 1597
 	$default_tab_name = '';
1598
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1599
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1598
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1599
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1600 1600
 			$active_tab      = $tab_index;
1601
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1601
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1602 1602
 		}
1603 1603
 
1604
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1604
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1605 1605
 			$default_tab      = $tab_index;
1606
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1606
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1607 1607
 		}
1608 1608
 	}
1609 1609
 
1610
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1611
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1612
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1610
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1611
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1612
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1613 1613
 		}
1614 1614
 
1615
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1615
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1616 1616
 		$active_tab                                            = $default_tab;
1617 1617
 		$active_tab_name                                       = $default_tab_name;
1618 1618
 	}
1619
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1619
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1620 1620
 	?>
1621 1621
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1622
-		<?php if ( ! $tab_list ){ ?>
1622
+		<?php if (!$tab_list) { ?>
1623 1623
 		<div id="geodir-tab-mobile-menu">
1624 1624
 			<i class="fa fa-bars"></i>
1625 1625
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1634,26 +1634,26 @@  discard block
 block discarded – undo
1634 1634
 			 * @since 1.0.0
1635 1635
 			 * @see   'geodir_after_tab_list'
1636 1636
 			 */
1637
-			do_action( 'geodir_before_tab_list' ); ?>
1637
+			do_action('geodir_before_tab_list'); ?>
1638 1638
 			<?php
1639 1639
 
1640
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1641
-				if ( $detail_page_tab['is_display'] ) {
1640
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1641
+				if ($detail_page_tab['is_display']) {
1642 1642
 
1643
-					if ( ! $tab_list ) {
1643
+					if (!$tab_list) {
1644 1644
 						?>
1645 1645
 						<dt></dt> <!-- added to comply with validation -->
1646
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1646
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1647 1647
 								data-tab="#<?php echo $tab_index; ?>"
1648
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1648
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1649 1649
 						</dd>
1650 1650
 						<?php
1651 1651
 					}
1652 1652
 					ob_start() // start tab content buffering
1653 1653
 					?>
1654 1654
 					<li id="<?php echo $tab_index; ?>Tab">
1655
-						<?php if ( $tab_list ) {
1656
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1655
+						<?php if ($tab_list) {
1656
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1657 1657
 							/**
1658 1658
 							 * Filter the tab list title html.
1659 1659
 							 *
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 							 * @param string $tab_index      The tab index type.
1664 1664
 							 * @param array $detail_page_tab The array of values including title text.
1665 1665
 							 */
1666
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1666
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1667 1667
 						} ?>
1668 1668
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1669 1669
 						<?php
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
 						 *
1675 1675
 						 * @param string $tab_index The tab name ID.
1676 1676
 						 */
1677
-						do_action( 'geodir_before_tab_content', $tab_index );
1677
+						do_action('geodir_before_tab_content', $tab_index);
1678 1678
 
1679 1679
 						/**
1680 1680
 						 * Called before the details tab content is output per tab.
@@ -1684,21 +1684,21 @@  discard block
 block discarded – undo
1684 1684
 						 * @since 1.0.0
1685 1685
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1686 1686
 						 */
1687
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1687
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1688 1688
 						/// write a code to generate content of each tab
1689
-						switch ( $tab_index ) {
1689
+						switch ($tab_index) {
1690 1690
 							case 'post_profile':
1691 1691
 								/**
1692 1692
 								 * Called before the listing description content on the details page tab.
1693 1693
 								 *
1694 1694
 								 * @since 1.0.0
1695 1695
 								 */
1696
-								do_action( 'geodir_before_description_on_listing_detail' );
1697
-								if ( geodir_is_page( 'detail' ) ) {
1696
+								do_action('geodir_before_description_on_listing_detail');
1697
+								if (geodir_is_page('detail')) {
1698 1698
 									the_content();
1699 1699
 								} else {
1700 1700
 									/** This action is documented in geodirectory_template_actions.php */
1701
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1701
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1702 1702
 								}
1703 1703
 
1704 1704
 								/**
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 								 *
1707 1707
 								 * @since 1.0.0
1708 1708
 								 */
1709
-								do_action( 'geodir_after_description_on_listing_detail' );
1709
+								do_action('geodir_after_description_on_listing_detail');
1710 1710
 								break;
1711 1711
 							case 'post_info':
1712 1712
 								echo $geodir_post_detail_fields;
@@ -1716,32 +1716,32 @@  discard block
 block discarded – undo
1716 1716
 								break;
1717 1717
 							case 'post_video':
1718 1718
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1719
-								if ( $preview ) {
1720
-									if ( $video ) {
1721
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1719
+								if ($preview) {
1720
+									if ($video) {
1721
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1722 1722
 									}
1723 1723
 								} else {
1724 1724
 
1725 1725
 									// stop payment manager filtering content length
1726
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1727
-									if ( false !== $filter_priority ) {
1728
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1726
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1727
+									if (false !== $filter_priority) {
1728
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1729 1729
 									}
1730 1730
 
1731 1731
 									/** This action is documented in geodirectory_template_actions.php */
1732
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1732
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1733 1733
 
1734
-									if ( false !== $filter_priority ) {
1735
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1734
+									if (false !== $filter_priority) {
1735
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1736 1736
 									}
1737 1737
 								}
1738 1738
 								break;
1739 1739
 							case 'special_offers':
1740
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1740
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1741 1741
 
1742 1742
 								break;
1743 1743
 							case 'post_map':
1744
-								geodir_draw_map( $map_args );
1744
+								geodir_draw_map($map_args);
1745 1745
 								break;
1746 1746
 							case 'reviews':
1747 1747
 								comments_template();
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 								echo $related_listing;
1751 1751
 								break;
1752 1752
 							default: {
1753
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1753
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1754 1754
 									echo $detail_page_tab['tab_content'];
1755 1755
 								}
1756 1756
 							}
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 						 *
1763 1763
 						 * @since 1.0.0
1764 1764
 						 */
1765
-						do_action( 'geodir_after_tab_content', $tab_index );
1765
+						do_action('geodir_after_tab_content', $tab_index);
1766 1766
 
1767 1767
 						/**
1768 1768
 						 * Called after the details tab content is output per tab.
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 						 * @since 1.0.0
1773 1773
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1774 1774
 						 */
1775
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1775
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1776 1776
 						?> </li>
1777 1777
 					<?php
1778 1778
 					/**
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 					 *
1781 1781
 					 * @since 1.0.0
1782 1782
 					 */
1783
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1783
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1784 1784
 				} // end of if for is_display
1785 1785
 			}// end of foreach
1786 1786
 
@@ -1790,14 +1790,14 @@  discard block
 block discarded – undo
1790 1790
 			 * @since 1.0.0
1791 1791
 			 * @see   'geodir_before_tab_list'
1792 1792
 			 */
1793
-			do_action( 'geodir_after_tab_list' );
1793
+			do_action('geodir_after_tab_list');
1794 1794
 			?>
1795
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1796
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1795
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1796
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1797 1797
 		    style="position:relative;">
1798 1798
 			<?php
1799
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1800
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1799
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1800
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1801 1801
 					echo $detail_page_tab['tab_content'];
1802 1802
 				}// end of if
1803 1803
 			}// end of foreach
@@ -1807,11 +1807,11 @@  discard block
 block discarded – undo
1807 1807
 			 *
1808 1808
 			 * @since 1.0.0
1809 1809
 			 */
1810
-			do_action( 'geodir_add_tab_content' ); ?>
1810
+			do_action('geodir_add_tab_content'); ?>
1811 1811
 		</ul>
1812 1812
 		<!--gd-tabs-content ul end-->
1813 1813
 	</div>
1814
-	<?php if ( ! $tab_list ) { ?>
1814
+	<?php if (!$tab_list) { ?>
1815 1815
 		<script>
1816 1816
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1817 1817
 				hashVal = window.location.hash;
@@ -1843,31 +1843,31 @@  discard block
 block discarded – undo
1843 1843
  *
1844 1844
  * @return mixed Image file.
1845 1845
  */
1846
-function geodir_exif( $file ) {
1847
-	if ( empty( $file ) || ! is_array( $file ) ) {
1846
+function geodir_exif($file) {
1847
+	if (empty($file) || !is_array($file)) {
1848 1848
 		return $file;
1849 1849
 	}
1850 1850
 
1851
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1852
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1851
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1852
+	if (!($file_path && file_exists($file_path))) {
1853 1853
 		return $file;
1854 1854
 	}
1855 1855
 	$file['file'] = $file_path;
1856 1856
 
1857
-	if ( ! file_is_valid_image( $file_path ) ) {
1857
+	if (!file_is_valid_image($file_path)) {
1858 1858
 		return $file; // Bail if file is not an image.
1859 1859
 	}
1860 1860
 
1861
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1861
+	if (!function_exists('wp_get_image_editor')) {
1862 1862
 		return $file;
1863 1863
 	}
1864 1864
 
1865 1865
 	$mime_type = $file['type'];
1866 1866
 	$exif      = array();
1867
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1867
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1868 1868
 		try {
1869
-			$exif = exif_read_data( $file_path );
1870
-		} catch ( Exception $e ) {
1869
+			$exif = exif_read_data($file_path);
1870
+		} catch (Exception $e) {
1871 1871
 			$exif = array();
1872 1872
 		}
1873 1873
 	}
@@ -1876,13 +1876,13 @@  discard block
 block discarded – undo
1876 1876
 	$flip        = false;
1877 1877
 	$modify      = false;
1878 1878
 	$orientation = 0;
1879
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1880
-		switch ( (int) $exif['Orientation'] ) {
1879
+	if (!empty($exif) && isset($exif['Orientation'])) {
1880
+		switch ((int) $exif['Orientation']) {
1881 1881
 			case 1:
1882 1882
 				// do nothing
1883 1883
 				break;
1884 1884
 			case 2:
1885
-				$flip   = array( false, true );
1885
+				$flip   = array(false, true);
1886 1886
 				$modify = true;
1887 1887
 				break;
1888 1888
 			case 3:
@@ -1891,13 +1891,13 @@  discard block
 block discarded – undo
1891 1891
 				$modify      = true;
1892 1892
 				break;
1893 1893
 			case 4:
1894
-				$flip   = array( true, false );
1894
+				$flip   = array(true, false);
1895 1895
 				$modify = true;
1896 1896
 				break;
1897 1897
 			case 5:
1898 1898
 				$orientation = - 90;
1899 1899
 				$rotate      = true;
1900
-				$flip        = array( false, true );
1900
+				$flip        = array(false, true);
1901 1901
 				$modify      = true;
1902 1902
 				break;
1903 1903
 			case 6:
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 			case 7:
1909 1909
 				$orientation = - 270;
1910 1910
 				$rotate      = true;
1911
-				$flip        = array( false, true );
1911
+				$flip        = array(false, true);
1912 1912
 				$modify      = true;
1913 1913
 				break;
1914 1914
 			case 8:
@@ -1934,31 +1934,31 @@  discard block
 block discarded – undo
1934 1934
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1935 1935
 	 * @param string $quality   Image mime type.
1936 1936
 	 */
1937
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1938
-	if ( $quality !== null ) {
1937
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1938
+	if ($quality !== null) {
1939 1939
 		$modify = true;
1940 1940
 	}
1941 1941
 
1942
-	if ( ! $modify ) {
1942
+	if (!$modify) {
1943 1943
 		return $file; // no change
1944 1944
 	}
1945 1945
 
1946
-	$image = wp_get_image_editor( $file_path );
1947
-	if ( ! is_wp_error( $image ) ) {
1948
-		if ( $rotate ) {
1949
-			$image->rotate( $orientation );
1946
+	$image = wp_get_image_editor($file_path);
1947
+	if (!is_wp_error($image)) {
1948
+		if ($rotate) {
1949
+			$image->rotate($orientation);
1950 1950
 		}
1951 1951
 
1952
-		if ( ! empty( $flip ) ) {
1953
-			$image->flip( $flip[0], $flip[1] );
1952
+		if (!empty($flip)) {
1953
+			$image->flip($flip[0], $flip[1]);
1954 1954
 		}
1955 1955
 
1956
-		if ( $quality !== null ) {
1957
-			$image->set_quality( (int) $quality );
1956
+		if ($quality !== null) {
1957
+			$image->set_quality((int) $quality);
1958 1958
 		}
1959 1959
 
1960
-		$result = $image->save( $file_path );
1961
-		if ( ! is_wp_error( $result ) ) {
1960
+		$result = $image->save($file_path);
1961
+		if (!is_wp_error($result)) {
1962 1962
 			$file['file']     = $result['path'];
1963 1963
 			$file['tmp_name'] = $result['path'];
1964 1964
 		}
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
  *
1987 1987
  * @return string Returns the recent reviews html.
1988 1988
  */
1989
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false ) {
1989
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 5, $comment_lenth = 60, $show_pass_post = false) {
1990 1990
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix;
1991 1991
 	$tablecomments = $wpdb->comments;
1992 1992
 	$tableposts    = $wpdb->posts;
@@ -1996,17 +1996,17 @@  discard block
 block discarded – undo
1996 1996
 	$region_filter  = '';
1997 1997
 	$country_filter = '';
1998 1998
 
1999
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
2000
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
2001
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1999
+	if ($gd_session->get('gd_multi_location')) {
2000
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
2001
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
2002 2002
 		}
2003 2003
 
2004
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
2005
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
2004
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
2005
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
2006 2006
 		}
2007 2007
 
2008
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
2009
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
2008
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
2009
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
2010 2010
 		}
2011 2011
 	}
2012 2012
 
@@ -2017,84 +2017,84 @@  discard block
 block discarded – undo
2017 2017
 		$lang_code = ICL_LANGUAGE_CODE;
2018 2018
 
2019 2019
 		if ($lang_code) {
2020
-			$join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2021
-			$where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2020
+			$join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
2021
+			$where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
2022 2022
 		}
2023 2023
 	}
2024 2024
 
2025
-	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT ". $no_comments;
2025
+	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT ".$no_comments;
2026 2026
 
2027
-	$comments = $wpdb->get_results( $request );
2027
+	$comments = $wpdb->get_results($request);
2028 2028
 
2029
-	foreach ( $comments as $comment ) {
2029
+	foreach ($comments as $comment) {
2030 2030
 		// Set the extra comment info needed.
2031
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
2031
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
2032 2032
 		$comment->comment_content      = $comment_extra->comment_content;
2033 2033
 		$comment->comment_author       = $comment_extra->comment_author;
2034 2034
 		$comment->comment_author_email = $comment_extra->comment_author_email;
2035 2035
 
2036 2036
 		$comment_id      = '';
2037 2037
 		$comment_id      = $comment->comment_ID;
2038
-		$comment_content = strip_tags( $comment->comment_content );
2038
+		$comment_content = strip_tags($comment->comment_content);
2039 2039
 
2040
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2040
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2041 2041
 
2042
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2042
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2043 2043
 		$comment_author_email = $comment->comment_author_email;
2044 2044
 		$comment_post_ID      = $comment->post_id;
2045 2045
 
2046
-		$post_title        = get_the_title( $comment_post_ID );
2047
-		$permalink         = get_permalink( $comment_post_ID );
2048
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2049
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2046
+		$post_title        = get_the_title($comment_post_ID);
2047
+		$permalink         = get_permalink($comment_post_ID);
2048
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2049
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2050 2050
 
2051
-		$comment_content_length = strlen( $comment_content );
2052
-		if ( $comment_content_length > $comment_lenth ) {
2053
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2051
+		$comment_content_length = strlen($comment_content);
2052
+		if ($comment_content_length > $comment_lenth) {
2053
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2054 2054
 		} else {
2055 2055
 			$comment_excerpt = $comment_content;
2056 2056
 		}
2057 2057
 
2058
-		if ( $comment->user_id ) {
2059
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2058
+		if ($comment->user_id) {
2059
+			$user_profile_url = get_author_posts_url($comment->user_id);
2060 2060
 		} else {
2061 2061
 			$user_profile_url = '';
2062 2062
 		}
2063 2063
 
2064
-		if ( $comment_id ) {
2064
+		if ($comment_id) {
2065 2065
 			$comments_echo .= '<li class="clearfix">';
2066
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2067
-			if ( function_exists( 'get_avatar' ) ) {
2068
-				if ( ! isset( $comment->comment_type ) ) {
2069
-					if ( $user_profile_url ) {
2070
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2066
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2067
+			if (function_exists('get_avatar')) {
2068
+				if (!isset($comment->comment_type)) {
2069
+					if ($user_profile_url) {
2070
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2071 2071
 					}
2072
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2073
-					if ( $user_profile_url ) {
2072
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2073
+					if ($user_profile_url) {
2074 2074
 						$comments_echo .= '</a>';
2075 2075
 					}
2076
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2077
-					if ( $user_profile_url ) {
2078
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2076
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2077
+					if ($user_profile_url) {
2078
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2079 2079
 					}
2080
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2080
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2081 2081
 				}
2082
-			} elseif ( function_exists( 'gravatar' ) ) {
2083
-				if ( $user_profile_url ) {
2084
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2082
+			} elseif (function_exists('gravatar')) {
2083
+				if ($user_profile_url) {
2084
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2085 2085
 				}
2086 2086
 				$comments_echo .= "<img src=\"";
2087
-				if ( '' == $comment->comment_type ) {
2088
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2089
-					if ( $user_profile_url ) {
2087
+				if ('' == $comment->comment_type) {
2088
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2089
+					if ($user_profile_url) {
2090 2090
 						$comments_echo .= '</a>';
2091 2091
 					}
2092
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2093
-					if ( $user_profile_url ) {
2094
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2092
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2093
+					if ($user_profile_url) {
2094
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2095 2095
 					}
2096
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2097
-					if ( $user_profile_url ) {
2096
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2097
+					if ($user_profile_url) {
2098 2098
 						$comments_echo .= '</a>';
2099 2099
 					}
2100 2100
 				}
@@ -2105,17 +2105,17 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2107 2107
 			$author_link = apply_filters('geodir_reviewer_content_author_link', true);
2108
-			if ( $comment->user_id && $author_link ) {
2109
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2108
+			if ($comment->user_id && $author_link) {
2109
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2110 2110
 			}
2111
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2112
-			if ( $comment->user_id && $author_link ) {
2111
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2112
+			if ($comment->user_id && $author_link) {
2113 2113
 				$comments_echo .= '</a>';
2114 2114
 			}
2115
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2116
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2117
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2118
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2115
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2116
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2117
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2118
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2119 2119
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2120 2120
 			$comments_echo .= '</p>';
2121 2121
 
@@ -2135,25 +2135,25 @@  discard block
 block discarded – undo
2135 2135
  * @return array Returns post categories as an array.
2136 2136
  */
2137 2137
 function geodir_home_map_cats_key_value_array() {
2138
-	$post_types = geodir_get_posttypes( 'object' );
2138
+	$post_types = geodir_get_posttypes('object');
2139 2139
 
2140 2140
 	$return = array();
2141
-	if ( ! empty( $post_types ) ) {
2142
-		foreach ( $post_types as $key => $post_type ) {
2143
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2144
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2145
-			$taxonomies     = geodir_get_taxonomies( $key );
2146
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2147
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2148
-
2149
-			if ( ! empty( $cat_terms ) ) {
2150
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2151
-
2152
-				foreach ( $cat_terms as $cat_term ) {
2153
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2141
+	if (!empty($post_types)) {
2142
+		foreach ($post_types as $key => $post_type) {
2143
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2144
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2145
+			$taxonomies     = geodir_get_taxonomies($key);
2146
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2147
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2148
+
2149
+			if (!empty($cat_terms)) {
2150
+				$return['optgroup_start-'.$key] = $post_type_name;
2151
+
2152
+				foreach ($cat_terms as $cat_term) {
2153
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2154 2154
 				}
2155 2155
 
2156
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2156
+				$return['optgroup_end-'.$key] = $post_type_name;
2157 2157
 			}
2158 2158
 		}
2159 2159
 	}
@@ -2169,14 +2169,14 @@  discard block
 block discarded – undo
2169 2169
  * @package GeoDirectory
2170 2170
  */
2171 2171
 function geodir_twitter_tweet_button() {
2172
-	if ( isset( $_GET['gde'] ) ) {
2173
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2172
+	if (isset($_GET['gde'])) {
2173
+		$link = '?url='.urlencode(geodir_curPageURL());
2174 2174
 	} else {
2175 2175
 		$link = '';
2176 2176
 	}
2177 2177
 	?>
2178 2178
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2179
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2179
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2180 2180
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2181 2181
 	<?php
2182 2182
 }
@@ -2193,10 +2193,10 @@  discard block
 block discarded – undo
2193 2193
 function geodir_fb_like_button() {
2194 2194
 	global $post;
2195 2195
 	?>
2196
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2196
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2197 2197
 		echo 'allowtransparency="true"';
2198 2198
 	} ?> class="facebook"
2199
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2199
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2200 2200
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2201 2201
 	<?php
2202 2202
 }
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
 
2228 2228
 
2229 2229
 function geodir_listing_bounce_map_pin_on_hover() {
2230
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2230
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2231 2231
 		?>
2232 2232
 		<script>
2233 2233
 			jQuery(function ($) {
@@ -2250,44 +2250,44 @@  discard block
 block discarded – undo
2250 2250
 	}
2251 2251
 }
2252 2252
 
2253
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2253
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2254 2254
 
2255
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2256
-function geodir_output_favourite_html_listings( $post_id ) {
2257
-	geodir_favourite_html( '', $post_id );
2255
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2256
+function geodir_output_favourite_html_listings($post_id) {
2257
+	geodir_favourite_html('', $post_id);
2258 2258
 }
2259 2259
 
2260
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2261
-function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) {
2260
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2261
+function geodir_output_pinpoint_html_listings($post_id, $post = array()) {
2262 2262
 	global $wp_query;
2263 2263
 
2264 2264
 	$show_pin_point = $wp_query->is_main_query();
2265 2265
 
2266
-	if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2267
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2268
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2266
+	if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2267
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2268
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2269 2269
 		?>
2270 2270
 		<span class="geodir-pinpoint"
2271
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2271
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2272 2272
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2273 2273
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2274 2274
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2275
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2275
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2276 2276
 		<?php
2277 2277
 	}
2278 2278
 }
2279 2279
 
2280 2280
 function geodir_search_form_submit_button() {
2281 2281
 
2282
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2282
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2283 2283
 
2284
-	if ( $new_style ) {
2284
+	if ($new_style) {
2285 2285
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2286
-	}else{
2286
+	} else {
2287 2287
 		$default_search_button_label = 'Search';
2288 2288
 	}
2289
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2290
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2289
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2290
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2291 2291
 	}
2292 2292
 
2293 2293
 	/**
@@ -2299,78 +2299,78 @@  discard block
 block discarded – undo
2299 2299
 	 *
2300 2300
 	 * @param string $default_search_button_label The current search button text.
2301 2301
 	 */
2302
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2302
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2303 2303
 
2304 2304
 	$fa_class = '';
2305
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2305
+	if (strpos($default_search_button_label, '&#') !== false) {
2306 2306
 		$fa_class = 'fa';
2307 2307
 	}
2308 2308
 
2309 2309
 
2310
-	if ( $new_style ) {
2310
+	if ($new_style) {
2311 2311
 		?>
2312
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2313
-	<?php }else{?>
2314
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2312
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2313
+	<?php } else {?>
2314
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2315 2315
 		       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2316 2316
 	<?php }
2317 2317
 }
2318 2318
 
2319
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2319
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2320 2320
 
2321 2321
 function geodir_search_form_post_type_input() {
2322 2322
 	global $geodir_search_post_type;
2323
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2323
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2324 2324
 	$curr_post_type = $geodir_search_post_type;
2325 2325
 
2326
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2326
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2327 2327
 
2328
-		foreach ( $post_types as $post_type => $info ){
2328
+		foreach ($post_types as $post_type => $info) {
2329 2329
 			global $wpdb;
2330
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2331
-			if ( ! $has_posts ) {
2330
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2331
+			if (!$has_posts) {
2332 2332
 				unset($post_types->{$post_type});
2333 2333
 			}
2334 2334
 		}
2335 2335
 
2336
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2336
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2337 2337
 
2338
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2339
-			if ( $new_style ) {
2338
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2339
+			if ($new_style) {
2340 2340
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2341 2341
 			}
2342 2342
 			?>
2343 2343
 			<select name="stype" class="search_by_post">
2344
-				<?php foreach ( $post_types as $post_type => $info ):
2344
+				<?php foreach ($post_types as $post_type => $info):
2345 2345
 					global $wpdb;
2346 2346
 					?>
2347 2347
 
2348
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2349
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2350
-						if ( $post_type == $_REQUEST['stype'] ) {
2348
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2349
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2350
+						if ($post_type == $_REQUEST['stype']) {
2351 2351
 							echo 'selected="selected"';
2352 2352
 						}
2353
-					} elseif ( $curr_post_type == $post_type ) {
2353
+					} elseif ($curr_post_type == $post_type) {
2354 2354
 						echo 'selected="selected"';
2355
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2355
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2356 2356
 
2357 2357
 				<?php endforeach; ?>
2358 2358
 			</select>
2359 2359
 			<?php
2360
-			if ( $new_style ) {
2360
+			if ($new_style) {
2361 2361
 				echo "</div>";
2362 2362
 			}
2363
-		}else{
2364
-			if(! empty( $post_types )){
2365
-				$pt_arr = (array)$post_types;
2366
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2367
-			}else{
2363
+		} else {
2364
+			if (!empty($post_types)) {
2365
+				$pt_arr = (array) $post_types;
2366
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2367
+			} else {
2368 2368
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2369 2369
 			}
2370 2370
 
2371 2371
 		}
2372 2372
 
2373
-	}elseif ( ! empty( $post_types ) ) {
2373
+	}elseif (!empty($post_types)) {
2374 2374
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2375 2375
 	}
2376 2376
 }
@@ -2378,27 +2378,27 @@  discard block
 block discarded – undo
2378 2378
 function geodir_search_form_search_input() {
2379 2379
 
2380 2380
 	$default_search_for_text = SEARCH_FOR_TEXT;
2381
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2382
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2381
+	if (get_option('geodir_search_field_default_text')) {
2382
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2383 2383
 	}
2384 2384
 
2385 2385
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2386
-	if($new_style){
2386
+	if ($new_style) {
2387 2387
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2388 2388
 	}
2389 2389
 	?>
2390 2390
 	<input class="search_text" name="s"
2391
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2392
-		       $search_term = esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2391
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2392
+		       $search_term = esc_attr(stripslashes_deep($_REQUEST['s']));
2393 2393
 		       echo $search_term;
2394 2394
 	       } else {
2395 2395
 		       echo $default_search_for_text;
2396 2396
 	       } ?>" type="text"
2397
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2398
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2397
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2398
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2399 2399
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2400 2400
 	<?php
2401
-	if($new_style){
2401
+	if ($new_style) {
2402 2402
 		echo "</div>";
2403 2403
 	}
2404 2404
 }
@@ -2406,12 +2406,12 @@  discard block
 block discarded – undo
2406 2406
 function geodir_search_form_near_input() {
2407 2407
 
2408 2408
 	$default_near_text = NEAR_TEXT;
2409
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2410
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2409
+	if (get_option('geodir_near_field_default_text')) {
2410
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2411 2411
 	}
2412 2412
 
2413
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2414
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2413
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2414
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2415 2415
 	} else {
2416 2416
 		$near = $default_near_text;
2417 2417
 	}
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
 	 * @since 1.6.9
2426 2426
 	 * @param string $curr_post_type The current post type.
2427 2427
 	 */
2428
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2428
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2429 2429
 
2430 2430
 
2431 2431
 	/**
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 	 * @param string $near              The current near value.
2439 2439
 	 * @param string $default_near_text The default near value.
2440 2440
 	 */
2441
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2441
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2442 2442
 	/**
2443 2443
 	 * Filter the default "Near" text value for the search form.
2444 2444
 	 *
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
 	 * @param string $near              The current near value.
2450 2450
 	 * @param string $default_near_text The default near value.
2451 2451
 	 */
2452
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2452
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2453 2453
 	/**
2454 2454
 	 * Filter the class for the near search input.
2455 2455
 	 *
@@ -2457,10 +2457,10 @@  discard block
 block discarded – undo
2457 2457
 	 *
2458 2458
 	 * @param string $class The class for the HTML near input, default is blank.
2459 2459
 	 */
2460
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2460
+	$near_class = apply_filters('geodir_search_near_class', '');
2461 2461
 
2462 2462
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2463
-	if($new_style){
2463
+	if ($new_style) {
2464 2464
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2465 2465
 
2466 2466
 		do_action('geodir_before_near_input');
@@ -2468,30 +2468,30 @@  discard block
 block discarded – undo
2468 2468
 
2469 2469
 	?>
2470 2470
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2471
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2472
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2473
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2471
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2472
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2473
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2474 2474
 	<?php
2475
-	if($new_style){
2475
+	if ($new_style) {
2476 2476
 		do_action('geodir_after_near_input');
2477 2477
 
2478 2478
 		echo "</div>";
2479 2479
 	}
2480 2480
 }
2481 2481
 
2482
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2483
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2484
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2482
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2483
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2484
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2485 2485
 
2486
-function geodir_get_search_post_type($pt=''){
2486
+function geodir_get_search_post_type($pt = '') {
2487 2487
 	global $geodir_search_post_type;
2488 2488
 
2489
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2490
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2489
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2490
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2491 2491
 
2492 2492
 	$geodir_search_post_type = geodir_get_current_posttype();
2493 2493
 
2494
-	if(!$geodir_search_post_type) {
2494
+	if (!$geodir_search_post_type) {
2495 2495
 		$geodir_search_post_type = geodir_get_default_posttype();
2496 2496
 	}
2497 2497
 
@@ -2499,7 +2499,7 @@  discard block
 block discarded – undo
2499 2499
 	return $geodir_search_post_type;
2500 2500
 }
2501 2501
 
2502
-function geodir_search_form(){
2502
+function geodir_search_form() {
2503 2503
 
2504 2504
 	geodir_get_search_post_type();
2505 2505
 
@@ -2509,8 +2509,8 @@  discard block
 block discarded – undo
2509 2509
 	die();
2510 2510
 }
2511 2511
 
2512
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2513
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2512
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2513
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2514 2514
 
2515 2515
 /**
2516 2516
  * Check wpml active or not.
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
 		}
2585 2585
 	}
2586 2586
 }
2587
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2587
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2588 2588
 
2589 2589
 /**
2590 2590
  * Duplicate post listing manually after listing saved.
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
 		foreach ($post_duplicates as $lang => $dup_post_id) {
2609 2609
 			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2610 2610
 		}
2611
-		do_action( 'geodir_wpml_listing_duplicated', $post_id, $request_info );
2611
+		do_action('geodir_wpml_listing_duplicated', $post_id, $request_info);
2612 2612
 	}
2613 2613
 }
2614 2614
 
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2628 2628
 	global $wpdb;
2629 2629
 
2630
-	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2630
+	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2631 2631
 
2632 2632
 	if (!empty($reviews)) {
2633 2633
 		foreach ($reviews as $review) {
@@ -2656,15 +2656,15 @@  discard block
 block discarded – undo
2656 2656
 	global $wpdb, $plugin_prefix;
2657 2657
 
2658 2658
 	$post_type = get_post_type($master_post_id);
2659
-	$post_table = $plugin_prefix . $post_type . '_detail';
2659
+	$post_table = $plugin_prefix.$post_type.'_detail';
2660 2660
 
2661
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2662
-	$data = (array)$wpdb->get_row($query);
2661
+	$query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2662
+	$data = (array) $wpdb->get_row($query);
2663 2663
 
2664
-	if ( !empty( $data ) ) {
2665
-		$data = apply_filters( 'geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang );
2664
+	if (!empty($data)) {
2665
+		$data = apply_filters('geodir_icl_duplicate_post_data', $data, $master_post_id, $tr_post_id, $lang);
2666 2666
 		$data['post_id'] = $tr_post_id;
2667
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2667
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2668 2668
 		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2669 2669
 		return true;
2670 2670
 	}
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
 	global $sitepress, $wpdb;
2690 2690
 	$post_type = get_post_type($master_post_id);
2691 2691
 
2692
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2692
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2693 2693
 
2694 2694
 	$taxonomies = get_object_taxonomies($post_type);
2695 2695
 	foreach ($taxonomies as $taxonomy) {
@@ -2698,9 +2698,9 @@  discard block
 block discarded – undo
2698 2698
 
2699 2699
 		if ($terms) {
2700 2700
 			foreach ($terms as $term) {
2701
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2701
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2702 2702
 
2703
-				if (!is_null($tr_id)){
2703
+				if (!is_null($tr_id)) {
2704 2704
 					// not using get_term - unfiltered get_term
2705 2705
 					$translated_term = $wpdb->get_row($wpdb->prepare("
2706 2706
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2709,14 +2709,14 @@  discard block
 block discarded – undo
2709 2709
 				}
2710 2710
 			}
2711 2711
 
2712
-			if (!is_taxonomy_hierarchical($taxonomy)){
2713
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2712
+			if (!is_taxonomy_hierarchical($taxonomy)) {
2713
+				$terms_array = array_unique(array_map('intval', $terms_array));
2714 2714
 			}
2715 2715
 
2716 2716
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2717 2717
 
2718
-			if ($taxonomy == $post_type . 'category') {
2719
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2718
+			if ($taxonomy == $post_type.'category') {
2719
+				geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2720 2720
 			}
2721 2721
 		}
2722 2722
 	}
@@ -2737,15 +2737,15 @@  discard block
 block discarded – undo
2737 2737
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2738 2738
 	global $wpdb;
2739 2739
 
2740
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2740
+	$query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2741 2741
 	$wpdb->query($query);
2742 2742
 
2743
-	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2743
+	$query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2744 2744
 	$post_images = $wpdb->get_results($query);
2745 2745
 
2746
-	if ( !empty( $post_images ) ) {
2747
-		foreach ( $post_images as $post_image) {
2748
-			$image_data = (array)$post_image;
2746
+	if (!empty($post_images)) {
2747
+		foreach ($post_images as $post_image) {
2748
+			$image_data = (array) $post_image;
2749 2749
 			unset($image_data['ID']);
2750 2750
 			$image_data['post_id'] = $tr_post_id;
2751 2751
 
@@ -2778,13 +2778,13 @@  discard block
 block discarded – undo
2778 2778
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2779 2779
 	global $wpdb, $plugin_prefix, $sitepress;
2780 2780
 
2781
-	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2781
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2782 2782
 
2783 2783
 	if (empty($review)) {
2784 2784
 		return false;
2785 2785
 	}
2786 2786
 	if ($review['post_id'] != $master_post_id) {
2787
-		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2787
+		$wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2788 2788
 		geodir_update_postrating($master_post_id, $post_type);
2789 2789
 	}
2790 2790
 
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
 	}
2796 2796
 
2797 2797
 	$post_type = get_post_type($master_post_id);
2798
-	$post_table = $plugin_prefix . $post_type . '_detail';
2798
+	$post_table = $plugin_prefix.$post_type.'_detail';
2799 2799
 
2800
-	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2800
+	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2801 2801
 	if (empty($translated_post)) {
2802 2802
 		return false;
2803 2803
 	}
@@ -2815,7 +2815,7 @@  discard block
 block discarded – undo
2815 2815
 		unset($review['id']);
2816 2816
 	}
2817 2817
 
2818
-	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2818
+	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2819 2819
 
2820 2820
 	if ($tr_review_id) { // update review
2821 2821
 		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2828,8 +2828,8 @@  discard block
 block discarded – undo
2828 2828
 		geodir_update_postrating($tr_post_id, $post_type);
2829 2829
 
2830 2830
 		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2831
-			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2832
-			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2831
+			$wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2832
+			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2833 2833
 
2834 2834
 			if (!empty($likes)) {
2835 2835
 				foreach ($likes as $like) {
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
  * @return bool True if review star disabled, otherwise false.
2932 2932
  */
2933 2933
 function geodir_rating_disabled_post_types() {
2934
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2934
+	$post_types = get_option('geodir_disable_rating_cpt');
2935 2935
 
2936 2936
 	/**
2937 2937
 	 * Filter the post types array which have rating disabled.
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
 	 *
2941 2941
 	 * @param array $post_types Array of post types which have rating starts disabled.
2942 2942
 	 */
2943
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2943
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2944 2944
 }
2945 2945
 
2946 2946
 /**
@@ -2952,30 +2952,30 @@  discard block
 block discarded – undo
2952 2952
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2953 2953
  * @return bool True if review star disabled, otherwise false.
2954 2954
  */
2955
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2955
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2956 2956
 	$post_types = geodir_rating_disabled_post_types();
2957 2957
 
2958
-	if ( empty( $post_types ) ) {
2958
+	if (empty($post_types)) {
2959 2959
 		return false;
2960 2960
 	}
2961 2961
 
2962
-	if ( is_int( $post_type ) ) {
2963
-		$post_type = get_post_type( $post_type );
2962
+	if (is_int($post_type)) {
2963
+		$post_type = get_post_type($post_type);
2964 2964
 	}
2965 2965
 
2966
-	if ( $taxonomy && !empty( $post_types ) ) {
2966
+	if ($taxonomy && !empty($post_types)) {
2967 2967
 		$posttypes = array();
2968 2968
 
2969
-		foreach ( $post_types as $posttype ) {
2970
-			$posttypes[] = $posttype . 'category';
2971
-			$posttypes[] = $posttype . '_tags';
2969
+		foreach ($post_types as $posttype) {
2970
+			$posttypes[] = $posttype.'category';
2971
+			$posttypes[] = $posttype.'_tags';
2972 2972
 		}
2973 2973
 
2974 2974
 		$post_types = $posttypes;
2975 2975
 	}
2976 2976
 
2977 2977
 	$return = false;
2978
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2978
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2979 2979
 		$return = true;
2980 2980
 	}
2981 2981
 
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
  * @return bool True if Yoast SEO disabled on GD pages.
2991 2991
  */
2992 2992
 function geodir_disable_yoast_seo_metas() {
2993
-	return (bool)get_option( 'geodir_disable_yoast_meta' );
2993
+	return (bool) get_option('geodir_disable_yoast_meta');
2994 2994
 }
2995 2995
 
2996 2996
 /**
@@ -3001,30 +3001,30 @@  discard block
 block discarded – undo
3001 3001
  * @param int $post_id The post ID.
3002 3002
  * @return bool True if allowed.
3003 3003
  */
3004
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
3004
+function geodir_wpml_allowed_to_duplicate($post_id) {
3005 3005
 	$allowed = false;
3006 3006
 
3007
-	if ( !geodir_is_wpml() || empty( $post_id ) ) {
3007
+	if (!geodir_is_wpml() || empty($post_id)) {
3008 3008
 		return $allowed;
3009 3009
 	}
3010 3010
 
3011
-	$user_id = (int)get_current_user_id();
3011
+	$user_id = (int) get_current_user_id();
3012 3012
 
3013
-	if ( empty( $user_id ) ) {
3013
+	if (empty($user_id)) {
3014 3014
 		return $allowed;
3015 3015
 	}
3016 3016
 
3017
-	$post_type = get_post_type( $post_id );
3018
-	if ( !geodir_wpml_is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
3017
+	$post_type = get_post_type($post_id);
3018
+	if (!geodir_wpml_is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
3019 3019
 		return $allowed;
3020 3020
 	}
3021 3021
 
3022
-	if ( geodir_listing_belong_to_current_user( $post_id ) ) {
3022
+	if (geodir_listing_belong_to_current_user($post_id)) {
3023 3023
 		$allowed = true;
3024 3024
 	}
3025 3025
 
3026
-	$disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
3027
-	if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
3026
+	$disable_cpts = get_option('geodir_wpml_disable_duplicate');
3027
+	if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
3028 3028
 		$allowed = false;
3029 3029
 	}
3030 3030
 
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
 	 * @param bool $allowed True if allowed.
3035 3035
 	 * @param int $post_id The post ID.
3036 3036
 	 */
3037
-	return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3037
+	return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3038 3038
 }
3039 3039
 
3040 3040
 /**
@@ -3049,61 +3049,61 @@  discard block
 block discarded – undo
3049 3049
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3050 3050
  * @return string Filtered html of the geodir_edit_post_link() function.
3051 3051
  */
3052
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3052
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3053 3053
 	global $post, $preview, $sitepress;
3054 3054
 
3055
-	if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3055
+	if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3056 3056
 		$post_id = $post->ID;
3057
-		$element_type = 'post_' . get_post_type( $post_id );
3058
-		$original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3057
+		$element_type = 'post_'.get_post_type($post_id);
3058
+		$original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3059 3059
 
3060
-		if ( $original_post_id == $post_id ) {
3060
+		if ($original_post_id == $post_id) {
3061 3061
 			$wpml_languages = $sitepress->get_active_languages();
3062
-			$post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3062
+			$post_language = $sitepress->get_language_for_element($post_id, $element_type);
3063 3063
 
3064
-			if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3065
-				unset( $wpml_languages[ $post_language ] );
3064
+			if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3065
+				unset($wpml_languages[$post_language]);
3066 3066
 			}
3067 3067
 
3068
-			if ( !empty( $wpml_languages ) ) {
3069
-				$trid  = $sitepress->get_element_trid( $post_id, $element_type );
3070
-				$element_translations = $sitepress->get_element_translations( $trid, $element_type );
3071
-				$duplicates = $sitepress->get_duplicates( $post_id );
3068
+			if (!empty($wpml_languages)) {
3069
+				$trid = $sitepress->get_element_trid($post_id, $element_type);
3070
+				$element_translations = $sitepress->get_element_translations($trid, $element_type);
3071
+				$duplicates = $sitepress->get_duplicates($post_id);
3072 3072
 
3073
-				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3073
+				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3074 3074
 				$wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3075
-				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3075
+				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>';
3076 3076
 
3077 3077
 				$needs_translation = false;
3078 3078
 
3079
-				foreach ( $wpml_languages as $lang_code => $lang ) {
3079
+				foreach ($wpml_languages as $lang_code => $lang) {
3080 3080
 					$duplicates_text = '';
3081 3081
 					$translated = false;
3082 3082
 
3083
-					if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3083
+					if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3084 3084
 						$translated = true;
3085 3085
 
3086
-						if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3087
-							$duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3086
+						if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3087
+							$duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3088 3088
 						}
3089 3089
 					} else {
3090 3090
 						$needs_translation = true;
3091 3091
 					}
3092 3092
 
3093
-					$wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3093
+					$wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3094 3094
 
3095
-					if ( $translated ) {
3095
+					if ($translated) {
3096 3096
 						$wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3097 3097
 					} else {
3098
-						$wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3098
+						$wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3099 3099
 					}
3100 3100
 
3101 3101
 					$wpml_content .= '</td></tr>';
3102 3102
 				}
3103 3103
 
3104
-				if ( $needs_translation ) {
3105
-					$nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3106
-					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3104
+				if ($needs_translation) {
3105
+					$nonce = wp_create_nonce('geodir_duplicate_nonce');
3106
+					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>';
3107 3107
 				}
3108 3108
 
3109 3109
 				$wpml_content .= '</tbody></table>';
@@ -3125,12 +3125,12 @@  discard block
 block discarded – undo
3125 3125
  * @param array $settings GD design settings array.
3126 3126
  * @return array Filtered GD design settings array..
3127 3127
  */
3128
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3128
+function geodir_wpml_duplicate_settings($settings = array()) {
3129 3129
 	$new_settings = array();
3130 3130
 
3131
-	foreach ( $settings as $key => $setting ) {
3131
+	foreach ($settings as $key => $setting) {
3132 3132
 
3133
-		if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3133
+		if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3134 3134
 			$new_settings[] = array(
3135 3135
 				'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3136 3136
 				'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
@@ -3158,12 +3158,12 @@  discard block
 block discarded – undo
3158 3158
  * @param string $taxonomy name/slug of a taxonomy.
3159 3159
  * @return bool true if the taxonomy is currently set to being translatable in WPML.
3160 3160
  */
3161
-function geodir_wpml_is_taxonomy_translated( $taxonomy ) {
3162
-	if ( empty( $taxonomy ) || !geodir_is_wpml() || !function_exists( 'is_taxonomy_translated' ) ) {
3161
+function geodir_wpml_is_taxonomy_translated($taxonomy) {
3162
+	if (empty($taxonomy) || !geodir_is_wpml() || !function_exists('is_taxonomy_translated')) {
3163 3163
 		return false;
3164 3164
 	}
3165 3165
 
3166
-	if ( is_taxonomy_translated( $taxonomy ) ) {
3166
+	if (is_taxonomy_translated($taxonomy)) {
3167 3167
 		return true;
3168 3168
 	}
3169 3169
 
@@ -3178,12 +3178,12 @@  discard block
 block discarded – undo
3178 3178
  * @param string $post_type name/slug of a post_type.
3179 3179
  * @return bool true if the post_type is currently set to being translatable in WPML.
3180 3180
  */
3181
-function geodir_wpml_is_post_type_translated( $post_type ) {
3182
-	if ( empty( $post_type ) || !geodir_is_wpml() || !function_exists( 'is_post_type_translated' ) ) {
3181
+function geodir_wpml_is_post_type_translated($post_type) {
3182
+	if (empty($post_type) || !geodir_is_wpml() || !function_exists('is_post_type_translated')) {
3183 3183
 		return false;
3184 3184
 	}
3185 3185
 
3186
-	if ( is_post_type_translated( $post_type ) ) {
3186
+	if (is_post_type_translated($post_type)) {
3187 3187
 		return true;
3188 3188
 	}
3189 3189
 
@@ -3205,12 +3205,12 @@  discard block
 block discarded – undo
3205 3205
  *
3206 3206
  * @return int|NULL
3207 3207
  */
3208
-function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
3209
-	if ( geodir_is_wpml() ) {
3210
-		if ( function_exists( 'wpml_object_id_filter' ) ) {
3211
-			return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3208
+function geodir_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null) {
3209
+	if (geodir_is_wpml()) {
3210
+		if (function_exists('wpml_object_id_filter')) {
3211
+			return apply_filters('wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3212 3212
 		} else {
3213
-			return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
3213
+			return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
3214 3214
 		}
3215 3215
 	}
3216 3216
 
Please login to merge, or discard this patch.