Passed
Push — master ( a83c7a...7f8179 )
by Stiofan
10:42
created
geodirectory-functions/custom_fields_functions.php 1 patch
Indentation   +2868 added lines, -2868 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@  discard block
 block discarded – undo
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-    /**
14
-     * Check table column exist or not.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     * @global object $wpdb WordPress Database object.
19
-     * @param string $db The table name.
20
-     * @param string $column The column name.
21
-     * @return bool If column exists returns true. Otherwise false.
22
-     */
23
-    function geodir_column_exist($db, $column)
24
-    {
25
-        global $wpdb;
26
-        $exists = false;
27
-        $columns = $wpdb->get_col("show columns from $db");
28
-        foreach ($columns as $c) {
29
-            if ($c == $column) {
30
-                $exists = true;
31
-                break;
32
-            }
33
-        }
34
-        return $exists;
35
-    }
13
+	/**
14
+	 * Check table column exist or not.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 * @global object $wpdb WordPress Database object.
19
+	 * @param string $db The table name.
20
+	 * @param string $column The column name.
21
+	 * @return bool If column exists returns true. Otherwise false.
22
+	 */
23
+	function geodir_column_exist($db, $column)
24
+	{
25
+		global $wpdb;
26
+		$exists = false;
27
+		$columns = $wpdb->get_col("show columns from $db");
28
+		foreach ($columns as $c) {
29
+			if ($c == $column) {
30
+				$exists = true;
31
+				break;
32
+			}
33
+		}
34
+		return $exists;
35
+	}
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-    /**
40
-     * Add column if table column not exist.
41
-     *
42
-     * @since 1.0.0
43
-     * @package GeoDirectory
44
-     * @global object $wpdb WordPress Database object.
45
-     * @param string $db The table name.
46
-     * @param string $column The column name.
47
-     * @param string $column_attr The column attributes.
48
-     */
49
-    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
-    {
51
-        global $wpdb;
52
-        $result = 0;// no rows affected
53
-        if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
-        }
57
-        return $result;
58
-    }
39
+	/**
40
+	 * Add column if table column not exist.
41
+	 *
42
+	 * @since 1.0.0
43
+	 * @package GeoDirectory
44
+	 * @global object $wpdb WordPress Database object.
45
+	 * @param string $db The table name.
46
+	 * @param string $column The column name.
47
+	 * @param string $column_attr The column attributes.
48
+	 */
49
+	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50
+	{
51
+		global $wpdb;
52
+		$result = 0;// no rows affected
53
+		if (!geodir_column_exist($db, $column)) {
54
+			if (!empty($db) && !empty($column))
55
+				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+		}
57
+		return $result;
58
+	}
59 59
 }
60 60
 
61 61
 /**
@@ -72,702 +72,702 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')
74 74
 {
75
-    global $wpdb, $geodir_post_custom_fields_cache;
76
-
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
-
79
-    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
-        return $geodir_post_custom_fields_cache[$cache_stored];
81
-    }
82
-
83
-    $default_query = '';
84
-
85
-    if ($default == 'default')
86
-        $default_query = " and is_default IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query = " and is_default = '0' ";
89
-
90
-    if ($fields_location == 'detail') {
91
-        $default_query = " and show_on_detail='1' ";
92
-    } elseif ($fields_location == 'listing') {
93
-        $default_query = " and show_on_listing='1' ";
94
-    }
95
-
96
-    $post_meta_info = $wpdb->get_results(
97
-        $wpdb->prepare(
98
-            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
-            array($post_type)
100
-        )
101
-    );
102
-
103
-
104
-    $return_arr = array();
105
-    if ($post_meta_info) {
106
-
107
-        foreach ($post_meta_info as $post_meta_info_obj) {
108
-
109
-            $custom_fields = array(
110
-                "name" => $post_meta_info_obj->htmlvar_name,
111
-                "label" => $post_meta_info_obj->clabels,
112
-                "default" => $post_meta_info_obj->default_value,
113
-                "type" => $post_meta_info_obj->field_type,
114
-                "desc" => $post_meta_info_obj->admin_desc);
115
-
116
-            if ($post_meta_info_obj->field_type) {
117
-                $options = explode(',', $post_meta_info_obj->option_values);
118
-                $custom_fields["options"] = $options;
119
-            }
120
-
121
-            foreach ($post_meta_info_obj as $key => $val) {
122
-                $custom_fields[$key] = $val;
123
-            }
124
-
125
-            $pricearr = array();
126
-            $pricearr = explode(',', $post_meta_info_obj->packages);
127
-
128
-            if ($package_id != '' && in_array($package_id, $pricearr)) {
129
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
-            } elseif ($package_id == '') {
131
-                $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
-            }
133
-        }
134
-    }
135
-    $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
-
137
-    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
-        /**
139
-         * Filter the post custom fields array.
140
-         *
141
-         * @since 1.0.0
142
-         *
143
-         * @param array $return_arr Post custom fields array.
144
-         * @param int|string $package_id The package ID.
145
-         * @param string $post_type Optional. The wordpress post type.
146
-         * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
-         */
148
-        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
-    }
150
-
151
-    return $return_arr;
75
+	global $wpdb, $geodir_post_custom_fields_cache;
76
+
77
+	$cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
78
+
79
+	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80
+		return $geodir_post_custom_fields_cache[$cache_stored];
81
+	}
82
+
83
+	$default_query = '';
84
+
85
+	if ($default == 'default')
86
+		$default_query = " and is_default IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query = " and is_default = '0' ";
89
+
90
+	if ($fields_location == 'detail') {
91
+		$default_query = " and show_on_detail='1' ";
92
+	} elseif ($fields_location == 'listing') {
93
+		$default_query = " and show_on_listing='1' ";
94
+	}
95
+
96
+	$post_meta_info = $wpdb->get_results(
97
+		$wpdb->prepare(
98
+			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
99
+			array($post_type)
100
+		)
101
+	);
102
+
103
+
104
+	$return_arr = array();
105
+	if ($post_meta_info) {
106
+
107
+		foreach ($post_meta_info as $post_meta_info_obj) {
108
+
109
+			$custom_fields = array(
110
+				"name" => $post_meta_info_obj->htmlvar_name,
111
+				"label" => $post_meta_info_obj->clabels,
112
+				"default" => $post_meta_info_obj->default_value,
113
+				"type" => $post_meta_info_obj->field_type,
114
+				"desc" => $post_meta_info_obj->admin_desc);
115
+
116
+			if ($post_meta_info_obj->field_type) {
117
+				$options = explode(',', $post_meta_info_obj->option_values);
118
+				$custom_fields["options"] = $options;
119
+			}
120
+
121
+			foreach ($post_meta_info_obj as $key => $val) {
122
+				$custom_fields[$key] = $val;
123
+			}
124
+
125
+			$pricearr = array();
126
+			$pricearr = explode(',', $post_meta_info_obj->packages);
127
+
128
+			if ($package_id != '' && in_array($package_id, $pricearr)) {
129
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
130
+			} elseif ($package_id == '') {
131
+				$return_arr[$post_meta_info_obj->sort_order] = $custom_fields;
132
+			}
133
+		}
134
+	}
135
+	$geodir_post_custom_fields_cache[$cache_stored] = $return_arr;
136
+
137
+	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
138
+		/**
139
+		 * Filter the post custom fields array.
140
+		 *
141
+		 * @since 1.0.0
142
+		 *
143
+		 * @param array $return_arr Post custom fields array.
144
+		 * @param int|string $package_id The package ID.
145
+		 * @param string $post_type Optional. The wordpress post type.
146
+		 * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.
147
+		 */
148
+		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
149
+	}
150
+
151
+	return $return_arr;
152 152
 }
153 153
 
154 154
 if (!function_exists('geodir_custom_field_adminhtml')) {
155
-    /**
156
-     * Adds admin html for custom fields.
157
-     *
158
-     * @since 1.0.0
159
-     * @package GeoDirectory
160
-     * @global object $wpdb WordPress Database object.
161
-     * @param string $field_type The form field type.
162
-     * @param object|int $result_str The custom field results object or row id.
163
-     * @param string $field_ins_upd When set to "submit" displays form.
164
-     * @param bool $default when set to true field will be for admin use only.
165
-     */
166
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
167
-    {
168
-        global $wpdb;
169
-        $cf = $result_str;
170
-        if (!is_object($cf)) {
171
-
172
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
173
-
174
-        } else {
175
-            $field_info = $cf;
176
-            $result_str = $cf->id;
177
-        }
178
-        /**
179
-         * Contains custom field html.
180
-         *
181
-         * @since 1.0.0
182
-         */
183
-        include('custom_field_html.php');
184
-
185
-    }
155
+	/**
156
+	 * Adds admin html for custom fields.
157
+	 *
158
+	 * @since 1.0.0
159
+	 * @package GeoDirectory
160
+	 * @global object $wpdb WordPress Database object.
161
+	 * @param string $field_type The form field type.
162
+	 * @param object|int $result_str The custom field results object or row id.
163
+	 * @param string $field_ins_upd When set to "submit" displays form.
164
+	 * @param bool $default when set to true field will be for admin use only.
165
+	 */
166
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
167
+	{
168
+		global $wpdb;
169
+		$cf = $result_str;
170
+		if (!is_object($cf)) {
171
+
172
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
173
+
174
+		} else {
175
+			$field_info = $cf;
176
+			$result_str = $cf->id;
177
+		}
178
+		/**
179
+		 * Contains custom field html.
180
+		 *
181
+		 * @since 1.0.0
182
+		 */
183
+		include('custom_field_html.php');
184
+
185
+	}
186 186
 }
187 187
 
188 188
 if (!function_exists('geodir_custom_field_delete')) {
189
-    /**
190
-     * Delete custom field using field id.
191
-     *
192
-     * @since 1.0.0
193
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
-     * @package GeoDirectory
195
-     * @global object $wpdb WordPress Database object.
196
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
197
-     * @param string $field_id The custom field ID.
198
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
-     */
200
-    function geodir_custom_field_delete($field_id = '') {
201
-        global $wpdb, $plugin_prefix;
202
-
203
-        if ($field_id != '') {
204
-            $cf = trim($field_id, '_');
205
-
206
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
208
-
209
-                $post_type = $field->post_type;
210
-                $htmlvar_name = $field->htmlvar_name;
211
-
212
-                if ($post_type != '' && $htmlvar_name != '') {
213
-                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
-                }
215
-
216
-                /**
217
-                 * Called after a custom field is deleted.
218
-                 *
219
-                 * @since 1.0.0
220
-                 * @param string $cf The fields ID.
221
-                 * @param string $field->htmlvar_name The html variable name for the field.
222
-                 * @param string $post_type The post type the field belongs to.
223
-                 */
224
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
225
-
226
-                if ($field->field_type == 'address') {
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
235
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
236
-                } else {
237
-                    if ($field->field_type != 'fieldset') {
238
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
239
-                    }
240
-                }
241
-
242
-                return $field_id;
243
-            } else
244
-                return 0;
245
-        } else
246
-            return 0;
247
-    }
189
+	/**
190
+	 * Delete custom field using field id.
191
+	 *
192
+	 * @since 1.0.0
193
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
+	 * @package GeoDirectory
195
+	 * @global object $wpdb WordPress Database object.
196
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
197
+	 * @param string $field_id The custom field ID.
198
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
+	 */
200
+	function geodir_custom_field_delete($field_id = '') {
201
+		global $wpdb, $plugin_prefix;
202
+
203
+		if ($field_id != '') {
204
+			$cf = trim($field_id, '_');
205
+
206
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
208
+
209
+				$post_type = $field->post_type;
210
+				$htmlvar_name = $field->htmlvar_name;
211
+
212
+				if ($post_type != '' && $htmlvar_name != '') {
213
+					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
+				}
215
+
216
+				/**
217
+				 * Called after a custom field is deleted.
218
+				 *
219
+				 * @since 1.0.0
220
+				 * @param string $cf The fields ID.
221
+				 * @param string $field->htmlvar_name The html variable name for the field.
222
+				 * @param string $post_type The post type the field belongs to.
223
+				 */
224
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
225
+
226
+				if ($field->field_type == 'address') {
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
235
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
236
+				} else {
237
+					if ($field->field_type != 'fieldset') {
238
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
239
+					}
240
+				}
241
+
242
+				return $field_id;
243
+			} else
244
+				return 0;
245
+		} else
246
+			return 0;
247
+	}
248 248
 }
249 249
 
250 250
 if (!function_exists('geodir_custom_field_save')) {
251
-    /**
252
-     * Save or Update custom fields into the database.
253
-     *
254
-     * @since 1.0.0
255
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
-     * @package GeoDirectory
257
-     * @global object $wpdb WordPress Database object.
258
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
259
-     * @param array $request_field {
260
-     *    Attributes of the request field array.
261
-     *
262
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
263
-     *    @type string $manage_field_type Field type Default "custom_fields".
264
-     *    @type string $create_field Create field Default "true".
265
-     *    @type string $field_ins_upd Field ins upd Default "submit".
266
-     *    @type string $_wpnonce WP nonce value.
267
-     *    @type string $listing_type Listing type Example "gd_place".
268
-     *    @type string $field_type Field type Example "radio".
269
-     *    @type string $field_id Field id Example "12".
270
-     *    @type string $data_type Data type Example "VARCHAR".
271
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
272
-     *    @type array $show_on_pkg Package list to display this field.
273
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
274
-     *    @type string $site_title Section title which you wish to display in frontend.
275
-     *    @type string $admin_desc Section description which will appear in frontend.
276
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
277
-     *    @type string $clabels Section Title which will appear in backend.
278
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
279
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
280
-     *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
281
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
282
-     *    @type string $is_required Use "1" to set field as required.
283
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
284
-     *    @type string $show_on_listing Want to show this on listing page?.
285
-     *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
-     *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
-     *    @type string $option_values Option Values should be separated by comma.
288
-     *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
-     *    @type string $css_class Enter custom css class for field custom style.
290
-     *
291
-     * }
292
-     * @param bool $default Not yet implemented.
293
-     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-     */
295
-    function geodir_custom_field_save($request_field = array(), $default = false)
296
-    {
297
-
298
-        global $wpdb, $plugin_prefix;
299
-
300
-        $old_html_variable = '';
301
-
302
-        $data_type = trim($request_field['data_type']);
303
-
304
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
-
306
-        // some servers fail if a POST value is VARCHAR so we change it.
307
-        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
-            $request_field['data_type'] = 'VARCHAR';
309
-        }
310
-
311
-        $cf = trim($result_str, '_');
312
-
313
-
314
-        /*-------- check dublicate validation --------*/
315
-
316
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
-        $post_type = $request_field['listing_type'];
318
-
319
-        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
-        }
322
-
323
-        $check_html_variable = $wpdb->get_var(
324
-            $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
-                array($cf, $cehhtmlvar_name, $post_type)
327
-            )
328
-        );
329
-
330
-
331
-        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
-
333
-            if ($cf != '') {
334
-
335
-                $post_meta_info = $wpdb->get_row(
336
-                    $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
-                        array($cf)
339
-                    )
340
-                );
341
-
342
-            }
343
-
344
-            if (!empty($post_meta_info)) {
345
-                $post_val = $post_meta_info;
346
-                $old_html_variable = $post_val->htmlvar_name;
347
-
348
-            }
349
-
350
-
351
-
352
-            if ($post_type == '') $post_type = 'gd_place';
251
+	/**
252
+	 * Save or Update custom fields into the database.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
+	 * @package GeoDirectory
257
+	 * @global object $wpdb WordPress Database object.
258
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
259
+	 * @param array $request_field {
260
+	 *    Attributes of the request field array.
261
+	 *
262
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
263
+	 *    @type string $manage_field_type Field type Default "custom_fields".
264
+	 *    @type string $create_field Create field Default "true".
265
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
266
+	 *    @type string $_wpnonce WP nonce value.
267
+	 *    @type string $listing_type Listing type Example "gd_place".
268
+	 *    @type string $field_type Field type Example "radio".
269
+	 *    @type string $field_id Field id Example "12".
270
+	 *    @type string $data_type Data type Example "VARCHAR".
271
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
272
+	 *    @type array $show_on_pkg Package list to display this field.
273
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
274
+	 *    @type string $site_title Section title which you wish to display in frontend.
275
+	 *    @type string $admin_desc Section description which will appear in frontend.
276
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
277
+	 *    @type string $clabels Section Title which will appear in backend.
278
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
279
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
280
+	 *    @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.
281
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
282
+	 *    @type string $is_required Use "1" to set field as required.
283
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
284
+	 *    @type string $show_on_listing Want to show this on listing page?.
285
+	 *    @type string $show_on_detail Want to show this in More Info tab on detail page?.
286
+	 *    @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.
287
+	 *    @type string $option_values Option Values should be separated by comma.
288
+	 *    @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.
289
+	 *    @type string $css_class Enter custom css class for field custom style.
290
+	 *
291
+	 * }
292
+	 * @param bool $default Not yet implemented.
293
+	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+	 */
295
+	function geodir_custom_field_save($request_field = array(), $default = false)
296
+	{
297
+
298
+		global $wpdb, $plugin_prefix;
299
+
300
+		$old_html_variable = '';
301
+
302
+		$data_type = trim($request_field['data_type']);
303
+
304
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305
+
306
+		// some servers fail if a POST value is VARCHAR so we change it.
307
+		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
308
+			$request_field['data_type'] = 'VARCHAR';
309
+		}
310
+
311
+		$cf = trim($result_str, '_');
312
+
313
+
314
+		/*-------- check dublicate validation --------*/
315
+
316
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
317
+		$post_type = $request_field['listing_type'];
318
+
319
+		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
+			$cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
321
+		}
322
+
323
+		$check_html_variable = $wpdb->get_var(
324
+			$wpdb->prepare(
325
+				"select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
326
+				array($cf, $cehhtmlvar_name, $post_type)
327
+			)
328
+		);
329
+
330
+
331
+		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
332
+
333
+			if ($cf != '') {
334
+
335
+				$post_meta_info = $wpdb->get_row(
336
+					$wpdb->prepare(
337
+						"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
338
+						array($cf)
339
+					)
340
+				);
341
+
342
+			}
343
+
344
+			if (!empty($post_meta_info)) {
345
+				$post_val = $post_meta_info;
346
+				$old_html_variable = $post_val->htmlvar_name;
347
+
348
+			}
349
+
350
+
351
+
352
+			if ($post_type == '') $post_type = 'gd_place';
353 353
 
354 354
 
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
355
+			$detail_table = $plugin_prefix . $post_type . '_detail';
356 356
 
357
-            $admin_title = $request_field['admin_title'];
358
-            $site_title = $request_field['site_title'];
359
-            $data_type = $request_field['data_type'];
360
-            $field_type = $request_field['field_type'];
361
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
362
-            $admin_desc = $request_field['admin_desc'];
363
-            $clabels = $request_field['clabels'];
364
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
365
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
366
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
367
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
368
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
369
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
370
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
371
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
372
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
373
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
374
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
375
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
376
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
377
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
378
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
357
+			$admin_title = $request_field['admin_title'];
358
+			$site_title = $request_field['site_title'];
359
+			$data_type = $request_field['data_type'];
360
+			$field_type = $request_field['field_type'];
361
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
362
+			$admin_desc = $request_field['admin_desc'];
363
+			$clabels = $request_field['clabels'];
364
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
365
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
366
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
367
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
368
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
369
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
370
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
371
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
372
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
373
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
374
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
375
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
376
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
377
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
378
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
379 379
 
380
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
381
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
382
-            }
380
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
381
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
382
+			}
383 383
 
384
-            $option_values = '';
385
-            if (isset($request_field['option_values']))
386
-                $option_values = $request_field['option_values'];
384
+			$option_values = '';
385
+			if (isset($request_field['option_values']))
386
+				$option_values = $request_field['option_values'];
387 387
 
388
-            $cat_sort = '';
389
-            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))
390
-                $cat_sort = implode(",", $request_field['cat_sort']);
388
+			$cat_sort = '';
389
+			if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))
390
+				$cat_sort = implode(",", $request_field['cat_sort']);
391 391
 
392
-            $cat_filter = '';
393
-            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))
394
-                $cat_filter = implode(",", $request_field['cat_filter']);
392
+			$cat_filter = '';
393
+			if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))
394
+				$cat_filter = implode(",", $request_field['cat_filter']);
395 395
 
396
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
397
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
398
-            else {
399
-                $package_info = array();
396
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
397
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
398
+			else {
399
+				$package_info = array();
400 400
 
401
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
402
-                $price_pkg = $package_info->pid;
403
-            }
401
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
402
+				$price_pkg = $package_info->pid;
403
+			}
404 404
 
405 405
 
406
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
407
-                $extra_fields = $request_field['extra'];
406
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
407
+				$extra_fields = $request_field['extra'];
408 408
 
409
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
410
-                $is_default = $request_field['is_default'];
411
-            else
412
-                $is_default = '0';
409
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
410
+				$is_default = $request_field['is_default'];
411
+			else
412
+				$is_default = '0';
413 413
 
414
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
415
-                $is_admin = $request_field['is_admin'];
416
-            else
417
-                $is_admin = '0';
414
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
415
+				$is_admin = $request_field['is_admin'];
416
+			else
417
+				$is_admin = '0';
418 418
 
419 419
 
420
-            if ($is_active == '') $is_active = 1;
421
-            if ($is_required == '') $is_required = 0;
420
+			if ($is_active == '') $is_active = 1;
421
+			if ($is_required == '') $is_required = 0;
422 422
 
423 423
 
424
-            if ($sort_order == '') {
424
+			if ($sort_order == '') {
425 425
 
426
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
426
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
427 427
 
428
-                $sort_order = (int)$last_order + 1;
429
-            }
428
+				$sort_order = (int)$last_order + 1;
429
+			}
430 430
 
431
-            $default_value_add = '';
431
+			$default_value_add = '';
432 432
 
433 433
 
434
-            if (!empty($post_meta_info)) {
435
-                switch ($field_type):
434
+			if (!empty($post_meta_info)) {
435
+				switch ($field_type):
436 436
 
437
-                    case 'address':
437
+					case 'address':
438 438
 
439
-                        if ($htmlvar_name != '') {
440
-                            $prefix = $htmlvar_name . '_';
441
-                        }
442
-                        $old_prefix = $old_html_variable . '_';
439
+						if ($htmlvar_name != '') {
440
+							$prefix = $htmlvar_name . '_';
441
+						}
442
+						$old_prefix = $old_html_variable . '_';
443 443
 
444 444
 
445
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
445
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
446 446
 
447
-                        if ($default_value != '') {
448
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
449
-                        }
447
+						if ($default_value != '') {
448
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
449
+						}
450 450
 
451
-                        $wpdb->query($meta_field_add);
451
+						$wpdb->query($meta_field_add);
452 452
 
453
-                        if ($extra_fields != '') {
453
+						if ($extra_fields != '') {
454 454
 
455
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
455
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
456 456
 
457
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
458
-                                if ($is_column) {
459
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
457
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
458
+								if ($is_column) {
459
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
460 460
 
461
-                                    if ($default_value != '') {
462
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
463
-                                    }
461
+									if ($default_value != '') {
462
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
463
+									}
464 464
 
465
-                                    $wpdb->query($meta_field_add);
466
-                                } else {
465
+									$wpdb->query($meta_field_add);
466
+								} else {
467 467
 
468
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
469
-                                    if ($default_value != '') {
470
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
471
-                                    }
472
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
468
+									$meta_field_add = "VARCHAR( 50 ) NULL";
469
+									if ($default_value != '') {
470
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
471
+									}
472
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
473 473
 
474
-                                }
474
+								}
475 475
 
476 476
 
477
-                            }
477
+							}
478 478
 
479 479
 
480
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
480
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
481 481
 
482
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
482
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
483 483
 
484
-                                if ($is_column) {
485
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
484
+								if ($is_column) {
485
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
486 486
 
487
-                                    if ($default_value != '') {
488
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
489
-                                    }
487
+									if ($default_value != '') {
488
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
489
+									}
490 490
 
491
-                                    $wpdb->query($meta_field_add);
492
-                                } else {
493
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
494
-                                    if ($default_value != '') {
495
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
496
-                                    }
491
+									$wpdb->query($meta_field_add);
492
+								} else {
493
+									$meta_field_add = "VARCHAR( 50 ) NULL";
494
+									if ($default_value != '') {
495
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
496
+									}
497 497
 
498
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
499
-                                }
498
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
499
+								}
500 500
 
501
-                            }
502
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
501
+							}
502
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
503 503
 
504
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
504
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
505 505
 
506
-                                if ($is_column) {
506
+								if ($is_column) {
507 507
 
508
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
508
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
509 509
 
510
-                                    if ($default_value != '') {
511
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
512
-                                    }
510
+									if ($default_value != '') {
511
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
512
+									}
513 513
 
514
-                                    $wpdb->query($meta_field_add);
515
-                                } else {
514
+									$wpdb->query($meta_field_add);
515
+								} else {
516 516
 
517
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
518
-                                    if ($default_value != '') {
519
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
520
-                                    }
517
+									$meta_field_add = "VARCHAR( 50 ) NULL";
518
+									if ($default_value != '') {
519
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
520
+									}
521 521
 
522
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
522
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
523 523
 
524
-                                }
524
+								}
525 525
 
526
-                            }
527
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
526
+							}
527
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
528 528
 
529
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
529
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
530 530
 
531
-                                if ($is_column) {
531
+								if ($is_column) {
532 532
 
533
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
533
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
534 534
 
535
-                                    if ($default_value != '') {
536
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
537
-                                    }
535
+									if ($default_value != '') {
536
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
537
+									}
538 538
 
539
-                                    $wpdb->query($meta_field_add);
540
-                                } else {
539
+									$wpdb->query($meta_field_add);
540
+								} else {
541 541
 
542
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
543
-                                    if ($default_value != '') {
544
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
545
-                                    }
542
+									$meta_field_add = "VARCHAR( 50 ) NULL";
543
+									if ($default_value != '') {
544
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
545
+									}
546 546
 
547
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
547
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
548 548
 
549
-                                }
549
+								}
550 550
 
551
-                            }
552
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
551
+							}
552
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
553 553
 
554
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
555
-                                if ($is_column) {
554
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
555
+								if ($is_column) {
556 556
 
557
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
557
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
558 558
 
559
-                                    if ($default_value != '') {
560
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
561
-                                    }
559
+									if ($default_value != '') {
560
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
561
+									}
562 562
 
563
-                                    $wpdb->query($meta_field_add);
564
-                                } else {
563
+									$wpdb->query($meta_field_add);
564
+								} else {
565 565
 
566
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
567
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
568
-                                    if ($default_value != '') {
569
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
570
-                                    }
566
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
567
+									$meta_field_add = "VARCHAR( 20 ) NULL";
568
+									if ($default_value != '') {
569
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
570
+									}
571 571
 
572
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
572
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
573 573
 
574
-                                }
574
+								}
575 575
 
576 576
 
577
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
577
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
578 578
 
579
-                                if ($is_column) {
580
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
579
+								if ($is_column) {
580
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
581 581
 
582
-                                    if ($default_value != '') {
583
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
584
-                                    }
582
+									if ($default_value != '') {
583
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
584
+									}
585 585
 
586
-                                    $wpdb->query($meta_field_add);
587
-                                } else {
586
+									$wpdb->query($meta_field_add);
587
+								} else {
588 588
 
589
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
590
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
591
-                                    if ($default_value != '') {
592
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
593
-                                    }
589
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
590
+									$meta_field_add = "VARCHAR( 20 ) NULL";
591
+									if ($default_value != '') {
592
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
593
+									}
594 594
 
595
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
596
-                                }
595
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
596
+								}
597 597
 
598
-                            }
599
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
598
+							}
599
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
600 600
 
601
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
601
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
602 602
 
603
-                                if ($is_column) {
604
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
603
+								if ($is_column) {
604
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
605 605
 
606
-                                    if ($default_value != '') {
607
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
608
-                                    }
606
+									if ($default_value != '') {
607
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
608
+									}
609 609
 
610
-                                    $wpdb->query($meta_field_add);
611
-                                } else {
610
+									$wpdb->query($meta_field_add);
611
+								} else {
612 612
 
613
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
613
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
614 614
 
615
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
616
-                                    if ($default_value != '') {
617
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
618
-                                    }
615
+									$meta_field_add = "VARCHAR( 15 ) NULL";
616
+									if ($default_value != '') {
617
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
618
+									}
619 619
 
620
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
621
-                                }
620
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
621
+								}
622 622
 
623 623
 
624
-                            }
625
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
624
+							}
625
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
626 626
 
627
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
628
-                                if ($is_column) {
629
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
627
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
628
+								if ($is_column) {
629
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
630 630
 
631
-                                    if ($default_value != '') {
632
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
633
-                                    }
631
+									if ($default_value != '') {
632
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
633
+									}
634 634
 
635
-                                    $wpdb->query($meta_field_add);
635
+									$wpdb->query($meta_field_add);
636 636
 
637
-                                } else {
637
+								} else {
638 638
 
639
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
639
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
640 640
 
641
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
642
-                                    if ($default_value != '') {
643
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
644
-                                    }
641
+									$meta_field_add = "VARCHAR( 3 ) NULL";
642
+									if ($default_value != '') {
643
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
644
+									}
645 645
 
646
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
647
-                                }
646
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
647
+								}
648 648
 
649
-                            }
650
-                            // show lat lng
651
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
652
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
649
+							}
650
+							// show lat lng
651
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
652
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
653 653
 
654
-                                if ($is_column) {
655
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
656
-                                    $meta_field_add .= " DEFAULT '1'";
654
+								if ($is_column) {
655
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
656
+									$meta_field_add .= " DEFAULT '1'";
657 657
 
658
-                                    $wpdb->query($meta_field_add);
659
-                                } else {
660
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
658
+									$wpdb->query($meta_field_add);
659
+								} else {
660
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
661 661
 
662
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
663
-                                    $meta_field_add .= " DEFAULT '1'";
662
+									$meta_field_add = "VARCHAR( 3 ) NULL";
663
+									$meta_field_add .= " DEFAULT '1'";
664 664
 
665
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
666
-                                }
665
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
666
+								}
667 667
 
668
-                            }
669
-                        }// end extra
668
+							}
669
+						}// end extra
670 670
 
671
-                        break;
671
+						break;
672 672
 
673
-                    case 'checkbox':
674
-                    case 'multiselect':
675
-                    case 'select':
676
-                    case 'taxonomy':
673
+					case 'checkbox':
674
+					case 'multiselect':
675
+					case 'select':
676
+					case 'taxonomy':
677 677
 
678
-                        $op_size = '500';
678
+						$op_size = '500';
679 679
 
680
-                        // only make the field as big as it needs to be.
681
-                        if(isset($option_values) && $option_values && $field_type=='select'){
682
-                            $option_values_arr = explode(',',$option_values);
683
-                            if(is_array($option_values_arr)){
684
-                                $op_max = 0;
685
-                                foreach($option_values_arr as $op_val){
686
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
687
-                                }
688
-                                if($op_max){$op_size =$op_max; }
689
-                            }
690
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
691
-                            if(strlen($option_values)){
692
-                                $op_size =  strlen($option_values);
693
-                            }
694
-                        }
680
+						// only make the field as big as it needs to be.
681
+						if(isset($option_values) && $option_values && $field_type=='select'){
682
+							$option_values_arr = explode(',',$option_values);
683
+							if(is_array($option_values_arr)){
684
+								$op_max = 0;
685
+								foreach($option_values_arr as $op_val){
686
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
687
+								}
688
+								if($op_max){$op_size =$op_max; }
689
+							}
690
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
691
+							if(strlen($option_values)){
692
+								$op_size =  strlen($option_values);
693
+							}
694
+						}
695
+
696
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
695 697
 
696
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
698
+						if ($default_value != '') {
699
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
700
+						}
697 701
 
698
-                        if ($default_value != '') {
699
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
700
-                        }
702
+						$alter_result = $wpdb->query($meta_field_add);
703
+						if($alter_result===false){
704
+							return __('Column change failed, you may have too many columns.','geodirectory');
705
+						}
701 706
 
702
-                        $alter_result = $wpdb->query($meta_field_add);
703
-                        if($alter_result===false){
704
-                            return __('Column change failed, you may have too many columns.','geodirectory');
705
-                        }
707
+						if (isset($request_field['cat_display_type']))
708
+							$extra_fields = $request_field['cat_display_type'];
706 709
 
707
-                        if (isset($request_field['cat_display_type']))
708
-                            $extra_fields = $request_field['cat_display_type'];
710
+						if (isset($request_field['multi_display_type']))
711
+							$extra_fields = $request_field['multi_display_type'];
709 712
 
710
-                        if (isset($request_field['multi_display_type']))
711
-                            $extra_fields = $request_field['multi_display_type'];
712 713
 
714
+						break;
713 715
 
714
-                        break;
716
+					case 'textarea':
717
+					case 'html':
718
+					case 'url':
719
+					case 'file':
715 720
 
716
-                    case 'textarea':
717
-                    case 'html':
718
-                    case 'url':
719
-                    case 'file':
721
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
722
+						if($alter_result===false){
723
+							return __('Column change failed, you may have too many columns.','geodirectory');
724
+						}
725
+						if (isset($request_field['advanced_editor']))
726
+							$extra_fields = $request_field['advanced_editor'];
720 727
 
721
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
722
-                        if($alter_result===false){
723
-                            return __('Column change failed, you may have too many columns.','geodirectory');
724
-                        }
725
-                        if (isset($request_field['advanced_editor']))
726
-                            $extra_fields = $request_field['advanced_editor'];
727
-
728
-                        break;
728
+						break;
729 729
 
730
-                    case 'fieldset':
731
-                        // Nothig happend for fieldset
732
-                        break;
730
+					case 'fieldset':
731
+						// Nothig happend for fieldset
732
+						break;
733
+
734
+					default:
735
+						if ($data_type != 'VARCHAR' && $data_type != '') {
736
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
737
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
738
+							} else {
739
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
740
+							}
733 741
 
734
-                    default:
735
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
736
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
737
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
738
-                            } else {
739
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
740
-                            }
741
-
742
-                            if (is_numeric($default_value) && $default_value != '') {
743
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
744
-                            }
745
-                        } else {
746
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
747
-                            if ($default_value != '') {
748
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
749
-                            }
750
-                        }
751
-
752
-                        $alter_result = $wpdb->query($default_value_add);
753
-                        if($alter_result===false){
754
-                            return __('Column change failed, you may have too many columns.','geodirectory');
755
-                        }
756
-                        break;
757
-                endswitch;
758
-
759
-                $extra_field_query = '';
760
-                if (!empty($extra_fields)) {
761
-                    $extra_field_query = serialize($extra_fields);
762
-                }
763
-
764
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
765
-
766
-                $wpdb->query(
767
-
768
-                    $wpdb->prepare(
769
-
770
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
742
+							if (is_numeric($default_value) && $default_value != '') {
743
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
744
+							}
745
+						} else {
746
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
747
+							if ($default_value != '') {
748
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
749
+							}
750
+						}
751
+
752
+						$alter_result = $wpdb->query($default_value_add);
753
+						if($alter_result===false){
754
+							return __('Column change failed, you may have too many columns.','geodirectory');
755
+						}
756
+						break;
757
+				endswitch;
758
+
759
+				$extra_field_query = '';
760
+				if (!empty($extra_fields)) {
761
+					$extra_field_query = serialize($extra_fields);
762
+				}
763
+
764
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
765
+
766
+				$wpdb->query(
767
+
768
+					$wpdb->prepare(
769
+
770
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
771 771
 					post_type = %s,
772 772
 					admin_title = %s,
773 773
 					site_title = %s,
@@ -799,308 +799,308 @@  discard block
 block discarded – undo
799 799
 					for_admin_use = %s
800 800
 					where id = %d",
801 801
 
802
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
803
-                    )
802
+						array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
803
+					)
804 804
 
805
-                );
805
+				);
806 806
 
807
-                $lastid = trim($cf);
807
+				$lastid = trim($cf);
808 808
 
809 809
 
810
-                $wpdb->query(
811
-                    $wpdb->prepare(
812
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
810
+				$wpdb->query(
811
+					$wpdb->prepare(
812
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
813 813
 					 	site_title=%s
814 814
 					where post_type = %s and htmlvar_name = %s",
815
-                        array($site_title, $post_type, $htmlvar_name)
816
-                    )
817
-                );
818
-
819
-
820
-                if ($cat_sort == '')
821
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
822
-
823
-
824
-                /**
825
-                 * Called after all custom fields are saved for a post.
826
-                 *
827
-                 * @since 1.0.0
828
-                 * @param int $lastid The post ID.
829
-                 */
830
-                do_action('geodir_after_custom_fields_updated', $lastid);
831
-
832
-            } else {
833
-
834
-                switch ($field_type):
835
-
836
-                    case 'address':
837
-
838
-                        $data_type = '';
839
-
840
-                        if ($htmlvar_name != '') {
841
-                            $prefix = $htmlvar_name . '_';
842
-                        }
843
-                        $old_prefix = $old_html_variable;
844
-
845
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
846
-
847
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
848
-                        if ($default_value != '') {
849
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
850
-                        }
851
-
852
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
853
-                        //$wpdb->query($meta_field_add);
854
-
855
-
856
-                        if (!empty($extra_fields)) {
815
+						array($site_title, $post_type, $htmlvar_name)
816
+					)
817
+				);
818
+
819
+
820
+				if ($cat_sort == '')
821
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
822
+
823
+
824
+				/**
825
+				 * Called after all custom fields are saved for a post.
826
+				 *
827
+				 * @since 1.0.0
828
+				 * @param int $lastid The post ID.
829
+				 */
830
+				do_action('geodir_after_custom_fields_updated', $lastid);
831
+
832
+			} else {
833
+
834
+				switch ($field_type):
835
+
836
+					case 'address':
837
+
838
+						$data_type = '';
839
+
840
+						if ($htmlvar_name != '') {
841
+							$prefix = $htmlvar_name . '_';
842
+						}
843
+						$old_prefix = $old_html_variable;
844
+
845
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
846
+
847
+						$meta_field_add = "VARCHAR( 254 ) NULL";
848
+						if ($default_value != '') {
849
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
850
+						}
851
+
852
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
853
+						//$wpdb->query($meta_field_add);
854
+
855
+
856
+						if (!empty($extra_fields)) {
857
+
858
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
859
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
860
+								$meta_field_add = "VARCHAR( 30 ) NULL";
861
+								if ($default_value != '') {
862
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
863
+								}
864
+
865
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
866
+								//$wpdb->query($meta_field_add);
867
+							}
868
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
869
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
870
+								$meta_field_add = "VARCHAR( 30 ) NULL";
871
+								if ($default_value != '') {
872
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
873
+								}
874
+
875
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
876
+								//$wpdb->query($meta_field_add);
877
+							}
878
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
879
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
880
+
881
+								$meta_field_add = "VARCHAR( 30 ) NULL";
882
+								if ($default_value != '') {
883
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
884
+								}
885
+
886
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
887
+								//$wpdb->query($meta_field_add);
888
+							}
889
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
890
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
891
+								$meta_field_add = "VARCHAR( 15 ) NULL";
892
+								if ($default_value != '') {
893
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
894
+								}
895
+
896
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
897
+								//$wpdb->query($meta_field_add);
898
+							}
899
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
900
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
901
+								$meta_field_add = "VARCHAR( 20 ) NULL";
902
+								if ($default_value != '') {
903
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
904
+								}
905
+
906
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
907
+								//$wpdb->query($meta_field_add);
857 908
 
858
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
859
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
860
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
861
-                                if ($default_value != '') {
862
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
863
-                                }
864
-
865
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
866
-                                //$wpdb->query($meta_field_add);
867
-                            }
868
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
869
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
870
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
871
-                                if ($default_value != '') {
872
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
873
-                                }
874
-
875
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
876
-                                //$wpdb->query($meta_field_add);
877
-                            }
878
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
879
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
880
-
881
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
882
-                                if ($default_value != '') {
883
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
884
-                                }
885
-
886
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
887
-                                //$wpdb->query($meta_field_add);
888
-                            }
889
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
890
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
891
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
892
-                                if ($default_value != '') {
893
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
894
-                                }
895
-
896
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
897
-                                //$wpdb->query($meta_field_add);
898
-                            }
899
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
900
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
901
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
902
-                                if ($default_value != '') {
903
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
904
-                                }
905
-
906
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
907
-                                //$wpdb->query($meta_field_add);
908
-
909
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
910
-
911
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
912
-                                if ($default_value != '') {
913
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
914
-                                }
915
-
916
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
917
-
918
-                                //$wpdb->query($meta_field_add);
919
-                            }
920
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
921
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
922
-
923
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
924
-                                if ($default_value != '') {
925
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
926
-                                }
927
-
928
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
929
-
930
-                                //$wpdb->query($meta_field_add);
931
-                            }
932
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
933
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
934
-
935
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
936
-                                if ($default_value != '') {
937
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
938
-                                }
939
-
940
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
941
-
942
-                                //$wpdb->query($meta_field_add);
943
-                            }
944
-                            // show lat lng
945
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
946
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
947
-
948
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
949
-                                $meta_field_add .= " DEFAULT '1'";
950
-
951
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
952
-                                //$wpdb->query($meta_field_add);
953
-                            }
954
-                        }
955
-
956
-                        break;
957
-
958
-                    case 'checkbox':
959
-                        $data_type = 'TINYINT';
960
-
961
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
962
-                        if ((int)$default_value === 1) {
963
-                            $meta_field_add .= " DEFAULT '1'";
964
-                        }
965
-
966
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
967
-                        if ($add_result === false) {
968
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
969
-                        }
970
-                        break;
971
-                    case 'multiselect':
972
-                    case 'select':
973
-                        $data_type = 'VARCHAR';
974
-                        $op_size = '500';
975
-
976
-                        // only make the field as big as it needs to be.
977
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
978
-                            $option_values_arr = explode(',', $option_values);
979
-
980
-                            if (is_array($option_values_arr)) {
981
-                                $op_max = 0;
982
-
983
-                                foreach ($option_values_arr as $op_val) {
984
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
985
-                                        $op_max = strlen($op_val);
986
-                                    }
987
-                                }
988
-
989
-                                if ($op_max) {
990
-                                    $op_size = $op_max;
991
-                                }
992
-                            }
993
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
994
-                            if (strlen($option_values)) {
995
-                                $op_size =  strlen($option_values);
996
-                            }
997
-
998
-                            if (isset($request_field['multi_display_type'])) {
999
-                                $extra_fields = $request_field['multi_display_type'];
1000
-                            }
1001
-                        }
1002
-
1003
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1004
-                        if ($default_value != '') {
1005
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1006
-                        }
1007
-
1008
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1009
-                        if ($add_result === false) {
1010
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1011
-                        }
1012
-                        break;
1013
-                    case 'textarea':
1014
-                    case 'html':
1015
-                    case 'url':
1016
-                    case 'file':
1017
-
1018
-                        $data_type = 'TEXT';
1019
-
1020
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1021
-
1022
-                        $meta_field_add = $data_type . " NULL ";
1023
-                        /*if($default_value != '')
909
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
910
+
911
+								$meta_field_add = "VARCHAR( 20 ) NULL";
912
+								if ($default_value != '') {
913
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
914
+								}
915
+
916
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
917
+
918
+								//$wpdb->query($meta_field_add);
919
+							}
920
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
921
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
922
+
923
+								$meta_field_add = "VARCHAR( 15 ) NULL";
924
+								if ($default_value != '') {
925
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
926
+								}
927
+
928
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
929
+
930
+								//$wpdb->query($meta_field_add);
931
+							}
932
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
933
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
934
+
935
+								$meta_field_add = "VARCHAR( 3 ) NULL";
936
+								if ($default_value != '') {
937
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
938
+								}
939
+
940
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
941
+
942
+								//$wpdb->query($meta_field_add);
943
+							}
944
+							// show lat lng
945
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
946
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
947
+
948
+								$meta_field_add = "VARCHAR( 3 ) NULL";
949
+								$meta_field_add .= " DEFAULT '1'";
950
+
951
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
952
+								//$wpdb->query($meta_field_add);
953
+							}
954
+						}
955
+
956
+						break;
957
+
958
+					case 'checkbox':
959
+						$data_type = 'TINYINT';
960
+
961
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
962
+						if ((int)$default_value === 1) {
963
+							$meta_field_add .= " DEFAULT '1'";
964
+						}
965
+
966
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
967
+						if ($add_result === false) {
968
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
969
+						}
970
+						break;
971
+					case 'multiselect':
972
+					case 'select':
973
+						$data_type = 'VARCHAR';
974
+						$op_size = '500';
975
+
976
+						// only make the field as big as it needs to be.
977
+						if (isset($option_values) && $option_values && $field_type == 'select') {
978
+							$option_values_arr = explode(',', $option_values);
979
+
980
+							if (is_array($option_values_arr)) {
981
+								$op_max = 0;
982
+
983
+								foreach ($option_values_arr as $op_val) {
984
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
985
+										$op_max = strlen($op_val);
986
+									}
987
+								}
988
+
989
+								if ($op_max) {
990
+									$op_size = $op_max;
991
+								}
992
+							}
993
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
994
+							if (strlen($option_values)) {
995
+								$op_size =  strlen($option_values);
996
+							}
997
+
998
+							if (isset($request_field['multi_display_type'])) {
999
+								$extra_fields = $request_field['multi_display_type'];
1000
+							}
1001
+						}
1002
+
1003
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1004
+						if ($default_value != '') {
1005
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1006
+						}
1007
+
1008
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1009
+						if ($add_result === false) {
1010
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1011
+						}
1012
+						break;
1013
+					case 'textarea':
1014
+					case 'html':
1015
+					case 'url':
1016
+					case 'file':
1017
+
1018
+						$data_type = 'TEXT';
1019
+
1020
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1021
+
1022
+						$meta_field_add = $data_type . " NULL ";
1023
+						/*if($default_value != '')
1024 1024
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1025 1025
 
1026
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1027
-                        if ($add_result === false) {
1028
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1029
-                        }
1026
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1027
+						if ($add_result === false) {
1028
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1029
+						}
1030 1030
 
1031
-                        break;
1031
+						break;
1032 1032
 
1033
-                    case 'datepicker':
1033
+					case 'datepicker':
1034 1034
 
1035
-                        $data_type = 'DATE';
1035
+						$data_type = 'DATE';
1036 1036
 
1037
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1037
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1038 1038
 
1039
-                        $meta_field_add = $data_type . " NULL ";
1039
+						$meta_field_add = $data_type . " NULL ";
1040 1040
 
1041
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1042
-                        if ($add_result === false) {
1043
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1044
-                        }
1041
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1042
+						if ($add_result === false) {
1043
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1044
+						}
1045 1045
 
1046
-                        break;
1046
+						break;
1047 1047
 
1048
-                    case 'time':
1048
+					case 'time':
1049 1049
 
1050
-                        $data_type = 'TIME';
1050
+						$data_type = 'TIME';
1051 1051
 
1052
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1052
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1053 1053
 
1054
-                        $meta_field_add = $data_type . " NULL ";
1054
+						$meta_field_add = $data_type . " NULL ";
1055 1055
 
1056
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1057
-                        if ($add_result === false) {
1058
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1059
-                        }
1056
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1057
+						if ($add_result === false) {
1058
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1059
+						}
1060 1060
 
1061
-                        break;
1061
+						break;
1062 1062
 
1063
-                    default:
1063
+					default:
1064 1064
 
1065
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1066
-                            $meta_field_add = $data_type . " NULL ";
1065
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1066
+							$meta_field_add = $data_type . " NULL ";
1067 1067
 
1068
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1069
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1070
-                            }
1068
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1069
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1070
+							}
1071 1071
 
1072
-                            if (is_numeric($default_value) && $default_value != '') {
1073
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1074
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1075
-                            }
1076
-                        } else {
1077
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1072
+							if (is_numeric($default_value) && $default_value != '') {
1073
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1074
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1075
+							}
1076
+						} else {
1077
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1078 1078
 
1079
-                            if ($default_value != '') {
1080
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1081
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1082
-                            }
1083
-                        }
1079
+							if ($default_value != '') {
1080
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1081
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1082
+							}
1083
+						}
1084 1084
 
1085
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1086
-                        if ($add_result === false) {
1087
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1088
-                        }
1089
-                        break;
1090
-                endswitch;
1085
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1086
+						if ($add_result === false) {
1087
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1088
+						}
1089
+						break;
1090
+				endswitch;
1091 1091
 
1092
-                $extra_field_query = '';
1093
-                if (!empty($extra_fields)) {
1094
-                    $extra_field_query = serialize($extra_fields);
1095
-                }
1092
+				$extra_field_query = '';
1093
+				if (!empty($extra_fields)) {
1094
+					$extra_field_query = serialize($extra_fields);
1095
+				}
1096 1096
 
1097
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1097
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1098 1098
 
1099
-                $wpdb->query(
1099
+				$wpdb->query(
1100 1100
 
1101
-                    $wpdb->prepare(
1101
+					$wpdb->prepare(
1102 1102
 
1103
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1103
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1104 1104
 					post_type = %s,
1105 1105
 					admin_title = %s,
1106 1106
 					site_title = %s,
@@ -1131,26 +1131,26 @@  discard block
 block discarded – undo
1131 1131
 					validation_msg = %s,
1132 1132
 					for_admin_use = %s ",
1133 1133
 
1134
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1134
+						array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1135 1135
 
1136
-                    )
1136
+					)
1137 1137
 
1138
-                );
1138
+				);
1139 1139
 
1140
-                $lastid = $wpdb->insert_id;
1140
+				$lastid = $wpdb->insert_id;
1141 1141
 
1142
-                $lastid = trim($lastid);
1142
+				$lastid = trim($lastid);
1143 1143
 
1144
-            }
1144
+			}
1145 1145
 
1146
-            return (int)$lastid;
1146
+			return (int)$lastid;
1147 1147
 
1148 1148
 
1149
-        } else {
1150
-            return 'HTML Variable Name should be a unique name';
1151
-        }
1149
+		} else {
1150
+			return 'HTML Variable Name should be a unique name';
1151
+		}
1152 1152
 
1153
-    }
1153
+	}
1154 1154
 }
1155 1155
 
1156 1156
 /**
@@ -1165,30 +1165,30 @@  discard block
 block discarded – undo
1165 1165
 function godir_set_field_order($field_ids = array())
1166 1166
 {
1167 1167
 
1168
-    global $wpdb;
1168
+	global $wpdb;
1169 1169
 
1170
-    $count = 0;
1171
-    if (!empty($field_ids)):
1172
-        $post_meta_info = false;
1173
-        foreach ($field_ids as $id) {
1170
+	$count = 0;
1171
+	if (!empty($field_ids)):
1172
+		$post_meta_info = false;
1173
+		foreach ($field_ids as $id) {
1174 1174
 
1175
-            $cf = trim($id, '_');
1175
+			$cf = trim($id, '_');
1176 1176
 
1177
-            $post_meta_info = $wpdb->query(
1178
-                $wpdb->prepare(
1179
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1177
+			$post_meta_info = $wpdb->query(
1178
+				$wpdb->prepare(
1179
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1180 1180
 															sort_order=%d 
1181 1181
 															where id= %d",
1182
-                    array($count, $cf)
1183
-                )
1184
-            );
1185
-            $count++;
1186
-        }
1187
-
1188
-        return $post_meta_info;
1189
-    else:
1190
-        return false;
1191
-    endif;
1182
+					array($count, $cf)
1183
+				)
1184
+			);
1185
+			$count++;
1186
+		}
1187
+
1188
+		return $post_meta_info;
1189
+	else:
1190
+		return false;
1191
+	endif;
1192 1192
 }
1193 1193
 
1194 1194
 
@@ -1208,140 +1208,140 @@  discard block
 block discarded – undo
1208 1208
  * @param string $post_type Optional. The wordpress post type.
1209 1209
  */
1210 1210
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1211
-    global $is_default, $mapzoom, $gd_session;
1212
-
1213
-    $show_editors = array();
1214
-    $listing_type = $post_type;
1215
-
1216
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1217
-
1218
-    $fieldset_id = '';
1219
-    $fieldset_field_class = 'gd-fieldset-details';
1220
-    foreach ($custom_fields as $key => $val) {
1221
-        $val = stripslashes_deep($val); // strip slashes from labels
1222
-        $name = $val['name'];
1223
-        $site_title = $val['site_title'];
1224
-        $type = $val['type'];
1225
-        $admin_desc = $val['desc'];
1226
-        $option_values = $val['option_values'];
1227
-        $is_required = $val['is_required'];
1228
-        $is_default = $val['is_default'];
1229
-        $is_admin = $val['is_admin'];
1230
-        $required_msg = $val['required_msg'];
1231
-        $extra_fields = unserialize($val['extra_fields']);
1232
-        $value = '';
1233
-
1234
-        /* field available to site admin only for edit */
1235
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1236
-        if ($for_admin_use && !is_super_admin()) {
1237
-            continue;
1238
-        }
1239
-
1240
-        if (is_admin()) {
1241
-            global $post;
1242
-
1243
-            if (isset($_REQUEST['post']))
1244
-                $_REQUEST['pid'] = $_REQUEST['post'];
1245
-        }
1246
-
1247
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1248
-            $post = $gd_ses_listing;
1249
-            $value = isset($post[$name]) ? $post[$name] : '';
1250
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1251
-            $value = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1252
-        } else {
1253
-            if ($value == '') {
1254
-                $value = $val['default'];
1255
-            }
1256
-        }
1257
-
1258
-        /**
1259
-         * Called before the custom fields info is output for submitting a post.
1260
-         *
1261
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1262
-         *
1263
-         * @since 1.0.0
1264
-         * @param string $listing_type The post post type.
1265
-         * @param int $package_id The price package ID for the post.
1266
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1267
-         * @see 'geodir_after_custom_form_field_$name'
1268
-         */
1269
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1270
-
1271
-        if ($type == 'fieldset') {
1272
-            $fieldset_id = (int)$val['id'];
1273
-            $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1274
-            ?>
1211
+	global $is_default, $mapzoom, $gd_session;
1212
+
1213
+	$show_editors = array();
1214
+	$listing_type = $post_type;
1215
+
1216
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1217
+
1218
+	$fieldset_id = '';
1219
+	$fieldset_field_class = 'gd-fieldset-details';
1220
+	foreach ($custom_fields as $key => $val) {
1221
+		$val = stripslashes_deep($val); // strip slashes from labels
1222
+		$name = $val['name'];
1223
+		$site_title = $val['site_title'];
1224
+		$type = $val['type'];
1225
+		$admin_desc = $val['desc'];
1226
+		$option_values = $val['option_values'];
1227
+		$is_required = $val['is_required'];
1228
+		$is_default = $val['is_default'];
1229
+		$is_admin = $val['is_admin'];
1230
+		$required_msg = $val['required_msg'];
1231
+		$extra_fields = unserialize($val['extra_fields']);
1232
+		$value = '';
1233
+
1234
+		/* field available to site admin only for edit */
1235
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1236
+		if ($for_admin_use && !is_super_admin()) {
1237
+			continue;
1238
+		}
1239
+
1240
+		if (is_admin()) {
1241
+			global $post;
1242
+
1243
+			if (isset($_REQUEST['post']))
1244
+				$_REQUEST['pid'] = $_REQUEST['post'];
1245
+		}
1246
+
1247
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1248
+			$post = $gd_ses_listing;
1249
+			$value = isset($post[$name]) ? $post[$name] : '';
1250
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1251
+			$value = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1252
+		} else {
1253
+			if ($value == '') {
1254
+				$value = $val['default'];
1255
+			}
1256
+		}
1257
+
1258
+		/**
1259
+		 * Called before the custom fields info is output for submitting a post.
1260
+		 *
1261
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1262
+		 *
1263
+		 * @since 1.0.0
1264
+		 * @param string $listing_type The post post type.
1265
+		 * @param int $package_id The price package ID for the post.
1266
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1267
+		 * @see 'geodir_after_custom_form_field_$name'
1268
+		 */
1269
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1270
+
1271
+		if ($type == 'fieldset') {
1272
+			$fieldset_id = (int)$val['id'];
1273
+			$fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1274
+			?>
1275 1275
             <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1276 1276
                 <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1277 1277
             <?php
1278
-        } else if ($type == 'address') {
1279
-            $prefix = $name . '_';
1280
-
1281
-            ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1282
-            ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1283
-            ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1284
-            ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1285
-
1286
-            $address = '';
1287
-            $zip = '';
1288
-            $mapview = '';
1289
-            $mapzoom = '';
1290
-            $lat = '';
1291
-            $lng = '';
1292
-
1293
-            if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1294
-                $post = $gd_ses_listing;
1295
-                $address = $post[$prefix . 'address'];
1296
-                $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1297
-                $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1298
-                $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1299
-                $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1300
-                $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1301
-            } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1302
-                $post_info = (array)$post_info;
1303
-
1304
-                $address = $post_info[$prefix . 'address'];
1305
-                $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1306
-                $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1307
-                $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1308
-                $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1309
-                $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1310
-            }
1311
-
1312
-            $location = geodir_get_default_location();
1313
-            if (empty($city)) $city = isset($location->city) ? $location->city : '';
1314
-            if (empty($region)) $region = isset($location->region) ? $location->region : '';
1315
-            if (empty($country)) $country = isset($location->country) ? $location->country : '';
1316
-
1317
-            $lat_lng_blank = false;
1318
-            if (empty($lat) && empty($lng)) {
1319
-                $lat_lng_blank = true;
1320
-            }
1321
-
1322
-            if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1323
-            if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1324
-
1325
-            /**
1326
-             * Filter the default latitude.
1327
-             *
1328
-             * @since 1.0.0
1329
-             *
1330
-             * @param float $lat Default latitude.
1331
-             * @param bool $is_admin For admin use only?.
1332
-             */
1333
-            $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1334
-            /**
1335
-             * Filter the default longitude.
1336
-             *
1337
-             * @since 1.0.0
1338
-             *
1339
-             * @param float $lat Default longitude.
1340
-             * @param bool $is_admin For admin use only?.
1341
-             */
1342
-            $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1343
-
1344
-            ?>
1278
+		} else if ($type == 'address') {
1279
+			$prefix = $name . '_';
1280
+
1281
+			($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1282
+			($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1283
+			($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1284
+			($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1285
+
1286
+			$address = '';
1287
+			$zip = '';
1288
+			$mapview = '';
1289
+			$mapzoom = '';
1290
+			$lat = '';
1291
+			$lng = '';
1292
+
1293
+			if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1294
+				$post = $gd_ses_listing;
1295
+				$address = $post[$prefix . 'address'];
1296
+				$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1297
+				$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1298
+				$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1299
+				$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1300
+				$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1301
+			} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1302
+				$post_info = (array)$post_info;
1303
+
1304
+				$address = $post_info[$prefix . 'address'];
1305
+				$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1306
+				$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1307
+				$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1308
+				$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1309
+				$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1310
+			}
1311
+
1312
+			$location = geodir_get_default_location();
1313
+			if (empty($city)) $city = isset($location->city) ? $location->city : '';
1314
+			if (empty($region)) $region = isset($location->region) ? $location->region : '';
1315
+			if (empty($country)) $country = isset($location->country) ? $location->country : '';
1316
+
1317
+			$lat_lng_blank = false;
1318
+			if (empty($lat) && empty($lng)) {
1319
+				$lat_lng_blank = true;
1320
+			}
1321
+
1322
+			if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1323
+			if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1324
+
1325
+			/**
1326
+			 * Filter the default latitude.
1327
+			 *
1328
+			 * @since 1.0.0
1329
+			 *
1330
+			 * @param float $lat Default latitude.
1331
+			 * @param bool $is_admin For admin use only?.
1332
+			 */
1333
+			$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1334
+			/**
1335
+			 * Filter the default longitude.
1336
+			 *
1337
+			 * @since 1.0.0
1338
+			 *
1339
+			 * @param float $lat Default longitude.
1340
+			 * @param bool $is_admin For admin use only?.
1341
+			 */
1342
+			$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1343
+
1344
+			?>
1345 1345
 
1346 1346
             <div id="geodir_<?php echo $prefix . 'address';?>_row"
1347 1347
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
@@ -1360,17 +1360,17 @@  discard block
 block discarded – undo
1360 1360
 
1361 1361
 
1362 1362
             <?php
1363
-            /**
1364
-             * Called after the address input on the add listings.
1365
-             *
1366
-             * This is used by the location manage to add further locations info etc.
1367
-             *
1368
-             * @since 1.0.0
1369
-             * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
1370
-             */
1371
-            do_action('geodir_address_extra_listing_fields', $val);
1372
-
1373
-            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1363
+			/**
1364
+			 * Called after the address input on the add listings.
1365
+			 *
1366
+			 * This is used by the location manage to add further locations info etc.
1367
+			 *
1368
+			 * @since 1.0.0
1369
+			 * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
1370
+			 */
1371
+			do_action('geodir_address_extra_listing_fields', $val);
1372
+
1373
+			if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1374 1374
 
1375 1375
                 <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1376 1376
                      class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
@@ -1391,22 +1391,22 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
                 <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1393 1393
                     <?php
1394
-                    /**
1395
-                     * Contains add listing page map functions.
1396
-                     *
1397
-                     * @since 1.0.0
1398
-                     */
1399
-                    include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1400
-                    if ($lat_lng_blank) {
1401
-                        $lat = '';
1402
-                        $lng = '';
1403
-                    }
1404
-                    ?>
1394
+					/**
1395
+					 * Contains add listing page map functions.
1396
+					 *
1397
+					 * @since 1.0.0
1398
+					 */
1399
+					include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1400
+					if ($lat_lng_blank) {
1401
+						$lat = '';
1402
+						$lng = '';
1403
+					}
1404
+					?>
1405 1405
                     <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span>
1406 1406
                 </div>
1407 1407
                 <?php
1408
-                /* show lat lng */
1409
-                $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1408
+				/* show lat lng */
1409
+				$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1410 1410
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1411 1411
                      class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1412 1412
                     <label>
@@ -1447,27 +1447,27 @@  discard block
 block discarded – undo
1447 1447
                                                             class="gd-checkbox"
1448 1448
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1449 1449
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1450
-                            echo 'checked="checked"';
1451
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1450
+							echo 'checked="checked"';
1451
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1452 1452
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1453 1453
                                                              class="gd-checkbox"
1454 1454
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1455 1455
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1456
-                            echo 'checked="checked"';
1457
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1456
+							echo 'checked="checked"';
1457
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1458 1458
 
1459 1459
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1460 1460
                                                             class="gd-checkbox"
1461 1461
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1462 1462
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1463
-                            echo 'checked="checked"';
1464
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1463
+							echo 'checked="checked"';
1464
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1465 1465
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1466 1466
                                                             class="gd-checkbox"
1467 1467
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1468 1468
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1469
-                            echo 'checked="checked"';
1470
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1469
+							echo 'checked="checked"';
1470
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1471 1471
 
1472 1472
 
1473 1473
                 </div>
@@ -1475,31 +1475,31 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
             <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1477 1477
                 <input type="hidden" value="<?php if (isset($mapzoom)) {
1478
-                    echo esc_attr($mapzoom);
1479
-                } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1478
+					echo esc_attr($mapzoom);
1479
+				} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1480 1480
             <?php }?>
1481 1481
         <?php } elseif ($type == 'text') {
1482 1482
 
1483
-            //number and float validation $validation_pattern
1484
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1485
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1486
-            //print_r($val);
1487
-            //validation
1488
-            if(isset($val['validation_pattern']) && $val['validation_pattern']){
1489
-                $validation = 'pattern="'.$val['validation_pattern'].'"';
1490
-            }else{$validation='';}
1491
-
1492
-            // validation message
1493
-            if(isset($val['validation_msg']) && $val['validation_msg']){
1494
-                $validation_msg = 'title="'.$val['validation_msg'].'"';
1495
-            }else{$validation_msg='';}
1496
-            ?>
1483
+			//number and float validation $validation_pattern
1484
+			if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1485
+			elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1486
+			//print_r($val);
1487
+			//validation
1488
+			if(isset($val['validation_pattern']) && $val['validation_pattern']){
1489
+				$validation = 'pattern="'.$val['validation_pattern'].'"';
1490
+			}else{$validation='';}
1491
+
1492
+			// validation message
1493
+			if(isset($val['validation_msg']) && $val['validation_msg']){
1494
+				$validation_msg = 'title="'.$val['validation_msg'].'"';
1495
+			}else{$validation_msg='';}
1496
+			?>
1497 1497
 
1498 1498
             <div id="<?php echo $name;?>_row"
1499 1499
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1500 1500
                 <label>
1501 1501
                     <?php $site_title = __($site_title, 'geodirectory');
1502
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1502
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1503 1503
                     <?php if ($is_required) echo '<span>*</span>';?>
1504 1504
                 </label>
1505 1505
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1511,15 +1511,15 @@  discard block
 block discarded – undo
1511 1511
             </div>
1512 1512
 
1513 1513
         <?php } elseif ($type == 'email') {
1514
-            if ($value == $val['default']) {
1515
-                $value = '';
1516
-            }?>
1514
+			if ($value == $val['default']) {
1515
+				$value = '';
1516
+			}?>
1517 1517
 
1518 1518
             <div id="<?php echo $name;?>_row"
1519 1519
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1520 1520
                 <label>
1521 1521
                     <?php $site_title = __($site_title, 'geodirectory');
1522
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1522
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1523 1523
                     <?php if ($is_required) echo '<span>*</span>';?>
1524 1524
                 </label>
1525 1525
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1531,15 +1531,15 @@  discard block
 block discarded – undo
1531 1531
             </div>
1532 1532
 
1533 1533
         <?php } elseif ($type == 'phone') {
1534
-            if ($value == $val['default']) {
1535
-                $value = '';
1536
-            } ?>
1534
+			if ($value == $val['default']) {
1535
+				$value = '';
1536
+			} ?>
1537 1537
 
1538 1538
             <div id="<?php echo $name;?>_row"
1539 1539
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1540 1540
                 <label>
1541 1541
                     <?php $site_title = __($site_title, 'geodirectory');
1542
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1542
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1543 1543
                     <?php if ($is_required) echo '<span>*</span>';?>
1544 1544
                 </label>
1545 1545
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1551,15 +1551,15 @@  discard block
 block discarded – undo
1551 1551
             </div>
1552 1552
 
1553 1553
         <?php } elseif ($type == 'url') {
1554
-            if ($value == $val['default']) {
1555
-                $value = '';
1556
-            }?>
1554
+			if ($value == $val['default']) {
1555
+				$value = '';
1556
+			}?>
1557 1557
 
1558 1558
             <div id="<?php echo $name;?>_row"
1559 1559
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1560 1560
                 <label>
1561 1561
                     <?php $site_title = __($site_title, 'geodirectory');
1562
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1562
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1563 1563
                     <?php if ($is_required) echo '<span>*</span>';?>
1564 1564
                 </label>
1565 1565
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1578,23 +1578,23 @@  discard block
 block discarded – undo
1578 1578
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1579 1579
                 <label>
1580 1580
                     <?php $site_title = __($site_title, 'geodirectory');
1581
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1581
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1582 1582
                     <?php if ($is_required) echo '<span>*</span>';?>
1583 1583
                 </label>
1584 1584
                 <?php if ($option_values) {
1585
-                    $option_values = geodir_string_values_to_options($option_values, true);
1585
+					$option_values = geodir_string_values_to_options($option_values, true);
1586 1586
 
1587
-                    if (!empty($option_values)) {
1588
-                        foreach ($option_values as $option_value) {
1589
-                            if (empty($option_value['optgroup'])) {
1590
-                                ?>
1587
+					if (!empty($option_values)) {
1588
+						foreach ($option_values as $option_value) {
1589
+							if (empty($option_value['optgroup'])) {
1590
+								?>
1591 1591
                                 <span class="gd-radios"><input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?></span>
1592 1592
                                 <?php
1593
-                            }
1594
-                        }
1595
-                    }
1596
-                }
1597
-                ?>
1593
+							}
1594
+						}
1595
+					}
1596
+				}
1597
+				?>
1598 1598
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1599 1599
                 <?php if ($is_required) { ?>
1600 1600
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
@@ -1607,16 +1607,16 @@  discard block
 block discarded – undo
1607 1607
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1608 1608
                 <label>
1609 1609
                     <?php $site_title = __($site_title, 'geodirectory');
1610
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1610
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1611 1611
                     <?php if ($is_required) echo '<span>*</span>';?>
1612 1612
                 </label>
1613 1613
                 <?php if ($value != '1') {
1614
-                    $value = '0';
1615
-                }?>
1614
+					$value = '0';
1615
+				}?>
1616 1616
                 <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>
1617 1617
                 <input  <?php if ($value == '1') {
1618
-                    echo 'checked="checked"';
1619
-                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1618
+					echo 'checked="checked"';
1619
+				}?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1620 1620
                      onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
1621 1621
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1622 1622
                 <?php if ($is_required) { ?>
@@ -1625,31 +1625,31 @@  discard block
 block discarded – undo
1625 1625
             </div>
1626 1626
 
1627 1627
         <?php } elseif ($type == 'textarea') {
1628
-            ?>
1628
+			?>
1629 1629
 
1630 1630
             <div id="<?php echo $name;?>_row"
1631 1631
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1632 1632
                 <label>
1633 1633
                     <?php $site_title = __($site_title, 'geodirectory');
1634
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1634
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1635 1635
                     <?php if ($is_required) echo '<span>*</span>';?>
1636 1636
                 </label><?php
1637 1637
 
1638 1638
 
1639
-                if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1639
+				if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1640 1640
 
1641
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1641
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1642 1642
 
1643 1643
                 <div class="editor" field_id="<?php echo $name;?>" field_type="editor">
1644 1644
                     <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>
1645 1645
                     </div><?php
1646 1646
 
1647
-                } else {
1647
+				} else {
1648 1648
 
1649
-                    ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1649
+					?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1650 1650
                                 id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php
1651 1651
 
1652
-                }?>
1652
+				}?>
1653 1653
 
1654 1654
 
1655 1655
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1663,28 +1663,28 @@  discard block
 block discarded – undo
1663 1663
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1664 1664
                 <label>
1665 1665
                     <?php $site_title = __($site_title, 'geodirectory');
1666
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1666
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1667 1667
                     <?php if ($is_required) echo '<span>*</span>';?>
1668 1668
                 </label>
1669 1669
                 <?php
1670
-                $option_values_arr = geodir_string_values_to_options($option_values, true);
1671
-                $select_options = '';
1672
-                if (!empty($option_values_arr)) {
1673
-                    foreach ($option_values_arr as $option_row) {
1674
-                        if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1675
-                            $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1676
-
1677
-                            $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1678
-                        } else {
1679
-                            $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1680
-                            $option_value = isset($option_row['value']) ? $option_row['value'] : '';
1681
-                            $selected = $option_value == $value ? 'selected="selected"' : '';
1682
-
1683
-                            $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1684
-                        }
1685
-                    }
1686
-                }
1687
-                ?>
1670
+				$option_values_arr = geodir_string_values_to_options($option_values, true);
1671
+				$select_options = '';
1672
+				if (!empty($option_values_arr)) {
1673
+					foreach ($option_values_arr as $option_row) {
1674
+						if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1675
+							$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1676
+
1677
+							$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1678
+						} else {
1679
+							$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1680
+							$option_value = isset($option_row['value']) ? $option_row['value'] : '';
1681
+							$selected = $option_value == $value ? 'selected="selected"' : '';
1682
+
1683
+							$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1684
+						}
1685
+					}
1686
+				}
1687
+				?>
1688 1688
                 <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1689 1689
                         class="geodir_textfield textfield_x chosen_select"
1690 1690
                         data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -1696,17 +1696,17 @@  discard block
 block discarded – undo
1696 1696
             </div>
1697 1697
 
1698 1698
             <?php
1699
-        } else if ($type == 'multiselect') {
1700
-            $multi_display = 'select';
1701
-            if (!empty($val['extra_fields'])) {
1702
-                $multi_display = unserialize($val['extra_fields']);
1703
-            }
1704
-            ?>
1699
+		} else if ($type == 'multiselect') {
1700
+			$multi_display = 'select';
1701
+			if (!empty($val['extra_fields'])) {
1702
+				$multi_display = unserialize($val['extra_fields']);
1703
+			}
1704
+			?>
1705 1705
             <div id="<?php echo $name; ?>_row"
1706 1706
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1707 1707
                 <label>
1708 1708
                     <?php $site_title = __($site_title, 'geodirectory');
1709
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1709
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1710 1710
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1711 1711
                 </label>
1712 1712
                 <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>
@@ -1717,55 +1717,55 @@  discard block
 block discarded – undo
1717 1717
                             data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
1718 1718
                             option-ajaxchosen="false">
1719 1719
                         <?php
1720
-                        } else {
1721
-                            echo '<ul class="gd_multi_choice">';
1722
-                        }
1723
-
1724
-                        $option_values_arr = geodir_string_values_to_options($option_values, true);
1725
-                        $select_options = '';
1726
-                        if (!empty($option_values_arr)) {
1727
-                            foreach ($option_values_arr as $option_row) {
1728
-                                if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1729
-                                    $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1730
-
1731
-                                    if ($multi_display == 'select') {
1732
-                                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1733
-                                    } else {
1734
-                                        $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
1735
-                                    }
1736
-                                } else {
1737
-                                    $option_label = isset($option_row['label']) ? $option_row['label'] : '';
1738
-                                    $option_value = isset($option_row['value']) ? $option_row['value'] : '';
1739
-                                    $selected = $option_value == $value ? 'selected="selected"' : '';
1740
-                                    $selected = '';
1741
-                                    $checked = '';
1742
-
1743
-                                    if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
1744
-                                        if (!is_array($value)) {
1745
-                                            $value_array = explode(',', $value);
1746
-                                        } else {
1747
-                                            $value_array = $value;
1748
-                                        }
1749
-
1750
-                                        if (is_array($value_array)) {
1751
-                                            if (in_array($option_value, $value_array)) {
1752
-                                                $selected = 'selected="selected"';
1753
-                                                $checked = 'checked="checked"';
1754
-                                            }
1755
-                                        }
1756
-                                    }
1757
-
1758
-                                    if ($multi_display == 'select') {
1759
-                                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1760
-                                    } else {
1761
-                                        $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
1762
-                                    }
1763
-                                }
1764
-                            }
1765
-                        }
1766
-                        echo $select_options;
1767
-
1768
-                        if ($multi_display == 'select') { ?></select></div>
1720
+						} else {
1721
+							echo '<ul class="gd_multi_choice">';
1722
+						}
1723
+
1724
+						$option_values_arr = geodir_string_values_to_options($option_values, true);
1725
+						$select_options = '';
1726
+						if (!empty($option_values_arr)) {
1727
+							foreach ($option_values_arr as $option_row) {
1728
+								if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
1729
+									$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1730
+
1731
+									if ($multi_display == 'select') {
1732
+										$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
1733
+									} else {
1734
+										$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
1735
+									}
1736
+								} else {
1737
+									$option_label = isset($option_row['label']) ? $option_row['label'] : '';
1738
+									$option_value = isset($option_row['value']) ? $option_row['value'] : '';
1739
+									$selected = $option_value == $value ? 'selected="selected"' : '';
1740
+									$selected = '';
1741
+									$checked = '';
1742
+
1743
+									if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
1744
+										if (!is_array($value)) {
1745
+											$value_array = explode(',', $value);
1746
+										} else {
1747
+											$value_array = $value;
1748
+										}
1749
+
1750
+										if (is_array($value_array)) {
1751
+											if (in_array($option_value, $value_array)) {
1752
+												$selected = 'selected="selected"';
1753
+												$checked = 'checked="checked"';
1754
+											}
1755
+										}
1756
+									}
1757
+
1758
+									if ($multi_display == 'select') {
1759
+										$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
1760
+									} else {
1761
+										$select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
1762
+									}
1763
+								}
1764
+							}
1765
+						}
1766
+						echo $select_options;
1767
+
1768
+						if ($multi_display == 'select') { ?></select></div>
1769 1769
             <?php } else { ?></ul><?php } ?>
1770 1770
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1771 1771
                 <?php if ($is_required) { ?>
@@ -1773,14 +1773,14 @@  discard block
 block discarded – undo
1773 1773
                 <?php } ?>
1774 1774
             </div>
1775 1775
             <?php
1776
-        } else if ($type == 'html') {
1777
-            ?>
1776
+		} else if ($type == 'html') {
1777
+			?>
1778 1778
 
1779 1779
             <div id="<?php echo $name; ?>_row"
1780 1780
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1781 1781
                 <label>
1782 1782
                     <?php $site_title = __($site_title, 'geodirectory');
1783
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1783
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1784 1784
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1785 1785
                 </label>
1786 1786
 
@@ -1798,34 +1798,34 @@  discard block
 block discarded – undo
1798 1798
             </div>
1799 1799
         <?php } elseif ($type == 'datepicker') {
1800 1800
 
1801
-            if ($extra_fields['date_format'] == '')
1802
-                $extra_fields['date_format'] = 'yy-mm-dd';
1801
+			if ($extra_fields['date_format'] == '')
1802
+				$extra_fields['date_format'] = 'yy-mm-dd';
1803 1803
 
1804 1804
 
1805
-            $search = array('dd', 'mm', 'yy');
1806
-            $replace = array('d', 'm', 'Y');
1805
+			$search = array('dd', 'mm', 'yy');
1806
+			$replace = array('d', 'm', 'Y');
1807 1807
 
1808
-            $date_format = str_replace($search, $replace, $extra_fields['date_format']);
1808
+			$date_format = str_replace($search, $replace, $extra_fields['date_format']);
1809 1809
 
1810
-            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1811
-            if($value && !isset($_REQUEST['backandedit'])) {
1812
-                $time = strtotime($value);
1813
-                $value = date($date_format, $time);
1814
-            }
1810
+			if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1811
+			if($value && !isset($_REQUEST['backandedit'])) {
1812
+				$time = strtotime($value);
1813
+				$value = date($date_format, $time);
1814
+			}
1815 1815
 
1816
-            ?>
1816
+			?>
1817 1817
             <script type="text/javascript">
1818 1818
 
1819 1819
                 jQuery(function () {
1820 1820
 
1821 1821
                     jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
1822
-                        /**
1823
-                         * Used to add extra option to datepicker per custom field.
1824
-                         *
1825
-                         * @since 1.5.7
1826
-                         * @param string $name The custom field name.
1827
-                         */
1828
-                        echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1822
+						/**
1823
+						 * Used to add extra option to datepicker per custom field.
1824
+						 *
1825
+						 * @since 1.5.7
1826
+						 * @param string $name The custom field name.
1827
+						 */
1828
+						echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1829 1829
 
1830 1830
                     jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format'];?>');
1831 1831
 
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
                 <label>
1842 1842
 
1843 1843
                     <?php $site_title = __($site_title, 'geodirectory');
1844
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1844
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1845 1845
                     <?php if ($is_required) echo '<span>*</span>';?>
1846 1846
                 </label>
1847 1847
 
@@ -1856,9 +1856,9 @@  discard block
 block discarded – undo
1856 1856
 
1857 1857
         <?php } elseif ($type == 'time') {
1858 1858
 
1859
-            if ($value != '')
1860
-                $value = date('H:i', strtotime($value));
1861
-            ?>
1859
+			if ($value != '')
1860
+				$value = date('H:i', strtotime($value));
1861
+			?>
1862 1862
             <script type="text/javascript">
1863 1863
                 jQuery(document).ready(function () {
1864 1864
 
@@ -1874,7 +1874,7 @@  discard block
 block discarded – undo
1874 1874
                 <label>
1875 1875
 
1876 1876
                     <?php $site_title = __($site_title, 'geodirectory');
1877
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1877
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1878 1878
                     <?php if ($is_required) echo '<span>*</span>';?>
1879 1879
                 </label>
1880 1880
                 <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
@@ -1887,110 +1887,110 @@  discard block
 block discarded – undo
1887 1887
             </div>
1888 1888
 
1889 1889
         <?php } elseif ($type == 'taxonomy') {
1890
-            if ($value == $val['default']) {
1891
-                $value = '';
1892
-            } ?>
1890
+			if ($value == $val['default']) {
1891
+				$value = '';
1892
+			} ?>
1893 1893
             <div id="<?php echo $name;?>_row"
1894 1894
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1895 1895
                 <label>
1896 1896
                     <?php $site_title = __($site_title, 'geodirectory');
1897
-                    echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1897
+					echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1898 1898
                     <?php if ($is_required) echo '<span>*</span>';?>
1899 1899
                 </label>
1900 1900
 
1901 1901
                 <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1902 1902
                     <?php
1903
-                    global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1903
+					global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1904 1904
 
1905
-                    $exclude_cats = array();
1905
+					$exclude_cats = array();
1906 1906
 
1907
-                    if ($is_admin == '1') {
1907
+					if ($is_admin == '1') {
1908 1908
 
1909
-                        $post_type = get_post_type();
1909
+						$post_type = get_post_type();
1910 1910
 
1911
-                        $package_info = array();
1911
+						$package_info = array();
1912 1912
 
1913
-                        $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1913
+						$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1914 1914
 
1915
-                        if (!empty($package_info)) {
1915
+						if (!empty($package_info)) {
1916 1916
 
1917
-                            if (isset($package_info['cat']) && $package_info['cat'] != '') {
1917
+							if (isset($package_info['cat']) && $package_info['cat'] != '') {
1918 1918
 
1919
-                                $exclude_cats = explode(',', $package_info['cat']);
1919
+								$exclude_cats = explode(',', $package_info['cat']);
1920 1920
 
1921
-                            }
1922
-                        }
1923
-                    }
1921
+							}
1922
+						}
1923
+					}
1924 1924
 
1925
-                    $cat_display = unserialize($val['extra_fields']);
1925
+					$cat_display = unserialize($val['extra_fields']);
1926 1926
 
1927
-                    if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1927
+					if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1928 1928
 
1929
-                        $post_cat = implode(",", $post_cat[$name]);
1929
+						$post_cat = implode(",", $post_cat[$name]);
1930 1930
 
1931
-                    } else {
1932
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1933
-                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1934
-                    }
1931
+					} else {
1932
+						if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1933
+							$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1934
+					}
1935 1935
 
1936 1936
 
1937
-                    global $geodir_addon_list;
1938
-                    if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1937
+					global $geodir_addon_list;
1938
+					if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1939 1939
 
1940
-                        $catadd_limit = $wpdb->get_var(
1941
-                            $wpdb->prepare(
1942
-                                "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1943
-                                array($package_id)
1944
-                            )
1945
-                        );
1940
+						$catadd_limit = $wpdb->get_var(
1941
+							$wpdb->prepare(
1942
+								"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1943
+								array($package_id)
1944
+							)
1945
+						);
1946 1946
 
1947 1947
 
1948
-                    } else {
1949
-                        $catadd_limit = 0;
1950
-                    }
1948
+					} else {
1949
+						$catadd_limit = 0;
1950
+					}
1951 1951
 
1952 1952
 
1953
-                    if ($cat_display != '' && $cat_display != 'ajax_chained') {
1953
+					if ($cat_display != '' && $cat_display != 'ajax_chained') {
1954 1954
 
1955
-                        $required_limit_msg = '';
1956
-                        if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1955
+						$required_limit_msg = '';
1956
+						if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1957 1957
 
1958
-                            $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1958
+							$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1959 1959
 
1960
-                        } else {
1961
-                            $required_limit_msg = $required_msg;
1962
-                        }
1960
+						} else {
1961
+							$required_limit_msg = $required_msg;
1962
+						}
1963 1963
 
1964
-                        echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1964
+						echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1965 1965
 
1966 1966
 
1967
-                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
1967
+						if ($cat_display == 'select' || $cat_display == 'multiselect') {
1968 1968
 
1969
-                            $cat_display == '';
1970
-                            $multiple = '';
1971
-                            if ($cat_display == 'multiselect')
1972
-                                $multiple = 'multiple="multiple"';
1969
+							$cat_display == '';
1970
+							$multiple = '';
1971
+							if ($cat_display == 'multiselect')
1972
+								$multiple = 'multiple="multiple"';
1973 1973
 
1974
-                            echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1974
+							echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1975 1975
 
1976 1976
 
1977
-                            if ($cat_display == 'select')
1978
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1977
+							if ($cat_display == 'select')
1978
+								echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1979 1979
 
1980
-                        }
1980
+						}
1981 1981
 
1982
-                        echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1982
+						echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1983 1983
 
1984
-                        if ($cat_display == 'select' || $cat_display == 'multiselect')
1985
-                            echo '</select>';
1984
+						if ($cat_display == 'select' || $cat_display == 'multiselect')
1985
+							echo '</select>';
1986 1986
 
1987
-                    } else {
1987
+					} else {
1988 1988
 
1989
-                        echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1989
+						echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1990 1990
 
1991
-                    }
1991
+					}
1992 1992
 
1993
-                    ?>
1993
+					?>
1994 1994
                 </div>
1995 1995
 
1996 1996
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -2005,46 +2005,46 @@  discard block
 block discarded – undo
2005 2005
 
2006 2006
 
2007 2007
 
2008
-            // adjust values here
2009
-            $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2008
+			// adjust values here
2009
+			$file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2010 2010
 
2011
-            if ($value != '') {
2011
+			if ($value != '') {
2012 2012
 
2013
-                $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2013
+				$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2014 2014
 
2015
-            } else
2016
-                $file_value = '';
2015
+			} else
2016
+				$file_value = '';
2017 2017
 
2018
-            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2019
-                $file_multiple = true; // allow multiple files upload
2020
-            else
2021
-                $file_multiple = false;
2018
+			if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2019
+				$file_multiple = true; // allow multiple files upload
2020
+			else
2021
+				$file_multiple = false;
2022 2022
 
2023
-            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2024
-                $file_image_limit = $extra_fields['image_limit'];
2025
-            else
2026
-                $file_image_limit = 1;
2023
+			if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2024
+				$file_image_limit = $extra_fields['image_limit'];
2025
+			else
2026
+				$file_image_limit = 1;
2027 2027
 
2028
-            $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2028
+			$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2029 2029
 
2030
-            $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2030
+			$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2031 2031
 
2032
-            if (!empty($file_value)) {
2033
-                $curImages = explode(',', $file_value);
2034
-                if (!empty($curImages))
2035
-                    $file_totImg = count($curImages);
2036
-            }
2032
+			if (!empty($file_value)) {
2033
+				$curImages = explode(',', $file_value);
2034
+				if (!empty($curImages))
2035
+					$file_totImg = count($curImages);
2036
+			}
2037 2037
 
2038
-            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2039
-            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2038
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2039
+			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2040 2040
 
2041
-            ?>
2041
+			?>
2042 2042
             <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
2043 2043
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
2044 2044
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
2045 2045
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
2046 2046
 			</h5>   <?php */
2047
-            ?>
2047
+			?>
2048 2048
 
2049 2049
             <div id="<?php echo $name;?>_row"
2050 2050
                  class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2053 2053
                     <label
2054 2054
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2055
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2055
+						echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2056 2056
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2057 2057
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2058 2058
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2064,17 +2064,17 @@  discard block
 block discarded – undo
2064 2064
                     <?php } ?>
2065 2065
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2066 2066
                            value="<?php if (isset($file_totImg)) {
2067
-                               echo esc_attr($file_totImg);
2068
-                           } else {
2069
-                               echo '0';
2070
-                           } ?>"/>
2067
+							   echo esc_attr($file_totImg);
2068
+						   } else {
2069
+							   echo '0';
2070
+						   } ?>"/>
2071 2071
 
2072 2072
                     <div style="float:left; width:55%;">
2073 2073
                         <div
2074 2074
                             class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2075 2075
                             id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
2076 2076
                             <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
2077
-                            ?>
2077
+							?>
2078 2078
                             <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
2079 2079
                                    value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
2080 2080
                                    class="geodir_button" style="margin-top:10px;"/>
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
                             style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
2094 2094
                         </div>
2095 2095
                         <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
2096
-                        ?>
2096
+						?>
2097 2097
 
2098 2098
                         <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
2099 2099
 
@@ -2107,178 +2107,178 @@  discard block
 block discarded – undo
2107 2107
 
2108 2108
 
2109 2109
         <?php }
2110
-        /**
2111
-         * Called after the custom fields info is output for submitting a post.
2112
-         *
2113
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
2114
-         *
2115
-         * @since 1.0.0
2116
-         * @param string $listing_type The post post type.
2117
-         * @param int $package_id The price package ID for the post.
2118
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
2119
-         * @see 'geodir_before_custom_form_field_$name'
2120
-         */
2121
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
2122
-
2123
-    }
2110
+		/**
2111
+		 * Called after the custom fields info is output for submitting a post.
2112
+		 *
2113
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
2114
+		 *
2115
+		 * @since 1.0.0
2116
+		 * @param string $listing_type The post post type.
2117
+		 * @param int $package_id The price package ID for the post.
2118
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
2119
+		 * @see 'geodir_before_custom_form_field_$name'
2120
+		 */
2121
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
2122
+
2123
+	}
2124 2124
 
2125 2125
 }
2126 2126
 
2127 2127
 
2128 2128
 if (!function_exists('geodir_get_field_infoby')) {
2129
-    /**
2130
-     * Get custom field using key and value.
2131
-     *
2132
-     * @since 1.0.0
2133
-     * @package GeoDirectory
2134
-     * @global object $wpdb WordPress Database object.
2135
-     * @param string $key The key you want to look for.
2136
-     * @param string $value The value of the key you want to look for.
2137
-     * @param string $geodir_post_type The post type.
2138
-     * @return bool|mixed Returns field info when available. otherwise returns false.
2139
-     */
2140
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2141
-    {
2142
-
2143
-        global $wpdb;
2144
-
2145
-        $filter = $wpdb->get_row(
2146
-            $wpdb->prepare(
2147
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
2148
-                array($geodir_post_type)
2149
-            )
2150
-        );
2151
-
2152
-        if ($filter) {
2153
-            return $filter;
2154
-        } else {
2155
-            return false;
2156
-        }
2157
-
2158
-    }
2129
+	/**
2130
+	 * Get custom field using key and value.
2131
+	 *
2132
+	 * @since 1.0.0
2133
+	 * @package GeoDirectory
2134
+	 * @global object $wpdb WordPress Database object.
2135
+	 * @param string $key The key you want to look for.
2136
+	 * @param string $value The value of the key you want to look for.
2137
+	 * @param string $geodir_post_type The post type.
2138
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
2139
+	 */
2140
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2141
+	{
2142
+
2143
+		global $wpdb;
2144
+
2145
+		$filter = $wpdb->get_row(
2146
+			$wpdb->prepare(
2147
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
2148
+				array($geodir_post_type)
2149
+			)
2150
+		);
2151
+
2152
+		if ($filter) {
2153
+			return $filter;
2154
+		} else {
2155
+			return false;
2156
+		}
2157
+
2158
+	}
2159 2159
 }
2160 2160
 
2161 2161
 
2162 2162
 if (!function_exists('geodir_show_listing_info')) {
2163
-    /**
2164
-     * Show listing info depending on field location.
2165
-     *
2166
-     * @since 1.0.0
2167
-     * @since 1.5.7 Custom fields option values added to db translation.
2168
-     *              Changes to display url fields title.
2169
-     * @package GeoDirectory
2170
-     * @global object $wpdb WordPress Database object.
2171
-     * @global object $post The current post object.
2172
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2173
-     *
2174
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2175
-     * @return string Returns listing info html.
2176
-     */
2177
-    function geodir_show_listing_info($fields_location = '') {
2178
-        global $post, $preview, $wpdb, $send_to_friend;
2179
-
2180
-        $payment_info = array();
2181
-        $package_info = array();
2182
-
2183
-        $package_info = geodir_post_package_info($package_info, $post);
2184
-        $post_package_id = $package_info->pid;
2185
-        $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;
2186
-        $send_to_friend = false;
2187
-
2188
-        ob_start();
2189
-        $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);
2190
-
2191
-        if (!empty($fields_info)) {
2192
-            $post = stripslashes_deep($post); // strip slashes
2163
+	/**
2164
+	 * Show listing info depending on field location.
2165
+	 *
2166
+	 * @since 1.0.0
2167
+	 * @since 1.5.7 Custom fields option values added to db translation.
2168
+	 *              Changes to display url fields title.
2169
+	 * @package GeoDirectory
2170
+	 * @global object $wpdb WordPress Database object.
2171
+	 * @global object $post The current post object.
2172
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2173
+	 *
2174
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2175
+	 * @return string Returns listing info html.
2176
+	 */
2177
+	function geodir_show_listing_info($fields_location = '') {
2178
+		global $post, $preview, $wpdb, $send_to_friend;
2179
+
2180
+		$payment_info = array();
2181
+		$package_info = array();
2182
+
2183
+		$package_info = geodir_post_package_info($package_info, $post);
2184
+		$post_package_id = $package_info->pid;
2185
+		$p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;
2186
+		$send_to_friend = false;
2187
+
2188
+		ob_start();
2189
+		$fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);
2190
+
2191
+		if (!empty($fields_info)) {
2192
+			$post = stripslashes_deep($post); // strip slashes
2193 2193
             
2194
-            //echo '<div class="geodir-company_info field-group">';
2195
-            $field_set_start = 0;
2194
+			//echo '<div class="geodir-company_info field-group">';
2195
+			$field_set_start = 0;
2196 2196
 
2197 2197
 
2198
-            if ($fields_location == 'detail')
2198
+			if ($fields_location == 'detail')
2199 2199
 
2200
-                $i = 1;
2201
-            foreach ($fields_info as $type) {
2202
-                $type = stripslashes_deep($type); // strip slashes
2203
-                $html = '';
2204
-                $html_var = '';
2205
-                $field_icon = '';
2200
+				$i = 1;
2201
+			foreach ($fields_info as $type) {
2202
+				$type = stripslashes_deep($type); // strip slashes
2203
+				$html = '';
2204
+				$html_var = '';
2205
+				$field_icon = '';
2206 2206
 
2207
-                $variables_array = array();
2207
+				$variables_array = array();
2208 2208
 
2209
-                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2210
-                    continue;
2211
-                }
2209
+				if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2210
+					continue;
2211
+				}
2212 2212
 
2213
-                if ($type['type'] != 'fieldset'):
2214
-                    $variables_array['post_id'] = $post->ID;
2215
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
2216
-                    $variables_array['value'] = '';
2217
-                    if (isset($post->{$type['htmlvar_name']}))
2218
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2219
-                endif;
2213
+				if ($type['type'] != 'fieldset'):
2214
+					$variables_array['post_id'] = $post->ID;
2215
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
2216
+					$variables_array['value'] = '';
2217
+					if (isset($post->{$type['htmlvar_name']}))
2218
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2219
+				endif;
2220 2220
 
2221
-                //if($type['field_icon'])
2221
+				//if($type['field_icon'])
2222 2222
 
2223
-                if (strpos($type['field_icon'], 'http') !== false) {
2224
-                    $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2225
-                } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2226
-                    $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2227
-                }
2228
-                //else{$field_icon = $type['field_icon'];}
2223
+				if (strpos($type['field_icon'], 'http') !== false) {
2224
+					$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2225
+				} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2226
+					$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2227
+				}
2228
+				//else{$field_icon = $type['field_icon'];}
2229 2229
 
2230 2230
 
2231
-                switch ($type['type']) {
2231
+				switch ($type['type']) {
2232 2232
 
2233
-                    case 'fieldset':
2233
+					case 'fieldset':
2234 2234
 
2235
-                        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);
2235
+						$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);
2236 2236
 
2237
-                        if ($field_set_start == 1) {
2238
-                            echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2239
-                        } else {
2240
-                            echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2241
-                            $field_set_start = 1;
2242
-                        }
2237
+						if ($field_set_start == 1) {
2238
+							echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2239
+						} else {
2240
+							echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2241
+							$field_set_start = 1;
2242
+						}
2243 2243
 
2244
-                        break;
2244
+						break;
2245 2245
 
2246
-                    case 'address':
2246
+					case 'address':
2247 2247
 
2248
-                        $html_var = $type['htmlvar_name'] . '_address';
2248
+						$html_var = $type['htmlvar_name'] . '_address';
2249 2249
 
2250
-                        if ($type['extra_fields']) {
2250
+						if ($type['extra_fields']) {
2251 2251
 
2252
-                            $extra_fields = unserialize($type['extra_fields']);
2252
+							$extra_fields = unserialize($type['extra_fields']);
2253 2253
 
2254
-                            $addition_fields = '';
2254
+							$addition_fields = '';
2255 2255
 
2256
-                            if (!empty($extra_fields)) {
2257
-                                /**
2258
-                                 * Filter "show city in address" value.
2259
-                                 *
2260
-                                 * @since 1.0.0
2261
-                                 */
2262
-                                $show_city_in_address = apply_filters('geodir_show_city_in_address', false);
2263
-                                if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
2264
-                                    $field = $type['htmlvar_name'] . '_city';
2265
-                                    if ($post->{$field}) {
2266
-                                        $addition_fields .= ', ' . $post->{$field};
2267
-                                    }
2268
-                                }
2256
+							if (!empty($extra_fields)) {
2257
+								/**
2258
+								 * Filter "show city in address" value.
2259
+								 *
2260
+								 * @since 1.0.0
2261
+								 */
2262
+								$show_city_in_address = apply_filters('geodir_show_city_in_address', false);
2263
+								if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
2264
+									$field = $type['htmlvar_name'] . '_city';
2265
+									if ($post->{$field}) {
2266
+										$addition_fields .= ', ' . $post->{$field};
2267
+									}
2268
+								}
2269 2269
 
2270 2270
 
2271
-                                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
2272
-                                    $field = $type['htmlvar_name'] . '_zip';
2273
-                                    if ($post->{$field}) {
2274
-                                        $addition_fields .= ', ' . $post->{$field};
2275
-                                    }
2276
-                                }
2271
+								if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
2272
+									$field = $type['htmlvar_name'] . '_zip';
2273
+									if ($post->{$field}) {
2274
+										$addition_fields .= ', ' . $post->{$field};
2275
+									}
2276
+								}
2277 2277
 
2278
-                            }
2278
+							}
2279 2279
 
2280
-                        }
2281
-                        /*if($type['extra_fields'])
2280
+						}
2281
+						/*if($type['extra_fields'])
2282 2282
 						{
2283 2283
 							
2284 2284
 							$extra_fields = unserialize($type['extra_fields']);
@@ -2327,1029 +2327,1029 @@  discard block
 block discarded – undo
2327 2327
 						
2328 2328
 						}*/
2329 2329
 
2330
-                        if ($post->{$html_var}):
2330
+						if ($post->{$html_var}):
2331
+
2332
+							if (strpos($field_icon, 'http') !== false) {
2333
+								$field_icon_af = '';
2334
+							} elseif ($field_icon == '') {
2335
+								$field_icon_af = '<i class="fa fa-home"></i>';
2336
+							} else {
2337
+								$field_icon_af = $field_icon;
2338
+								$field_icon = '';
2339
+							}
2340
+
2341
+							$geodir_odd_even = '';
2342
+							if ($fields_location == 'detail') {
2343
+
2344
+								$geodir_odd_even = 'geodir_more_info_odd';
2345
+								if ($i % 2 == 0)
2346
+									$geodir_odd_even = 'geodir_more_info_even';
2347
+
2348
+								$i++;
2349
+							}
2350
+
2351
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
2352
+							$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
2353
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2354
+							$html .= '</span>';
2355
+
2356
+							if ($preview) {
2357
+								$html .= $post->{$html_var} . $addition_fields . '</p></div>';
2358
+							} else {
2359
+								if ($post->post_address) {
2360
+									$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
2361
+								}
2362
+								if ($post->post_city) {
2363
+									$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
2364
+								}
2365
+								if ($post->post_region) {
2366
+									$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
2367
+								}
2368
+								if ($post->post_zip) {
2369
+									$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
2370
+								}
2371
+								if ($post->post_country) {
2372
+									$html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>';
2373
+								}
2374
+								$html .= '</div>';
2375
+							}
2376
+
2377
+
2378
+						endif;
2379
+
2380
+						$variables_array['value'] = $post->{$html_var};
2381
+
2382
+						break;
2383
+
2384
+					case 'url':
2385
+
2386
+						$html_var = $type['htmlvar_name'];
2387
+
2388
+						if ($post->{$type['htmlvar_name']}):
2389
+
2390
+							if (strpos($field_icon, 'http') !== false) {
2391
+								$field_icon_af = '';
2392
+							} elseif ($field_icon == '') {
2393
+
2394
+								if ($type['name'] == 'geodir_facebook') {
2395
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2396
+								} elseif ($type['name'] == 'geodir_twitter') {
2397
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2398
+								} else {
2399
+									$field_icon_af = '<i class="fa fa-link"></i>';
2400
+								}
2401
+
2402
+							} else {
2403
+								$field_icon_af = $field_icon;
2404
+								$field_icon = '';
2405
+							}
2406
+
2407
+							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2331 2408
 
2332
-                            if (strpos($field_icon, 'http') !== false) {
2333
-                                $field_icon_af = '';
2334
-                            } elseif ($field_icon == '') {
2335
-                                $field_icon_af = '<i class="fa fa-home"></i>';
2336
-                            } else {
2337
-                                $field_icon_af = $field_icon;
2338
-                                $field_icon = '';
2339
-                            }
2340
-
2341
-                            $geodir_odd_even = '';
2342
-                            if ($fields_location == 'detail') {
2343 2409
 
2344
-                                $geodir_odd_even = 'geodir_more_info_odd';
2345
-                                if ($i % 2 == 0)
2346
-                                    $geodir_odd_even = 'geodir_more_info_even';
2410
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2411
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2412
+							if(!empty($type['default_value'])){$title = $type['default_value'];}
2413
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2347 2414
 
2348
-                                $i++;
2349
-                            }
2350 2415
 
2351
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
2352
-                            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
2353
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2354
-                            $html .= '</span>';
2416
+							$geodir_odd_even = '';
2417
+							if ($fields_location == 'detail') {
2355 2418
 
2356
-                            if ($preview) {
2357
-                                $html .= $post->{$html_var} . $addition_fields . '</p></div>';
2358
-                            } else {
2359
-                                if ($post->post_address) {
2360
-                                    $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
2361
-                                }
2362
-                                if ($post->post_city) {
2363
-                                    $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
2364
-                                }
2365
-                                if ($post->post_region) {
2366
-                                    $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
2367
-                                }
2368
-                                if ($post->post_zip) {
2369
-                                    $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
2370
-                                }
2371
-                                if ($post->post_country) {
2372
-                                    $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>';
2373
-                                }
2374
-                                $html .= '</div>';
2375
-                            }
2419
+								$geodir_odd_even = 'geodir_more_info_odd';
2420
+								if ($i % 2 == 0)
2421
+									$geodir_odd_even = 'geodir_more_info_even';
2376 2422
 
2423
+								$i++;
2424
+							}
2425
+
2426
+
2427
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2428
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2429
+							/**
2430
+							 * Filter custom field website name.
2431
+							 *
2432
+							 * @since 1.0.0
2433
+							 *
2434
+							 * @param string $title Website Title.
2435
+							 * @param string $website Website URL.
2436
+							 * @param int $post->ID Post ID.
2437
+							 */
2438
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['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>';
2439
+
2440
+						endif;
2441
+
2442
+						break;
2443
+
2444
+					case 'phone':
2445
+
2446
+						$html_var = $type['htmlvar_name'];
2447
+
2448
+						if ($post->{$type['htmlvar_name']}):
2449
+
2450
+							if (strpos($field_icon, 'http') !== false) {
2451
+								$field_icon_af = '';
2452
+							} elseif ($field_icon == '') {
2453
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2454
+							} else {
2455
+								$field_icon_af = $field_icon;
2456
+								$field_icon = '';
2457
+							}
2458
+
2459
+							$geodir_odd_even = '';
2460
+							if ($fields_location == 'detail') {
2461
+
2462
+								$geodir_odd_even = 'geodir_more_info_odd';
2463
+								if ($i % 2 == 0)
2464
+									$geodir_odd_even = 'geodir_more_info_even';
2465
+
2466
+								$i++;
2467
+							}
2468
+
2469
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
2470
+								$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2471
+							$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . $post->{$type['htmlvar_name']} . '</a></div>';
2472
+
2473
+						endif;
2474
+
2475
+						break;
2476
+
2477
+					case 'time':
2478
+
2479
+						$html_var = $type['htmlvar_name'];
2480
+
2481
+						if ($post->{$type['htmlvar_name']}):
2482
+
2483
+							$value = '';
2484
+							if ($post->{$type['htmlvar_name']} != '')
2485
+								//$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2486
+								$value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2487
+
2488
+							if (strpos($field_icon, 'http') !== false) {
2489
+								$field_icon_af = '';
2490
+							} elseif ($field_icon == '') {
2491
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2492
+							} else {
2493
+								$field_icon_af = $field_icon;
2494
+								$field_icon = '';
2495
+							}
2496
+
2497
+							$geodir_odd_even = '';
2498
+							if ($fields_location == 'detail') {
2499
+
2500
+								$geodir_odd_even = 'geodir_more_info_odd';
2501
+								if ($i % 2 == 0)
2502
+									$geodir_odd_even = 'geodir_more_info_even';
2503
+
2504
+								$i++;
2505
+							}
2506
+
2507
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2508
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2509
+							$html .= '</span>' . $value . '</div>';
2510
+
2511
+						endif;
2512
+
2513
+						break;
2514
+
2515
+					case 'datepicker':
2516
+
2517
+						if ($post->{$type['htmlvar_name']}):
2518
+
2519
+							$date_format = geodir_default_date_format();
2520
+							if ($type['extra_fields'] != '') {
2521
+								$date_format = unserialize($type['extra_fields']);
2522
+								$date_format = $date_format['date_format'];
2523
+							}
2524
+
2525
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2526
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2527
+
2528
+							$date_format = str_replace($search, $replace, $date_format);
2529
+
2530
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2531
+
2532
+							$value = '';
2533
+							if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2534
+								$value = date($date_format, strtotime($post_htmlvar_value));
2535
+							}else{
2536
+								continue;
2537
+							}
2538
+
2539
+							if (strpos($field_icon, 'http') !== false) {
2540
+								$field_icon_af = '';
2541
+							} elseif ($field_icon == '') {
2542
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2543
+							} else {
2544
+								$field_icon_af = $field_icon;
2545
+								$field_icon = '';
2546
+							}
2547
+
2548
+							$geodir_odd_even = '';
2549
+							if ($fields_location == 'detail') {
2550
+
2551
+								$geodir_odd_even = 'geodir_more_info_odd';
2552
+								if ($i % 2 == 0)
2553
+									$geodir_odd_even = 'geodir_more_info_even';
2554
+
2555
+								$i++;
2556
+							}
2557
+
2558
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2559
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2560
+							$html .= '</span>' . $value . '</div>';
2561
+
2562
+						endif;
2563
+
2564
+						break;
2565
+
2566
+					case 'text':
2567
+
2568
+						$html_var = $type['htmlvar_name'];
2569
+
2570
+						if (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']} != '' && $type['htmlvar_name'] == 'geodir_timing'):
2571
+
2572
+							if (strpos($field_icon, 'http') !== false) {
2573
+								$field_icon_af = '';
2574
+							} elseif ($field_icon == '') {
2575
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2576
+							} else {
2577
+								$field_icon_af = $field_icon;
2578
+								$field_icon = '';
2579
+							}
2580
+
2581
+							$geodir_odd_even = '';
2582
+							if ($fields_location == 'detail') {
2583
+
2584
+								$geodir_odd_even = 'geodir_more_info_odd';
2585
+								if ($i % 2 == 0)
2586
+									$geodir_odd_even = 'geodir_more_info_even';
2587
+
2588
+								$i++;
2589
+							}
2590
+
2591
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2592
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2593
+							$html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
2594
+
2595
+						elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
2596
+
2597
+							if (strpos($field_icon, 'http') !== false) {
2598
+								$field_icon_af = '';
2599
+							} elseif ($field_icon == '') {
2600
+								$field_icon_af = '';
2601
+							} else {
2602
+								$field_icon_af = $field_icon;
2603
+								$field_icon = '';
2604
+							}
2605
+
2606
+							$geodir_odd_even = '';
2607
+							if ($fields_location == 'detail') {
2608
+
2609
+								$geodir_odd_even = 'geodir_more_info_odd';
2610
+								if ($i % 2 == 0)
2611
+									$geodir_odd_even = 'geodir_more_info_even';
2612
+
2613
+								$i++;
2614
+							}
2615
+
2616
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2617
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2618
+							$html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
2619
+
2620
+						endif;
2621
+
2622
+						break;
2623
+
2624
+					case 'radio':
2625
+
2626
+						$html_var = $type['htmlvar_name'];
2627
+						if(!isset($post->{$type['htmlvar_name']})){continue;}
2628
+						$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2629
+						if ($post->{$type['htmlvar_name']} != ''):
2630
+
2631
+							if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2632
+								$html_val = __('No', 'geodirectory');
2633
+							} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2634
+								$html_val = __('Yes', 'geodirectory');
2635
+							} else {
2636
+								if (!empty($type['option_values'])) {
2637
+									$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2638
+
2639
+									if (!empty($cf_option_values)) {
2640
+										foreach ($cf_option_values as $cf_option_value) {
2641
+											if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2642
+												$html_val = $cf_option_value['label'];
2643
+											}
2644
+										}
2645
+									}
2646
+								}
2647
+							}
2648
+
2649
+							if (strpos($field_icon, 'http') !== false) {
2650
+								$field_icon_af = '';
2651
+							} elseif ($field_icon == '') {
2652
+								$field_icon_af = '';
2653
+							} else {
2654
+								$field_icon_af = $field_icon;
2655
+								$field_icon = '';
2656
+							}
2377 2657
 
2378
-                        endif;
2658
+							$geodir_odd_even = '';
2659
+							if ($fields_location == 'detail') {
2379 2660
 
2380
-                        $variables_array['value'] = $post->{$html_var};
2661
+								$geodir_odd_even = 'geodir_more_info_odd';
2662
+								if ($i % 2 == 0)
2663
+									$geodir_odd_even = 'geodir_more_info_even';
2381 2664
 
2382
-                        break;
2665
+								$i++;
2666
+							}
2383 2667
 
2384
-                    case 'url':
2668
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2669
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2670
+							$html .= '</span>' . $html_val . '</div>';
2671
+						endif;
2385 2672
 
2386
-                        $html_var = $type['htmlvar_name'];
2673
+						break;
2387 2674
 
2388
-                        if ($post->{$type['htmlvar_name']}):
2675
+					case 'checkbox':
2389 2676
 
2390
-                            if (strpos($field_icon, 'http') !== false) {
2391
-                                $field_icon_af = '';
2392
-                            } elseif ($field_icon == '') {
2677
+						$html_var = $type['htmlvar_name'];
2393 2678
 
2394
-                                if ($type['name'] == 'geodir_facebook') {
2395
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2396
-                                } elseif ($type['name'] == 'geodir_twitter') {
2397
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2398
-                                } else {
2399
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2400
-                                }
2679
+						if ((int)$post->{$html_var} == 1):
2401 2680
 
2402
-                            } else {
2403
-                                $field_icon_af = $field_icon;
2404
-                                $field_icon = '';
2405
-                            }
2681
+							if ($post->{$type['htmlvar_name']} == '1'):
2682
+								$html_val = __('Yes', 'geodirectory');
2683
+							else:
2684
+								$html_val = __('No', 'geodirectory');
2685
+							endif;
2406 2686
 
2407
-                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2687
+							if (strpos($field_icon, 'http') !== false) {
2688
+								$field_icon_af = '';
2689
+							} elseif ($field_icon == '') {
2690
+								$field_icon_af = '';
2691
+							} else {
2692
+								$field_icon_af = $field_icon;
2693
+								$field_icon = '';
2694
+							}
2408 2695
 
2696
+							$geodir_odd_even = '';
2697
+							if ($fields_location == 'detail') {
2409 2698
 
2410
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2411
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2412
-                            if(!empty($type['default_value'])){$title = $type['default_value'];}
2413
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2699
+								$geodir_odd_even = 'geodir_more_info_odd';
2700
+								if ($i % 2 == 0)
2701
+									$geodir_odd_even = 'geodir_more_info_even';
2414 2702
 
2703
+								$i++;
2704
+							}
2415 2705
 
2416
-                            $geodir_odd_even = '';
2417
-                            if ($fields_location == 'detail') {
2706
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2707
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2708
+							$html .= '</span>' . $html_val . '</div>';
2709
+						endif;
2418 2710
 
2419
-                                $geodir_odd_even = 'geodir_more_info_odd';
2420
-                                if ($i % 2 == 0)
2421
-                                    $geodir_odd_even = 'geodir_more_info_even';
2711
+						break;
2422 2712
 
2423
-                                $i++;
2424
-                            }
2713
+					case 'select':
2425 2714
 
2715
+						$html_var = $type['htmlvar_name'];
2716
+						if(!isset($post->{$type['htmlvar_name']})){continue;}
2717
+						if ($post->{$type['htmlvar_name']}):
2718
+							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2426 2719
 
2427
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2428
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2429
-                            /**
2430
-                             * Filter custom field website name.
2431
-                             *
2432
-                             * @since 1.0.0
2433
-                             *
2434
-                             * @param string $title Website Title.
2435
-                             * @param string $website Website URL.
2436
-                             * @param int $post->ID Post ID.
2437
-                             */
2438
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['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>';
2720
+							if (!empty($type['option_values'])) {
2721
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2439 2722
 
2440
-                        endif;
2723
+								if (!empty($cf_option_values)) {
2724
+									foreach ($cf_option_values as $cf_option_value) {
2725
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2726
+											//$field_value = $cf_option_value['label']; // no longer needed here.
2727
+										}
2728
+									}
2729
+								}
2730
+							}
2441 2731
 
2442
-                        break;
2732
+							if (strpos($field_icon, 'http') !== false) {
2733
+								$field_icon_af = '';
2734
+							} elseif ($field_icon == '') {
2735
+								$field_icon_af = '';
2736
+							} else {
2737
+								$field_icon_af = $field_icon;
2738
+								$field_icon = '';
2739
+							}
2443 2740
 
2444
-                    case 'phone':
2741
+							$geodir_odd_even = '';
2742
+							if ($fields_location == 'detail') {
2445 2743
 
2446
-                        $html_var = $type['htmlvar_name'];
2744
+								$geodir_odd_even = 'geodir_more_info_odd';
2745
+								if ($i % 2 == 0)
2746
+									$geodir_odd_even = 'geodir_more_info_even';
2447 2747
 
2448
-                        if ($post->{$type['htmlvar_name']}):
2748
+								$i++;
2749
+							}
2449 2750
 
2450
-                            if (strpos($field_icon, 'http') !== false) {
2451
-                                $field_icon_af = '';
2452
-                            } elseif ($field_icon == '') {
2453
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2454
-                            } else {
2455
-                                $field_icon_af = $field_icon;
2456
-                                $field_icon = '';
2457
-                            }
2751
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2752
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2753
+							$html .= '</span>' . $field_value . '</div>';
2754
+						endif;
2458 2755
 
2459
-                            $geodir_odd_even = '';
2460
-                            if ($fields_location == 'detail') {
2756
+						break;
2461 2757
 
2462
-                                $geodir_odd_even = 'geodir_more_info_odd';
2463
-                                if ($i % 2 == 0)
2464
-                                    $geodir_odd_even = 'geodir_more_info_even';
2465 2758
 
2466
-                                $i++;
2467
-                            }
2759
+					case 'multiselect':
2468 2760
 
2469
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
2470
-                                $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2471
-                            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . $post->{$type['htmlvar_name']} . '</a></div>';
2761
+						$html_var = $type['htmlvar_name'];
2472 2762
 
2473
-                        endif;
2763
+						if (!empty($post->{$type['htmlvar_name']})):
2474 2764
 
2475
-                        break;
2765
+							if (is_array($post->{$type['htmlvar_name']})) {
2766
+								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2767
+							}
2476 2768
 
2477
-                    case 'time':
2769
+							if (strpos($field_icon, 'http') !== false) {
2770
+								$field_icon_af = '';
2771
+							} elseif ($field_icon == '') {
2772
+								$field_icon_af = '';
2773
+							} else {
2774
+								$field_icon_af = $field_icon;
2775
+								$field_icon = '';
2776
+							}
2478 2777
 
2479
-                        $html_var = $type['htmlvar_name'];
2778
+							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2480 2779
 
2481
-                        if ($post->{$type['htmlvar_name']}):
2780
+							$option_values = array();
2781
+							if (!empty($type['option_values'])) {
2782
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2482 2783
 
2483
-                            $value = '';
2484
-                            if ($post->{$type['htmlvar_name']} != '')
2485
-                                //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2486
-                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2784
+								if (!empty($cf_option_values)) {
2785
+									foreach ($cf_option_values as $cf_option_value) {
2786
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2787
+											$option_values[] = $cf_option_value['label'];
2788
+										}
2789
+									}
2790
+								}
2791
+							}
2487 2792
 
2488
-                            if (strpos($field_icon, 'http') !== false) {
2489
-                                $field_icon_af = '';
2490
-                            } elseif ($field_icon == '') {
2491
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2492
-                            } else {
2493
-                                $field_icon_af = $field_icon;
2494
-                                $field_icon = '';
2495
-                            }
2793
+							$geodir_odd_even = '';
2794
+							if ($fields_location == 'detail') {
2496 2795
 
2497
-                            $geodir_odd_even = '';
2498
-                            if ($fields_location == 'detail') {
2796
+								$geodir_odd_even = 'geodir_more_info_odd';
2797
+								if ($i % 2 == 0)
2798
+									$geodir_odd_even = 'geodir_more_info_even';
2499 2799
 
2500
-                                $geodir_odd_even = 'geodir_more_info_odd';
2501
-                                if ($i % 2 == 0)
2502
-                                    $geodir_odd_even = 'geodir_more_info_even';
2800
+								$i++;
2801
+							}
2503 2802
 
2504
-                                $i++;
2505
-                            }
2803
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2804
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2805
+							$html .= '</span>';
2506 2806
 
2507
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2508
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2509
-                            $html .= '</span>' . $value . '</div>';
2807
+							if (count($option_values) > 1) {
2808
+								$html .= '<ul>';
2510 2809
 
2511
-                        endif;
2810
+								foreach ($option_values as $val) {
2811
+									$html .= '<li>' . $val . '</li>';
2812
+								}
2512 2813
 
2513
-                        break;
2814
+								$html .= '</ul>';
2815
+							} else {
2816
+								$html .= $post->{$type['htmlvar_name']};
2817
+							}
2514 2818
 
2515
-                    case 'datepicker':
2819
+							$html .= '</div>';
2820
+						endif;
2821
+						break;
2822
+					case 'email':
2823
+						$html_var = $type['htmlvar_name'];
2824
+						if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2825
+							continue; // Remove Send Enquiry | Send To Friend from listings page
2826
+						}
2827
+
2828
+						if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2829
+							$send_to_friend = true;
2830
+							$b_send_inquiry = '';
2831
+							$b_sendtofriend = '';
2832
+
2833
+							$html = '';
2834
+							if (!$preview) {
2835
+								$b_send_inquiry = 'b_send_inquiry';
2836
+								$b_sendtofriend = 'b_sendtofriend';
2837
+								$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
2838
+							}
2516 2839
 
2517
-                        if ($post->{$type['htmlvar_name']}):
2840
+							if (strpos($field_icon, 'http') !== false) {
2841
+								$field_icon_af = '';
2842
+							} elseif ($field_icon == '') {
2843
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2844
+							} else {
2845
+								$field_icon_af = $field_icon;
2846
+								$field_icon = '';
2847
+							}
2518 2848
 
2519
-                            $date_format = geodir_default_date_format();
2520
-                            if ($type['extra_fields'] != '') {
2521
-                                $date_format = unserialize($type['extra_fields']);
2522
-                                $date_format = $date_format['date_format'];
2523
-                            }
2849
+							$geodir_odd_even = '';
2850
+							if ($fields_location == 'detail') {
2524 2851
 
2525
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2526
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2852
+								$geodir_odd_even = 'geodir_more_info_odd';
2853
+								if ($i % 2 == 0)
2854
+									$geodir_odd_even = 'geodir_more_info_even';
2527 2855
 
2528
-                            $date_format = str_replace($search, $replace, $date_format);
2856
+								$i++;
2857
+							}
2529 2858
 
2530
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2859
+							$html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2860
+							$seperator = '';
2861
+							if ($post->{$type['htmlvar_name']}) {
2862
+								$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
2863
+								$seperator = ' | ';
2864
+							}
2531 2865
 
2532
-                            $value = '';
2533
-                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2534
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2535
-                            }else{
2536
-                                continue;
2537
-                            }
2866
+							if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
2867
+								$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
2868
+							}
2869
+
2870
+							$html .= '</span></div>';
2871
+
2872
+
2873
+							if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
2874
+								$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
2875
+							} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
2876
+								$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
2877
+							} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
2878
+								$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
2879
+							}
2538 2880
 
2539
-                            if (strpos($field_icon, 'http') !== false) {
2540
-                                $field_icon_af = '';
2541
-                            } elseif ($field_icon == '') {
2542
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2543
-                            } else {
2544
-                                $field_icon_af = $field_icon;
2545
-                                $field_icon = '';
2546
-                            }
2881
+							/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
2547 2882
 
2548
-                            $geodir_odd_even = '';
2549
-                            if ($fields_location == 'detail') {
2883
+						} else {
2550 2884
 
2551
-                                $geodir_odd_even = 'geodir_more_info_odd';
2552
-                                if ($i % 2 == 0)
2553
-                                    $geodir_odd_even = 'geodir_more_info_even';
2885
+							if ($post->{$type['htmlvar_name']}) {
2886
+								if (strpos($field_icon, 'http') !== false) {
2887
+									$field_icon_af = '';
2888
+								} elseif ($field_icon == '') {
2889
+									$field_icon_af = '<i class="fa fa-envelope"></i>';
2890
+								} else {
2891
+									$field_icon_af = $field_icon;
2892
+									$field_icon = '';
2893
+								}
2894
+
2895
+								$geodir_odd_even = '';
2896
+								if ($fields_location == 'detail') {
2554 2897
 
2555
-                                $i++;
2556
-                            }
2898
+									$geodir_odd_even = 'geodir_more_info_odd';
2899
+									if ($i % 2 == 0)
2900
+										$geodir_odd_even = 'geodir_more_info_even';
2557 2901
 
2558
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2559
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2560
-                            $html .= '</span>' . $value . '</div>';
2902
+									$i++;
2903
+								}
2561 2904
 
2562
-                        endif;
2905
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2906
+								$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2907
+								$html .= '</span><span class="geodir-email-address-output">';
2908
+								$email = $post->{$type['htmlvar_name']} ;
2909
+								if($e_split = explode('@',$email)){
2910
+									/**
2911
+									 * Filter email custom field name output.
2912
+									 *
2913
+									 * @since 1.5.3
2914
+									 *
2915
+									 * @param string $email The email string being output.
2916
+									 * @param array $type Custom field variables array.
2917
+									 */
2918
+									$email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2919
+									$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2920
+								}else{
2921
+									$html .=  $email;
2922
+								}
2923
+								$html .= '</span></div>';
2924
+							}
2563 2925
 
2564
-                        break;
2926
+						}
2565 2927
 
2566
-                    case 'text':
2928
+						break;
2567 2929
 
2568
-                        $html_var = $type['htmlvar_name'];
2569 2930
 
2570
-                        if (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']} != '' && $type['htmlvar_name'] == 'geodir_timing'):
2931
+					case 'file':
2571 2932
 
2572
-                            if (strpos($field_icon, 'http') !== false) {
2573
-                                $field_icon_af = '';
2574
-                            } elseif ($field_icon == '') {
2575
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2576
-                            } else {
2577
-                                $field_icon_af = $field_icon;
2578
-                                $field_icon = '';
2579
-                            }
2933
+						$html_var = $type['htmlvar_name'];
2580 2934
 
2581
-                            $geodir_odd_even = '';
2582
-                            if ($fields_location == 'detail') {
2935
+						if (!empty($post->{$type['htmlvar_name']})):
2583 2936
 
2584
-                                $geodir_odd_even = 'geodir_more_info_odd';
2585
-                                if ($i % 2 == 0)
2586
-                                    $geodir_odd_even = 'geodir_more_info_even';
2937
+							$files = explode(",", $post->{$type['htmlvar_name']});
2938
+							if (!empty($files)):
2587 2939
 
2588
-                                $i++;
2589
-                            }
2940
+								$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2941
+								$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'] : '';
2590 2942
 
2591
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2592
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '&nbsp;';
2593
-                            $html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
2943
+								$file_paths = '';
2944
+								foreach ($files as $file) {
2945
+									if (!empty($file)) {
2594 2946
 
2595
-                        elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
2947
+										// $filetype = wp_check_filetype($file);
2596 2948
 
2597
-                            if (strpos($field_icon, 'http') !== false) {
2598
-                                $field_icon_af = '';
2599
-                            } elseif ($field_icon == '') {
2600
-                                $field_icon_af = '';
2601
-                            } else {
2602
-                                $field_icon_af = $field_icon;
2603
-                                $field_icon = '';
2604
-                            }
2949
+										$image_name_arr = explode('/', $file);
2950
+										$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2951
+										$filename = end($image_name_arr);
2952
+										$img_name_arr = explode('.', $filename);
2953
+
2954
+										$arr_file_type = wp_check_filetype($filename);
2955
+										if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2956
+											continue;
2957
+										}
2958
+
2959
+										$uploaded_file_type = $arr_file_type['type'];
2960
+										$uploaded_file_ext = $arr_file_type['ext'];
2961
+
2962
+										if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2963
+											continue; // Invalid file type.
2964
+										}
2965
+
2966
+										//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2967
+										$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2968
+
2969
+										// If the uploaded file is image
2970
+										if (in_array($uploaded_file_type, $image_file_types)) {
2971
+											$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2972
+											$file_paths .= '<a href="'.$file.'">';
2973
+											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2974
+											$file_paths .= '</a>';
2975
+											//$file_paths .= '<img src="'.$file.'"  />';	
2976
+											$file_paths .= '</div>';
2977
+										} else {
2978
+											$ext_path = '_' . $html_var . '_';
2979
+											$filename = explode($ext_path, $filename);
2980
+											$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2981
+										}
2982
+									}
2983
+								}
2984
+
2985
+								if (strpos($field_icon, 'http') !== false) {
2986
+									$field_icon_af = '';
2987
+								} elseif ($field_icon == '') {
2988
+									$field_icon_af = '';
2989
+								} else {
2990
+									$field_icon_af = $field_icon;
2991
+									$field_icon = '';
2992
+								}
2605 2993
 
2606
-                            $geodir_odd_even = '';
2607
-                            if ($fields_location == 'detail') {
2994
+								$geodir_odd_even = '';
2995
+								if ($fields_location == 'detail') {
2608 2996
 
2609
-                                $geodir_odd_even = 'geodir_more_info_odd';
2610
-                                if ($i % 2 == 0)
2611
-                                    $geodir_odd_even = 'geodir_more_info_even';
2997
+									$geodir_odd_even = 'geodir_more_info_odd';
2998
+									if ($i % 2 == 0)
2999
+										$geodir_odd_even = 'geodir_more_info_even';
3000
+
3001
+									$i++;
3002
+								}
3003
+
3004
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
3005
+								$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
3006
+								$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3007
+								$html .= '</span>';
3008
+								$html .= $file_paths . '</div></div>';
3009
+
3010
+							endif;
3011
+						endif;
3012
+
3013
+						break;
3014
+
3015
+					case 'textarea':
3016
+						$html_var = $type['htmlvar_name'];
3017
+
3018
+						if (!empty($post->{$type['htmlvar_name']})) {
3019
+
3020
+							if (strpos($field_icon, 'http') !== false) {
3021
+								$field_icon_af = '';
3022
+							} elseif ($field_icon == '') {
3023
+								$field_icon_af = '';
3024
+							} else {
3025
+								$field_icon_af = $field_icon;
3026
+								$field_icon = '';
3027
+							}
3028
+
3029
+							$geodir_odd_even = '';
3030
+							if ($fields_location == 'detail') {
3031
+
3032
+								$geodir_odd_even = 'geodir_more_info_odd';
3033
+								if ($i % 2 == 0)
3034
+									$geodir_odd_even = 'geodir_more_info_even';
3035
+
3036
+								$i++;
3037
+							}
3038
+
3039
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
3040
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3041
+							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
3042
+
3043
+						}
3044
+						break;
3045
+
3046
+					case 'html':
3047
+						if (!empty($post->{$type['htmlvar_name']})) {
3048
+
3049
+							if (strpos($field_icon, 'http') !== false) {
3050
+								$field_icon_af = '';
3051
+							} elseif ($field_icon == '') {
3052
+								$field_icon_af = '';
3053
+							} else {
3054
+								$field_icon_af = $field_icon;
3055
+								$field_icon = '';
3056
+							}
3057
+
3058
+							$geodir_odd_even = '';
3059
+							if ($fields_location == 'detail') {
3060
+
3061
+								$geodir_odd_even = 'geodir_more_info_odd';
3062
+								if ($i % 2 == 0)
3063
+									$geodir_odd_even = 'geodir_more_info_even';
3064
+
3065
+								$i++;
3066
+							}
3067
+
3068
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
3069
+							$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3070
+							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
3071
+
3072
+						}
3073
+						break;
3074
+					case 'taxonomy': {
3075
+						$html_var = $type['htmlvar_name'];
3076
+						if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
3077
+							$post_taxonomy = $post->post_type . 'category';
3078
+							$field_value = $post->{$html_var};
3079
+							$links = array();
3080
+							$terms = array();
3081
+							$termsOrdered = array();
3082
+							if (!is_array($field_value)) {
3083
+								$field_value = explode(",", trim($field_value, ","));
3084
+							}
3085
+
3086
+							$field_value = array_unique($field_value);
3087
+
3088
+							if (!empty($field_value)) {
3089
+								foreach ($field_value as $term) {
3090
+									$term = trim($term);
3091
+
3092
+									if ($term != '') {
3093
+										$term = get_term_by('id', $term, $html_var);
3094
+										if (is_object($term)) {
3095
+											$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
3096
+											$terms[] = $term;
3097
+										}
3098
+									}
3099
+								}
3100
+								if (!empty($links)) {
3101
+									// order alphabetically
3102
+									asort($links);
3103
+									foreach (array_keys($links) as $key) {
3104
+										$termsOrdered[$key] = $terms[$key];
3105
+									}
3106
+									$terms = $termsOrdered;
3107
+								}
3108
+							}
3109
+							$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
3110
+
3111
+							if ($html_value != '') {
3112
+								if (strpos($field_icon, 'http') !== false) {
3113
+									$field_icon_af = '';
3114
+								} else if ($field_icon == '') {
3115
+									$field_icon_af = '';
3116
+								} else {
3117
+									$field_icon_af = $field_icon;
3118
+									$field_icon = '';
3119
+								}
3120
+
3121
+								$geodir_odd_even = '';
3122
+								if ($fields_location == 'detail') {
3123
+									$geodir_odd_even = 'geodir_more_info_odd';
3124
+									if ($i % 2 == 0) {
3125
+										$geodir_odd_even = 'geodir_more_info_even';
3126
+									}
3127
+									$i++;
3128
+								}
3129
+
3130
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
3131
+								$html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3132
+								$html .= '</span> ' . $html_value . '</div>';
3133
+							}
3134
+						}
3135
+					}
3136
+						break;
2612 3137
 
2613
-                                $i++;
2614
-                            }
3138
+				}
2615 3139
 
2616
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2617
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2618
-                            $html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
3140
+				if ($html):
2619 3141
 
2620
-                        endif;
3142
+					/**
3143
+					 * Called before a custom fields is output on the frontend.
3144
+					 *
3145
+					 * @since 1.0.0
3146
+					 * @param string $html_var The HTML variable name for the field.
3147
+					 */
3148
+					do_action("geodir_before_show_{$html_var}");
3149
+					/**
3150
+					 * Filter custom field output.
3151
+					 *
3152
+					 * @since 1.0.0
3153
+					 *
3154
+					 * @param string $html_var The HTML variable name for the field.
3155
+					 * @param string $html Custom field unfiltered HTML.
3156
+					 * @param array $variables_array Custom field variables array.
3157
+					 */
3158
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
2621 3159
 
2622
-                        break;
3160
+					/**
3161
+					 * Called after a custom fields is output on the frontend.
3162
+					 *
3163
+					 * @since 1.0.0
3164
+					 * @param string $html_var The HTML variable name for the field.
3165
+					 */
3166
+					do_action("geodir_after_show_{$html_var}");
2623 3167
 
2624
-                    case 'radio':
3168
+				endif;
2625 3169
 
2626
-                        $html_var = $type['htmlvar_name'];
2627
-                        if(!isset($post->{$type['htmlvar_name']})){continue;}
2628
-                        $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2629
-                        if ($post->{$type['htmlvar_name']} != ''):
2630
-
2631
-                            if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2632
-                                $html_val = __('No', 'geodirectory');
2633
-                            } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2634
-                                $html_val = __('Yes', 'geodirectory');
2635
-                            } else {
2636
-                                if (!empty($type['option_values'])) {
2637
-                                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2638
-
2639
-                                    if (!empty($cf_option_values)) {
2640
-                                        foreach ($cf_option_values as $cf_option_value) {
2641
-                                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2642
-                                                $html_val = $cf_option_value['label'];
2643
-                                            }
2644
-                                        }
2645
-                                    }
2646
-                                }
2647
-                            }
2648
-
2649
-                            if (strpos($field_icon, 'http') !== false) {
2650
-                                $field_icon_af = '';
2651
-                            } elseif ($field_icon == '') {
2652
-                                $field_icon_af = '';
2653
-                            } else {
2654
-                                $field_icon_af = $field_icon;
2655
-                                $field_icon = '';
2656
-                            }
3170
+			}
2657 3171
 
2658
-                            $geodir_odd_even = '';
2659
-                            if ($fields_location == 'detail') {
3172
+			//echo '</div>';
2660 3173
 
2661
-                                $geodir_odd_even = 'geodir_more_info_odd';
2662
-                                if ($i % 2 == 0)
2663
-                                    $geodir_odd_even = 'geodir_more_info_even';
3174
+		}
2664 3175
 
2665
-                                $i++;
2666
-                            }
2667 3176
 
2668
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2669
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2670
-                            $html .= '</span>' . $html_val . '</div>';
2671
-                        endif;
2672
-
2673
-                        break;
2674
-
2675
-                    case 'checkbox':
2676
-
2677
-                        $html_var = $type['htmlvar_name'];
2678
-
2679
-                        if ((int)$post->{$html_var} == 1):
3177
+		return $html = ob_get_clean();
2680 3178
 
2681
-                            if ($post->{$type['htmlvar_name']} == '1'):
2682
-                                $html_val = __('Yes', 'geodirectory');
2683
-                            else:
2684
-                                $html_val = __('No', 'geodirectory');
2685
-                            endif;
2686
-
2687
-                            if (strpos($field_icon, 'http') !== false) {
2688
-                                $field_icon_af = '';
2689
-                            } elseif ($field_icon == '') {
2690
-                                $field_icon_af = '';
2691
-                            } else {
2692
-                                $field_icon_af = $field_icon;
2693
-                                $field_icon = '';
2694
-                            }
2695
-
2696
-                            $geodir_odd_even = '';
2697
-                            if ($fields_location == 'detail') {
2698
-
2699
-                                $geodir_odd_even = 'geodir_more_info_odd';
2700
-                                if ($i % 2 == 0)
2701
-                                    $geodir_odd_even = 'geodir_more_info_even';
2702
-
2703
-                                $i++;
2704
-                            }
2705
-
2706
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2707
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2708
-                            $html .= '</span>' . $html_val . '</div>';
2709
-                        endif;
2710
-
2711
-                        break;
2712
-
2713
-                    case 'select':
2714
-
2715
-                        $html_var = $type['htmlvar_name'];
2716
-                        if(!isset($post->{$type['htmlvar_name']})){continue;}
2717
-                        if ($post->{$type['htmlvar_name']}):
2718
-                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2719
-
2720
-                            if (!empty($type['option_values'])) {
2721
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2722
-
2723
-                                if (!empty($cf_option_values)) {
2724
-                                    foreach ($cf_option_values as $cf_option_value) {
2725
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2726
-                                            //$field_value = $cf_option_value['label']; // no longer needed here.
2727
-                                        }
2728
-                                    }
2729
-                                }
2730
-                            }
2731
-
2732
-                            if (strpos($field_icon, 'http') !== false) {
2733
-                                $field_icon_af = '';
2734
-                            } elseif ($field_icon == '') {
2735
-                                $field_icon_af = '';
2736
-                            } else {
2737
-                                $field_icon_af = $field_icon;
2738
-                                $field_icon = '';
2739
-                            }
2740
-
2741
-                            $geodir_odd_even = '';
2742
-                            if ($fields_location == 'detail') {
2743
-
2744
-                                $geodir_odd_even = 'geodir_more_info_odd';
2745
-                                if ($i % 2 == 0)
2746
-                                    $geodir_odd_even = 'geodir_more_info_even';
2747
-
2748
-                                $i++;
2749
-                            }
2750
-
2751
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2752
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2753
-                            $html .= '</span>' . $field_value . '</div>';
2754
-                        endif;
2755
-
2756
-                        break;
2757
-
2758
-
2759
-                    case 'multiselect':
2760
-
2761
-                        $html_var = $type['htmlvar_name'];
2762
-
2763
-                        if (!empty($post->{$type['htmlvar_name']})):
2764
-
2765
-                            if (is_array($post->{$type['htmlvar_name']})) {
2766
-                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2767
-                            }
2768
-
2769
-                            if (strpos($field_icon, 'http') !== false) {
2770
-                                $field_icon_af = '';
2771
-                            } elseif ($field_icon == '') {
2772
-                                $field_icon_af = '';
2773
-                            } else {
2774
-                                $field_icon_af = $field_icon;
2775
-                                $field_icon = '';
2776
-                            }
2777
-
2778
-                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2779
-
2780
-                            $option_values = array();
2781
-                            if (!empty($type['option_values'])) {
2782
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2783
-
2784
-                                if (!empty($cf_option_values)) {
2785
-                                    foreach ($cf_option_values as $cf_option_value) {
2786
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2787
-                                            $option_values[] = $cf_option_value['label'];
2788
-                                        }
2789
-                                    }
2790
-                                }
2791
-                            }
2792
-
2793
-                            $geodir_odd_even = '';
2794
-                            if ($fields_location == 'detail') {
2795
-
2796
-                                $geodir_odd_even = 'geodir_more_info_odd';
2797
-                                if ($i % 2 == 0)
2798
-                                    $geodir_odd_even = 'geodir_more_info_even';
2799
-
2800
-                                $i++;
2801
-                            }
2802
-
2803
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2804
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2805
-                            $html .= '</span>';
2806
-
2807
-                            if (count($option_values) > 1) {
2808
-                                $html .= '<ul>';
2809
-
2810
-                                foreach ($option_values as $val) {
2811
-                                    $html .= '<li>' . $val . '</li>';
2812
-                                }
2813
-
2814
-                                $html .= '</ul>';
2815
-                            } else {
2816
-                                $html .= $post->{$type['htmlvar_name']};
2817
-                            }
2818
-
2819
-                            $html .= '</div>';
2820
-                        endif;
2821
-                        break;
2822
-                    case 'email':
2823
-                        $html_var = $type['htmlvar_name'];
2824
-                        if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2825
-                            continue; // Remove Send Enquiry | Send To Friend from listings page
2826
-                        }
2827
-
2828
-                        if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2829
-                            $send_to_friend = true;
2830
-                            $b_send_inquiry = '';
2831
-                            $b_sendtofriend = '';
2832
-
2833
-                            $html = '';
2834
-                            if (!$preview) {
2835
-                                $b_send_inquiry = 'b_send_inquiry';
2836
-                                $b_sendtofriend = 'b_sendtofriend';
2837
-                                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
2838
-                            }
2839
-
2840
-                            if (strpos($field_icon, 'http') !== false) {
2841
-                                $field_icon_af = '';
2842
-                            } elseif ($field_icon == '') {
2843
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2844
-                            } else {
2845
-                                $field_icon_af = $field_icon;
2846
-                                $field_icon = '';
2847
-                            }
2848
-
2849
-                            $geodir_odd_even = '';
2850
-                            if ($fields_location == 'detail') {
2851
-
2852
-                                $geodir_odd_even = 'geodir_more_info_odd';
2853
-                                if ($i % 2 == 0)
2854
-                                    $geodir_odd_even = 'geodir_more_info_even';
2855
-
2856
-                                $i++;
2857
-                            }
2858
-
2859
-                            $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2860
-                            $seperator = '';
2861
-                            if ($post->{$type['htmlvar_name']}) {
2862
-                                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
2863
-                                $seperator = ' | ';
2864
-                            }
2865
-
2866
-                            if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
2867
-                                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
2868
-                            }
2869
-
2870
-                            $html .= '</span></div>';
2871
-
2872
-
2873
-                            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
2874
-                                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
2875
-                            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
2876
-                                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
2877
-                            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
2878
-                                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
2879
-                            }
2880
-
2881
-                            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
2882
-
2883
-                        } else {
2884
-
2885
-                            if ($post->{$type['htmlvar_name']}) {
2886
-                                if (strpos($field_icon, 'http') !== false) {
2887
-                                    $field_icon_af = '';
2888
-                                } elseif ($field_icon == '') {
2889
-                                    $field_icon_af = '<i class="fa fa-envelope"></i>';
2890
-                                } else {
2891
-                                    $field_icon_af = $field_icon;
2892
-                                    $field_icon = '';
2893
-                                }
2894
-
2895
-                                $geodir_odd_even = '';
2896
-                                if ($fields_location == 'detail') {
2897
-
2898
-                                    $geodir_odd_even = 'geodir_more_info_odd';
2899
-                                    if ($i % 2 == 0)
2900
-                                        $geodir_odd_even = 'geodir_more_info_even';
2901
-
2902
-                                    $i++;
2903
-                                }
2904
-
2905
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2906
-                                $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2907
-                                $html .= '</span><span class="geodir-email-address-output">';
2908
-                                $email = $post->{$type['htmlvar_name']} ;
2909
-                                if($e_split = explode('@',$email)){
2910
-                                    /**
2911
-                                     * Filter email custom field name output.
2912
-                                     *
2913
-                                     * @since 1.5.3
2914
-                                     *
2915
-                                     * @param string $email The email string being output.
2916
-                                     * @param array $type Custom field variables array.
2917
-                                     */
2918
-                                    $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2919
-                                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2920
-                                }else{
2921
-                                    $html .=  $email;
2922
-                                }
2923
-                                $html .= '</span></div>';
2924
-                            }
2925
-
2926
-                        }
2927
-
2928
-                        break;
2929
-
2930
-
2931
-                    case 'file':
2932
-
2933
-                        $html_var = $type['htmlvar_name'];
2934
-
2935
-                        if (!empty($post->{$type['htmlvar_name']})):
2936
-
2937
-                            $files = explode(",", $post->{$type['htmlvar_name']});
2938
-                            if (!empty($files)):
2939
-
2940
-                                $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2941
-                                $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'] : '';
2942
-
2943
-                                $file_paths = '';
2944
-                                foreach ($files as $file) {
2945
-                                    if (!empty($file)) {
2946
-
2947
-                                        // $filetype = wp_check_filetype($file);
2948
-
2949
-                                        $image_name_arr = explode('/', $file);
2950
-                                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2951
-                                        $filename = end($image_name_arr);
2952
-                                        $img_name_arr = explode('.', $filename);
2953
-
2954
-                                        $arr_file_type = wp_check_filetype($filename);
2955
-                                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2956
-                                            continue;
2957
-                                        }
2958
-
2959
-                                        $uploaded_file_type = $arr_file_type['type'];
2960
-                                        $uploaded_file_ext = $arr_file_type['ext'];
2961
-
2962
-                                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2963
-                                            continue; // Invalid file type.
2964
-                                        }
2965
-
2966
-                                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2967
-                                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2968
-
2969
-                                        // If the uploaded file is image
2970
-                                        if (in_array($uploaded_file_type, $image_file_types)) {
2971
-                                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2972
-                                            $file_paths .= '<a href="'.$file.'">';
2973
-                                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2974
-                                            $file_paths .= '</a>';
2975
-                                            //$file_paths .= '<img src="'.$file.'"  />';	
2976
-                                            $file_paths .= '</div>';
2977
-                                        } else {
2978
-                                            $ext_path = '_' . $html_var . '_';
2979
-                                            $filename = explode($ext_path, $filename);
2980
-                                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2981
-                                        }
2982
-                                    }
2983
-                                }
2984
-
2985
-                                if (strpos($field_icon, 'http') !== false) {
2986
-                                    $field_icon_af = '';
2987
-                                } elseif ($field_icon == '') {
2988
-                                    $field_icon_af = '';
2989
-                                } else {
2990
-                                    $field_icon_af = $field_icon;
2991
-                                    $field_icon = '';
2992
-                                }
2993
-
2994
-                                $geodir_odd_even = '';
2995
-                                if ($fields_location == 'detail') {
2996
-
2997
-                                    $geodir_odd_even = 'geodir_more_info_odd';
2998
-                                    if ($i % 2 == 0)
2999
-                                        $geodir_odd_even = 'geodir_more_info_even';
3000
-
3001
-                                    $i++;
3002
-                                }
3003
-
3004
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
3005
-                                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
3006
-                                $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3007
-                                $html .= '</span>';
3008
-                                $html .= $file_paths . '</div></div>';
3009
-
3010
-                            endif;
3011
-                        endif;
3012
-
3013
-                        break;
3014
-
3015
-                    case 'textarea':
3016
-                        $html_var = $type['htmlvar_name'];
3017
-
3018
-                        if (!empty($post->{$type['htmlvar_name']})) {
3019
-
3020
-                            if (strpos($field_icon, 'http') !== false) {
3021
-                                $field_icon_af = '';
3022
-                            } elseif ($field_icon == '') {
3023
-                                $field_icon_af = '';
3024
-                            } else {
3025
-                                $field_icon_af = $field_icon;
3026
-                                $field_icon = '';
3027
-                            }
3028
-
3029
-                            $geodir_odd_even = '';
3030
-                            if ($fields_location == 'detail') {
3031
-
3032
-                                $geodir_odd_even = 'geodir_more_info_odd';
3033
-                                if ($i % 2 == 0)
3034
-                                    $geodir_odd_even = 'geodir_more_info_even';
3035
-
3036
-                                $i++;
3037
-                            }
3038
-
3039
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
3040
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3041
-                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
3042
-
3043
-                        }
3044
-                        break;
3045
-
3046
-                    case 'html':
3047
-                        if (!empty($post->{$type['htmlvar_name']})) {
3048
-
3049
-                            if (strpos($field_icon, 'http') !== false) {
3050
-                                $field_icon_af = '';
3051
-                            } elseif ($field_icon == '') {
3052
-                                $field_icon_af = '';
3053
-                            } else {
3054
-                                $field_icon_af = $field_icon;
3055
-                                $field_icon = '';
3056
-                            }
3057
-
3058
-                            $geodir_odd_even = '';
3059
-                            if ($fields_location == 'detail') {
3060
-
3061
-                                $geodir_odd_even = 'geodir_more_info_odd';
3062
-                                if ($i % 2 == 0)
3063
-                                    $geodir_odd_even = 'geodir_more_info_even';
3064
-
3065
-                                $i++;
3066
-                            }
3067
-
3068
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
3069
-                            $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3070
-                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
3071
-
3072
-                        }
3073
-                        break;
3074
-                    case 'taxonomy': {
3075
-                        $html_var = $type['htmlvar_name'];
3076
-                        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
3077
-                            $post_taxonomy = $post->post_type . 'category';
3078
-                            $field_value = $post->{$html_var};
3079
-                            $links = array();
3080
-                            $terms = array();
3081
-                            $termsOrdered = array();
3082
-                            if (!is_array($field_value)) {
3083
-                                $field_value = explode(",", trim($field_value, ","));
3084
-                            }
3085
-
3086
-                            $field_value = array_unique($field_value);
3087
-
3088
-                            if (!empty($field_value)) {
3089
-                                foreach ($field_value as $term) {
3090
-                                    $term = trim($term);
3091
-
3092
-                                    if ($term != '') {
3093
-                                        $term = get_term_by('id', $term, $html_var);
3094
-                                        if (is_object($term)) {
3095
-                                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
3096
-                                            $terms[] = $term;
3097
-                                        }
3098
-                                    }
3099
-                                }
3100
-                                if (!empty($links)) {
3101
-                                    // order alphabetically
3102
-                                    asort($links);
3103
-                                    foreach (array_keys($links) as $key) {
3104
-                                        $termsOrdered[$key] = $terms[$key];
3105
-                                    }
3106
-                                    $terms = $termsOrdered;
3107
-                                }
3108
-                            }
3109
-                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
3110
-
3111
-                            if ($html_value != '') {
3112
-                                if (strpos($field_icon, 'http') !== false) {
3113
-                                    $field_icon_af = '';
3114
-                                } else if ($field_icon == '') {
3115
-                                    $field_icon_af = '';
3116
-                                } else {
3117
-                                    $field_icon_af = $field_icon;
3118
-                                    $field_icon = '';
3119
-                                }
3120
-
3121
-                                $geodir_odd_even = '';
3122
-                                if ($fields_location == 'detail') {
3123
-                                    $geodir_odd_even = 'geodir_more_info_odd';
3124
-                                    if ($i % 2 == 0) {
3125
-                                        $geodir_odd_even = 'geodir_more_info_even';
3126
-                                    }
3127
-                                    $i++;
3128
-                                }
3129
-
3130
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
3131
-                                $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
3132
-                                $html .= '</span> ' . $html_value . '</div>';
3133
-                            }
3134
-                        }
3135
-                    }
3136
-                        break;
3137
-
3138
-                }
3139
-
3140
-                if ($html):
3141
-
3142
-                    /**
3143
-                     * Called before a custom fields is output on the frontend.
3144
-                     *
3145
-                     * @since 1.0.0
3146
-                     * @param string $html_var The HTML variable name for the field.
3147
-                     */
3148
-                    do_action("geodir_before_show_{$html_var}");
3149
-                    /**
3150
-                     * Filter custom field output.
3151
-                     *
3152
-                     * @since 1.0.0
3153
-                     *
3154
-                     * @param string $html_var The HTML variable name for the field.
3155
-                     * @param string $html Custom field unfiltered HTML.
3156
-                     * @param array $variables_array Custom field variables array.
3157
-                     */
3158
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3159
-
3160
-                    /**
3161
-                     * Called after a custom fields is output on the frontend.
3162
-                     *
3163
-                     * @since 1.0.0
3164
-                     * @param string $html_var The HTML variable name for the field.
3165
-                     */
3166
-                    do_action("geodir_after_show_{$html_var}");
3167
-
3168
-                endif;
3169
-
3170
-            }
3171
-
3172
-            //echo '</div>';
3173
-
3174
-        }
3175
-
3176
-
3177
-        return $html = ob_get_clean();
3178
-
3179
-    }
3179
+	}
3180 3180
 }
3181 3181
 
3182 3182
 if (!function_exists('geodir_default_date_format')) {
3183
-    /**
3184
-     * Returns default date format.
3185
-     *
3186
-     * @since 1.0.0
3187
-     * @package GeoDirectory
3188
-     * @return mixed|string|void Returns default date format.
3189
-     */
3190
-    function geodir_default_date_format()
3191
-    {
3192
-        if ($format = get_option('date_format'))
3193
-            return $format;
3194
-        else
3195
-            return 'dd-mm-yy';
3196
-    }
3183
+	/**
3184
+	 * Returns default date format.
3185
+	 *
3186
+	 * @since 1.0.0
3187
+	 * @package GeoDirectory
3188
+	 * @return mixed|string|void Returns default date format.
3189
+	 */
3190
+	function geodir_default_date_format()
3191
+	{
3192
+		if ($format = get_option('date_format'))
3193
+			return $format;
3194
+		else
3195
+			return 'dd-mm-yy';
3196
+	}
3197 3197
 }
3198 3198
 
3199 3199
 if (!function_exists('geodir_get_formated_date')) {
3200
-    /**
3201
-     * Returns formatted date.
3202
-     *
3203
-     * @since 1.0.0
3204
-     * @package GeoDirectory
3205
-     * @param string $date Date string to convert.
3206
-     * @return bool|int|string Returns formatted date.
3207
-     */
3208
-    function geodir_get_formated_date($date)
3209
-    {
3210
-        return mysql2date(get_option('date_format'), $date);
3211
-    }
3200
+	/**
3201
+	 * Returns formatted date.
3202
+	 *
3203
+	 * @since 1.0.0
3204
+	 * @package GeoDirectory
3205
+	 * @param string $date Date string to convert.
3206
+	 * @return bool|int|string Returns formatted date.
3207
+	 */
3208
+	function geodir_get_formated_date($date)
3209
+	{
3210
+		return mysql2date(get_option('date_format'), $date);
3211
+	}
3212 3212
 }
3213 3213
 
3214 3214
 if (!function_exists('geodir_get_formated_time')) {
3215
-    /**
3216
-     * Returns formatted time.
3217
-     *
3218
-     * @since 1.0.0
3219
-     * @package GeoDirectory
3220
-     * @param string $time Time string to convert.
3221
-     * @return bool|int|string Returns formatted time.
3222
-     */
3223
-    function geodir_get_formated_time($time)
3224
-    {
3225
-        return mysql2date(get_option('time_format'), $time, $translate = true);
3226
-    }
3215
+	/**
3216
+	 * Returns formatted time.
3217
+	 *
3218
+	 * @since 1.0.0
3219
+	 * @package GeoDirectory
3220
+	 * @param string $time Time string to convert.
3221
+	 * @return bool|int|string Returns formatted time.
3222
+	 */
3223
+	function geodir_get_formated_time($time)
3224
+	{
3225
+		return mysql2date(get_option('time_format'), $time, $translate = true);
3226
+	}
3227 3227
 }
3228 3228
 
3229 3229
 
3230 3230
 if (!function_exists('geodir_save_post_file_fields')) {
3231
-    /**
3232
-     * Save post file fields
3233
-     *
3234
-     * @since 1.0.0
3235
-     * @since 1.4.7 Added `$extra_fields` parameter.
3236
-     * @package GeoDirectory
3237
-     * @global object $wpdb WordPress Database object.
3238
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
3239
-     * @global object $current_user Current user object.
3240
-     * @param int $post_id
3241
-     * @param string $field_id
3242
-     * @param array $post_image
3243
-     * @param array $extra_fields Array of extra fields.
3244
-     */
3245
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3246
-    {
3231
+	/**
3232
+	 * Save post file fields
3233
+	 *
3234
+	 * @since 1.0.0
3235
+	 * @since 1.4.7 Added `$extra_fields` parameter.
3236
+	 * @package GeoDirectory
3237
+	 * @global object $wpdb WordPress Database object.
3238
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
3239
+	 * @global object $current_user Current user object.
3240
+	 * @param int $post_id
3241
+	 * @param string $field_id
3242
+	 * @param array $post_image
3243
+	 * @param array $extra_fields Array of extra fields.
3244
+	 */
3245
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3246
+	{
3247 3247
 
3248
-        global $wpdb, $plugin_prefix, $current_user;
3248
+		global $wpdb, $plugin_prefix, $current_user;
3249 3249
 
3250
-        $post_type = get_post_type($post_id);
3251
-        //echo $field_id; exit;
3252
-        $table = $plugin_prefix . $post_type . '_detail';
3250
+		$post_type = get_post_type($post_id);
3251
+		//echo $field_id; exit;
3252
+		$table = $plugin_prefix . $post_type . '_detail';
3253 3253
 
3254
-        $postcurr_images = array();
3255
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
3256
-        $file_urls = '';
3254
+		$postcurr_images = array();
3255
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
3256
+		$file_urls = '';
3257 3257
 
3258
-        if (!empty($post_image)) {
3258
+		if (!empty($post_image)) {
3259 3259
 
3260
-            $invalid_files = array();
3260
+			$invalid_files = array();
3261 3261
 
3262
-            //Get and remove all old images of post from database to set by new order
3263
-            $geodir_uploaddir = '';
3264
-            $uploads = wp_upload_dir();
3265
-            $uploads_dir = $uploads['path'];
3262
+			//Get and remove all old images of post from database to set by new order
3263
+			$geodir_uploaddir = '';
3264
+			$uploads = wp_upload_dir();
3265
+			$uploads_dir = $uploads['path'];
3266 3266
 
3267
-            $geodir_uploadpath = $uploads['path'];
3268
-            $geodir_uploadurl = $uploads['url'];
3269
-            $sub_dir = $uploads['subdir'];
3267
+			$geodir_uploadpath = $uploads['path'];
3268
+			$geodir_uploadurl = $uploads['url'];
3269
+			$sub_dir = $uploads['subdir'];
3270 3270
 
3271
-            $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'] : '';
3271
+			$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'] : '';
3272 3272
 
3273
-            for ($m = 0; $m < count($post_image); $m++) {
3273
+			for ($m = 0; $m < count($post_image); $m++) {
3274 3274
 
3275
-                /* --------- start ------- */
3275
+				/* --------- start ------- */
3276 3276
 
3277
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
3277
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
3278 3278
 
3279 3279
 
3280
-                    $curr_img_url = $post_image[$m];
3281
-                    $image_name_arr = explode('/', $curr_img_url);
3282
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
3283
-                    $filename = end($image_name_arr);
3284
-                    $img_name_arr = explode('.', $filename);
3280
+					$curr_img_url = $post_image[$m];
3281
+					$image_name_arr = explode('/', $curr_img_url);
3282
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
3283
+					$filename = end($image_name_arr);
3284
+					$img_name_arr = explode('.', $filename);
3285 3285
 
3286
-                    $arr_file_type = wp_check_filetype($filename);
3286
+					$arr_file_type = wp_check_filetype($filename);
3287 3287
 
3288
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3289
-                        continue;
3290
-                    }
3288
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3289
+						continue;
3290
+					}
3291 3291
 
3292
-                    $uploaded_file_type = $arr_file_type['type'];
3293
-                    $uploaded_file_ext = $arr_file_type['ext'];
3292
+					$uploaded_file_type = $arr_file_type['type'];
3293
+					$uploaded_file_ext = $arr_file_type['ext'];
3294 3294
 
3295
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3296
-                        continue; // Invalid file type.
3297
-                    }
3295
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3296
+						continue; // Invalid file type.
3297
+					}
3298 3298
 
3299
-                    // Set an array containing a list of acceptable formats
3300
-                    //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
3299
+					// Set an array containing a list of acceptable formats
3300
+					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
3301 3301
 
3302
-                    if (!function_exists('wp_handle_upload'))
3303
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
3302
+					if (!function_exists('wp_handle_upload'))
3303
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
3304 3304
 
3305
-                    if (!is_dir($geodir_uploadpath))
3306
-                        mkdir($geodir_uploadpath);
3305
+					if (!is_dir($geodir_uploadpath))
3306
+						mkdir($geodir_uploadpath);
3307 3307
 
3308
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3309
-                    $explode_sub_dir = explode("/", $sub_dir);
3310
-                    if ($curr_img_dir == end($explode_sub_dir)) {
3311
-                        $img_path = $geodir_uploadpath . '/' . $filename;
3312
-                        $img_url = $geodir_uploadurl . '/' . $filename;
3313
-                    } else {
3314
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3315
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3316
-                    }
3308
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3309
+					$explode_sub_dir = explode("/", $sub_dir);
3310
+					if ($curr_img_dir == end($explode_sub_dir)) {
3311
+						$img_path = $geodir_uploadpath . '/' . $filename;
3312
+						$img_url = $geodir_uploadurl . '/' . $filename;
3313
+					} else {
3314
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3315
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3316
+					}
3317 3317
 
3318
-                    $uploaded_file = '';
3319
-                    if (file_exists($img_path))
3320
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3318
+					$uploaded_file = '';
3319
+					if (file_exists($img_path))
3320
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3321 3321
 
3322
-                    if ($curr_img_dir != $geodir_uploaddir) {
3323
-                        if (file_exists($img_path))
3324
-                            unlink($img_path);
3325
-                    }
3322
+					if ($curr_img_dir != $geodir_uploaddir) {
3323
+						if (file_exists($img_path))
3324
+							unlink($img_path);
3325
+					}
3326 3326
 
3327
-                    if (!empty($uploaded_file))
3328
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
3327
+					if (!empty($uploaded_file))
3328
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
3329 3329
 
3330
-                } else {
3331
-                    $file_urls = $post_image[$m];
3332
-                }
3333
-            }
3330
+				} else {
3331
+					$file_urls = $post_image[$m];
3332
+				}
3333
+			}
3334 3334
 
3335 3335
 
3336
-        }
3336
+		}
3337 3337
 
3338
-        //Remove all old attachments and temp images
3339
-        if (!empty($postcurr_images)) {
3338
+		//Remove all old attachments and temp images
3339
+		if (!empty($postcurr_images)) {
3340 3340
 
3341
-            if ($file_urls != $postcurr_images) {
3342
-                $invalid_files[] = (object)array('src' => $postcurr_images);
3343
-                $invalid_files = (object)$invalid_files;
3344
-            }
3345
-        }
3341
+			if ($file_urls != $postcurr_images) {
3342
+				$invalid_files[] = (object)array('src' => $postcurr_images);
3343
+				$invalid_files = (object)$invalid_files;
3344
+			}
3345
+		}
3346 3346
 
3347
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
3347
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
3348 3348
 
3349
-        if (!empty($invalid_files))
3350
-            geodir_remove_attachments($invalid_files);
3349
+		if (!empty($invalid_files))
3350
+			geodir_remove_attachments($invalid_files);
3351 3351
 
3352
-    }
3352
+	}
3353 3353
 }
3354 3354
 
3355 3355
 
@@ -3364,76 +3364,76 @@  discard block
 block discarded – undo
3364 3364
  */
3365 3365
 function geodir_custom_upload_mimes($existing_mimes = array())
3366 3366
 {
3367
-    $existing_mimes['wif'] = 'text/plain';
3368
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
3369
-    $existing_mimes['gif'] = 'image/gif';
3370
-    $existing_mimes['png'] = 'image/png';
3371
-    $existing_mimes['pdf'] = 'application/pdf';
3372
-    $existing_mimes['txt'] = 'text/text';
3373
-    $existing_mimes['csv'] = 'application/octet-stream';
3374
-    $existing_mimes['doc'] = 'application/msword';
3375
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
3376
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
3377
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
3378
-    return $existing_mimes;
3367
+	$existing_mimes['wif'] = 'text/plain';
3368
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
3369
+	$existing_mimes['gif'] = 'image/gif';
3370
+	$existing_mimes['png'] = 'image/png';
3371
+	$existing_mimes['pdf'] = 'application/pdf';
3372
+	$existing_mimes['txt'] = 'text/text';
3373
+	$existing_mimes['csv'] = 'application/octet-stream';
3374
+	$existing_mimes['doc'] = 'application/msword';
3375
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
3376
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
3377
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
3378
+	return $existing_mimes;
3379 3379
 }
3380 3380
 
3381 3381
 if (!function_exists('geodir_plupload_action')) {
3382 3382
 
3383
-    /**
3384
-     * Get upload directory path details
3385
-     *
3386
-     * @since 1.0.0
3387
-     * @package GeoDirectory
3388
-     * @global object $current_user Current user object.
3389
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3390
-     * @return mixed Returns upload directory details as an array.
3391
-     */
3392
-    function geodir_upload_dir($upload)
3393
-    {
3394
-        global $current_user;
3395
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
3396
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
3397
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
3398
-        return $upload;
3399
-    }
3400
-
3401
-    /**
3402
-     * Handles place file and image upload.
3403
-     *
3404
-     * @since 1.0.0
3405
-     * @package GeoDirectory
3406
-     */
3407
-    function geodir_plupload_action()
3408
-    {
3409
-        // check ajax noonce
3410
-        $imgid = $_POST["imgid"];
3411
-
3412
-        check_ajax_referer($imgid . 'pluploadan');
3413
-
3414
-        // handle custom file uploaddir
3415
-        add_filter('upload_dir', 'geodir_upload_dir');
3416
-
3417
-        // change file orinetation if needed
3418
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
3419
-
3420
-        // handle file upload
3421
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
3422
-        // remove handle custom file uploaddir
3423
-        remove_filter('upload_dir', 'geodir_upload_dir');
3424
-
3425
-        if(!isset($status['url']) && isset($status['error'])){
3426
-            print_r($status);
3427
-        }
3428
-
3429
-        // send the uploaded file url in response
3430
-        if (isset($status['url'])) {
3431
-            echo $status['url'];
3432
-        } else {
3433
-            echo 'x';
3434
-        }
3435
-        exit;
3436
-    }
3383
+	/**
3384
+	 * Get upload directory path details
3385
+	 *
3386
+	 * @since 1.0.0
3387
+	 * @package GeoDirectory
3388
+	 * @global object $current_user Current user object.
3389
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3390
+	 * @return mixed Returns upload directory details as an array.
3391
+	 */
3392
+	function geodir_upload_dir($upload)
3393
+	{
3394
+		global $current_user;
3395
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
3396
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
3397
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
3398
+		return $upload;
3399
+	}
3400
+
3401
+	/**
3402
+	 * Handles place file and image upload.
3403
+	 *
3404
+	 * @since 1.0.0
3405
+	 * @package GeoDirectory
3406
+	 */
3407
+	function geodir_plupload_action()
3408
+	{
3409
+		// check ajax noonce
3410
+		$imgid = $_POST["imgid"];
3411
+
3412
+		check_ajax_referer($imgid . 'pluploadan');
3413
+
3414
+		// handle custom file uploaddir
3415
+		add_filter('upload_dir', 'geodir_upload_dir');
3416
+
3417
+		// change file orinetation if needed
3418
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
3419
+
3420
+		// handle file upload
3421
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
3422
+		// remove handle custom file uploaddir
3423
+		remove_filter('upload_dir', 'geodir_upload_dir');
3424
+
3425
+		if(!isset($status['url']) && isset($status['error'])){
3426
+			print_r($status);
3427
+		}
3428
+
3429
+		// send the uploaded file url in response
3430
+		if (isset($status['url'])) {
3431
+			echo $status['url'];
3432
+		} else {
3433
+			echo 'x';
3434
+		}
3435
+		exit;
3436
+	}
3437 3437
 }
3438 3438
 
3439 3439
 /**
@@ -3448,17 +3448,17 @@  discard block
 block discarded – undo
3448 3448
  */
3449 3449
 function geodir_get_video($post_id)
3450 3450
 {
3451
-    global $wpdb, $plugin_prefix;
3451
+	global $wpdb, $plugin_prefix;
3452 3452
 
3453
-    $post_type = get_post_type($post_id);
3453
+	$post_type = get_post_type($post_id);
3454 3454
 
3455
-    $table = $plugin_prefix . $post_type . '_detail';
3455
+	$table = $plugin_prefix . $post_type . '_detail';
3456 3456
 
3457
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
3457
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
3458 3458
 
3459
-    if ($results) {
3460
-        return $results[0]->geodir_video;
3461
-    }
3459
+	if ($results) {
3460
+		return $results[0]->geodir_video;
3461
+	}
3462 3462
 
3463 3463
 }
3464 3464
 
@@ -3474,40 +3474,40 @@  discard block
 block discarded – undo
3474 3474
  */
3475 3475
 function geodir_get_special_offers($post_id)
3476 3476
 {
3477
-    global $wpdb, $plugin_prefix;
3477
+	global $wpdb, $plugin_prefix;
3478 3478
 
3479
-    $post_type = get_post_type($post_id);
3479
+	$post_type = get_post_type($post_id);
3480 3480
 
3481
-    $table = $plugin_prefix . $post_type . '_detail';
3481
+	$table = $plugin_prefix . $post_type . '_detail';
3482 3482
 
3483
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
3483
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
3484 3484
 
3485
-    if ($results) {
3486
-        return $results[0]->geodir_special_offers;
3487
-    }
3485
+	if ($results) {
3486
+		return $results[0]->geodir_special_offers;
3487
+	}
3488 3488
 
3489 3489
 }
3490 3490
 
3491 3491
 if (!function_exists('geodir_max_upload_size')) {
3492
-    /**
3493
-     * Get max upload file size
3494
-     *
3495
-     * @since 1.0.0
3496
-     * @package GeoDirectory
3497
-     * @return mixed|void Returns max upload file size.
3498
-     */
3499
-    function geodir_max_upload_size()
3500
-    {
3501
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3502
-
3503
-        if ($max_filesize > 0 && $max_filesize < 1) {
3504
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
3505
-        } else {
3506
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
3507
-        }
3508
-        /** Filter documented in geodirectory-functions/general_functions.php **/
3509
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
3510
-    }
3492
+	/**
3493
+	 * Get max upload file size
3494
+	 *
3495
+	 * @since 1.0.0
3496
+	 * @package GeoDirectory
3497
+	 * @return mixed|void Returns max upload file size.
3498
+	 */
3499
+	function geodir_max_upload_size()
3500
+	{
3501
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3502
+
3503
+		if ($max_filesize > 0 && $max_filesize < 1) {
3504
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
3505
+		} else {
3506
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
3507
+		}
3508
+		/** Filter documented in geodirectory-functions/general_functions.php **/
3509
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
3510
+	}
3511 3511
 }
3512 3512
 
3513 3513
 
@@ -3525,33 +3525,33 @@  discard block
 block discarded – undo
3525 3525
  */
3526 3526
 function geodir_add_custom_sort_options($fields, $post_type)
3527 3527
 {
3528
-    global $wpdb;
3528
+	global $wpdb;
3529 3529
 
3530
-    if ($post_type != '') {
3530
+	if ($post_type != '') {
3531 3531
 
3532
-        $all_postypes = geodir_get_posttypes();
3532
+		$all_postypes = geodir_get_posttypes();
3533 3533
 
3534
-        if (in_array($post_type, $all_postypes)) {
3534
+		if (in_array($post_type, $all_postypes)) {
3535 3535
 
3536
-            $custom_fields = $wpdb->get_results(
3537
-                $wpdb->prepare(
3538
-                    "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
3539
-                    array($post_type)
3540
-                ), 'ARRAY_A'
3541
-            );
3536
+			$custom_fields = $wpdb->get_results(
3537
+				$wpdb->prepare(
3538
+					"select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
3539
+					array($post_type)
3540
+				), 'ARRAY_A'
3541
+			);
3542 3542
 
3543
-            if (!empty($custom_fields)) {
3543
+			if (!empty($custom_fields)) {
3544 3544
 
3545
-                foreach ($custom_fields as $val) {
3546
-                    $fields[] = $val;
3547
-                }
3548
-            }
3545
+				foreach ($custom_fields as $val) {
3546
+					$fields[] = $val;
3547
+				}
3548
+			}
3549 3549
 
3550
-        }
3550
+		}
3551 3551
 
3552
-    }
3552
+	}
3553 3553
 
3554
-    return $fields;
3554
+	return $fields;
3555 3555
 }
3556 3556
 
3557 3557
 
@@ -3567,66 +3567,66 @@  discard block
 block discarded – undo
3567 3567
 function geodir_get_custom_sort_options($post_type = '')
3568 3568
 {
3569 3569
 
3570
-    global $wpdb;
3571
-
3572
-    if ($post_type != '') {
3573
-
3574
-        $all_postypes = geodir_get_posttypes();
3575
-
3576
-        if (!in_array($post_type, $all_postypes))
3577
-            return false;
3578
-
3579
-        $fields = array();
3580
-
3581
-        $fields[] = array(
3582
-            'post_type' => $post_type,
3583
-            'data_type' => '',
3584
-            'field_type' => 'random',
3585
-            'site_title' => 'Random',
3586
-            'htmlvar_name' => 'post_title'
3587
-        );
3588
-
3589
-        $fields[] = array(
3590
-            'post_type' => $post_type,
3591
-            'data_type' => '',
3592
-            'field_type' => 'datetime',
3593
-            'site_title' => __('Add date', 'geodirectory'),
3594
-            'htmlvar_name' => 'post_date'
3595
-        );
3596
-        $fields[] = array(
3597
-            'post_type' => $post_type,
3598
-            'data_type' => '',
3599
-            'field_type' => 'bigint',
3600
-            'site_title' => __('Review', 'geodirectory'),
3601
-            'htmlvar_name' => 'comment_count'
3602
-        );
3603
-        $fields[] = array(
3604
-            'post_type' => $post_type,
3605
-            'data_type' => '',
3606
-            'field_type' => 'float',
3607
-            'site_title' => __('Rating', 'geodirectory'),
3608
-            'htmlvar_name' => 'overall_rating'
3609
-        );
3610
-        $fields[] = array(
3611
-            'post_type' => $post_type,
3612
-            'data_type' => '',
3613
-            'field_type' => 'text',
3614
-            'site_title' => __('Title', 'geodirectory'),
3615
-            'htmlvar_name' => 'post_title'
3616
-        );
3617
-
3618
-        /**
3619
-         * Hook to add custom sort options.
3620
-         *
3621
-         * @since 1.0.0
3622
-         * @param array $fields Unmodified sort options array.
3623
-         * @param string $post_type Post type.
3624
-         */
3625
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
3626
-
3627
-    }
3628
-
3629
-    return false;
3570
+	global $wpdb;
3571
+
3572
+	if ($post_type != '') {
3573
+
3574
+		$all_postypes = geodir_get_posttypes();
3575
+
3576
+		if (!in_array($post_type, $all_postypes))
3577
+			return false;
3578
+
3579
+		$fields = array();
3580
+
3581
+		$fields[] = array(
3582
+			'post_type' => $post_type,
3583
+			'data_type' => '',
3584
+			'field_type' => 'random',
3585
+			'site_title' => 'Random',
3586
+			'htmlvar_name' => 'post_title'
3587
+		);
3588
+
3589
+		$fields[] = array(
3590
+			'post_type' => $post_type,
3591
+			'data_type' => '',
3592
+			'field_type' => 'datetime',
3593
+			'site_title' => __('Add date', 'geodirectory'),
3594
+			'htmlvar_name' => 'post_date'
3595
+		);
3596
+		$fields[] = array(
3597
+			'post_type' => $post_type,
3598
+			'data_type' => '',
3599
+			'field_type' => 'bigint',
3600
+			'site_title' => __('Review', 'geodirectory'),
3601
+			'htmlvar_name' => 'comment_count'
3602
+		);
3603
+		$fields[] = array(
3604
+			'post_type' => $post_type,
3605
+			'data_type' => '',
3606
+			'field_type' => 'float',
3607
+			'site_title' => __('Rating', 'geodirectory'),
3608
+			'htmlvar_name' => 'overall_rating'
3609
+		);
3610
+		$fields[] = array(
3611
+			'post_type' => $post_type,
3612
+			'data_type' => '',
3613
+			'field_type' => 'text',
3614
+			'site_title' => __('Title', 'geodirectory'),
3615
+			'htmlvar_name' => 'post_title'
3616
+		);
3617
+
3618
+		/**
3619
+		 * Hook to add custom sort options.
3620
+		 *
3621
+		 * @since 1.0.0
3622
+		 * @param array $fields Unmodified sort options array.
3623
+		 * @param string $post_type Post type.
3624
+		 */
3625
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
3626
+
3627
+	}
3628
+
3629
+	return false;
3630 3630
 }
3631 3631
 
3632 3632
 
@@ -3642,117 +3642,117 @@  discard block
 block discarded – undo
3642 3642
 function godir_set_sort_field_order($field_ids = array())
3643 3643
 {
3644 3644
 
3645
-    global $wpdb;
3645
+	global $wpdb;
3646 3646
 
3647
-    $count = 0;
3648
-    if (!empty($field_ids)):
3649
-        foreach ($field_ids as $id) {
3647
+	$count = 0;
3648
+	if (!empty($field_ids)):
3649
+		foreach ($field_ids as $id) {
3650 3650
 
3651
-            $cf = trim($id, '_');
3651
+			$cf = trim($id, '_');
3652 3652
 
3653
-            $post_meta_info = $wpdb->query(
3654
-                $wpdb->prepare(
3655
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
3653
+			$post_meta_info = $wpdb->query(
3654
+				$wpdb->prepare(
3655
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
3656 3656
 															sort_order=%d 
3657 3657
 															where id= %d",
3658
-                    array($count, $cf)
3659
-                )
3660
-            );
3661
-            $count++;
3662
-        }
3663
-
3664
-        return $field_ids;
3665
-    else:
3666
-        return false;
3667
-    endif;
3658
+					array($count, $cf)
3659
+				)
3660
+			);
3661
+			$count++;
3662
+		}
3663
+
3664
+		return $field_ids;
3665
+	else:
3666
+		return false;
3667
+	endif;
3668 3668
 }
3669 3669
 
3670 3670
 
3671 3671
 if (!function_exists('geodir_custom_sort_field_save')) {
3672
-    /**
3673
-     * Save or Update custom sort fields into the database.
3674
-     *
3675
-     * @since 1.0.0
3676
-     * @package GeoDirectory
3677
-     * @global object $wpdb WordPress Database object.
3678
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
3679
-     * @param array $request_field {
3680
-     *    Attributes of the Request field.
3681
-     *
3682
-     *    @type string $action Ajax action name.
3683
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
3684
-     *    @type string $create_field Do you want to create this field?.
3685
-     *    @type string $field_ins_upd Field created or updated?.
3686
-     *    @type string $_wpnonce Nonce value.
3687
-     *    @type string $listing_type The Post type.
3688
-     *    @type string $field_type Field Type.
3689
-     *    @type string $field_id Field ID.
3690
-     *    @type string $data_type Data Type.
3691
-     *    @type string $htmlvar_name HTML variable name.
3692
-     *    @type string $site_title Section title which you wish to display in frontend.
3693
-     *    @type string $is_default Is this default sorting?.
3694
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
3695
-     *    @type string $sort_order Sort Order.
3696
-     *
3697
-     * }
3698
-     * @param bool $default Not yet implemented.
3699
-     * @return int Returns the last affected db table row id.
3700
-     */
3701
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
3702
-    {
3703
-
3704
-        global $wpdb, $plugin_prefix;
3705
-
3706
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
3707
-
3708
-        $cf = trim($result_str, '_');
3709
-
3710
-        /*-------- check dublicate validation --------*/
3711
-
3712
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
3713
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
3714
-
3715
-        $post_type = $request_field['listing_type'];
3716
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
3717
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
3718
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
3719
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
3720
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
3721
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
3722
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
3723
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
3724
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
3725
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
3726
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
3727
-
3728
-        $default_order = '';
3729
-        if ($is_default != '') {
3730
-            $default_order = $is_default;
3731
-            $is_default = '1';
3732
-        }
3733
-
3734
-
3735
-        $check_html_variable = $wpdb->get_var(
3736
-            $wpdb->prepare(
3737
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
3738
-                array($cehhtmlvar_name, $post_type, $field_type)
3739
-            )
3740
-        );
3741
-
3742
-        if ($is_default == 1) {
3743
-
3744
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
3745
-
3746
-        }
3747
-
3748
-
3749
-        if (!$check_html_variable) {
3750
-
3751
-            $wpdb->query(
3752
-
3753
-                $wpdb->prepare(
3754
-
3755
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
3672
+	/**
3673
+	 * Save or Update custom sort fields into the database.
3674
+	 *
3675
+	 * @since 1.0.0
3676
+	 * @package GeoDirectory
3677
+	 * @global object $wpdb WordPress Database object.
3678
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
3679
+	 * @param array $request_field {
3680
+	 *    Attributes of the Request field.
3681
+	 *
3682
+	 *    @type string $action Ajax action name.
3683
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
3684
+	 *    @type string $create_field Do you want to create this field?.
3685
+	 *    @type string $field_ins_upd Field created or updated?.
3686
+	 *    @type string $_wpnonce Nonce value.
3687
+	 *    @type string $listing_type The Post type.
3688
+	 *    @type string $field_type Field Type.
3689
+	 *    @type string $field_id Field ID.
3690
+	 *    @type string $data_type Data Type.
3691
+	 *    @type string $htmlvar_name HTML variable name.
3692
+	 *    @type string $site_title Section title which you wish to display in frontend.
3693
+	 *    @type string $is_default Is this default sorting?.
3694
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
3695
+	 *    @type string $sort_order Sort Order.
3696
+	 *
3697
+	 * }
3698
+	 * @param bool $default Not yet implemented.
3699
+	 * @return int Returns the last affected db table row id.
3700
+	 */
3701
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
3702
+	{
3703
+
3704
+		global $wpdb, $plugin_prefix;
3705
+
3706
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
3707
+
3708
+		$cf = trim($result_str, '_');
3709
+
3710
+		/*-------- check dublicate validation --------*/
3711
+
3712
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
3713
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
3714
+
3715
+		$post_type = $request_field['listing_type'];
3716
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
3717
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
3718
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
3719
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
3720
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
3721
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
3722
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
3723
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
3724
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
3725
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
3726
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
3727
+
3728
+		$default_order = '';
3729
+		if ($is_default != '') {
3730
+			$default_order = $is_default;
3731
+			$is_default = '1';
3732
+		}
3733
+
3734
+
3735
+		$check_html_variable = $wpdb->get_var(
3736
+			$wpdb->prepare(
3737
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
3738
+				array($cehhtmlvar_name, $post_type, $field_type)
3739
+			)
3740
+		);
3741
+
3742
+		if ($is_default == 1) {
3743
+
3744
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
3745
+
3746
+		}
3747
+
3748
+
3749
+		if (!$check_html_variable) {
3750
+
3751
+			$wpdb->query(
3752
+
3753
+				$wpdb->prepare(
3754
+
3755
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
3756 3756
 				post_type = %s,
3757 3757
 				data_type = %s,
3758 3758
 				field_type = %s,
@@ -3767,23 +3767,23 @@  discard block
 block discarded – undo
3767 3767
 				asc_title = %s,
3768 3768
 				desc_title = %s",
3769 3769
 
3770
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
3771
-                )
3770
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)
3771
+				)
3772 3772
 
3773
-            );
3773
+			);
3774 3774
 
3775 3775
 
3776
-            $lastid = $wpdb->insert_id;
3776
+			$lastid = $wpdb->insert_id;
3777 3777
 
3778
-            $lastid = trim($lastid);
3778
+			$lastid = trim($lastid);
3779 3779
 
3780
-        } else {
3780
+		} else {
3781 3781
 
3782
-            $wpdb->query(
3782
+			$wpdb->query(
3783 3783
 
3784
-                $wpdb->prepare(
3784
+				$wpdb->prepare(
3785 3785
 
3786
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
3786
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
3787 3787
 				post_type = %s,
3788 3788
 				data_type = %s,
3789 3789
 				field_type = %s,
@@ -3799,115 +3799,115 @@  discard block
 block discarded – undo
3799 3799
 				desc_title = %s
3800 3800
 				where id = %d",
3801 3801
 
3802
-                    array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
3803
-                )
3802
+					array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)
3803
+				)
3804 3804
 
3805
-            );
3805
+			);
3806 3806
 
3807
-            $lastid = trim($cf);
3807
+			$lastid = trim($cf);
3808 3808
 
3809
-        }
3809
+		}
3810 3810
 
3811 3811
 
3812
-        return (int)$lastid;
3812
+		return (int)$lastid;
3813 3813
 
3814
-    }
3814
+	}
3815 3815
 }
3816 3816
 
3817 3817
 
3818 3818
 if (!function_exists('geodir_custom_sort_field_delete')) {
3819
-    /**
3820
-     * Delete a custom sort field using field id.
3821
-     * @since 1.0.0
3822
-     * @package GeoDirectory
3823
-     * @global object $wpdb WordPress Database object.
3824
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
3825
-     * @param string $field_id The field ID.
3826
-     * @return int|string Returns field id when successful deletion, else returns 0.
3827
-     */
3828
-    function geodir_custom_sort_field_delete($field_id = '')
3829
-    {
3830
-
3831
-        global $wpdb, $plugin_prefix;
3832
-        if ($field_id != '') {
3833
-            $cf = trim($field_id, '_');
3834
-
3835
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
3836
-
3837
-            return $field_id;
3838
-
3839
-        } else
3840
-            return 0;
3841
-
3842
-    }
3819
+	/**
3820
+	 * Delete a custom sort field using field id.
3821
+	 * @since 1.0.0
3822
+	 * @package GeoDirectory
3823
+	 * @global object $wpdb WordPress Database object.
3824
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
3825
+	 * @param string $field_id The field ID.
3826
+	 * @return int|string Returns field id when successful deletion, else returns 0.
3827
+	 */
3828
+	function geodir_custom_sort_field_delete($field_id = '')
3829
+	{
3830
+
3831
+		global $wpdb, $plugin_prefix;
3832
+		if ($field_id != '') {
3833
+			$cf = trim($field_id, '_');
3834
+
3835
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
3836
+
3837
+			return $field_id;
3838
+
3839
+		} else
3840
+			return 0;
3841
+
3842
+	}
3843 3843
 }
3844 3844
 
3845 3845
 
3846 3846
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
3847
-    /**
3848
-     * Custom sort field admin html.
3849
-     *
3850
-     * @since 1.0.0
3851
-     * @package GeoDirectory
3852
-     * @global object $wpdb WordPress Database object.
3853
-     * @param string $field_type The form field type.
3854
-     * @param object|int $result_str The custom field results object or row id.
3855
-     * @param string $field_ins_upd When set to "submit" displays form.
3856
-     * @param bool $default when set to true field will be for admin use only.
3857
-     */
3858
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3859
-    {
3860
-        global $wpdb;
3861
-        $cf = $result_str;
3862
-        if (!is_object($cf)) {
3863
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
3864
-        } else {
3865
-            $field_info = $cf;
3866
-            $result_str = $cf->id;
3867
-        }
3868
-
3869
-        $field_info = stripslashes_deep($field_info); // strip slashes
3870
-
3871
-        if (!isset($field_info->post_type)) {
3872
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
3873
-        } else {
3874
-            $post_type = $field_info->post_type;
3875
-        }
3876
-
3877
-        $field_types = explode('-_-', $field_type);
3878
-        $field_type = $field_types[0];
3879
-        $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3880
-
3881
-        $site_title = '';
3882
-        if ($site_title == '')
3883
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
3884
-
3885
-        if ($site_title == '') {
3886
-            $fields = geodir_get_custom_sort_options($post_type);
3887
-
3888
-            foreach ($fields as $val) {
3889
-                $val = stripslashes_deep($val); // strip slashes
3890
-
3891
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
3892
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
3893
-                }
3894
-            }
3895
-        }
3896
-
3897
-        if ($htmlvar_name == '')
3898
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3899
-
3900
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
3901
-
3902
-        ?>
3847
+	/**
3848
+	 * Custom sort field admin html.
3849
+	 *
3850
+	 * @since 1.0.0
3851
+	 * @package GeoDirectory
3852
+	 * @global object $wpdb WordPress Database object.
3853
+	 * @param string $field_type The form field type.
3854
+	 * @param object|int $result_str The custom field results object or row id.
3855
+	 * @param string $field_ins_upd When set to "submit" displays form.
3856
+	 * @param bool $default when set to true field will be for admin use only.
3857
+	 */
3858
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3859
+	{
3860
+		global $wpdb;
3861
+		$cf = $result_str;
3862
+		if (!is_object($cf)) {
3863
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
3864
+		} else {
3865
+			$field_info = $cf;
3866
+			$result_str = $cf->id;
3867
+		}
3868
+
3869
+		$field_info = stripslashes_deep($field_info); // strip slashes
3870
+
3871
+		if (!isset($field_info->post_type)) {
3872
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
3873
+		} else {
3874
+			$post_type = $field_info->post_type;
3875
+		}
3876
+
3877
+		$field_types = explode('-_-', $field_type);
3878
+		$field_type = $field_types[0];
3879
+		$htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3880
+
3881
+		$site_title = '';
3882
+		if ($site_title == '')
3883
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
3884
+
3885
+		if ($site_title == '') {
3886
+			$fields = geodir_get_custom_sort_options($post_type);
3887
+
3888
+			foreach ($fields as $val) {
3889
+				$val = stripslashes_deep($val); // strip slashes
3890
+
3891
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
3892
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
3893
+				}
3894
+			}
3895
+		}
3896
+
3897
+		if ($htmlvar_name == '')
3898
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
3899
+
3900
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
3901
+
3902
+		?>
3903 3903
         <li class="text" id="licontainer_<?php echo $result_str;?>">
3904 3904
             <div class="title title<?php echo $result_str;?> gt-fieldset"
3905 3905
                  title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
3906 3906
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
3907 3907
                 <?php
3908 3908
 
3909
-                $nonce = wp_create_nonce('custom_fields_' . $result_str);
3910
-                ?>
3909
+				$nonce = wp_create_nonce('custom_fields_' . $result_str);
3910
+				?>
3911 3911
 
3912 3912
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
3913 3913
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -3920,17 +3920,17 @@  discard block
 block discarded – undo
3920 3920
 
3921 3921
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3922 3922
                  style="display:<?php if ($field_ins_upd == 'submit') {
3923
-                     echo 'block;';
3924
-                 } else {
3925
-                     echo 'none;';
3926
-                 } ?>">
3923
+					 echo 'block;';
3924
+				 } else {
3925
+					 echo 'none;';
3926
+				 } ?>">
3927 3927
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3928 3928
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3929 3929
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
3930 3930
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
3931 3931
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
3932
-                    echo $field_info->data_type;
3933
-                }?>"/>
3932
+					echo $field_info->data_type;
3933
+				}?>"/>
3934 3934
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
3935 3935
 
3936 3936
 
@@ -3945,19 +3945,19 @@  discard block
 block discarded – undo
3945 3945
                             <td>
3946 3946
                                 <input type="checkbox" name="asc" id="asc"
3947 3947
                                        value="1" <?php if (isset($field_info->sort_asc) && $field_info->sort_asc == '1') {
3948
-                                    echo 'checked="checked"';
3949
-                                } ?>/>
3948
+									echo 'checked="checked"';
3949
+								} ?>/>
3950 3950
 
3951 3951
                                 <input type="text" name="asc_title" id="asc_title"
3952 3952
                                        placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
3953 3953
                                        value="<?php if (isset($field_info->asc_title)) {
3954
-                                           echo esc_attr($field_info->asc_title);
3955
-                                       } ?>" style="width:45%;"/>
3954
+										   echo esc_attr($field_info->asc_title);
3955
+									   } ?>" style="width:45%;"/>
3956 3956
 
3957 3957
                                 <input type="radio" name="is_default"
3958 3958
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
3959
-                                    echo 'checked="checked"';
3960
-                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3959
+									echo 'checked="checked"';
3960
+								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3961 3961
 
3962 3962
                                 <br/>
3963 3963
                                 <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
@@ -3969,18 +3969,18 @@  discard block
 block discarded – undo
3969 3969
                             <td>
3970 3970
                                 <input type="checkbox" name="desc" id="desc"
3971 3971
                                        value="1" <?php if (isset($field_info->sort_desc) && $field_info->sort_desc == '1') {
3972
-                                    echo 'checked="checked"';
3973
-                                } ?>/>
3972
+									echo 'checked="checked"';
3973
+								} ?>/>
3974 3974
 
3975 3975
                                 <input type="text" name="desc_title" id="desc_title"
3976 3976
                                        placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
3977 3977
                                        value="<?php if (isset($field_info->desc_title)) {
3978
-                                           echo esc_attr($field_info->desc_title);
3979
-                                       } ?>" style="width:45%;"/>
3978
+										   echo esc_attr($field_info->desc_title);
3979
+									   } ?>" style="width:45%;"/>
3980 3980
                                 <input type="radio" name="is_default"
3981 3981
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
3982
-                                    echo 'checked="checked"';
3983
-                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3982
+									echo 'checked="checked"';
3983
+								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
3984 3984
                                 <br/>
3985 3985
                                 <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
3986 3986
                             </td>
@@ -4003,8 +4003,8 @@  discard block
 block discarded – undo
4003 4003
                             <td align="left">
4004 4004
                                 <input type="checkbox" name="is_default"
4005 4005
                                        value="<?php echo $field_type; ?>"  <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
4006
-                                    echo 'checked="checked"';
4007
-                                } ?>/>
4006
+									echo 'checked="checked"';
4007
+								} ?>/>
4008 4008
                                 <br/>
4009 4009
                                 <span><?php _e('If field is checked then the field will be use as default sort.', 'geodirectory'); ?></span>
4010 4010
                             </td>
@@ -4018,12 +4018,12 @@  discard block
 block discarded – undo
4018 4018
                             <select name="is_active" id="is_active">
4019 4019
                                 <option
4020 4020
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
4021
-                                    echo 'selected="selected"';
4022
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
4021
+									echo 'selected="selected"';
4022
+								}?>><?php _e('Yes', 'geodirectory');?></option>
4023 4023
                                 <option
4024 4024
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
4025
-                                    echo 'selected="selected"';
4026
-                                }?>><?php _e('No', 'geodirectory');?></option>
4025
+									echo 'selected="selected"';
4026
+								}?>><?php _e('No', 'geodirectory');?></option>
4027 4027
                             </select>
4028 4028
                             <br/>
4029 4029
                             <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
@@ -4034,8 +4034,8 @@  discard block
 block discarded – undo
4034 4034
                         <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
4035 4035
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
4036 4036
                                                 value="<?php if (isset($field_info->sort_order)) {
4037
-                                                    echo esc_attr($field_info->sort_order);
4038
-                                                }?>" size="50"/>
4037
+													echo esc_attr($field_info->sort_order);
4038
+												}?>" size="50"/>
4039 4039
                             <br/>
4040 4040
                             <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
4041 4041
                         </td>
@@ -4058,38 +4058,38 @@  discard block
 block discarded – undo
4058 4058
             </div>
4059 4059
         </li> <?php
4060 4060
 
4061
-    }
4061
+	}
4062 4062
 }
4063 4063
 
4064 4064
 if (!function_exists('check_field_visibility')) {
4065
-    /**
4066
-     * Check field visibility as per price package.
4067
-     *
4068
-     * @since 1.0.0
4069
-     * @package GeoDirectory
4070
-     * @global object $wpdb WordPress Database object.
4071
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
4072
-     * @param int|string $package_id The package ID.
4073
-     * @param string $field_name The field name.
4074
-     * @param string $post_type Optional. The wordpress post type.
4075
-     * @return bool Returns true when field visible, otherwise false.
4076
-     */
4077
-    function check_field_visibility($package_id, $field_name, $post_type)
4078
-    {
4079
-        global $wpdb, $geodir_addon_list;
4080
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
4081
-            return true;
4082
-        }
4083
-        if (!$package_id || !$field_name || !$post_type) {
4084
-            return true;
4085
-        }
4086
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
4087
-
4088
-        if ($wpdb->get_var($sql)) {
4089
-            return true;
4090
-        }
4091
-        return false;
4092
-    }
4065
+	/**
4066
+	 * Check field visibility as per price package.
4067
+	 *
4068
+	 * @since 1.0.0
4069
+	 * @package GeoDirectory
4070
+	 * @global object $wpdb WordPress Database object.
4071
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
4072
+	 * @param int|string $package_id The package ID.
4073
+	 * @param string $field_name The field name.
4074
+	 * @param string $post_type Optional. The wordpress post type.
4075
+	 * @return bool Returns true when field visible, otherwise false.
4076
+	 */
4077
+	function check_field_visibility($package_id, $field_name, $post_type)
4078
+	{
4079
+		global $wpdb, $geodir_addon_list;
4080
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
4081
+			return true;
4082
+		}
4083
+		if (!$package_id || !$field_name || !$post_type) {
4084
+			return true;
4085
+		}
4086
+		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
4087
+
4088
+		if ($wpdb->get_var($sql)) {
4089
+			return true;
4090
+		}
4091
+		return false;
4092
+	}
4093 4093
 }
4094 4094
 
4095 4095
 /**
@@ -4104,43 +4104,43 @@  discard block
 block discarded – undo
4104 4104
  */
4105 4105
 function geodir_string_to_options($input = '', $translated = false)
4106 4106
 {
4107
-    $return = array();
4108
-    if ($input != '') {
4109
-        $input = trim($input);
4110
-        $input = rtrim($input, ",");
4111
-        $input = ltrim($input, ",");
4112
-        $input = trim($input);
4113
-    }
4114
-
4115
-    $input_arr = explode(',', $input);
4116
-
4117
-    if (!empty($input_arr)) {
4118
-        foreach ($input_arr as $input_str) {
4119
-            $input_str = trim($input_str);
4120
-
4121
-            if (strpos($input_str, "/") !== false) {
4122
-                $input_str = explode("/", $input_str, 2);
4123
-                $label = trim($input_str[0]);
4124
-                if ($translated && $label != '') {
4125
-                    $label = __($label, 'geodirectory');
4126
-                }
4127
-                $label = ucfirst($label);
4128
-                $value = trim($input_str[1]);
4129
-            } else {
4130
-                if ($translated && $input_str != '') {
4131
-                    $input_str = __($input_str, 'geodirectory');
4132
-                }
4133
-                $label = ucfirst($input_str);
4134
-                $value = $input_str;
4135
-            }
4136
-
4137
-            if ($label != '') {
4138
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
4139
-            }
4140
-        }
4141
-    }
4142
-
4143
-    return $return;
4107
+	$return = array();
4108
+	if ($input != '') {
4109
+		$input = trim($input);
4110
+		$input = rtrim($input, ",");
4111
+		$input = ltrim($input, ",");
4112
+		$input = trim($input);
4113
+	}
4114
+
4115
+	$input_arr = explode(',', $input);
4116
+
4117
+	if (!empty($input_arr)) {
4118
+		foreach ($input_arr as $input_str) {
4119
+			$input_str = trim($input_str);
4120
+
4121
+			if (strpos($input_str, "/") !== false) {
4122
+				$input_str = explode("/", $input_str, 2);
4123
+				$label = trim($input_str[0]);
4124
+				if ($translated && $label != '') {
4125
+					$label = __($label, 'geodirectory');
4126
+				}
4127
+				$label = ucfirst($label);
4128
+				$value = trim($input_str[1]);
4129
+			} else {
4130
+				if ($translated && $input_str != '') {
4131
+					$input_str = __($input_str, 'geodirectory');
4132
+				}
4133
+				$label = ucfirst($input_str);
4134
+				$value = $input_str;
4135
+			}
4136
+
4137
+			if ($label != '') {
4138
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
4139
+			}
4140
+		}
4141
+	}
4142
+
4143
+	return $return;
4144 4144
 }
4145 4145
 
4146 4146
 /**
@@ -4155,51 +4155,51 @@  discard block
 block discarded – undo
4155 4155
  */
4156 4156
 function geodir_string_values_to_options($option_values = '', $translated = false)
4157 4157
 {
4158
-    $options = array();
4159
-    if ($option_values == '') {
4160
-        return NULL;
4161
-    }
4162
-
4163
-    if (strpos($option_values, "{/optgroup}") !== false) {
4164
-        $option_values_arr = explode("{/optgroup}", $option_values);
4165
-
4166
-        foreach ($option_values_arr as $optgroup) {
4167
-            if (strpos($optgroup, "{optgroup}") !== false) {
4168
-                $optgroup_arr = explode("{optgroup}", $optgroup);
4169
-
4170
-                $count = 0;
4171
-                foreach ($optgroup_arr as $optgroup_str) {
4172
-                    $count++;
4173
-                    $optgroup_str = trim($optgroup_str);
4174
-
4175
-                    $optgroup_label = '';
4176
-                    if (strpos($optgroup_str, "|") !== false) {
4177
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
4178
-                        $optgroup_label = trim($optgroup_str_arr[0]);
4179
-                        if ($translated && $optgroup_label != '') {
4180
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
4181
-                        }
4182
-                        $optgroup_label = ucfirst($optgroup_label);
4183
-                        $optgroup_str = $optgroup_str_arr[1];
4184
-                    }
4185
-
4186
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
4187
-
4188
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
4189
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
4190
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
4191
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
4192
-                    }
4193
-                    $options = array_merge($options, $optgroup3);
4194
-                }
4195
-            } else {
4196
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
4197
-                $options = array_merge($options, $optgroup1);
4198
-            }
4199
-        }
4200
-    } else {
4201
-        $options = geodir_string_to_options($option_values, $translated);
4202
-    }
4203
-
4204
-    return $options;
4158
+	$options = array();
4159
+	if ($option_values == '') {
4160
+		return NULL;
4161
+	}
4162
+
4163
+	if (strpos($option_values, "{/optgroup}") !== false) {
4164
+		$option_values_arr = explode("{/optgroup}", $option_values);
4165
+
4166
+		foreach ($option_values_arr as $optgroup) {
4167
+			if (strpos($optgroup, "{optgroup}") !== false) {
4168
+				$optgroup_arr = explode("{optgroup}", $optgroup);
4169
+
4170
+				$count = 0;
4171
+				foreach ($optgroup_arr as $optgroup_str) {
4172
+					$count++;
4173
+					$optgroup_str = trim($optgroup_str);
4174
+
4175
+					$optgroup_label = '';
4176
+					if (strpos($optgroup_str, "|") !== false) {
4177
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
4178
+						$optgroup_label = trim($optgroup_str_arr[0]);
4179
+						if ($translated && $optgroup_label != '') {
4180
+							$optgroup_label = __($optgroup_label, 'geodirectory');
4181
+						}
4182
+						$optgroup_label = ucfirst($optgroup_label);
4183
+						$optgroup_str = $optgroup_str_arr[1];
4184
+					}
4185
+
4186
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
4187
+
4188
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
4189
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
4190
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
4191
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
4192
+					}
4193
+					$options = array_merge($options, $optgroup3);
4194
+				}
4195
+			} else {
4196
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
4197
+				$options = array_merge($options, $optgroup1);
4198
+			}
4199
+		}
4200
+	} else {
4201
+		$options = geodir_string_to_options($option_values, $translated);
4202
+	}
4203
+
4204
+	return $options;
4205 4205
 }
4206 4206
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 1 patch
Indentation   +1494 added lines, -1494 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 virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function geodir_unset_prev_theme_nav_location($newname)
224 224
 {
225
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
-    if ($geodir_theme_location) {
227
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
228
-    } else {
229
-        update_option('geodir_theme_location_nav', '');
230
-    }
225
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
226
+	if ($geodir_theme_location) {
227
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
228
+	} else {
229
+		update_option('geodir_theme_location_nav', '');
230
+	}
231 231
 }
232 232
 
233 233
 /// add action for theme switch to blank previous theme navigation location setting
@@ -248,32 +248,32 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function geodir_add_post_filters()
250 250
 {
251
-    /**
252
-     * Contains all function for filtering listing.
253
-     *
254
-     * @since 1.0.0
255
-     * @package GeoDirectory
256
-     */
257
-    include_once('geodirectory-functions/listing_filters.php');
251
+	/**
252
+	 * Contains all function for filtering listing.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @package GeoDirectory
256
+	 */
257
+	include_once('geodirectory-functions/listing_filters.php');
258 258
 }
259 259
 
260 260
 
261 261
 if (!function_exists('geodir_init_defaults')) {
262
-    /**
263
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
-     *
265
-     * @since 1.0.0
266
-     * @package GeoDirectory
267
-     */
268
-    function geodir_init_defaults()
269
-    {
270
-        if (function_exists('geodir_register_defaults')) {
262
+	/**
263
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
264
+	 *
265
+	 * @since 1.0.0
266
+	 * @package GeoDirectory
267
+	 */
268
+	function geodir_init_defaults()
269
+	{
270
+		if (function_exists('geodir_register_defaults')) {
271 271
 
272
-            geodir_register_defaults();
272
+			geodir_register_defaults();
273 273
 
274
-        }
274
+		}
275 275
 
276
-    }
276
+	}
277 277
 }
278 278
 
279 279
 
@@ -295,26 +295,26 @@  discard block
 block discarded – undo
295 295
 // CALLED ON 'sidebars_widgets' FILTER
296 296
 
297 297
 if (!function_exists('geodir_restrict_widget')) {
298
-    /**
299
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
-     *
301
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
-     * @since 1.0.0
304
-     * @package GeoDirectory
305
-     */
306
-    function geodir_restrict_widget()
307
-    {
308
-        global $is_listing, $is_single_place;
298
+	/**
299
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
300
+	 *
301
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
302
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
303
+	 * @since 1.0.0
304
+	 * @package GeoDirectory
305
+	 */
306
+	function geodir_restrict_widget()
307
+	{
308
+		global $is_listing, $is_single_place;
309 309
 
310
-        // set is listing	
311
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
310
+		// set is listing	
311
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
312 312
 
313
-        // set is single place
314
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
313
+		// set is single place
314
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
315 315
 
316 316
 
317
-    }
317
+	}
318 318
 }
319 319
 
320 320
 
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function geodir_detail_page_sidebar_content_sorting()
337 337
 {
338
-    $arr_detail_page_sidebar_content =
339
-        /**
340
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
341
-         *
342
-         * This filter can be used to remove sections of the details page sidebar,
343
-         * add new sections or rearrange the order of the sections.
344
-         *
345
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
-         * @since 1.0.0
347
-         */
348
-        apply_filters('geodir_detail_page_sidebar_content',
349
-            array('geodir_social_sharing_buttons',
350
-                'geodir_share_this_button',
351
-                'geodir_detail_page_google_analytics',
352
-                'geodir_edit_post_link',
353
-                //'geodir_detail_page_review_rating',
354
-                'geodir_detail_page_more_info'
355
-            ) // end of array 
356
-        ); // end of apply filter
357
-    if (!empty($arr_detail_page_sidebar_content)) {
358
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
359
-            if (function_exists($content_function)) {
360
-                add_action('geodir_detail_page_sidebar', $content_function);
361
-            }
362
-        }
363
-    }
338
+	$arr_detail_page_sidebar_content =
339
+		/**
340
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
341
+		 *
342
+		 * This filter can be used to remove sections of the details page sidebar,
343
+		 * add new sections or rearrange the order of the sections.
344
+		 *
345
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
346
+		 * @since 1.0.0
347
+		 */
348
+		apply_filters('geodir_detail_page_sidebar_content',
349
+			array('geodir_social_sharing_buttons',
350
+				'geodir_share_this_button',
351
+				'geodir_detail_page_google_analytics',
352
+				'geodir_edit_post_link',
353
+				//'geodir_detail_page_review_rating',
354
+				'geodir_detail_page_more_info'
355
+			) // end of array 
356
+		); // end of apply filter
357
+	if (!empty($arr_detail_page_sidebar_content)) {
358
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
359
+			if (function_exists($content_function)) {
360
+				add_action('geodir_detail_page_sidebar', $content_function);
361
+			}
362
+		}
363
+	}
364 364
 }
365 365
 
366 366
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function geodir_add_to_favourite_link()
377 377
 {
378
-    global $post, $preview;
379
-    if (!$preview && geodir_is_page('detail')) {
380
-        ?>
378
+	global $post, $preview;
379
+	if (!$preview && geodir_is_page('detail')) {
380
+		?>
381 381
         <p class="edit_link">
382 382
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
383 383
         </p>
384 384
     <?php
385
-    }
385
+	}
386 386
 }
387 387
 
388 388
 /**
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function geodir_social_sharing_buttons()
398 398
 {
399
-    global $preview;
400
-    ob_start(); // Start  buffering;
401
-    /**
402
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
-     *
404
-     * @since 1.0.0
405
-     */
406
-    do_action('geodir_before_social_sharing_buttons');
407
-    if (!$preview) {
408
-        ?>
399
+	global $preview;
400
+	ob_start(); // Start  buffering;
401
+	/**
402
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
403
+	 *
404
+	 * @since 1.0.0
405
+	 */
406
+	do_action('geodir_before_social_sharing_buttons');
407
+	if (!$preview) {
408
+		?>
409 409
         <div class="likethis">
410 410
             <?php geodir_twitter_tweet_button(); ?>
411 411
             <?php geodir_fb_like_button(); ?>
412 412
             <?php geodir_google_plus_button(); ?>
413 413
         </div>
414 414
     <?php
415
-    }// end of if, if its a preview or not
416
-
417
-    /**
418
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
-     *
420
-     * @since 1.0.0
421
-     */
422
-    do_action('geodir_after_social_sharing_buttons');
423
-    $content_html = ob_get_clean();
424
-    if (trim($content_html) != '')
425
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
-        /**
428
-         * Filter the geodir_social_sharing_buttons() function content.
429
-         *
430
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
-         */
432
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
-    }
415
+	}// end of if, if its a preview or not
416
+
417
+	/**
418
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
419
+	 *
420
+	 * @since 1.0.0
421
+	 */
422
+	do_action('geodir_after_social_sharing_buttons');
423
+	$content_html = ob_get_clean();
424
+	if (trim($content_html) != '')
425
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
427
+		/**
428
+		 * Filter the geodir_social_sharing_buttons() function content.
429
+		 *
430
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
431
+		 */
432
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
433
+	}
434 434
 
435 435
 
436 436
 }
@@ -446,39 +446,39 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function geodir_share_this_button()
448 448
 {
449
-    global $preview;
450
-    ob_start(); // Start buffering;
451
-    /**
452
-     * This is called before the share this html in the function geodir_share_this_button()
453
-     *
454
-     * @since 1.0.0
455
-     */
456
-    do_action('geodir_before_share_this_button');
457
-    if (!$preview) {
458
-        ?>
449
+	global $preview;
450
+	ob_start(); // Start buffering;
451
+	/**
452
+	 * This is called before the share this html in the function geodir_share_this_button()
453
+	 *
454
+	 * @since 1.0.0
455
+	 */
456
+	do_action('geodir_before_share_this_button');
457
+	if (!$preview) {
458
+		?>
459 459
         <div class="share clearfix">
460 460
             <?php geodir_share_this_button_code(); ?>
461 461
         </div>
462 462
     <?php
463
-    }// end of if, if its a preview or not
464
-    /**
465
-     * This is called after the share this html in the function geodir_share_this_button()
466
-     *
467
-     * @since 1.0.0
468
-     */
469
-    do_action('geodir_after_share_this_button');
470
-    $content_html = ob_get_clean();
471
-    if (trim($content_html) != '')
472
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
-        /**
475
-         * Filter the geodir_share_this_button() function content.
476
-         *
477
-         * @param string $content_html The output html of the geodir_share_this_button() function.
478
-         * @since 1.0.0
479
-         */
480
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
-    }
463
+	}// end of if, if its a preview or not
464
+	/**
465
+	 * This is called after the share this html in the function geodir_share_this_button()
466
+	 *
467
+	 * @since 1.0.0
468
+	 */
469
+	do_action('geodir_after_share_this_button');
470
+	$content_html = ob_get_clean();
471
+	if (trim($content_html) != '')
472
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
473
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
474
+		/**
475
+		 * Filter the geodir_share_this_button() function content.
476
+		 *
477
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
478
+		 * @since 1.0.0
479
+		 */
480
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
481
+	}
482 482
 
483 483
 }
484 484
 
@@ -494,46 +494,46 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_edit_post_link()
496 496
 {
497
-    global $post, $preview;
498
-    ob_start(); // Start buffering;
499
-    /**
500
-     * This is called before the edit post link html in the function geodir_edit_post_link()
501
-     *
502
-     * @since 1.0.0
503
-     */
504
-    do_action('geodir_before_edit_post_link');
505
-    if (!$preview) {
506
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
497
+	global $post, $preview;
498
+	ob_start(); // Start buffering;
499
+	/**
500
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
501
+	 *
502
+	 * @since 1.0.0
503
+	 */
504
+	do_action('geodir_before_edit_post_link');
505
+	if (!$preview) {
506
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
507 507
         
508
-        if ($is_current_user_owner) {
509
-            $post_id = $post->ID;
508
+		if ($is_current_user_owner) {
509
+			$post_id = $post->ID;
510 510
             
511
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
-                $post_id = (int)$_REQUEST['pid'];
513
-            }
511
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
512
+				$post_id = (int)$_REQUEST['pid'];
513
+			}
514 514
 
515
-            $postlink = get_permalink(geodir_add_listing_page_id());
516
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
-        }
519
-    }// end of if, if its a preview or not
520
-    /**
521
-     * This is called after the edit post link html in the function geodir_edit_post_link()
522
-     *
523
-     * @since 1.0.0
524
-     */
525
-    do_action('geodir_after_edit_post_link');
526
-    $content_html = ob_get_clean();
527
-    if (trim($content_html) != '')
528
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
-        /**
531
-         * Filter the geodir_edit_post_link() function content.
532
-         *
533
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
534
-         */
535
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
-    }
515
+			$postlink = get_permalink(geodir_add_listing_page_id());
516
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
517
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
518
+		}
519
+	}// end of if, if its a preview or not
520
+	/**
521
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
522
+	 *
523
+	 * @since 1.0.0
524
+	 */
525
+	do_action('geodir_after_edit_post_link');
526
+	$content_html = ob_get_clean();
527
+	if (trim($content_html) != '')
528
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
529
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
530
+		/**
531
+		 * Filter the geodir_edit_post_link() function content.
532
+		 *
533
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
534
+		 */
535
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
536
+	}
537 537
 }
538 538
 
539 539
 /**
@@ -547,41 +547,41 @@  discard block
 block discarded – undo
547 547
  */
548 548
 function geodir_detail_page_google_analytics()
549 549
 {
550
-    global $post;
551
-    $package_info = array();
552
-    $package_info = geodir_post_package_info($package_info, $post);
550
+	global $post;
551
+	$package_info = array();
552
+	$package_info = geodir_post_package_info($package_info, $post);
553 553
 
554
-    $id = trim(get_option('geodir_ga_id'));
554
+	$id = trim(get_option('geodir_ga_id'));
555 555
 
556
-    if (!$id) {
557
-        return; //if no Google Analytics ID then bail.
558
-    }
556
+	if (!$id) {
557
+		return; //if no Google Analytics ID then bail.
558
+	}
559 559
 
560
-    ob_start(); // Start buffering;
561
-    /**
562
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
-     *
564
-     * @since 1.0.0
565
-     */
566
-    do_action('geodir_before_google_analytics');
560
+	ob_start(); // Start buffering;
561
+	/**
562
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
563
+	 *
564
+	 * @since 1.0.0
565
+	 */
566
+	do_action('geodir_before_google_analytics');
567 567
     
568
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
569
-    /**
570
-     * Filter the time interval to check & refresh new users results.
571
-     *
572
-     * @since 1.5.9
573
-     *
574
-     * @param int $refresh_time Time interval to check & refresh new users results.
575
-     */
576
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
-    $refresh_time = absint($refresh_time * 1000);
568
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
569
+	/**
570
+	 * Filter the time interval to check & refresh new users results.
571
+	 *
572
+	 * @since 1.5.9
573
+	 *
574
+	 * @param int $refresh_time Time interval to check & refresh new users results.
575
+	 */
576
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
577
+	$refresh_time = absint($refresh_time * 1000);
578 578
     
579
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
579
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
580 580
     
581
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
584
-        ?>
581
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
582
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
583
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
584
+		?>
585 585
         <script type="text/javascript">
586 586
             var gd_gaTimeOut;
587 587
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
834 834
 
835 835
                     <?php
836
-                    // Here we list the shorthand days of the week so it can be used in translation.
837
-                    __("Mon",'geodirectory');
838
-                    __("Tue",'geodirectory');
839
-                    __("Wed",'geodirectory');
840
-                    __("Thu",'geodirectory');
841
-                    __("Fri",'geodirectory');
842
-                    __("Sat",'geodirectory');
843
-                    __("Sun",'geodirectory');
844
-                    ?>
836
+					// Here we list the shorthand days of the week so it can be used in translation.
837
+					__("Mon",'geodirectory');
838
+					__("Tue",'geodirectory');
839
+					__("Wed",'geodirectory');
840
+					__("Thu",'geodirectory');
841
+					__("Fri",'geodirectory');
842
+					__("Sat",'geodirectory');
843
+					__("Sun",'geodirectory');
844
+					?>
845 845
 
846 846
                     labels = [
847 847
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1090,24 +1090,24 @@  discard block
 block discarded – undo
1090 1090
         </span>
1091 1091
 
1092 1092
     <?php
1093
-    }
1094
-    /**
1095
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
-     *
1097
-     * @since 1.0.0
1098
-     */
1099
-    do_action('geodir_after_google_analytics');
1100
-    $content_html = ob_get_clean();
1101
-    if (trim($content_html) != '')
1102
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
-        /**
1105
-         * Filter the geodir_edit_post_link() function content.
1106
-         *
1107
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
-         */
1109
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
-    }
1093
+	}
1094
+	/**
1095
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1096
+	 *
1097
+	 * @since 1.0.0
1098
+	 */
1099
+	do_action('geodir_after_google_analytics');
1100
+	$content_html = ob_get_clean();
1101
+	if (trim($content_html) != '')
1102
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1103
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1104
+		/**
1105
+		 * Filter the geodir_edit_post_link() function content.
1106
+		 *
1107
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1108
+		 */
1109
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1110
+	}
1111 1111
 }
1112 1112
 
1113 1113
 /**
@@ -1123,90 +1123,90 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function geodir_detail_page_review_rating()
1125 1125
 {
1126
-    global $post, $preview, $post_images;
1127
-    ob_start(); // Start  buffering;
1128
-    /**
1129
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
-     *
1131
-     * This is called outside the check for an actual rating and the check for preview page.
1132
-     *
1133
-     * @since 1.0.0
1134
-     */
1135
-    do_action('geodir_before_detail_page_review_rating');
1136
-
1137
-    $comment_count = geodir_get_review_count_total($post->ID);
1138
-    $post_avgratings = geodir_get_post_rating($post->ID);
1139
-
1140
-    if ($post_avgratings != 0 && !$preview) {
1141
-        /**
1142
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
-         *
1144
-         * This is called inside the check for an actual rating and the check for preview page.
1145
-         *
1146
-         * @since 1.0.0
1147
-         * @param float $post_avgratings Average rating for the surrent post.
1148
-         * @param int $post->ID Current post ID.
1149
-         */
1150
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
-
1152
-        $html = '<p style=" float:left;">';
1153
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1126
+	global $post, $preview, $post_images;
1127
+	ob_start(); // Start  buffering;
1128
+	/**
1129
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1130
+	 *
1131
+	 * This is called outside the check for an actual rating and the check for preview page.
1132
+	 *
1133
+	 * @since 1.0.0
1134
+	 */
1135
+	do_action('geodir_before_detail_page_review_rating');
1136
+
1137
+	$comment_count = geodir_get_review_count_total($post->ID);
1138
+	$post_avgratings = geodir_get_post_rating($post->ID);
1139
+
1140
+	if ($post_avgratings != 0 && !$preview) {
1141
+		/**
1142
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1143
+		 *
1144
+		 * This is called inside the check for an actual rating and the check for preview page.
1145
+		 *
1146
+		 * @since 1.0.0
1147
+		 * @param float $post_avgratings Average rating for the surrent post.
1148
+		 * @param int $post->ID Current post ID.
1149
+		 */
1150
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1151
+
1152
+		$html = '<p style=" float:left;">';
1153
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1154
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1155
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1156 1156
        
1157 1157
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1158 1158
 	   
1159 1159
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1160 1160
 
1161
-        $html .= '<span class="item">';
1162
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1161
+		$html .= '<span class="item">';
1162
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1163 1163
 
1164
-        if ($post_images) {
1165
-            foreach ($post_images as $img) {
1166
-                $post_img = $img->src;
1167
-                break;
1168
-            }
1169
-        }
1170
-
1171
-        if (isset($post_img) && $post_img) {
1172
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
-        }
1174
-
1175
-        $html .= '</span>';
1176
-
1177
-        echo $html .= '</div>';
1178
-        /**
1179
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
-         *
1181
-         * This is called inside the check for an actual rating and the check for preview page.
1182
-         *
1183
-         * @since 1.0.0
1184
-         * @param float $post_avgratings Average rating for the surrent post.
1185
-         * @param int $post->ID Current post ID.
1186
-         */
1187
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
-    }
1189
-    /**
1190
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
-     *
1192
-     * This is called outside the check for an actual rating and the check for preview page.
1193
-     *
1194
-     * @since 1.0.0
1195
-     */
1196
-    do_action('geodir_after_detail_page_review_rating');
1197
-    $content_html = ob_get_clean();
1198
-    if (trim($content_html) != '') {
1199
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
-    }
1201
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
-        /**
1203
-         * Filter the geodir_detail_page_review_rating() function content.
1204
-         *
1205
-         * @since 1.0.0
1206
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
-         */
1208
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
-    }
1164
+		if ($post_images) {
1165
+			foreach ($post_images as $img) {
1166
+				$post_img = $img->src;
1167
+				break;
1168
+			}
1169
+		}
1170
+
1171
+		if (isset($post_img) && $post_img) {
1172
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1173
+		}
1174
+
1175
+		$html .= '</span>';
1176
+
1177
+		echo $html .= '</div>';
1178
+		/**
1179
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1180
+		 *
1181
+		 * This is called inside the check for an actual rating and the check for preview page.
1182
+		 *
1183
+		 * @since 1.0.0
1184
+		 * @param float $post_avgratings Average rating for the surrent post.
1185
+		 * @param int $post->ID Current post ID.
1186
+		 */
1187
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1188
+	}
1189
+	/**
1190
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1191
+	 *
1192
+	 * This is called outside the check for an actual rating and the check for preview page.
1193
+	 *
1194
+	 * @since 1.0.0
1195
+	 */
1196
+	do_action('geodir_after_detail_page_review_rating');
1197
+	$content_html = ob_get_clean();
1198
+	if (trim($content_html) != '') {
1199
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1200
+	}
1201
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1202
+		/**
1203
+		 * Filter the geodir_detail_page_review_rating() function content.
1204
+		 *
1205
+		 * @since 1.0.0
1206
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1207
+		 */
1208
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1209
+	}
1210 1210
 }
1211 1211
 
1212 1212
 /**
@@ -1218,35 +1218,35 @@  discard block
 block discarded – undo
1218 1218
  */
1219 1219
 function geodir_detail_page_more_info()
1220 1220
 {
1221
-    ob_start(); // Start  buffering;
1222
-    /**
1223
-     * This is called before the info section html.
1224
-     *
1225
-     * @since 1.0.0
1226
-     */
1227
-    do_action('geodir_before_detail_page_more_info');
1228
-    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1229
-        echo $geodir_post_detail_fields;
1230
-    }
1231
-    /**
1232
-     * This is called after the info section html.
1233
-     *
1234
-     * @since 1.0.0
1235
-     */
1236
-    do_action('geodir_after_detail_page_more_info');
1237
-
1238
-    $content_html = ob_get_clean();
1239
-    if (trim($content_html) != '')
1240
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
-        /**
1243
-         * Filter the output html for function geodir_detail_page_more_info().
1244
-         *
1245
-         * @since 1.0.0
1246
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
-         */
1248
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
-    }
1221
+	ob_start(); // Start  buffering;
1222
+	/**
1223
+	 * This is called before the info section html.
1224
+	 *
1225
+	 * @since 1.0.0
1226
+	 */
1227
+	do_action('geodir_before_detail_page_more_info');
1228
+	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1229
+		echo $geodir_post_detail_fields;
1230
+	}
1231
+	/**
1232
+	 * This is called after the info section html.
1233
+	 *
1234
+	 * @since 1.0.0
1235
+	 */
1236
+	do_action('geodir_after_detail_page_more_info');
1237
+
1238
+	$content_html = ob_get_clean();
1239
+	if (trim($content_html) != '')
1240
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1241
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1242
+		/**
1243
+		 * Filter the output html for function geodir_detail_page_more_info().
1244
+		 *
1245
+		 * @since 1.0.0
1246
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1247
+		 */
1248
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1249
+	}
1250 1250
 }
1251 1251
 
1252 1252
 
@@ -1260,15 +1260,15 @@  discard block
 block discarded – undo
1260 1260
  */
1261 1261
 function geodir_localize_all_js_msg()
1262 1262
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1263
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
-        $ajax_url = admin_url('admin-ajax.php');
1265
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
-        $ajax_url = admin_url('admin-ajax.php');
1267
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
-    }
1263
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1264
+		$ajax_url = admin_url('admin-ajax.php');
1265
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1266
+		$ajax_url = admin_url('admin-ajax.php');
1267
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1268
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1269
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1270
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1271
+	}
1272 1272
 	
1273 1273
 	/**
1274 1274
 	 * Filter the allowed image type extensions for post images.
@@ -1278,59 +1278,59 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1280 1280
 	
1281
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1282
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
-    $default_marker_width = $default_marker_size['w'];
1284
-    $default_marker_height = $default_marker_size['h'];
1281
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1282
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1283
+	$default_marker_width = $default_marker_size['w'];
1284
+	$default_marker_height = $default_marker_size['h'];
1285 1285
     
1286
-    $arr_alert_msg = array(
1287
-        'geodir_plugin_url' => geodir_plugin_url(),
1288
-        'geodir_admin_ajax_url' => $ajax_url,
1289
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
-        //start not show alert msg
1294
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
-        // end not show alert msg
1300
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
-        //start not show alert msg
1302
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1303
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1304
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1305
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1306
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1307
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1308
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1309
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1310
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1311
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1312
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1313
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1314
-        'geodir_default_marker_icon' => $default_marker_icon,
1315
-        'geodir_default_marker_w' => $default_marker_width,
1316
-        'geodir_default_marker_h' => $default_marker_height,
1317
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1318
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1319
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1320
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1321
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1322
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1323
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1324
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1325
-        /* on/off dragging for phone devices */
1326
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1327
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1328
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1329
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1330
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1331
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1332
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1333
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1286
+	$arr_alert_msg = array(
1287
+		'geodir_plugin_url' => geodir_plugin_url(),
1288
+		'geodir_admin_ajax_url' => $ajax_url,
1289
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1290
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1291
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1292
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1293
+		//start not show alert msg
1294
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1295
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1296
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1297
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1298
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1299
+		// end not show alert msg
1300
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1301
+		//start not show alert msg
1302
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1303
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1304
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1305
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1306
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1307
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1308
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1309
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1310
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1311
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1312
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1313
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1314
+		'geodir_default_marker_icon' => $default_marker_icon,
1315
+		'geodir_default_marker_w' => $default_marker_width,
1316
+		'geodir_default_marker_h' => $default_marker_height,
1317
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1318
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1319
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1320
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1321
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1322
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1323
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1324
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1325
+		/* on/off dragging for phone devices */
1326
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1327
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1328
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1329
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1330
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1331
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1332
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1333
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1334 1334
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1335 1335
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1336 1336
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1338,29 +1338,29 @@  discard block
 block discarded – undo
1338 1338
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1339 1339
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1340 1340
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1341
-        'geodir_map_name' => geodir_map_name(),
1342
-    );
1343
-
1344
-    /**
1345
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1346
-     *
1347
-     * With this filter you can add, remove or change translated JS strings.
1348
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1349
-     *
1350
-     * @since 1.0.0
1351
-     */
1352
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1353
-
1354
-    foreach ($arr_alert_msg as $key => $value) {
1355
-        if (!is_scalar($value))
1356
-            continue;
1357
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
-    }
1341
+		'geodir_map_name' => geodir_map_name(),
1342
+	);
1343
+
1344
+	/**
1345
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1346
+	 *
1347
+	 * With this filter you can add, remove or change translated JS strings.
1348
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1349
+	 *
1350
+	 * @since 1.0.0
1351
+	 */
1352
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1353
+
1354
+	foreach ($arr_alert_msg as $key => $value) {
1355
+		if (!is_scalar($value))
1356
+			continue;
1357
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1358
+	}
1359 1359
 
1360
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
-    echo '<script>';
1362
-    echo $script;
1363
-    echo '</script>';
1360
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1361
+	echo '<script>';
1362
+	echo $script;
1363
+	echo '</script>';
1364 1364
 }
1365 1365
 
1366 1366
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1376,9 +1376,9 @@  discard block
 block discarded – undo
1376 1376
  */
1377 1377
 function geodir_admin_bar_site_menu($wp_admin_bar)
1378 1378
 {
1379
-    if (get_option("geodir_installed")) {
1380
-        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1381
-    }
1379
+	if (get_option("geodir_installed")) {
1380
+		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1381
+	}
1382 1382
 }
1383 1383
 
1384 1384
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1404,25 +1404,25 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_store_sidebars()
1406 1406
 {
1407
-    global $geodir_sidebars;
1408
-    global $sidebars_widgets;
1409
-
1410
-    if (!is_array($sidebars_widgets))
1411
-        $sidebars_widgets = wp_get_sidebars_widgets();
1412
-    $geodir_old_sidebars = array();
1413
-
1414
-    if (is_array($geodir_sidebars)) {
1415
-        foreach ($geodir_sidebars as $val) {
1416
-            if (is_array($sidebars_widgets)) {
1417
-                if (array_key_exists($val, $sidebars_widgets))
1418
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
-                else
1420
-                    $geodir_old_sidebars[$val] = array();
1421
-            }
1422
-        }
1423
-    }
1424
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1425
-    geodir_option_version_backup('geodir_sidebars');
1407
+	global $geodir_sidebars;
1408
+	global $sidebars_widgets;
1409
+
1410
+	if (!is_array($sidebars_widgets))
1411
+		$sidebars_widgets = wp_get_sidebars_widgets();
1412
+	$geodir_old_sidebars = array();
1413
+
1414
+	if (is_array($geodir_sidebars)) {
1415
+		foreach ($geodir_sidebars as $val) {
1416
+			if (is_array($sidebars_widgets)) {
1417
+				if (array_key_exists($val, $sidebars_widgets))
1418
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1419
+				else
1420
+					$geodir_old_sidebars[$val] = array();
1421
+			}
1422
+		}
1423
+	}
1424
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1425
+	geodir_option_version_backup('geodir_sidebars');
1426 1426
 
1427 1427
 }
1428 1428
 
@@ -1436,28 +1436,28 @@  discard block
 block discarded – undo
1436 1436
  */
1437 1437
 function geodir_restore_sidebars()
1438 1438
 {
1439
-    global $sidebars_widgets;
1440
-
1441
-    if (!is_array($sidebars_widgets))
1442
-        $sidebars_widgets = wp_get_sidebars_widgets();
1443
-
1444
-    if (is_array($sidebars_widgets)) {
1445
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1446
-        if (is_array($geodir_old_sidebars)) {
1447
-            foreach ($geodir_old_sidebars as $key => $val) {
1448
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1449
-                {
1450
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451
-                }
1439
+	global $sidebars_widgets;
1452 1440
 
1441
+	if (!is_array($sidebars_widgets))
1442
+		$sidebars_widgets = wp_get_sidebars_widgets();
1453 1443
 
1454
-            }
1455
-        }
1444
+	if (is_array($sidebars_widgets)) {
1445
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1446
+		if (is_array($geodir_old_sidebars)) {
1447
+			foreach ($geodir_old_sidebars as $key => $val) {
1448
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1449
+				{
1450
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1451
+				}
1456 1452
 
1457
-    }
1458 1453
 
1459
-    update_option('sidebars_widgets', $sidebars_widgets);
1460
-    update_option('geodir_sidebars', '');
1454
+			}
1455
+		}
1456
+
1457
+	}
1458
+
1459
+	update_option('sidebars_widgets', $sidebars_widgets);
1460
+	update_option('geodir_sidebars', '');
1461 1461
 }
1462 1462
 
1463 1463
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1470,9 +1470,9 @@  discard block
 block discarded – undo
1470 1470
  */
1471 1471
 function geodir_after_listing_post_gridview()
1472 1472
 {
1473
-    global $gridview_columns;
1473
+	global $gridview_columns;
1474 1474
 
1475
-    $gridview_columns = '';
1475
+	$gridview_columns = '';
1476 1476
 
1477 1477
 }
1478 1478
 
@@ -1500,11 +1500,11 @@  discard block
 block discarded – undo
1500 1500
  */
1501 1501
 function so_handle_038($url, $original_url, $_context)
1502 1502
 {
1503
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1504
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1505
-    }
1503
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1504
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1505
+	}
1506 1506
 
1507
-    return $url;
1507
+	return $url;
1508 1508
 }
1509 1509
 
1510 1510
 
@@ -1520,34 +1520,34 @@  discard block
 block discarded – undo
1520 1520
 function geodir_after_main_form_fields() {
1521 1521
 	global $gd_session;
1522 1522
 	
1523
-    if (get_option('geodir_accept_term_condition')) {
1524
-        global $post;
1525
-        $term_condition = '';
1526
-        if (isset($_REQUEST['backandedit'])) {
1527
-            $post = (object)$gd_session->get('listing');
1528
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1529
-        }
1530
-
1531
-        ?>
1523
+	if (get_option('geodir_accept_term_condition')) {
1524
+		global $post;
1525
+		$term_condition = '';
1526
+		if (isset($_REQUEST['backandedit'])) {
1527
+			$post = (object)$gd_session->get('listing');
1528
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1529
+		}
1530
+
1531
+		?>
1532 1532
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1533 1533
             <label>&nbsp;</label>
1534 1534
 
1535 1535
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1536 1536
 				<span style="display:block"> 
1537 1537
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1538
-                    echo 'checked="checked"';
1539
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1538
+					echo 'checked="checked"';
1539
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1540 1540
                        class="geodir_textfield" value="1"
1541 1541
                        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>
1542 1542
 				</span>
1543 1543
             </div>
1544 1544
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1545
-                    _e($required_msg, 'geodirectory');
1546
-                } ?></span>
1545
+					_e($required_msg, 'geodirectory');
1546
+				} ?></span>
1547 1547
         </div>
1548 1548
     <?php
1549 1549
 
1550
-    }
1550
+	}
1551 1551
 }
1552 1552
 
1553 1553
 
@@ -1572,42 +1572,42 @@  discard block
 block discarded – undo
1572 1572
  */
1573 1573
 function geodir_detail_page_tab_is_display($is_display, $tab)
1574 1574
 {
1575
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1575
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1576 1576
 
1577
-    if ($tab == 'post_profile') {
1578
-        /** This action is documented in geodirectory_template_actions.php */
1579
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1577
+	if ($tab == 'post_profile') {
1578
+		/** This action is documented in geodirectory_template_actions.php */
1579
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1580 1580
         
1581
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1582
-            $is_display = false;
1583
-        }
1584
-    }
1581
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1582
+			$is_display = false;
1583
+		}
1584
+	}
1585 1585
     
1586
-    if ($tab == 'post_info')
1587
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1586
+	if ($tab == 'post_info')
1587
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1588 1588
 
1589
-    if ($tab == 'post_images')
1590
-        $is_display = (!empty($post_images)) ? true : false;
1589
+	if ($tab == 'post_images')
1590
+		$is_display = (!empty($post_images)) ? true : false;
1591 1591
 
1592
-    if ($tab == 'post_video')
1593
-        $is_display = (!empty($video)) ? true : false;
1592
+	if ($tab == 'post_video')
1593
+		$is_display = (!empty($video)) ? true : false;
1594 1594
 
1595
-    if ($tab == 'special_offers')
1596
-        $is_display = (!empty($special_offers)) ? true : false;
1595
+	if ($tab == 'special_offers')
1596
+		$is_display = (!empty($special_offers)) ? true : false;
1597 1597
 
1598
-    if ($tab == 'reviews')
1599
-        $is_display = (geodir_is_page('detail')) ? true : false;
1598
+	if ($tab == 'reviews')
1599
+		$is_display = (geodir_is_page('detail')) ? true : false;
1600 1600
 
1601
-    if ($tab == 'related_listing') {
1602
-       $message = __('No listings found which match your selection.', 'geodirectory');
1601
+	if ($tab == 'related_listing') {
1602
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1603 1603
        
1604
-       /** This action is documented in geodirectory-functions/template_functions.php */
1605
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1604
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1605
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1606 1606
        
1607
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1608
-    }
1607
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1608
+	}
1609 1609
 
1610
-    return $is_display;
1610
+	return $is_display;
1611 1611
 }
1612 1612
 
1613 1613
 
@@ -1623,69 +1623,69 @@  discard block
 block discarded – undo
1623 1623
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1624 1624
  */
1625 1625
 function geodir_changes_in_custom_fields_table() {
1626
-    global $wpdb, $plugin_prefix;
1626
+	global $wpdb, $plugin_prefix;
1627 1627
 	
1628 1628
 	// Remove unused virtual page
1629 1629
 	$listings_page_id = (int)get_option('geodir_listing_page');
1630 1630
 	if ($listings_page_id) {
1631 1631
 		$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')));
1632
-        delete_option('geodir_listing_page');
1632
+		delete_option('geodir_listing_page');
1633 1633
 	}
1634 1634
 
1635
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1636
-        $wpdb->query(
1637
-            $wpdb->prepare(
1638
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1639
-                array('1', '1', 'admin')
1640
-            )
1641
-        );
1635
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1636
+		$wpdb->query(
1637
+			$wpdb->prepare(
1638
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1639
+				array('1', '1', 'admin')
1640
+			)
1641
+		);
1642 1642
 
1643 1643
 
1644
-        /* --- terms meta value set --- */
1644
+		/* --- terms meta value set --- */
1645 1645
 
1646
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1646
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1647 1647
 
1648
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1648
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1649 1649
 
1650
-        if (!empty($options_data)) {
1650
+		if (!empty($options_data)) {
1651 1651
 
1652
-            foreach ($options_data as $optobj) {
1652
+			foreach ($options_data as $optobj) {
1653 1653
 
1654
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1654
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1655 1655
 
1656
-                $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)));
1656
+				$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)));
1657 1657
 
1658
-                if (!empty($taxonomies_data)) {
1658
+				if (!empty($taxonomies_data)) {
1659 1659
 
1660
-                    foreach ($taxonomies_data as $taxobj) {
1660
+					foreach ($taxonomies_data as $taxobj) {
1661 1661
 
1662
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1663
-                        $post_type = $taxObject->object_type[0];
1662
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1663
+						$post_type = $taxObject->object_type[0];
1664 1664
 
1665
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1665
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1666 1666
 
1667
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1667
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1668 1668
 
1669
-                        if ($duplicate_data) {
1669
+						if ($duplicate_data) {
1670 1670
 
1671
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1671
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1672 1672
 
1673
-                        } else {
1673
+						} else {
1674 1674
 
1675
-                            $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)));
1675
+							$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)));
1676 1676
 
1677
-                        }
1677
+						}
1678 1678
 
1679
-                    }
1679
+					}
1680 1680
 
1681
-                }
1681
+				}
1682 1682
 
1683
-            }
1684
-        }
1683
+			}
1684
+		}
1685 1685
 
1686
-        update_option('geodir_changes_in_custom_fields_table', '1');
1686
+		update_option('geodir_changes_in_custom_fields_table', '1');
1687 1687
 
1688
-    }
1688
+	}
1689 1689
 
1690 1690
 }
1691 1691
 
@@ -1704,24 +1704,24 @@  discard block
 block discarded – undo
1704 1704
 function geodir_location_slug_check($slug)
1705 1705
 {
1706 1706
 
1707
-    global $wpdb, $table_prefix;
1707
+	global $wpdb, $table_prefix;
1708 1708
 
1709
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1709
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1710 1710
 
1711
-    if ($slug_exists) {
1711
+	if ($slug_exists) {
1712 1712
 
1713
-        $suffix = 1;
1714
-        do {
1715
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1716
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1717
-            $suffix++;
1718
-        } while ($location_slug_check && $suffix < 100);
1713
+		$suffix = 1;
1714
+		do {
1715
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1716
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1717
+			$suffix++;
1718
+		} while ($location_slug_check && $suffix < 100);
1719 1719
 
1720
-        $slug = $alt_location_name;
1720
+		$slug = $alt_location_name;
1721 1721
 
1722
-    }
1722
+	}
1723 1723
 
1724
-    return $slug;
1724
+	return $slug;
1725 1725
 
1726 1726
 }
1727 1727
 
@@ -1746,42 +1746,42 @@  discard block
 block discarded – undo
1746 1746
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1747 1747
 {
1748 1748
 
1749
-    global $wpdb, $plugin_prefix, $table_prefix;
1749
+	global $wpdb, $plugin_prefix, $table_prefix;
1750 1750
 
1751
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1751
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1752 1752
 
1753
-    $slug = $tern_data->slug;
1753
+	$slug = $tern_data->slug;
1754 1754
 
1755
-    /**
1756
-     * Filter if a term slug exists.
1757
-     *
1758
-     * @since 1.0.0
1759
-     * @package GeoDirectory
1760
-     * @param bool $bool Default: false.
1761
-     * @param string $slug The term slug.
1762
-     * @param int $term_id The term ID.
1763
-     */
1764
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1755
+	/**
1756
+	 * Filter if a term slug exists.
1757
+	 *
1758
+	 * @since 1.0.0
1759
+	 * @package GeoDirectory
1760
+	 * @param bool $bool Default: false.
1761
+	 * @param string $slug The term slug.
1762
+	 * @param int $term_id The term ID.
1763
+	 */
1764
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1765 1765
 
1766
-    if ($slug_exists) {
1766
+	if ($slug_exists) {
1767 1767
 
1768
-        $suffix = 1;
1769
-        do {
1770
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1768
+		$suffix = 1;
1769
+		do {
1770
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1771 1771
 
1772
-            /** This action is documented in geodirectory_hooks_actions.php */
1773
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1772
+			/** This action is documented in geodirectory_hooks_actions.php */
1773
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1774 1774
 
1775
-            $suffix++;
1776
-        } while ($term_slug_check && $suffix < 100);
1775
+			$suffix++;
1776
+		} while ($term_slug_check && $suffix < 100);
1777 1777
 
1778
-        $slug = $new_slug;
1778
+		$slug = $new_slug;
1779 1779
 
1780
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1780
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1781 1781
 
1782
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1782
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1783 1783
 
1784
-    }
1784
+	}
1785 1785
 	
1786 1786
 	// Update tag in detail table.
1787 1787
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1822,21 +1822,21 @@  discard block
 block discarded – undo
1822 1822
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1823 1823
 {
1824 1824
 
1825
-    global $wpdb, $table_prefix;
1825
+	global $wpdb, $table_prefix;
1826 1826
 
1827
-    $default_location = geodir_get_default_location();
1827
+	$default_location = geodir_get_default_location();
1828 1828
 
1829
-    $country_slug = $default_location->country_slug;
1830
-    $region_slug = $default_location->region_slug;
1831
-    $city_slug = $default_location->city_slug;
1829
+	$country_slug = $default_location->country_slug;
1830
+	$region_slug = $default_location->region_slug;
1831
+	$city_slug = $default_location->city_slug;
1832 1832
 
1833
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1834
-        return $slug_exists = true;
1833
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1834
+		return $slug_exists = true;
1835 1835
 
1836
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1837
-        return $slug_exists = true;
1836
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1837
+		return $slug_exists = true;
1838 1838
 
1839
-    return $slug_exists;
1839
+	return $slug_exists;
1840 1840
 }
1841 1841
 
1842 1842
 
@@ -1855,75 +1855,75 @@  discard block
 block discarded – undo
1855 1855
  */
1856 1856
 function geodir_custom_page_title($title = '', $sep = '')
1857 1857
 {
1858
-    global $wp;
1859
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1860
-        return $title;
1861
-    }
1858
+	global $wp;
1859
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1860
+		return $title;
1861
+	}
1862 1862
 
1863
-    if ($sep == '') {
1864
-        /**
1865
-         * Filter the page title separator.
1866
-         *
1867
-         * @since 1.0.0
1868
-         * @package GeoDirectory
1869
-         * @param string $sep The separator, default: `|`.
1870
-         */
1871
-        $sep = apply_filters('geodir_page_title_separator', '|');
1872
-    }
1863
+	if ($sep == '') {
1864
+		/**
1865
+		 * Filter the page title separator.
1866
+		 *
1867
+		 * @since 1.0.0
1868
+		 * @package GeoDirectory
1869
+		 * @param string $sep The separator, default: `|`.
1870
+		 */
1871
+		$sep = apply_filters('geodir_page_title_separator', '|');
1872
+	}
1873 1873
 
1874 1874
 
1875
-    $gd_page = '';
1876
-    if(geodir_is_page('home')){
1877
-        $gd_page = 'home';
1878
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('detail')){
1881
-        $gd_page = 'detail';
1882
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1883
-    }
1884
-    elseif(geodir_is_page('pt')){
1885
-        $gd_page = 'pt';
1886
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1887
-    }
1888
-    elseif(geodir_is_page('listing')){
1889
-        $gd_page = 'listing';
1890
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1891
-    }
1892
-    elseif(geodir_is_page('location')){
1893
-        $gd_page = 'location';
1894
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1895
-    }
1896
-    elseif(geodir_is_page('search')){
1897
-        $gd_page = 'search';
1898
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1899
-    }
1900
-    elseif(geodir_is_page('add-listing')){
1901
-        $gd_page = 'add-listing';
1902
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1903
-    }
1904
-    elseif(geodir_is_page('author')){
1905
-        $gd_page = 'author';
1906
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1907
-    }
1908
-    elseif(geodir_is_page('login')){
1909
-        $gd_page = 'login';
1910
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1911
-    }
1912
-    elseif(geodir_is_page('listing-success')){
1913
-        $gd_page = 'listing-success';
1914
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1915
-    }
1875
+	$gd_page = '';
1876
+	if(geodir_is_page('home')){
1877
+		$gd_page = 'home';
1878
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('detail')){
1881
+		$gd_page = 'detail';
1882
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1883
+	}
1884
+	elseif(geodir_is_page('pt')){
1885
+		$gd_page = 'pt';
1886
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1887
+	}
1888
+	elseif(geodir_is_page('listing')){
1889
+		$gd_page = 'listing';
1890
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1891
+	}
1892
+	elseif(geodir_is_page('location')){
1893
+		$gd_page = 'location';
1894
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1895
+	}
1896
+	elseif(geodir_is_page('search')){
1897
+		$gd_page = 'search';
1898
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1899
+	}
1900
+	elseif(geodir_is_page('add-listing')){
1901
+		$gd_page = 'add-listing';
1902
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1903
+	}
1904
+	elseif(geodir_is_page('author')){
1905
+		$gd_page = 'author';
1906
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1907
+	}
1908
+	elseif(geodir_is_page('login')){
1909
+		$gd_page = 'login';
1910
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1911
+	}
1912
+	elseif(geodir_is_page('listing-success')){
1913
+		$gd_page = 'listing-success';
1914
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1915
+	}
1916 1916
 
1917 1917
 
1918
-    /**
1919
-     * Filter page meta title to replace variables.
1920
-     *
1921
-     * @since 1.5.4
1922
-     * @param string $title The page title including variables.
1923
-     * @param string $gd_page The GeoDirectory page type if any.
1924
-     * @param string $sep The title separator symbol.
1925
-     */
1926
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1918
+	/**
1919
+	 * Filter page meta title to replace variables.
1920
+	 *
1921
+	 * @since 1.5.4
1922
+	 * @param string $title The page title including variables.
1923
+	 * @param string $gd_page The GeoDirectory page type if any.
1924
+	 * @param string $sep The title separator symbol.
1925
+	 */
1926
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1927 1927
 
1928 1928
 }
1929 1929
 
@@ -1939,36 +1939,36 @@  discard block
 block discarded – undo
1939 1939
 function geodir_set_post_attachment()
1940 1940
 {
1941 1941
 
1942
-    if (!get_option('geodir_set_post_attachments')) {
1942
+	if (!get_option('geodir_set_post_attachments')) {
1943 1943
 
1944
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1945
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1944
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1945
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1946 1946
 
1947
-        $all_postypes = geodir_get_posttypes();
1947
+		$all_postypes = geodir_get_posttypes();
1948 1948
 
1949
-        foreach($all_postypes as $post_type){
1950
-            $args = array(
1951
-                'posts_per_page' => -1,
1952
-                'post_type' => $post_type,
1953
-                'post_status' => 'publish');
1949
+		foreach($all_postypes as $post_type){
1950
+			$args = array(
1951
+				'posts_per_page' => -1,
1952
+				'post_type' => $post_type,
1953
+				'post_status' => 'publish');
1954 1954
 
1955
-            $posts_array = get_posts($args);
1955
+			$posts_array = get_posts($args);
1956 1956
 
1957
-            if (!empty($posts_array)) {
1957
+			if (!empty($posts_array)) {
1958 1958
 
1959
-                foreach ($posts_array as $post) {
1959
+				foreach ($posts_array as $post) {
1960 1960
 
1961
-                    geodir_set_wp_featured_image($post->ID);
1961
+					geodir_set_wp_featured_image($post->ID);
1962 1962
 
1963
-                }
1963
+				}
1964 1964
 
1965
-            }
1966
-        }
1965
+			}
1966
+		}
1967 1967
 
1968 1968
 
1969
-        update_option('geodir_set_post_attachments', '1');
1969
+		update_option('geodir_set_post_attachments', '1');
1970 1970
 
1971
-    }
1971
+	}
1972 1972
 
1973 1973
 }
1974 1974
 
@@ -1985,19 +1985,19 @@  discard block
 block discarded – undo
1985 1985
 function geodir_remove_url_seperator()
1986 1986
 {
1987 1987
 
1988
-    if (!get_option('geodir_remove_url_seperator')) {
1988
+	if (!get_option('geodir_remove_url_seperator')) {
1989 1989
 
1990
-        if (get_option('geodir_listingurl_separator'))
1991
-            delete_option('geodir_listingurl_separator');
1990
+		if (get_option('geodir_listingurl_separator'))
1991
+			delete_option('geodir_listingurl_separator');
1992 1992
 
1993
-        if (get_option('geodir_detailurl_separator'))
1994
-            delete_option('geodir_detailurl_separator');
1993
+		if (get_option('geodir_detailurl_separator'))
1994
+			delete_option('geodir_detailurl_separator');
1995 1995
 
1996
-        flush_rewrite_rules(false);
1996
+		flush_rewrite_rules(false);
1997 1997
 
1998
-        update_option('geodir_remove_url_seperator', '1');
1998
+		update_option('geodir_remove_url_seperator', '1');
1999 1999
 
2000
-    }
2000
+	}
2001 2001
 
2002 2002
 }
2003 2003
 
@@ -2013,19 +2013,19 @@  discard block
 block discarded – undo
2013 2013
  */
2014 2014
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2015 2015
 {
2016
-    foreach ($permalink_arr as $key => $value) {
2016
+	foreach ($permalink_arr as $key => $value) {
2017 2017
 
2018
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2019
-            unset($permalink_arr[$key]);
2018
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2019
+			unset($permalink_arr[$key]);
2020 2020
 
2021
-    }
2021
+	}
2022 2022
 
2023
-    return $permalink_arr;
2023
+	return $permalink_arr;
2024 2024
 
2025 2025
 }
2026 2026
 
2027 2027
 if (!is_admin()) {
2028
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2028
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2029 2029
 }
2030 2030
 /**
2031 2031
  * Set status from draft to publish.
@@ -2038,16 +2038,16 @@  discard block
 block discarded – undo
2038 2038
  */
2039 2039
 function geodir_set_status_draft_to_publish_for_own_post($post)
2040 2040
 {
2041
-    $user_id = get_current_user_id();
2041
+	$user_id = get_current_user_id();
2042 2042
 
2043
-    if(!$user_id){return $post;}
2043
+	if(!$user_id){return $post;}
2044 2044
 
2045
-    $gd_post_types = geodir_get_posttypes();
2045
+	$gd_post_types = geodir_get_posttypes();
2046 2046
 
2047
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2048
-        $post[0]->post_status = 'publish';
2049
-    }
2050
-    return $post;
2047
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2048
+		$post[0]->post_status = 'publish';
2049
+	}
2050
+	return $post;
2051 2051
 }
2052 2052
 
2053 2053
 
@@ -2139,33 +2139,33 @@  discard block
 block discarded – undo
2139 2139
  */
2140 2140
 function geodir_detail_page_tab_headings_change($tabs_arr)
2141 2141
 {
2142
-    global $wpdb;
2142
+	global $wpdb;
2143 2143
 
2144
-    $post_type = geodir_get_current_posttype();
2144
+	$post_type = geodir_get_current_posttype();
2145 2145
 
2146
-    $all_postypes = geodir_get_posttypes();
2146
+	$all_postypes = geodir_get_posttypes();
2147 2147
 
2148
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2148
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2149 2149
 
2150
-        if (array_key_exists('post_video', $tabs_arr)) {
2150
+		if (array_key_exists('post_video', $tabs_arr)) {
2151 2151
 
2152
-            $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)));
2152
+			$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)));
2153 2153
 
2154
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2156
-        }
2154
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2155
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2156
+		}
2157 2157
 
2158
-        if (array_key_exists('special_offers', $tabs_arr)) {
2158
+		if (array_key_exists('special_offers', $tabs_arr)) {
2159 2159
 
2160
-            $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)));
2160
+			$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)));
2161 2161
 
2162
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2164
-        }
2162
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2163
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2164
+		}
2165 2165
 
2166
-    }
2166
+	}
2167 2167
 
2168
-    return $tabs_arr;
2168
+	return $tabs_arr;
2169 2169
 
2170 2170
 }
2171 2171
 
@@ -2178,10 +2178,10 @@  discard block
 block discarded – undo
2178 2178
  */
2179 2179
 function geodir_remove_template_redirect_actions()
2180 2180
 {
2181
-    if (geodir_is_page('login')){
2182
-        remove_all_actions('template_redirect');
2183
-        remove_action('init', 'avia_modify_front', 10);
2184
-    }
2181
+	if (geodir_is_page('login')){
2182
+		remove_all_actions('template_redirect');
2183
+		remove_action('init', 'avia_modify_front', 10);
2184
+	}
2185 2185
 }
2186 2186
 
2187 2187
 
@@ -2203,51 +2203,51 @@  discard block
 block discarded – undo
2203 2203
 function geodirectory_before_featured_image_delete($attachment_id)
2204 2204
 {
2205 2205
 
2206
-    global $wpdb, $plugin_prefix;
2206
+	global $wpdb, $plugin_prefix;
2207 2207
 
2208
-    $post_id = get_post_field('post_parent', $attachment_id);
2208
+	$post_id = get_post_field('post_parent', $attachment_id);
2209 2209
 
2210
-    $attachment_url = wp_get_attachment_url($attachment_id);
2210
+	$attachment_url = wp_get_attachment_url($attachment_id);
2211 2211
 
2212
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2212
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2213 2213
 
2214
-        $post_type = get_post_type($post_id);
2214
+		$post_type = get_post_type($post_id);
2215 2215
 
2216
-        $all_postypes = geodir_get_posttypes();
2216
+		$all_postypes = geodir_get_posttypes();
2217 2217
 
2218
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2219
-            return false;
2218
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2219
+			return false;
2220 2220
 
2221
-        $uploads = wp_upload_dir();
2221
+		$uploads = wp_upload_dir();
2222 2222
 
2223
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2223
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2224 2224
 
2225
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2225
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2226 2226
 
2227
-        $wpdb->query(
2228
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2229
-                array($post_id, $split_img_file_path)
2230
-            )
2231
-        );
2227
+		$wpdb->query(
2228
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2229
+				array($post_id, $split_img_file_path)
2230
+			)
2231
+		);
2232 2232
 
2233
-        $attachment_data = $wpdb->get_row(
2234
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2235
-                array($post_id)
2236
-            )
2237
-        );
2233
+		$attachment_data = $wpdb->get_row(
2234
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2235
+				array($post_id)
2236
+			)
2237
+		);
2238 2238
 
2239
-        if (!empty($attachment_data)) {
2240
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2241
-        }
2239
+		if (!empty($attachment_data)) {
2240
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2241
+		}
2242 2242
 
2243 2243
 
2244
-        $table_name = $plugin_prefix . $post_type . '_detail';
2244
+		$table_name = $plugin_prefix . $post_type . '_detail';
2245 2245
 
2246
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2246
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2247 2247
 
2248
-        geodir_set_wp_featured_image($post_id);
2248
+		geodir_set_wp_featured_image($post_id);
2249 2249
 
2250
-    }
2250
+	}
2251 2251
 
2252 2252
 }
2253 2253
 
@@ -2265,79 +2265,79 @@  discard block
 block discarded – undo
2265 2265
 function geodir_temp_set_post_attachment()
2266 2266
 {
2267 2267
 
2268
-    global $wpdb, $plugin_prefix;
2268
+	global $wpdb, $plugin_prefix;
2269 2269
 
2270
-    $all_postypes = geodir_get_posttypes();
2270
+	$all_postypes = geodir_get_posttypes();
2271 2271
 
2272
-    foreach ($all_postypes as $posttype) {
2272
+	foreach ($all_postypes as $posttype) {
2273 2273
 
2274
-        $tablename = $plugin_prefix . $posttype . '_detail';
2274
+		$tablename = $plugin_prefix . $posttype . '_detail';
2275 2275
 
2276
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2276
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2277 2277
 
2278
-        if (!empty($get_post_data)) {
2278
+		if (!empty($get_post_data)) {
2279 2279
 
2280
-            foreach ($get_post_data as $data) {
2280
+			foreach ($get_post_data as $data) {
2281 2281
 
2282
-                $post_id = $data->post_id;
2282
+				$post_id = $data->post_id;
2283 2283
 
2284
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2284
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2285 2285
 
2286
-                if (!empty($attachment_data)) {
2286
+				if (!empty($attachment_data)) {
2287 2287
 
2288
-                    foreach ($attachment_data as $attach) {
2288
+					foreach ($attachment_data as $attach) {
2289 2289
 
2290
-                        $file_info = pathinfo($attach->file);
2290
+						$file_info = pathinfo($attach->file);
2291 2291
 
2292
-                        $sub_dir = '';
2293
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2294
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2292
+						$sub_dir = '';
2293
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2294
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2295 2295
 
2296
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2297
-                        $uploads_path = $uploads['basedir'];
2296
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2297
+						$uploads_path = $uploads['basedir'];
2298 2298
 
2299
-                        $file_name = $file_info['basename'];
2299
+						$file_name = $file_info['basename'];
2300 2300
 
2301
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2301
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2302 2302
 
2303
-                        if (!file_exists($img_arr['path'])) {
2303
+						if (!file_exists($img_arr['path'])) {
2304 2304
 
2305
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2305
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2306 2306
 
2307
-                        }
2307
+						}
2308 2308
 
2309
-                    }
2309
+					}
2310 2310
 
2311
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2311
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2312 2312
 
2313
-                    if (!empty($attachment_data)) {
2313
+					if (!empty($attachment_data)) {
2314 2314
 
2315
-                        if ($attachment_data->ID)
2316
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2315
+						if ($attachment_data->ID)
2316
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2317 2317
 
2318
-                    } else {
2318
+					} else {
2319 2319
 
2320
-                        if (has_post_thumbnail($post_id)) {
2320
+						if (has_post_thumbnail($post_id)) {
2321 2321
 
2322
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2322
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2323 2323
 
2324
-                            wp_delete_attachment($post_thumbnail_id);
2324
+							wp_delete_attachment($post_thumbnail_id);
2325 2325
 
2326
-                        }
2326
+						}
2327 2327
 
2328
-                    }
2328
+					}
2329 2329
 
2330
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2330
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2331 2331
 
2332
-                    geodir_set_wp_featured_image($post_id);
2332
+					geodir_set_wp_featured_image($post_id);
2333 2333
 
2334
-                }
2334
+				}
2335 2335
 
2336
-            }
2336
+			}
2337 2337
 
2338
-        }
2338
+		}
2339 2339
 
2340
-    }
2340
+	}
2341 2341
 
2342 2342
 }
2343 2343
 
@@ -2355,9 +2355,9 @@  discard block
 block discarded – undo
2355 2355
 function geodir_default_rating_star_icon()
2356 2356
 {
2357 2357
 
2358
-    if (!get_option('geodir_default_rating_star_icon')) {
2359
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2360
-    }
2358
+	if (!get_option('geodir_default_rating_star_icon')) {
2359
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2360
+	}
2361 2361
 
2362 2362
 }
2363 2363
 
@@ -2375,27 +2375,27 @@  discard block
 block discarded – undo
2375 2375
  */
2376 2376
 function geodir_user_post_listing_count($user_id=null)
2377 2377
 {
2378
-    global $wpdb, $plugin_prefix, $current_user;
2379
-    if(!$user_id){
2380
-        $user_id = $current_user->ID;
2381
-    }
2378
+	global $wpdb, $plugin_prefix, $current_user;
2379
+	if(!$user_id){
2380
+		$user_id = $current_user->ID;
2381
+	}
2382 2382
 
2383
-    $user_id = $current_user->ID;
2384
-    $all_postypes = geodir_get_posttypes();
2385
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2383
+	$user_id = $current_user->ID;
2384
+	$all_postypes = geodir_get_posttypes();
2385
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2386 2386
 
2387
-    $user_listing = array();
2388
-    if (is_array($all_posts) && !empty($all_posts)) {
2389
-        foreach ($all_posts as $ptype) {
2390
-            $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' )");
2387
+	$user_listing = array();
2388
+	if (is_array($all_posts) && !empty($all_posts)) {
2389
+		foreach ($all_posts as $ptype) {
2390
+			$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' )");
2391 2391
 
2392
-            if ($total_posts > 0) {
2393
-                $user_listing[$ptype] = $total_posts;
2394
-            }
2395
-        }
2396
-    }
2392
+			if ($total_posts > 0) {
2393
+				$user_listing[$ptype] = $total_posts;
2394
+			}
2395
+		}
2396
+	}
2397 2397
 
2398
-    return $user_listing;
2398
+	return $user_listing;
2399 2399
 }
2400 2400
 
2401 2401
 
@@ -2415,586 +2415,586 @@  discard block
 block discarded – undo
2415 2415
  */
2416 2416
 function geodir_detail_page_custom_field_tab($tabs_arr)
2417 2417
 {
2418
-    global $post;
2419
-
2420
-    $post_type = geodir_get_current_posttype();
2421
-    $all_postypes = geodir_get_posttypes();
2422
-
2423
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2424
-        $package_info = array();
2425
-        $package_info = geodir_post_package_info($package_info, $post);
2426
-        $post_package_id = $package_info->pid;
2427
-        $fields_location = 'detail';
2428
-
2429
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2430
-        if (!empty($custom_fields)) {
2431
-            $parse_custom_fields = array();
2432
-            foreach ($custom_fields as $field) {
2433
-                $field = stripslashes_deep($field); // strip slashes
2418
+	global $post;
2419
+
2420
+	$post_type = geodir_get_current_posttype();
2421
+	$all_postypes = geodir_get_posttypes();
2422
+
2423
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2424
+		$package_info = array();
2425
+		$package_info = geodir_post_package_info($package_info, $post);
2426
+		$post_package_id = $package_info->pid;
2427
+		$fields_location = 'detail';
2428
+
2429
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2430
+		if (!empty($custom_fields)) {
2431
+			$parse_custom_fields = array();
2432
+			foreach ($custom_fields as $field) {
2433
+				$field = stripslashes_deep($field); // strip slashes
2434 2434
                 
2435
-                $type = $field;
2436
-                $field_name = $field['htmlvar_name'];
2437
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2438
-                    $post->{$field_name} = $_REQUEST[$field_name];
2439
-                }
2440
-
2441
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2442
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2443
-                        continue;
2444
-                    }
2445
-
2446
-                    $parse_custom_fields[] = $field;
2447
-                }
2448
-            }
2449
-            $custom_fields = $parse_custom_fields;
2450
-        }
2435
+				$type = $field;
2436
+				$field_name = $field['htmlvar_name'];
2437
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2438
+					$post->{$field_name} = $_REQUEST[$field_name];
2439
+				}
2440
+
2441
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2442
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2443
+						continue;
2444
+					}
2445
+
2446
+					$parse_custom_fields[] = $field;
2447
+				}
2448
+			}
2449
+			$custom_fields = $parse_custom_fields;
2450
+		}
2451 2451
 
2452
-        if (!empty($custom_fields)) {
2453
-            $post = stripslashes_deep($post); // strip slashes
2452
+		if (!empty($custom_fields)) {
2453
+			$post = stripslashes_deep($post); // strip slashes
2454 2454
             
2455
-            $field_set_start = 0;
2456
-            $fieldset_count = 0;
2457
-            $fieldset = '';
2458
-            $total_fields = count($custom_fields);
2459
-            $count_field = 0;
2460
-            $fieldset_arr = array();
2461
-            $i = 0;
2462
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2463
-
2464
-            foreach ($custom_fields as $field) {
2465
-                $count_field++;
2466
-                $field_name = $field['htmlvar_name'];
2467
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2468
-                    $post->{$field_name} = $_REQUEST[$field_name];
2469
-                }
2470
-
2471
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2472
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2473
-                    $site_title = trim($field['site_title']);
2474
-                    $type = $field;
2475
-                    $html = '';
2476
-                    $html_var = $field_name;
2477
-                    $field_icon = '';
2478
-                    $variables_array = array();
2479
-
2480
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2481
-                        continue;
2482
-                    }
2483
-
2484
-                    if ($type['type'] != 'fieldset') {
2485
-                        $i++;
2486
-                        $variables_array['post_id'] = $post->ID;
2487
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2488
-                        $variables_array['value'] = '';
2489
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2490
-                    }
2491
-
2492
-                    if (strpos($type['field_icon'], 'http') !== false) {
2493
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2494
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2495
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2496
-                    }
2497
-
2498
-                    switch ($type['type']) {
2499
-                        case 'fieldset': {
2500
-                            $i = 0;
2501
-                            $fieldset_count++;
2502
-                            $field_set_start = 1;
2503
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2504
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2505
-                        }
2506
-                            break;
2507
-                        case 'url': {
2508
-                            if (strpos($field_icon, 'http') !== false) {
2509
-                                $field_icon_af = '';
2510
-                            } elseif ($field_icon == '') {
2511
-
2512
-                                if ($type['name'] == 'geodir_facebook') {
2513
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2514
-                                } elseif ($type['name'] == 'geodir_twitter') {
2515
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2516
-                                } else {
2517
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2518
-                                }
2519
-
2520
-                            } else {
2521
-                                $field_icon_af = $field_icon;
2522
-                                $field_icon = '';
2523
-                            }
2455
+			$field_set_start = 0;
2456
+			$fieldset_count = 0;
2457
+			$fieldset = '';
2458
+			$total_fields = count($custom_fields);
2459
+			$count_field = 0;
2460
+			$fieldset_arr = array();
2461
+			$i = 0;
2462
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2463
+
2464
+			foreach ($custom_fields as $field) {
2465
+				$count_field++;
2466
+				$field_name = $field['htmlvar_name'];
2467
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2468
+					$post->{$field_name} = $_REQUEST[$field_name];
2469
+				}
2470
+
2471
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2472
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2473
+					$site_title = trim($field['site_title']);
2474
+					$type = $field;
2475
+					$html = '';
2476
+					$html_var = $field_name;
2477
+					$field_icon = '';
2478
+					$variables_array = array();
2479
+
2480
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2481
+						continue;
2482
+					}
2483
+
2484
+					if ($type['type'] != 'fieldset') {
2485
+						$i++;
2486
+						$variables_array['post_id'] = $post->ID;
2487
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2488
+						$variables_array['value'] = '';
2489
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
2490
+					}
2491
+
2492
+					if (strpos($type['field_icon'], 'http') !== false) {
2493
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2494
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2495
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2496
+					}
2497
+
2498
+					switch ($type['type']) {
2499
+						case 'fieldset': {
2500
+							$i = 0;
2501
+							$fieldset_count++;
2502
+							$field_set_start = 1;
2503
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2504
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2505
+						}
2506
+							break;
2507
+						case 'url': {
2508
+							if (strpos($field_icon, 'http') !== false) {
2509
+								$field_icon_af = '';
2510
+							} elseif ($field_icon == '') {
2511
+
2512
+								if ($type['name'] == 'geodir_facebook') {
2513
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2514
+								} elseif ($type['name'] == 'geodir_twitter') {
2515
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2516
+								} else {
2517
+									$field_icon_af = '<i class="fa fa-link"></i>';
2518
+								}
2519
+
2520
+							} else {
2521
+								$field_icon_af = $field_icon;
2522
+								$field_icon = '';
2523
+							}
2524 2524
                             
2525
-                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2526
-
2527
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2528
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2529
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2530
-
2531
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2532
-
2533
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2534
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2535
-
2536
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2537
-                                /**
2538
-                                 * Filer the custom field website name.
2539
-                                 *
2540
-                                 * @since 1.0.0
2541
-                                 * @param string $title The field name default: "Website".
2542
-                                 * @param string $website The website address.
2543
-                                 * @param int $post->ID The post ID.
2544
-                                 */
2545
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2546
-                        }
2547
-                            break;
2548
-                        case 'phone': {
2549
-                            if (strpos($field_icon, 'http') !== false) {
2550
-                                $field_icon_af = '';
2551
-                            } elseif ($field_icon == '') {
2552
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2553
-                            } else {
2554
-                                $field_icon_af = $field_icon;
2555
-                                $field_icon = '';
2556
-                            }
2557
-
2558
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2559
-
2560
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2561
-                            if ($field_set_start == 1 && $site_title != '') {
2562
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2563
-                            }
2564
-                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2565
-                        }
2566
-                            break;
2567
-                        case 'time': {
2568
-                            $value = '';
2569
-                            if ($post->{$type['htmlvar_name']} != '')
2570
-                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2571
-
2572
-                            if (strpos($field_icon, 'http') !== false) {
2573
-                                $field_icon_af = '';
2574
-                            } elseif ($field_icon == '') {
2575
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2576
-                            } else {
2577
-                                $field_icon_af = $field_icon;
2578
-                                $field_icon = '';
2579
-                            }
2580
-
2581
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2582
-
2583
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2584
-                            if ($field_set_start == 1 && $site_title != '') {
2585
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2586
-                            }
2587
-                            $html .= ' </span>' . $value . '</div>';
2588
-                        }
2589
-                            break;
2590
-                        case 'datepicker': {
2591
-                            $date_format = geodir_default_date_format();
2592
-                            if ($type['extra_fields'] != '') {
2593
-                                $date_format = unserialize($type['extra_fields']);
2594
-                                $date_format = $date_format['date_format'];
2595
-                            }
2596
-
2597
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2598
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2599
-
2600
-                            $date_format = str_replace($search, $replace, $date_format);
2601
-
2602
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2603
-
2604
-                            $value = '';
2605
-                            if ($post->{$type['htmlvar_name']} != '')
2606
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2607
-
2608
-                            if (strpos($field_icon, 'http') !== false) {
2609
-                                $field_icon_af = '';
2610
-                            } elseif ($field_icon == '') {
2611
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2612
-                            } else {
2613
-                                $field_icon_af = $field_icon;
2614
-                                $field_icon = '';
2615
-                            }
2616
-
2617
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2618
-
2619
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2620
-                            if ($field_set_start == 1 && $site_title != '') {
2621
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2622
-                            }
2623
-                            $html .= ' </span>' . $value . '</div>';
2624
-                        }
2625
-                            break;
2626
-                        case 'text': {
2627
-                            if (strpos($field_icon, 'http') !== false) {
2628
-                                $field_icon_af = '';
2629
-                            } elseif ($field_icon == '') {
2630
-                                $field_icon_af = '';
2631
-                            } else {
2632
-                                $field_icon_af = $field_icon;
2633
-                                $field_icon = '';
2634
-                            }
2635
-
2636
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2637
-
2638
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2639
-                            if ($field_set_start == 1 && $site_title != '') {
2640
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2641
-                            }
2642
-                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2643
-                        }
2644
-                            break;
2645
-                        case 'radio': {
2646
-
2647
-                            if ($post->{$type['htmlvar_name']} != '') {
2648
-                                if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2649
-                                    $html_val = __('No', 'geodirectory');
2650
-                                } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2651
-                                    $html_val = __('Yes', 'geodirectory');
2652
-                                } else {
2653
-                                    $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2525
+							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2526
+
2527
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2528
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2529
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2530
+
2531
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2532
+
2533
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2534
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2535
+
2536
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2537
+								/**
2538
+								 * Filer the custom field website name.
2539
+								 *
2540
+								 * @since 1.0.0
2541
+								 * @param string $title The field name default: "Website".
2542
+								 * @param string $website The website address.
2543
+								 * @param int $post->ID The post ID.
2544
+								 */
2545
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2546
+						}
2547
+							break;
2548
+						case 'phone': {
2549
+							if (strpos($field_icon, 'http') !== false) {
2550
+								$field_icon_af = '';
2551
+							} elseif ($field_icon == '') {
2552
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2553
+							} else {
2554
+								$field_icon_af = $field_icon;
2555
+								$field_icon = '';
2556
+							}
2557
+
2558
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2559
+
2560
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2561
+							if ($field_set_start == 1 && $site_title != '') {
2562
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2563
+							}
2564
+							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2565
+						}
2566
+							break;
2567
+						case 'time': {
2568
+							$value = '';
2569
+							if ($post->{$type['htmlvar_name']} != '')
2570
+								$value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2571
+
2572
+							if (strpos($field_icon, 'http') !== false) {
2573
+								$field_icon_af = '';
2574
+							} elseif ($field_icon == '') {
2575
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2576
+							} else {
2577
+								$field_icon_af = $field_icon;
2578
+								$field_icon = '';
2579
+							}
2580
+
2581
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2582
+
2583
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2584
+							if ($field_set_start == 1 && $site_title != '') {
2585
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2586
+							}
2587
+							$html .= ' </span>' . $value . '</div>';
2588
+						}
2589
+							break;
2590
+						case 'datepicker': {
2591
+							$date_format = geodir_default_date_format();
2592
+							if ($type['extra_fields'] != '') {
2593
+								$date_format = unserialize($type['extra_fields']);
2594
+								$date_format = $date_format['date_format'];
2595
+							}
2596
+
2597
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2598
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2599
+
2600
+							$date_format = str_replace($search, $replace, $date_format);
2601
+
2602
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2603
+
2604
+							$value = '';
2605
+							if ($post->{$type['htmlvar_name']} != '')
2606
+								$value = date($date_format, strtotime($post_htmlvar_value));
2607
+
2608
+							if (strpos($field_icon, 'http') !== false) {
2609
+								$field_icon_af = '';
2610
+							} elseif ($field_icon == '') {
2611
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2612
+							} else {
2613
+								$field_icon_af = $field_icon;
2614
+								$field_icon = '';
2615
+							}
2616
+
2617
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2618
+
2619
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2620
+							if ($field_set_start == 1 && $site_title != '') {
2621
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2622
+							}
2623
+							$html .= ' </span>' . $value . '</div>';
2624
+						}
2625
+							break;
2626
+						case 'text': {
2627
+							if (strpos($field_icon, 'http') !== false) {
2628
+								$field_icon_af = '';
2629
+							} elseif ($field_icon == '') {
2630
+								$field_icon_af = '';
2631
+							} else {
2632
+								$field_icon_af = $field_icon;
2633
+								$field_icon = '';
2634
+							}
2635
+
2636
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2637
+
2638
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2639
+							if ($field_set_start == 1 && $site_title != '') {
2640
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2641
+							}
2642
+							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2643
+						}
2644
+							break;
2645
+						case 'radio': {
2646
+
2647
+							if ($post->{$type['htmlvar_name']} != '') {
2648
+								if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2649
+									$html_val = __('No', 'geodirectory');
2650
+								} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2651
+									$html_val = __('Yes', 'geodirectory');
2652
+								} else {
2653
+									$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
2654 2654
                                     
2655
-                                    if (!empty($type['option_values'])) {
2656
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2655
+									if (!empty($type['option_values'])) {
2656
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2657 2657
                                         
2658
-                                        if (!empty($cf_option_values)) {
2659
-                                            foreach ($cf_option_values as $cf_option_value) {
2660
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2661
-                                                    $html_val = $cf_option_value['label'];
2662
-                                                }
2663
-                                            }
2664
-                                        }
2665
-                                    }
2666
-                                }
2667
-
2668
-                                if (strpos($field_icon, 'http') !== false) {
2669
-                                    $field_icon_af = '';
2670
-                                } else if ($field_icon == '') {
2671
-                                    $field_icon_af = '';
2672
-                                } else {
2673
-                                    $field_icon_af = $field_icon;
2674
-                                    $field_icon = '';
2675
-                                }
2676
-
2677
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2678
-
2679
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2680
-
2681
-                                if ($field_set_start == 1 && $site_title != '') {
2682
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2683
-                                }
2684
-
2685
-                                $html .= ' </span>' . $html_val . '</div>';
2686
-                            }
2687
-                        }
2688
-                            break;
2689
-                        case 'checkbox': {
2690
-                            $html_var = $type['htmlvar_name'];
2691
-                            $html_val = $type['htmlvar_name'];
2692
-
2693
-                            if ((int)$post->{$html_var} == 1) {
2694
-
2695
-                                if ($post->{$type['htmlvar_name']} == '1') {
2696
-                                    $html_val = __('Yes', 'geodirectory');
2697
-                                } else {
2698
-                                    $html_val = __('No', 'geodirectory');
2699
-                                }
2700
-
2701
-                                if (strpos($field_icon, 'http') !== false) {
2702
-                                    $field_icon_af = '';
2703
-                                } else if ($field_icon == '') {
2704
-                                    $field_icon_af = '';
2705
-                                } else {
2706
-                                    $field_icon_af = $field_icon;
2707
-                                    $field_icon = '';
2708
-                                }
2709
-
2710
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2711
-
2712
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2713
-
2714
-                                if ($field_set_start == 1 && $site_title != '') {
2715
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2716
-                                }
2717
-
2718
-                                $html .= ' </span>' . $html_val . '</div>';
2719
-                            }
2720
-                        }
2721
-                            break;
2722
-                        case 'select': {
2723
-                            if (strpos($field_icon, 'http') !== false) {
2724
-                                $field_icon_af = '';
2725
-                            } elseif ($field_icon == '') {
2726
-                                $field_icon_af = '';
2727
-                            } else {
2728
-                                $field_icon_af = $field_icon;
2729
-                                $field_icon = '';
2730
-                            }
2658
+										if (!empty($cf_option_values)) {
2659
+											foreach ($cf_option_values as $cf_option_value) {
2660
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2661
+													$html_val = $cf_option_value['label'];
2662
+												}
2663
+											}
2664
+										}
2665
+									}
2666
+								}
2667
+
2668
+								if (strpos($field_icon, 'http') !== false) {
2669
+									$field_icon_af = '';
2670
+								} else if ($field_icon == '') {
2671
+									$field_icon_af = '';
2672
+								} else {
2673
+									$field_icon_af = $field_icon;
2674
+									$field_icon = '';
2675
+								}
2676
+
2677
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2678
+
2679
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2680
+
2681
+								if ($field_set_start == 1 && $site_title != '') {
2682
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2683
+								}
2684
+
2685
+								$html .= ' </span>' . $html_val . '</div>';
2686
+							}
2687
+						}
2688
+							break;
2689
+						case 'checkbox': {
2690
+							$html_var = $type['htmlvar_name'];
2691
+							$html_val = $type['htmlvar_name'];
2692
+
2693
+							if ((int)$post->{$html_var} == 1) {
2694
+
2695
+								if ($post->{$type['htmlvar_name']} == '1') {
2696
+									$html_val = __('Yes', 'geodirectory');
2697
+								} else {
2698
+									$html_val = __('No', 'geodirectory');
2699
+								}
2700
+
2701
+								if (strpos($field_icon, 'http') !== false) {
2702
+									$field_icon_af = '';
2703
+								} else if ($field_icon == '') {
2704
+									$field_icon_af = '';
2705
+								} else {
2706
+									$field_icon_af = $field_icon;
2707
+									$field_icon = '';
2708
+								}
2709
+
2710
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2711
+
2712
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2713
+
2714
+								if ($field_set_start == 1 && $site_title != '') {
2715
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2716
+								}
2717
+
2718
+								$html .= ' </span>' . $html_val . '</div>';
2719
+							}
2720
+						}
2721
+							break;
2722
+						case 'select': {
2723
+							if (strpos($field_icon, 'http') !== false) {
2724
+								$field_icon_af = '';
2725
+							} elseif ($field_icon == '') {
2726
+								$field_icon_af = '';
2727
+							} else {
2728
+								$field_icon_af = $field_icon;
2729
+								$field_icon = '';
2730
+							}
2731 2731
                             
2732
-                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2732
+							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
2733 2733
                             
2734
-                            if (!empty($type['option_values'])) {
2735
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2734
+							if (!empty($type['option_values'])) {
2735
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2736 2736
                                 
2737
-                                if (!empty($cf_option_values)) {
2738
-                                    foreach ($cf_option_values as $cf_option_value) {
2739
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2740
-                                            $field_value = $cf_option_value['label'];
2741
-                                        }
2742
-                                    }
2743
-                                }
2744
-                            }
2745
-
2746
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2747
-
2748
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2749
-                            if ($field_set_start == 1 && $site_title != '') {
2750
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2751
-                            }
2752
-                            $html .= ' </span>' . $field_value . '</div>';
2753
-                        }
2754
-                            break;
2755
-                        case 'multiselect': {
2756
-                            if (is_array($post->{$type['htmlvar_name']})) {
2757
-                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2758
-                            }
2759
-
2760
-                            if (strpos($field_icon, 'http') !== false) {
2761
-                                $field_icon_af = '';
2762
-                            } elseif ($field_icon == '') {
2763
-                                $field_icon_af = '';
2764
-                            } else {
2765
-                                $field_icon_af = $field_icon;
2766
-                                $field_icon = '';
2767
-                            }
2768
-
2769
-                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2770
-
2771
-                            $option_values = array();
2772
-                            if (!empty($type['option_values'])) {
2773
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2737
+								if (!empty($cf_option_values)) {
2738
+									foreach ($cf_option_values as $cf_option_value) {
2739
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2740
+											$field_value = $cf_option_value['label'];
2741
+										}
2742
+									}
2743
+								}
2744
+							}
2745
+
2746
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2747
+
2748
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2749
+							if ($field_set_start == 1 && $site_title != '') {
2750
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2751
+							}
2752
+							$html .= ' </span>' . $field_value . '</div>';
2753
+						}
2754
+							break;
2755
+						case 'multiselect': {
2756
+							if (is_array($post->{$type['htmlvar_name']})) {
2757
+								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
2758
+							}
2759
+
2760
+							if (strpos($field_icon, 'http') !== false) {
2761
+								$field_icon_af = '';
2762
+							} elseif ($field_icon == '') {
2763
+								$field_icon_af = '';
2764
+							} else {
2765
+								$field_icon_af = $field_icon;
2766
+								$field_icon = '';
2767
+							}
2768
+
2769
+							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
2770
+
2771
+							$option_values = array();
2772
+							if (!empty($type['option_values'])) {
2773
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2774 2774
                                 
2775
-                                if (!empty($cf_option_values)) {
2776
-                                    foreach ($cf_option_values as $cf_option_value) {
2777
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2778
-                                            $option_values[] = $cf_option_value['label'];
2779
-                                        }
2780
-                                    }
2781
-                                }
2782
-                            }
2783
-
2784
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2785
-
2786
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2787
-                            if ($field_set_start == 1 && $site_title != '') {
2788
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2789
-                            }
2790
-                            $html .= ' </span>';
2791
-
2792
-                            $html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';
2793
-
2794
-                            if (count($option_values) > 1) {
2795
-                                $html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
2796
-                            } else {
2797
-                                $vals = explode(",",$post->{$type['htmlvar_name']});
2798
-                                $html .= "<span>".implode('</span>, <span>', $vals)."</span>";
2799
-                            }
2800
-
2801
-                            $html .= ' </span>';
2802
-
2803
-
2804
-
2805
-
2806
-                            $html .= '</div>';
2807
-                        }
2808
-                            break;
2809
-                        case 'email': {
2810
-                            if (strpos($field_icon, 'http') !== false) {
2811
-                                $field_icon_af = '';
2812
-                            } elseif ($field_icon == '') {
2813
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2814
-                            } else {
2815
-                                $field_icon_af = $field_icon;
2816
-                                $field_icon = '';
2817
-                            }
2818
-
2819
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2820
-
2821
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2822
-                            if ($field_set_start == 1 && $site_title != '') {
2823
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2824
-                            }
2825
-                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2826
-                        }
2827
-                            break;
2828
-                        case 'textarea': {
2829
-                            if (strpos($field_icon, 'http') !== false) {
2830
-                                $field_icon_af = '';
2831
-                            } elseif ($field_icon == '') {
2832
-                                $field_icon_af = '';
2833
-                            } else {
2834
-                                $field_icon_af = $field_icon;
2835
-                                $field_icon = '';
2836
-                            }
2837
-
2838
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2839
-
2840
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2841
-                            if ($field_set_start == 1 && $site_title != '') {
2842
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2843
-                            }
2844
-                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2845
-                        }
2846
-                            break;
2847
-                        case 'html': {
2848
-                            if (strpos($field_icon, 'http') !== false) {
2849
-                                $field_icon_af = '';
2850
-                            } elseif ($field_icon == '') {
2851
-                                $field_icon_af = '';
2852
-                            } else {
2853
-                                $field_icon_af = $field_icon;
2854
-                                $field_icon = '';
2855
-                            }
2856
-
2857
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2858
-
2859
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2860
-                            if ($field_set_start == 1 && $site_title != '') {
2861
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2862
-                            }
2863
-                            $html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2864
-                        }
2865
-                        break;
2866
-                        case 'file': {
2867
-                            $html_var = $type['htmlvar_name'];
2868
-
2869
-                            if (!empty($post->{$type['htmlvar_name']})) {
2870
-                                $files = explode(",", $post->{$type['htmlvar_name']});
2871
-
2872
-                                if (!empty($files)) {
2873
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2874
-                                    $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'] : '';
2775
+								if (!empty($cf_option_values)) {
2776
+									foreach ($cf_option_values as $cf_option_value) {
2777
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2778
+											$option_values[] = $cf_option_value['label'];
2779
+										}
2780
+									}
2781
+								}
2782
+							}
2783
+
2784
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2785
+
2786
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2787
+							if ($field_set_start == 1 && $site_title != '') {
2788
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2789
+							}
2790
+							$html .= ' </span>';
2791
+
2792
+							$html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';
2793
+
2794
+							if (count($option_values) > 1) {
2795
+								$html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
2796
+							} else {
2797
+								$vals = explode(",",$post->{$type['htmlvar_name']});
2798
+								$html .= "<span>".implode('</span>, <span>', $vals)."</span>";
2799
+							}
2800
+
2801
+							$html .= ' </span>';
2802
+
2803
+
2804
+
2805
+
2806
+							$html .= '</div>';
2807
+						}
2808
+							break;
2809
+						case 'email': {
2810
+							if (strpos($field_icon, 'http') !== false) {
2811
+								$field_icon_af = '';
2812
+							} elseif ($field_icon == '') {
2813
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2814
+							} else {
2815
+								$field_icon_af = $field_icon;
2816
+								$field_icon = '';
2817
+							}
2818
+
2819
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2820
+
2821
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2822
+							if ($field_set_start == 1 && $site_title != '') {
2823
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2824
+							}
2825
+							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
2826
+						}
2827
+							break;
2828
+						case 'textarea': {
2829
+							if (strpos($field_icon, 'http') !== false) {
2830
+								$field_icon_af = '';
2831
+							} elseif ($field_icon == '') {
2832
+								$field_icon_af = '';
2833
+							} else {
2834
+								$field_icon_af = $field_icon;
2835
+								$field_icon = '';
2836
+							}
2837
+
2838
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2839
+
2840
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2841
+							if ($field_set_start == 1 && $site_title != '') {
2842
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2843
+							}
2844
+							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2845
+						}
2846
+							break;
2847
+						case 'html': {
2848
+							if (strpos($field_icon, 'http') !== false) {
2849
+								$field_icon_af = '';
2850
+							} elseif ($field_icon == '') {
2851
+								$field_icon_af = '';
2852
+							} else {
2853
+								$field_icon_af = $field_icon;
2854
+								$field_icon = '';
2855
+							}
2856
+
2857
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2858
+
2859
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2860
+							if ($field_set_start == 1 && $site_title != '') {
2861
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2862
+							}
2863
+							$html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
2864
+						}
2865
+						break;
2866
+						case 'file': {
2867
+							$html_var = $type['htmlvar_name'];
2868
+
2869
+							if (!empty($post->{$type['htmlvar_name']})) {
2870
+								$files = explode(",", $post->{$type['htmlvar_name']});
2871
+
2872
+								if (!empty($files)) {
2873
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2874
+									$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'] : '';
2875 2875
                                
2876
-                                    $file_paths = '';
2877
-                                    foreach ($files as $file) {
2878
-                                        if (!empty($file)) {
2879
-                                            $image_name_arr = explode('/', $file);
2880
-                                            $filename = end($image_name_arr);
2881
-
2882
-                                            $arr_file_type = wp_check_filetype($filename);
2883
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2884
-                                                continue;
2885
-                                            }
2886
-                                            $uploaded_file_type = $arr_file_type['type'];
2887
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2876
+									$file_paths = '';
2877
+									foreach ($files as $file) {
2878
+										if (!empty($file)) {
2879
+											$image_name_arr = explode('/', $file);
2880
+											$filename = end($image_name_arr);
2881
+
2882
+											$arr_file_type = wp_check_filetype($filename);
2883
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2884
+												continue;
2885
+											}
2886
+											$uploaded_file_type = $arr_file_type['type'];
2887
+											$uploaded_file_ext = $arr_file_type['ext'];
2888 2888
                                             
2889
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2890
-                                                continue; // Invalid file type.
2891
-                                            }
2892
-
2893
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2894
-
2895
-                                            // If the uploaded file is image
2896
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2897
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2898
-                                                $file_paths .= '<a href="'.$file.'">';
2899
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2900
-                                                $file_paths .= '</a>';
2901
-                                                $file_paths .= '</div>';
2902
-                                            } else {
2903
-                                                $ext_path = '_' . $html_var . '_';
2904
-                                                $filename = explode($ext_path, $filename);
2905
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2906
-                                            }
2907
-                                        }
2908
-                                    }
2909
-
2910
-                                    if (strpos($field_icon, 'http') !== false) {
2911
-                                        $field_icon_af = '';
2912
-                                    } else if ($field_icon == '') {
2913
-                                        $field_icon_af = '';
2914
-                                    } else {
2915
-                                        $field_icon_af = $field_icon;
2916
-                                        $field_icon = '';
2917
-                                    }
2918
-
2919
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2920
-
2921
-
2922
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2923
-
2924
-                                    if ($field_set_start == 1 && $site_title != '') {
2925
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2926
-                                    }
2927
-
2928
-                                    $html .= ' </span>' . $file_paths . '</div>';
2929
-                                }
2930
-                            }
2931
-                        }
2932
-                            break;
2933
-                    }
2934
-
2935
-
2936
-                    /**
2937
-                     * Filter custom field output in tab.
2938
-                     *
2939
-                     * @since 1.5.6
2940
-                     *
2941
-                     * @param string $html_var The HTML variable name for the field.
2942
-                     * @param string $html Custom field unfiltered HTML.
2943
-                     * @param array $variables_array Custom field variables array.
2944
-                     */
2945
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2946
-
2947
-                    $fieldset_html = '';
2948
-                    if ($field_set_start == 1) {
2949
-                        $add_html = false;
2950
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2951
-                            if ($fieldset != '') {
2952
-                                $add_html = true;
2953
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2954
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2955
-                            }
2956
-                            $fieldset_html = $fieldset;
2957
-                            $fieldset = '';
2958
-                        } else {
2959
-                            $fieldset .= $html;
2960
-                            if ($total_fields == $count_field && $fieldset != '') {
2961
-                                $add_html = true;
2962
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2963
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2964
-                                $fieldset_html = $fieldset;
2965
-                            }
2966
-                        }
2967
-
2968
-                        if ($add_html) {
2969
-                            $tabs_arr[$htmlvar_name] = array(
2970
-                                'heading_text' => __($label, 'geodirectory'),
2971
-                                'is_active_tab' => false,
2972
-                                /**
2973
-                                 * Filter if a custom field should be displayed on the details page tab.
2974
-                                 *
2975
-                                 * @since 1.0.0
2976
-                                 * @param string $htmlvar_name The field HTML var name.
2977
-                                 */
2978
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2979
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2980
-                            );
2981
-                        }
2982
-                    } else {
2983
-                        if ($html != '') {
2984
-                            $tabs_arr[$field['htmlvar_name']] = array(
2985
-                                'heading_text' => __($label, 'geodirectory'),
2986
-                                'is_active_tab' => false,
2987
-                                /** This action is documented in geodirectory_hooks_actions.php */
2988
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2989
-                                'tab_content' => $html
2990
-                            );
2991
-                        }
2992
-                    }
2993
-                }
2994
-            }
2995
-        }
2996
-    }
2997
-    return $tabs_arr;
2889
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2890
+												continue; // Invalid file type.
2891
+											}
2892
+
2893
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2894
+
2895
+											// If the uploaded file is image
2896
+											if (in_array($uploaded_file_type, $image_file_types)) {
2897
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2898
+												$file_paths .= '<a href="'.$file.'">';
2899
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2900
+												$file_paths .= '</a>';
2901
+												$file_paths .= '</div>';
2902
+											} else {
2903
+												$ext_path = '_' . $html_var . '_';
2904
+												$filename = explode($ext_path, $filename);
2905
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2906
+											}
2907
+										}
2908
+									}
2909
+
2910
+									if (strpos($field_icon, 'http') !== false) {
2911
+										$field_icon_af = '';
2912
+									} else if ($field_icon == '') {
2913
+										$field_icon_af = '';
2914
+									} else {
2915
+										$field_icon_af = $field_icon;
2916
+										$field_icon = '';
2917
+									}
2918
+
2919
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2920
+
2921
+
2922
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2923
+
2924
+									if ($field_set_start == 1 && $site_title != '') {
2925
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2926
+									}
2927
+
2928
+									$html .= ' </span>' . $file_paths . '</div>';
2929
+								}
2930
+							}
2931
+						}
2932
+							break;
2933
+					}
2934
+
2935
+
2936
+					/**
2937
+					 * Filter custom field output in tab.
2938
+					 *
2939
+					 * @since 1.5.6
2940
+					 *
2941
+					 * @param string $html_var The HTML variable name for the field.
2942
+					 * @param string $html Custom field unfiltered HTML.
2943
+					 * @param array $variables_array Custom field variables array.
2944
+					 */
2945
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2946
+
2947
+					$fieldset_html = '';
2948
+					if ($field_set_start == 1) {
2949
+						$add_html = false;
2950
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2951
+							if ($fieldset != '') {
2952
+								$add_html = true;
2953
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2954
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2955
+							}
2956
+							$fieldset_html = $fieldset;
2957
+							$fieldset = '';
2958
+						} else {
2959
+							$fieldset .= $html;
2960
+							if ($total_fields == $count_field && $fieldset != '') {
2961
+								$add_html = true;
2962
+								$label = $fieldset_arr[$fieldset_count]['label'];
2963
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2964
+								$fieldset_html = $fieldset;
2965
+							}
2966
+						}
2967
+
2968
+						if ($add_html) {
2969
+							$tabs_arr[$htmlvar_name] = array(
2970
+								'heading_text' => __($label, 'geodirectory'),
2971
+								'is_active_tab' => false,
2972
+								/**
2973
+								 * Filter if a custom field should be displayed on the details page tab.
2974
+								 *
2975
+								 * @since 1.0.0
2976
+								 * @param string $htmlvar_name The field HTML var name.
2977
+								 */
2978
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2979
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2980
+							);
2981
+						}
2982
+					} else {
2983
+						if ($html != '') {
2984
+							$tabs_arr[$field['htmlvar_name']] = array(
2985
+								'heading_text' => __($label, 'geodirectory'),
2986
+								'is_active_tab' => false,
2987
+								/** This action is documented in geodirectory_hooks_actions.php */
2988
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2989
+								'tab_content' => $html
2990
+							);
2991
+						}
2992
+					}
2993
+				}
2994
+			}
2995
+		}
2996
+	}
2997
+	return $tabs_arr;
2998 2998
 }
2999 2999
 
3000 3000
 /* display add listing page for wpml */
@@ -3018,37 +3018,37 @@  discard block
 block discarded – undo
3018 3018
  */
3019 3019
 function geodir_add_post_status_author_page()
3020 3020
 {
3021
-    global $wpdb, $post;
3022
-
3023
-    $html = '';
3024
-    if (get_current_user_id()) {
3025
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3026
-
3027
-            // 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.
3028
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3029
-            $status = "<strong>(";
3030
-            $status_icon = '<i class="fa fa-play"></i>';
3031
-            if ($real_status == 'publish') {
3032
-                $status .= __('Published', 'geodirectory');
3033
-            } else {
3034
-                $status .= __('Not published', 'geodirectory');
3035
-                $status_icon = '<i class="fa fa-pause"></i>';
3036
-            }
3037
-            $status .= ")</strong>";
3021
+	global $wpdb, $post;
3022
+
3023
+	$html = '';
3024
+	if (get_current_user_id()) {
3025
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3026
+
3027
+			// 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.
3028
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3029
+			$status = "<strong>(";
3030
+			$status_icon = '<i class="fa fa-play"></i>';
3031
+			if ($real_status == 'publish') {
3032
+				$status .= __('Published', 'geodirectory');
3033
+			} else {
3034
+				$status .= __('Not published', 'geodirectory');
3035
+				$status_icon = '<i class="fa fa-pause"></i>';
3036
+			}
3037
+			$status .= ")</strong>";
3038 3038
 
3039
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3040
-        }
3041
-    }
3039
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3040
+		}
3041
+	}
3042 3042
 
3043
-    if ($html != '') {
3044
-        /**
3045
-         * Filter the post status text on the author page.
3046
-         *
3047
-         * @since 1.0.0
3048
-         * @param string $html The HTML of the status.
3049
-         */
3050
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3051
-    }
3043
+	if ($html != '') {
3044
+		/**
3045
+		 * Filter the post status text on the author page.
3046
+		 *
3047
+		 * @since 1.0.0
3048
+		 * @param string $html The HTML of the status.
3049
+		 */
3050
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3051
+	}
3052 3052
 
3053 3053
 
3054 3054
 }
@@ -3062,21 +3062,21 @@  discard block
 block discarded – undo
3062 3062
  */
3063 3063
 function geodir_init_no_rating()
3064 3064
 {
3065
-    if (get_option('geodir_disable_rating')) {
3066
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3067
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3068
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3069
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3070
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3071
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3072
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3073
-
3074
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3075
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3076
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3077
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3078
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3079
-    }
3065
+	if (get_option('geodir_disable_rating')) {
3066
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3067
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3068
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3069
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3070
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3071
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3072
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3073
+
3074
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3075
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3076
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3077
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3078
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3079
+	}
3080 3080
 }
3081 3081
 
3082 3082
 /**
@@ -3088,20 +3088,20 @@  discard block
 block discarded – undo
3088 3088
  */
3089 3089
 function geodir_no_rating_rating_fields()
3090 3090
 {
3091
-    global $post;
3091
+	global $post;
3092 3092
 
3093
-    $post_types = geodir_get_posttypes();
3093
+	$post_types = geodir_get_posttypes();
3094 3094
 
3095
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3096
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3097
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3098
-            if (get_option('geodir_reviewrating_enable_images')) {
3099
-                geodir_reviewrating_rating_img_html();
3100
-            }
3101
-        } else {
3102
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3103
-        }
3104
-    }
3095
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3096
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3097
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3098
+			if (get_option('geodir_reviewrating_enable_images')) {
3099
+				geodir_reviewrating_rating_img_html();
3100
+			}
3101
+		} else {
3102
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3103
+		}
3104
+	}
3105 3105
 }
3106 3106
 
3107 3107
 /**
@@ -3115,11 +3115,11 @@  discard block
 block discarded – undo
3115 3115
  */
3116 3116
 function geodir_no_rating_comment_text($content, $comment = '')
3117 3117
 {
3118
-    if (!is_admin()) {
3119
-        return '<div class="description">' . $content . '</div>';
3120
-    } else {
3121
-        return $content;
3122
-    }
3118
+	if (!is_admin()) {
3119
+		return '<div class="description">' . $content . '</div>';
3120
+	} else {
3121
+		return $content;
3122
+	}
3123 3123
 }
3124 3124
 
3125 3125
 /**
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
  */
3133 3133
 function geodir_no_rating_review_rating_html($content = '')
3134 3134
 {
3135
-    return NULL;
3135
+	return NULL;
3136 3136
 }
3137 3137
 
3138 3138
 /**
@@ -3146,19 +3146,19 @@  discard block
 block discarded – undo
3146 3146
  */
3147 3147
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3148 3148
 {
3149
-    $new_options = array();
3150
-    if (!empty($options)) {
3151
-        foreach ($options as $option) {
3152
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3153
-                continue;
3154
-            }
3155
-            $new_options[] = $option;
3156
-        }
3149
+	$new_options = array();
3150
+	if (!empty($options)) {
3151
+		foreach ($options as $option) {
3152
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3153
+				continue;
3154
+			}
3155
+			$new_options[] = $option;
3156
+		}
3157 3157
 
3158
-        $options = $new_options;
3159
-    }
3158
+		$options = $new_options;
3159
+	}
3160 3160
 
3161
-    return $options;
3161
+	return $options;
3162 3162
 }
3163 3163
 
3164 3164
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3172,11 +3172,11 @@  discard block
 block discarded – undo
3172 3172
  */
3173 3173
 function geodir_all_js_msg_no_rating($msg = array())
3174 3174
 {
3175
-    if (get_option('geodir_disable_rating')) {
3176
-        $msg['gd_cmt_no_rating'] = true;
3177
-    }
3175
+	if (get_option('geodir_disable_rating')) {
3176
+		$msg['gd_cmt_no_rating'] = true;
3177
+	}
3178 3178
 
3179
-    return $msg;
3179
+	return $msg;
3180 3180
 }
3181 3181
 
3182 3182
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3190,13 +3190,13 @@  discard block
 block discarded – undo
3190 3190
  */
3191 3191
 function geodir_body_class_no_rating($classes = array())
3192 3192
 {
3193
-    if (get_option('geodir_disable_rating')) {
3194
-        $classes[] = 'gd-no-rating';
3195
-    }
3193
+	if (get_option('geodir_disable_rating')) {
3194
+		$classes[] = 'gd-no-rating';
3195
+	}
3196 3196
     
3197
-    $classes[] = 'gd-map-' . geodir_map_name();
3197
+	$classes[] = 'gd-map-' . geodir_map_name();
3198 3198
 
3199
-    return $classes;
3199
+	return $classes;
3200 3200
 }
3201 3201
 
3202 3202
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3210,13 +3210,13 @@  discard block
 block discarded – undo
3210 3210
  */
3211 3211
 function geodir_admin_body_class_no_rating($class = '')
3212 3212
 {
3213
-    if (get_option('geodir_disable_rating')) {
3214
-        $class .= ' gd-no-rating';
3215
-    }
3213
+	if (get_option('geodir_disable_rating')) {
3214
+		$class .= ' gd-no-rating';
3215
+	}
3216 3216
     
3217
-    $class .= ' gd-map-' . geodir_map_name();
3217
+	$class .= ' gd-map-' . geodir_map_name();
3218 3218
 
3219
-    return $class;
3219
+	return $class;
3220 3220
 }
3221 3221
 
3222 3222
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3229,10 +3229,10 @@  discard block
 block discarded – undo
3229 3229
  */
3230 3230
 function geodir_wp_head_no_rating()
3231 3231
 {
3232
-    if (get_option('geodir_disable_rating')) {
3233
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3234
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3235
-    }
3232
+	if (get_option('geodir_disable_rating')) {
3233
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3234
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3235
+	}
3236 3236
 }
3237 3237
 
3238 3238
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3249,36 +3249,36 @@  discard block
 block discarded – undo
3249 3249
  * @return array Translation texts.
3250 3250
  */
3251 3251
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3252
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3253
-
3254
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3255
-
3256
-    /**
3257
-     * Filters the geodirectory option names that requires to add for translation.
3258
-     *
3259
-     * @since 1.5.7
3260
-     * @package GeoDirectory
3261
-     *
3262
-     * @param  array $gd_options Array of option names.
3263
-     */
3264
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3265
-    $gd_options = array_unique($gd_options);
3266
-
3267
-    if (!empty($gd_options)) {
3268
-        foreach ($gd_options as $gd_option) {
3269
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3270
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3252
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3253
+
3254
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
3255
+
3256
+	/**
3257
+	 * Filters the geodirectory option names that requires to add for translation.
3258
+	 *
3259
+	 * @since 1.5.7
3260
+	 * @package GeoDirectory
3261
+	 *
3262
+	 * @param  array $gd_options Array of option names.
3263
+	 */
3264
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3265
+	$gd_options = array_unique($gd_options);
3266
+
3267
+	if (!empty($gd_options)) {
3268
+		foreach ($gd_options as $gd_option) {
3269
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3270
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3271 3271
                 
3272
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3273
-                    $translation_texts[] = stripslashes_deep($option_value);
3274
-                }
3275
-            }
3276
-        }
3277
-    }
3272
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3273
+					$translation_texts[] = stripslashes_deep($option_value);
3274
+				}
3275
+			}
3276
+		}
3277
+	}
3278 3278
 
3279
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3279
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3280 3280
 
3281
-    return $translation_texts;
3281
+	return $translation_texts;
3282 3282
 }
3283 3283
 
3284 3284
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -3292,15 +3292,15 @@  discard block
 block discarded – undo
3292 3292
 
3293 3293
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
3294 3294
 function gd_get_comments_link($comments_link, $post_id) {
3295
-    $post_type = get_post_type($post_id);
3295
+	$post_type = get_post_type($post_id);
3296 3296
 
3297
-    $all_postypes = geodir_get_posttypes();
3298
-    if (in_array($post_type, $all_postypes)) {
3299
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
3300
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
3301
-    }
3297
+	$all_postypes = geodir_get_posttypes();
3298
+	if (in_array($post_type, $all_postypes)) {
3299
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
3300
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
3301
+	}
3302 3302
 
3303
-    return $comments_link;
3303
+	return $comments_link;
3304 3304
 }
3305 3305
 
3306 3306
 
@@ -3318,11 +3318,11 @@  discard block
 block discarded – undo
3318 3318
 function geodir_add_nav_menu_class( $args )
3319 3319
 {
3320 3320
 
3321
-        if(isset($args['menu_class'])){
3322
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
3323
-        }
3321
+		if(isset($args['menu_class'])){
3322
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
3323
+		}
3324 3324
     
3325
-    return $args;
3325
+	return $args;
3326 3326
 }
3327 3327
 
3328 3328
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
3329 3329
\ No newline at end of file
Please login to merge, or discard this patch.