Test Failed
Push — master ( 92bef4...4fd89c )
by Stiofan
08:03
created
geodirectory-functions/custom_fields_functions.php 3 patches
Indentation   +2245 added lines, -2245 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,705 +72,705 @@  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_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
89
-
90
-    if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
93
-        $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
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_admin IN ('1') ";
87
+	elseif ($default == 'custom')
88
+		$default_query .= " and is_admin = '0' ";
89
+
90
+	if ($fields_location == 'none') {
91
+	} else{
92
+		$fields_location = esc_sql( $fields_location );
93
+		$default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
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
-    /**
155
-     * Adds admin html for custom fields.
156
-     *
157
-     * @since 1.0.0
158
-     * @package GeoDirectory
159
-     * @global object $wpdb WordPress Database object.
160
-     * @param string $field_type The form field type.
161
-     * @param object|int $result_str The custom field results object or row id.
162
-     * @param string $field_ins_upd When set to "submit" displays form.
163
-     * @param string $field_type_key The key of the custom field.
164
-     */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
-    {
167
-        global $wpdb;
168
-        $cf = $result_str;
169
-        if (!is_object($cf)) {
170
-
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
-
173
-        } else {
174
-            $field_info = $cf;
175
-            $result_str = $cf->id;
176
-        }
177
-        /**
178
-         * Contains custom field html.
179
-         *
180
-         * @since 1.0.0
181
-         */
182
-        include('custom_field_html.php');
183
-
184
-    }
154
+	/**
155
+	 * Adds admin html for custom fields.
156
+	 *
157
+	 * @since 1.0.0
158
+	 * @package GeoDirectory
159
+	 * @global object $wpdb WordPress Database object.
160
+	 * @param string $field_type The form field type.
161
+	 * @param object|int $result_str The custom field results object or row id.
162
+	 * @param string $field_ins_upd When set to "submit" displays form.
163
+	 * @param string $field_type_key The key of the custom field.
164
+	 */
165
+	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
166
+	{
167
+		global $wpdb;
168
+		$cf = $result_str;
169
+		if (!is_object($cf)) {
170
+
171
+			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
172
+
173
+		} else {
174
+			$field_info = $cf;
175
+			$result_str = $cf->id;
176
+		}
177
+		/**
178
+		 * Contains custom field html.
179
+		 *
180
+		 * @since 1.0.0
181
+		 */
182
+		include('custom_field_html.php');
183
+
184
+	}
185 185
 
186 186
 
187 187
 if (!function_exists('geodir_custom_field_delete')) {
188
-    /**
189
-     * Delete custom field using field id.
190
-     *
191
-     * @since 1.0.0
192
-     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
-     * @package GeoDirectory
194
-     * @global object $wpdb WordPress Database object.
195
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
196
-     * @param string $field_id The custom field ID.
197
-     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
-     */
199
-    function geodir_custom_field_delete($field_id = '') {
200
-        global $wpdb, $plugin_prefix;
201
-
202
-        if ($field_id != '') {
203
-            $cf = trim($field_id, '_');
204
-
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
-
208
-                $post_type = $field->post_type;
209
-                $htmlvar_name = $field->htmlvar_name;
210
-
211
-                if ($post_type != '' && $htmlvar_name != '') {
212
-                    $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)));
213
-                }
214
-
215
-                /**
216
-                 * Called after a custom field is deleted.
217
-                 *
218
-                 * @since 1.0.0
219
-                 * @param string $cf The fields ID.
220
-                 * @param string $field->htmlvar_name The html variable name for the field.
221
-                 * @param string $post_type The post type the field belongs to.
222
-                 */
223
-                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
-
225
-                if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
-                } else {
236
-                    if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
-                    }
239
-                }
240
-
241
-                return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
246
-    }
188
+	/**
189
+	 * Delete custom field using field id.
190
+	 *
191
+	 * @since 1.0.0
192
+	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
193
+	 * @package GeoDirectory
194
+	 * @global object $wpdb WordPress Database object.
195
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
196
+	 * @param string $field_id The custom field ID.
197
+	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
198
+	 */
199
+	function geodir_custom_field_delete($field_id = '') {
200
+		global $wpdb, $plugin_prefix;
201
+
202
+		if ($field_id != '') {
203
+			$cf = trim($field_id, '_');
204
+
205
+			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
+				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
207
+
208
+				$post_type = $field->post_type;
209
+				$htmlvar_name = $field->htmlvar_name;
210
+
211
+				if ($post_type != '' && $htmlvar_name != '') {
212
+					$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)));
213
+				}
214
+
215
+				/**
216
+				 * Called after a custom field is deleted.
217
+				 *
218
+				 * @since 1.0.0
219
+				 * @param string $cf The fields ID.
220
+				 * @param string $field->htmlvar_name The html variable name for the field.
221
+				 * @param string $post_type The post type the field belongs to.
222
+				 */
223
+				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224
+
225
+				if ($field->field_type == 'address') {
226
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
+					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
235
+				} else {
236
+					if ($field->field_type != 'fieldset') {
237
+						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
238
+					}
239
+				}
240
+
241
+				return $field_id;
242
+			} else
243
+				return 0;
244
+		} else
245
+			return 0;
246
+	}
247 247
 }
248 248
 
249 249
 if (!function_exists('geodir_custom_field_save')) {
250
-    /**
251
-     * Save or Update custom fields into the database.
252
-     *
253
-     * @since 1.0.0
254
-     * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
-     * @package GeoDirectory
256
-     * @global object $wpdb WordPress Database object.
257
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
258
-     * @param array $request_field {
259
-     *    Attributes of the request field array.
260
-     *
261
-     *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
-     *    @type string $manage_field_type Field type Default "custom_fields".
263
-     *    @type string $create_field Create field Default "true".
264
-     *    @type string $field_ins_upd Field ins upd Default "submit".
265
-     *    @type string $_wpnonce WP nonce value.
266
-     *    @type string $listing_type Listing type Example "gd_place".
267
-     *    @type string $field_type Field type Example "radio".
268
-     *    @type string $field_id Field id Example "12".
269
-     *    @type string $data_type Data type Example "VARCHAR".
270
-     *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
-     *    @type array $show_on_pkg Package list to display this field.
272
-     *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
-     *    @type string $site_title Section title which you wish to display in frontend.
274
-     *    @type string $admin_desc Section description which will appear in frontend.
275
-     *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
-     *    @type string $clabels Section Title which will appear in backend.
277
-     *    @type string $default_value The default value (for "link" this will be used as the link text).
278
-     *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
-     *    @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.
280
-     *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
-     *    @type string $is_required Use "1" to set field as required.
282
-     *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
-     *    @type string $show_on_listing Want to show this on listing page?.
284
-     *    @type string $show_in What locations to show the custom field in.
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
-
354
-
355
-            $detail_table = $plugin_prefix . $post_type . '_detail';
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
-            $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
-            $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
-            $admin_desc = $request_field['admin_desc'];
364
-            $clabels = $request_field['clabels'];
365
-            $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
-            $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
-            $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
-            $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
-            $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
-            $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
-            $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
-            $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
-            $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
-            $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
-            $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
-            $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
-            $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
-            $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
-            $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
-            $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
250
+	/**
251
+	 * Save or Update custom fields into the database.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
255
+	 * @package GeoDirectory
256
+	 * @global object $wpdb WordPress Database object.
257
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
258
+	 * @param array $request_field {
259
+	 *    Attributes of the request field array.
260
+	 *
261
+	 *    @type string $action Ajax Action name. Default "geodir_ajax_action".
262
+	 *    @type string $manage_field_type Field type Default "custom_fields".
263
+	 *    @type string $create_field Create field Default "true".
264
+	 *    @type string $field_ins_upd Field ins upd Default "submit".
265
+	 *    @type string $_wpnonce WP nonce value.
266
+	 *    @type string $listing_type Listing type Example "gd_place".
267
+	 *    @type string $field_type Field type Example "radio".
268
+	 *    @type string $field_id Field id Example "12".
269
+	 *    @type string $data_type Data type Example "VARCHAR".
270
+	 *    @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.
271
+	 *    @type array $show_on_pkg Package list to display this field.
272
+	 *    @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.
273
+	 *    @type string $site_title Section title which you wish to display in frontend.
274
+	 *    @type string $admin_desc Section description which will appear in frontend.
275
+	 *    @type string $htmlvar_name Html variable name. This should be a unique name.
276
+	 *    @type string $clabels Section Title which will appear in backend.
277
+	 *    @type string $default_value The default value (for "link" this will be used as the link text).
278
+	 *    @type string $sort_order The display order of this field in backend. e.g. 5.
279
+	 *    @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.
280
+	 *    @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.
281
+	 *    @type string $is_required Use "1" to set field as required.
282
+	 *    @type string $required_msg Enter text for error message if field required and have not full fill requirment.
283
+	 *    @type string $show_on_listing Want to show this on listing page?.
284
+	 *    @type string $show_in What locations to show the custom field in.
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
+
354
+
355
+			$detail_table = $plugin_prefix . $post_type . '_detail';
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
+			$field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type;
362
+			$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
363
+			$admin_desc = $request_field['admin_desc'];
364
+			$clabels = $request_field['clabels'];
365
+			$default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';
366
+			$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';
367
+			$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';
368
+			$is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';
369
+			$required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';
370
+			$css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';
371
+			$field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';
372
+			$show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';
373
+			$show_in = isset($request_field['show_in']) ? $request_field['show_in'] : '';
374
+			$show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';
375
+			$show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';
376
+			$decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type
377
+			$decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';
378
+			$validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';
379
+			$validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';
380
+			$for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
384
-                $show_in = implode(",", $request_field['show_in']);
385
-            }
383
+			if(is_array($show_in)){
384
+				$show_in = implode(",", $request_field['show_in']);
385
+			}
386 386
             
387
-            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
389
-            }
387
+			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
+				$htmlvar_name = 'geodir_' . $htmlvar_name;
389
+			}
390 390
 
391
-            $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
391
+			$option_values = '';
392
+			if (isset($request_field['option_values']))
393
+				$option_values = $request_field['option_values'];
394 394
 
395
-            $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
395
+			$cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 396
 
397
-            $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
397
+			$cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 398
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
402
-                $package_info = array();
399
+			if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
+				$price_pkg = implode(",", $request_field['show_on_pkg']);
401
+			else {
402
+				$package_info = array();
403 403
 
404
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
405
-                $price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
406
-            }
404
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
405
+				$price_pkg = !empty($package_info->pid) ? $package_info->pid : '';
406
+			}
407 407
 
408 408
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
409
+			if (isset($request_field['extra']) && !empty($request_field['extra']))
410
+				$extra_fields = $request_field['extra'];
411 411
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
412
+			if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
+				$is_default = $request_field['is_default'];
414
+			else
415
+				$is_default = '0';
416 416
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
417
+			if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
+				$is_admin = $request_field['is_admin'];
419
+			else
420
+				$is_admin = '0';
421 421
 
422 422
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
423
+			if ($is_active == '') $is_active = 1;
424
+			if ($is_required == '') $is_required = 0;
425 425
 
426 426
 
427
-            if ($sort_order == '') {
427
+			if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
432
-            }
431
+				$sort_order = (int)$last_order + 1;
432
+			}
433 433
 
434
-            $default_value_add = '';
434
+			$default_value_add = '';
435 435
 
436 436
 
437
-            if (!empty($post_meta_info)) {
438
-                switch ($field_type):
437
+			if (!empty($post_meta_info)) {
438
+				switch ($field_type):
439 439
 
440
-                    case 'address':
440
+					case 'address':
441 441
 
442
-                        if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
444
-                        }
445
-                        $old_prefix = $old_html_variable . '_';
442
+						if ($htmlvar_name != '') {
443
+							$prefix = $htmlvar_name . '_';
444
+						}
445
+						$old_prefix = $old_html_variable . '_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
449 449
 
450
-                        if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
452
-                        }
450
+						if ($default_value != '') {
451
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
452
+						}
453 453
 
454
-                        $wpdb->query($meta_field_add);
454
+						$wpdb->query($meta_field_add);
455 455
 
456
-                        if ($extra_fields != '') {
456
+						if ($extra_fields != '') {
457 457
 
458
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
458
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
-                                if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
460
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
461
+								if ($is_column) {
462
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
463 463
 
464
-                                    if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
466
-                                    }
464
+									if ($default_value != '') {
465
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
466
+									}
467 467
 
468
-                                    $wpdb->query($meta_field_add);
469
-                                } else {
468
+									$wpdb->query($meta_field_add);
469
+								} else {
470 470
 
471
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
472
-                                    if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
474
-                                    }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
471
+									$meta_field_add = "VARCHAR( 50 ) NULL";
472
+									if ($default_value != '') {
473
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
474
+									}
475
+									geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
476 476
 
477
-                                }
477
+								}
478 478
 
479 479
 
480
-                            }
480
+							}
481 481
 
482 482
 
483
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
483
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
486 486
 
487
-                                if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
487
+								if ($is_column) {
488
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
489 489
 
490
-                                    if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
492
-                                    }
490
+									if ($default_value != '') {
491
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
492
+									}
493 493
 
494
-                                    $wpdb->query($meta_field_add);
495
-                                } else {
496
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
497
-                                    if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
499
-                                    }
494
+									$wpdb->query($meta_field_add);
495
+								} else {
496
+									$meta_field_add = "VARCHAR( 50 ) NULL";
497
+									if ($default_value != '') {
498
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
499
+									}
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
-                                }
501
+									geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
502
+								}
503 503
 
504
-                            }
505
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
504
+							}
505
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
508 508
 
509
-                                if ($is_column) {
509
+								if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
512 512
 
513
-                                    if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
515
-                                    }
513
+									if ($default_value != '') {
514
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
515
+									}
516 516
 
517
-                                    $wpdb->query($meta_field_add);
518
-                                } else {
517
+									$wpdb->query($meta_field_add);
518
+								} else {
519 519
 
520
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
521
-                                    if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
523
-                                    }
520
+									$meta_field_add = "VARCHAR( 50 ) NULL";
521
+									if ($default_value != '') {
522
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
523
+									}
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+									geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
526 526
 
527
-                                }
527
+								}
528 528
 
529
-                            }
530
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
529
+							}
530
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
533 533
 
534
-                                if ($is_column) {
534
+								if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
537 537
 
538
-                                    if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
540
-                                    }
538
+									if ($default_value != '') {
539
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
540
+									}
541 541
 
542
-                                    $wpdb->query($meta_field_add);
543
-                                } else {
542
+									$wpdb->query($meta_field_add);
543
+								} else {
544 544
 
545
-                                    $meta_field_add = "VARCHAR( 50 ) NULL";
546
-                                    if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
548
-                                    }
545
+									$meta_field_add = "VARCHAR( 50 ) NULL";
546
+									if ($default_value != '') {
547
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
548
+									}
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+									geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
551 551
 
552
-                                }
552
+								}
553 553
 
554
-                            }
555
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
554
+							}
555
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
-                                if ($is_column) {
557
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
558
+								if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
561 561
 
562
-                                    if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
564
-                                    }
562
+									if ($default_value != '') {
563
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
564
+									}
565 565
 
566
-                                    $wpdb->query($meta_field_add);
567
-                                } else {
566
+									$wpdb->query($meta_field_add);
567
+								} else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
571
-                                    if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
573
-                                    }
569
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
570
+									$meta_field_add = "VARCHAR( 20 ) NULL";
571
+									if ($default_value != '') {
572
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
573
+									}
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
576 576
 
577
-                                }
577
+								}
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
581 581
 
582
-                                if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
582
+								if ($is_column) {
583
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
584 584
 
585
-                                    if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
587
-                                    }
585
+									if ($default_value != '') {
586
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
587
+									}
588 588
 
589
-                                    $wpdb->query($meta_field_add);
590
-                                } else {
589
+									$wpdb->query($meta_field_add);
590
+								} else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
-                                    $meta_field_add = "VARCHAR( 20 ) NULL";
594
-                                    if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
596
-                                    }
592
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
593
+									$meta_field_add = "VARCHAR( 20 ) NULL";
594
+									if ($default_value != '') {
595
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
596
+									}
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
-                                }
598
+									geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
599
+								}
600 600
 
601
-                            }
602
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
601
+							}
602
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
605 605
 
606
-                                if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
606
+								if ($is_column) {
607
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
608 608
 
609
-                                    if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
611
-                                    }
609
+									if ($default_value != '') {
610
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
611
+									}
612 612
 
613
-                                    $wpdb->query($meta_field_add);
614
-                                } else {
613
+									$wpdb->query($meta_field_add);
614
+								} else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
617 617
 
618
-                                    $meta_field_add = "VARCHAR( 15 ) NULL";
619
-                                    if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
621
-                                    }
618
+									$meta_field_add = "VARCHAR( 15 ) NULL";
619
+									if ($default_value != '') {
620
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
621
+									}
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
-                                }
623
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
624
+								}
625 625
 
626 626
 
627
-                            }
628
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
627
+							}
628
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
-                                if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
630
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
631
+								if ($is_column) {
632
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634
-                                    if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
636
-                                    }
634
+									if ($default_value != '') {
635
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
636
+									}
637 637
 
638
-                                    $wpdb->query($meta_field_add);
638
+									$wpdb->query($meta_field_add);
639 639
 
640
-                                } else {
640
+								} else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
645
-                                    if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
647
-                                    }
644
+									$meta_field_add = "VARCHAR( 3 ) NULL";
645
+									if ($default_value != '') {
646
+										$meta_field_add .= " DEFAULT '" . $default_value . "'";
647
+									}
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
-                                }
649
+									geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
650
+								}
651 651
 
652
-                            }
653
-                            // show lat lng
654
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
652
+							}
653
+							// show lat lng
654
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
+								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
656 656
 
657
-                                if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
-                                    $meta_field_add .= " DEFAULT '1'";
657
+								if ($is_column) {
658
+									$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
659
+									$meta_field_add .= " DEFAULT '1'";
660 660
 
661
-                                    $wpdb->query($meta_field_add);
662
-                                } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
661
+									$wpdb->query($meta_field_add);
662
+								} else {
663
+									$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
664 664
 
665
-                                    $meta_field_add = "VARCHAR( 3 ) NULL";
666
-                                    $meta_field_add .= " DEFAULT '1'";
665
+									$meta_field_add = "VARCHAR( 3 ) NULL";
666
+									$meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
-                                }
668
+									geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
669
+								}
670 670
 
671
-                            }
672
-                        }// end extra
671
+							}
672
+						}// end extra
673 673
 
674
-                        break;
674
+						break;
675 675
 
676
-                    case 'checkbox':
677
-                    case 'multiselect':
678
-                    case 'select':
679
-                    case 'taxonomy':
676
+					case 'checkbox':
677
+					case 'multiselect':
678
+					case 'select':
679
+					case 'taxonomy':
680 680
 
681
-                        $op_size = '500';
681
+						$op_size = '500';
682 682
 
683
-                        // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
687
-                                $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
-                                }
691
-                                if($op_max){$op_size =$op_max; }
692
-                            }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
696
-                            }
697
-                        }
683
+						// only make the field as big as it needs to be.
684
+						if(isset($option_values) && $option_values && $field_type=='select'){
685
+							$option_values_arr = explode(',',$option_values);
686
+							if(is_array($option_values_arr)){
687
+								$op_max = 0;
688
+								foreach($option_values_arr as $op_val){
689
+									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
690
+								}
691
+								if($op_max){$op_size =$op_max; }
692
+							}
693
+						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
+							if(strlen($option_values)){
695
+								$op_size =  strlen($option_values);
696
+							}
697
+						}
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+						$meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
700 700
 
701
-                        if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
703
-                        }
701
+						if ($default_value != '') {
702
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
703
+						}
704 704
 
705
-                        $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
708
-                        }
705
+						$alter_result = $wpdb->query($meta_field_add);
706
+						if($alter_result===false){
707
+							return __('Column change failed, you may have too many columns.','geodirectory');
708
+						}
709 709
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
710
+						if (isset($request_field['cat_display_type']))
711
+							$extra_fields = $request_field['cat_display_type'];
712 712
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
713
+						if (isset($request_field['multi_display_type']))
714
+							$extra_fields = $request_field['multi_display_type'];
715 715
 
716 716
 
717
-                        break;
717
+						break;
718 718
 
719
-                    case 'textarea':
720
-                    case 'html':
721
-                    case 'url':
722
-                    case 'file':
719
+					case 'textarea':
720
+					case 'html':
721
+					case 'url':
722
+					case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
727
-                        }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
730
-
731
-                        break;
724
+						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
+						if($alter_result===false){
726
+							return __('Column change failed, you may have too many columns.','geodirectory');
727
+						}
728
+						if (isset($request_field['advanced_editor']))
729
+							$extra_fields = $request_field['advanced_editor'];
730
+
731
+						break;
732 732
 
733
-                    case 'fieldset':
734
-                        // Nothig happend for fieldset
735
-                        break;
733
+					case 'fieldset':
734
+						// Nothig happend for fieldset
735
+						break;
736 736
 
737
-                    default:
738
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
739
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
-                            } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
-                            }
744
-
745
-                            if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
747
-                            }
748
-                        } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
-                            if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
752
-                            }
753
-                        }
754
-
755
-                        $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
758
-                        }
759
-                        break;
760
-                endswitch;
761
-
762
-                $extra_field_query = '';
763
-                if (!empty($extra_fields)) {
764
-                    $extra_field_query = serialize($extra_fields);
765
-                }
766
-
767
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
-
769
-                $wpdb->query(
770
-
771
-                    $wpdb->prepare(
772
-
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
737
+					default:
738
+						if ($data_type != 'VARCHAR' && $data_type != '') {
739
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
741
+							} else {
742
+								$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
743
+							}
744
+
745
+							if (is_numeric($default_value) && $default_value != '') {
746
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
747
+							}
748
+						} else {
749
+							$default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
750
+							if ($default_value != '') {
751
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
752
+							}
753
+						}
754
+
755
+						$alter_result = $wpdb->query($default_value_add);
756
+						if($alter_result===false){
757
+							return __('Column change failed, you may have too many columns.','geodirectory');
758
+						}
759
+						break;
760
+				endswitch;
761
+
762
+				$extra_field_query = '';
763
+				if (!empty($extra_fields)) {
764
+					$extra_field_query = serialize($extra_fields);
765
+				}
766
+
767
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
768
+
769
+				$wpdb->query(
770
+
771
+					$wpdb->prepare(
772
+
773
+						"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,308 +804,308 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
808
-                    )
807
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
808
+					)
809 809
 
810
-                );
810
+				);
811 811
 
812
-                $lastid = trim($cf);
812
+				$lastid = trim($cf);
813 813
 
814 814
 
815
-                $wpdb->query(
816
-                    $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
815
+				$wpdb->query(
816
+					$wpdb->prepare(
817
+						"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820
-                        array($site_title, $post_type, $htmlvar_name)
821
-                    )
822
-                );
823
-
824
-
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
-
828
-
829
-                /**
830
-                 * Called after all custom fields are saved for a post.
831
-                 *
832
-                 * @since 1.0.0
833
-                 * @param int $lastid The post ID.
834
-                 */
835
-                do_action('geodir_after_custom_fields_updated', $lastid);
836
-
837
-            } else {
838
-
839
-                switch ($field_type):
840
-
841
-                    case 'address':
842
-
843
-                        $data_type = '';
844
-
845
-                        if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
847
-                        }
848
-                        $old_prefix = $old_html_variable;
849
-
850
-                        //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
-
852
-                        $meta_field_add = "VARCHAR( 254 ) NULL";
853
-                        if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
855
-                        }
856
-
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
-                        //$wpdb->query($meta_field_add);
859
-
860
-
861
-                        if (!empty($extra_fields)) {
820
+						array($site_title, $post_type, $htmlvar_name)
821
+					)
822
+				);
823
+
824
+
825
+				if ($cat_sort == '')
826
+					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827
+
828
+
829
+				/**
830
+				 * Called after all custom fields are saved for a post.
831
+				 *
832
+				 * @since 1.0.0
833
+				 * @param int $lastid The post ID.
834
+				 */
835
+				do_action('geodir_after_custom_fields_updated', $lastid);
836
+
837
+			} else {
838
+
839
+				switch ($field_type):
840
+
841
+					case 'address':
842
+
843
+						$data_type = '';
844
+
845
+						if ($htmlvar_name != '') {
846
+							$prefix = $htmlvar_name . '_';
847
+						}
848
+						$old_prefix = $old_html_variable;
849
+
850
+						//$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";
851
+
852
+						$meta_field_add = "VARCHAR( 254 ) NULL";
853
+						if ($default_value != '') {
854
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
855
+						}
856
+
857
+						geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
858
+						//$wpdb->query($meta_field_add);
859
+
860
+
861
+						if (!empty($extra_fields)) {
862 862
 
863
-                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
866
-                                if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
868
-                                }
869
-
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
-                                //$wpdb->query($meta_field_add);
872
-                            }
873
-                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
876
-                                if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
878
-                                }
879
-
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
-                                //$wpdb->query($meta_field_add);
882
-                            }
883
-                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
-
886
-                                $meta_field_add = "VARCHAR( 30 ) NULL";
887
-                                if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
889
-                                }
890
-
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
-                                //$wpdb->query($meta_field_add);
893
-                            }
894
-                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
897
-                                if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
899
-                                }
900
-
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
-                                //$wpdb->query($meta_field_add);
903
-                            }
904
-                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
907
-                                if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
909
-                                }
910
-
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
-                                //$wpdb->query($meta_field_add);
913
-
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
-
916
-                                $meta_field_add = "VARCHAR( 20 ) NULL";
917
-                                if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
919
-                                }
920
-
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
-
923
-                                //$wpdb->query($meta_field_add);
924
-                            }
925
-                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
-
928
-                                $meta_field_add = "VARCHAR( 15 ) NULL";
929
-                                if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
931
-                                }
932
-
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
-
935
-                                //$wpdb->query($meta_field_add);
936
-                            }
937
-                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
-
940
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
941
-                                if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
943
-                                }
944
-
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
-
947
-                                //$wpdb->query($meta_field_add);
948
-                            }
949
-                            // show lat lng
950
-                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
-
953
-                                $meta_field_add = "VARCHAR( 3 ) NULL";
954
-                                $meta_field_add .= " DEFAULT '1'";
955
-
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
-                                //$wpdb->query($meta_field_add);
958
-                            }
959
-                        }
960
-
961
-                        break;
962
-
963
-                    case 'checkbox':
964
-                        $data_type = 'TINYINT';
965
-
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
968
-                            $meta_field_add .= " DEFAULT '1'";
969
-                        }
970
-
971
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
-                        if ($add_result === false) {
973
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
-                        }
975
-                        break;
976
-                    case 'multiselect':
977
-                    case 'select':
978
-                        $data_type = 'VARCHAR';
979
-                        $op_size = '500';
980
-
981
-                        // only make the field as big as it needs to be.
982
-                        if (isset($option_values) && $option_values && $field_type == 'select') {
983
-                            $option_values_arr = explode(',', $option_values);
984
-
985
-                            if (is_array($option_values_arr)) {
986
-                                $op_max = 0;
987
-
988
-                                foreach ($option_values_arr as $op_val) {
989
-                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
990
-                                        $op_max = strlen($op_val);
991
-                                    }
992
-                                }
993
-
994
-                                if ($op_max) {
995
-                                    $op_size = $op_max;
996
-                                }
997
-                            }
998
-                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
-                            if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1001
-                            }
1002
-
1003
-                            if (isset($request_field['multi_display_type'])) {
1004
-                                $extra_fields = $request_field['multi_display_type'];
1005
-                            }
1006
-                        }
1007
-
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1009
-                        if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
-                        }
1012
-
1013
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
-                        if ($add_result === false) {
1015
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
-                        }
1017
-                        break;
1018
-                    case 'textarea':
1019
-                    case 'html':
1020
-                    case 'url':
1021
-                    case 'file':
1022
-
1023
-                        $data_type = 'TEXT';
1024
-
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
-
1027
-                        $meta_field_add = $data_type . " NULL ";
1028
-                        /*if($default_value != '')
863
+							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
865
+								$meta_field_add = "VARCHAR( 30 ) NULL";
866
+								if ($default_value != '') {
867
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
868
+								}
869
+
870
+								geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
871
+								//$wpdb->query($meta_field_add);
872
+							}
873
+							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
875
+								$meta_field_add = "VARCHAR( 30 ) NULL";
876
+								if ($default_value != '') {
877
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
878
+								}
879
+
880
+								geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
881
+								//$wpdb->query($meta_field_add);
882
+							}
883
+							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
885
+
886
+								$meta_field_add = "VARCHAR( 30 ) NULL";
887
+								if ($default_value != '') {
888
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
889
+								}
890
+
891
+								geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
892
+								//$wpdb->query($meta_field_add);
893
+							}
894
+							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
896
+								$meta_field_add = "VARCHAR( 15 ) NULL";
897
+								if ($default_value != '') {
898
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
899
+								}
900
+
901
+								geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
902
+								//$wpdb->query($meta_field_add);
903
+							}
904
+							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
906
+								$meta_field_add = "VARCHAR( 20 ) NULL";
907
+								if ($default_value != '') {
908
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
909
+								}
910
+
911
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
912
+								//$wpdb->query($meta_field_add);
913
+
914
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
915
+
916
+								$meta_field_add = "VARCHAR( 20 ) NULL";
917
+								if ($default_value != '') {
918
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
919
+								}
920
+
921
+								geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
922
+
923
+								//$wpdb->query($meta_field_add);
924
+							}
925
+							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
927
+
928
+								$meta_field_add = "VARCHAR( 15 ) NULL";
929
+								if ($default_value != '') {
930
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
931
+								}
932
+
933
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
934
+
935
+								//$wpdb->query($meta_field_add);
936
+							}
937
+							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
939
+
940
+								$meta_field_add = "VARCHAR( 3 ) NULL";
941
+								if ($default_value != '') {
942
+									$meta_field_add .= " DEFAULT '" . $default_value . "'";
943
+								}
944
+
945
+								geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
946
+
947
+								//$wpdb->query($meta_field_add);
948
+							}
949
+							// show lat lng
950
+							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
+								$meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
952
+
953
+								$meta_field_add = "VARCHAR( 3 ) NULL";
954
+								$meta_field_add .= " DEFAULT '1'";
955
+
956
+								geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
957
+								//$wpdb->query($meta_field_add);
958
+							}
959
+						}
960
+
961
+						break;
962
+
963
+					case 'checkbox':
964
+						$data_type = 'TINYINT';
965
+
966
+						$meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
+						if ((int)$default_value === 1) {
968
+							$meta_field_add .= " DEFAULT '1'";
969
+						}
970
+
971
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
972
+						if ($add_result === false) {
973
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
974
+						}
975
+						break;
976
+					case 'multiselect':
977
+					case 'select':
978
+						$data_type = 'VARCHAR';
979
+						$op_size = '500';
980
+
981
+						// only make the field as big as it needs to be.
982
+						if (isset($option_values) && $option_values && $field_type == 'select') {
983
+							$option_values_arr = explode(',', $option_values);
984
+
985
+							if (is_array($option_values_arr)) {
986
+								$op_max = 0;
987
+
988
+								foreach ($option_values_arr as $op_val) {
989
+									if (strlen($op_val) && strlen($op_val) > $op_max) {
990
+										$op_max = strlen($op_val);
991
+									}
992
+								}
993
+
994
+								if ($op_max) {
995
+									$op_size = $op_max;
996
+								}
997
+							}
998
+						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999
+							if (strlen($option_values)) {
1000
+								$op_size =  strlen($option_values);
1001
+							}
1002
+
1003
+							if (isset($request_field['multi_display_type'])) {
1004
+								$extra_fields = $request_field['multi_display_type'];
1005
+							}
1006
+						}
1007
+
1008
+						$meta_field_add = $data_type . "( $op_size ) NULL ";
1009
+						if ($default_value != '') {
1010
+							$meta_field_add .= " DEFAULT '" . $default_value . "'";
1011
+						}
1012
+
1013
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1014
+						if ($add_result === false) {
1015
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1016
+						}
1017
+						break;
1018
+					case 'textarea':
1019
+					case 'html':
1020
+					case 'url':
1021
+					case 'file':
1022
+
1023
+						$data_type = 'TEXT';
1024
+
1025
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1026
+
1027
+						$meta_field_add = $data_type . " NULL ";
1028
+						/*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
1031
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
-                        if ($add_result === false) {
1033
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
-                        }
1031
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1032
+						if ($add_result === false) {
1033
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1034
+						}
1035 1035
 
1036
-                        break;
1036
+						break;
1037 1037
 
1038
-                    case 'datepicker':
1038
+					case 'datepicker':
1039 1039
 
1040
-                        $data_type = 'DATE';
1040
+						$data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+						$meta_field_add = $data_type . " NULL ";
1045 1045
 
1046
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
-                        if ($add_result === false) {
1048
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
-                        }
1046
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047
+						if ($add_result === false) {
1048
+							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
1049
+						}
1050 1050
 
1051
-                        break;
1051
+						break;
1052 1052
 
1053
-                    case 'time':
1053
+					case 'time':
1054 1054
 
1055
-                        $data_type = 'TIME';
1055
+						$data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+						$default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+						$meta_field_add = $data_type . " NULL ";
1060 1060
 
1061
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
-                        if ($add_result === false) {
1063
-                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
-                        }
1061
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062
+						if ($add_result === false) {
1063
+							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
1064
+						}
1065 1065
 
1066
-                        break;
1066
+						break;
1067 1067
 
1068
-                    default:
1068
+					default:
1069 1069
 
1070
-                        if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1070
+						if ($data_type != 'VARCHAR' && $data_type != '') {
1071
+							$meta_field_add = $data_type . " NULL ";
1072 1072
 
1073
-                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
-                            }
1073
+							if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
+								$meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1075
+							}
1076 1076
 
1077
-                            if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
-                            }
1081
-                        } else {
1082
-                            $meta_field_add = " VARCHAR( 254 ) NULL ";
1077
+							if (is_numeric($default_value) && $default_value != '') {
1078
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1079
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1080
+							}
1081
+						} else {
1082
+							$meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084
-                            if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
-                            }
1088
-                        }
1084
+							if ($default_value != '') {
1085
+								$default_value_add .= " DEFAULT '" . $default_value . "'";
1086
+								$meta_field_add .= " DEFAULT '" . $default_value . "'";
1087
+							}
1088
+						}
1089 1089
 
1090
-                        $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
-                        if ($add_result === false) {
1092
-                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
-                        }
1094
-                        break;
1095
-                endswitch;
1090
+						$add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1091
+						if ($add_result === false) {
1092
+							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
1093
+						}
1094
+						break;
1095
+				endswitch;
1096 1096
 
1097
-                $extra_field_query = '';
1098
-                if (!empty($extra_fields)) {
1099
-                    $extra_field_query = serialize($extra_fields);
1100
-                }
1097
+				$extra_field_query = '';
1098
+				if (!empty($extra_fields)) {
1099
+					$extra_field_query = serialize($extra_fields);
1100
+				}
1101 1101
 
1102
-                $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1102
+				$decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';
1103 1103
 
1104
-                $wpdb->query(
1104
+				$wpdb->query(
1105 1105
 
1106
-                    $wpdb->prepare(
1106
+					$wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+						"insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,26 +1138,26 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
1141
+						array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
1142 1142
 
1143
-                    )
1143
+					)
1144 1144
 
1145
-                );
1145
+				);
1146 1146
 
1147
-                $lastid = $wpdb->insert_id;
1147
+				$lastid = $wpdb->insert_id;
1148 1148
 
1149
-                $lastid = trim($lastid);
1149
+				$lastid = trim($lastid);
1150 1150
 
1151
-            }
1151
+			}
1152 1152
 
1153
-            return (int)$lastid;
1153
+			return (int)$lastid;
1154 1154
 
1155 1155
 
1156
-        } else {
1157
-            return 'HTML Variable Name should be a unique name';
1158
-        }
1156
+		} else {
1157
+			return 'HTML Variable Name should be a unique name';
1158
+		}
1159 1159
 
1160
-    }
1160
+	}
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1172,54 +1172,54 @@  discard block
 block discarded – undo
1172 1172
 function godir_set_field_order($field_ids = array())
1173 1173
 {
1174 1174
 
1175
-    global $wpdb;
1175
+	global $wpdb;
1176 1176
 
1177
-    $count = 0;
1178
-    if (!empty($field_ids)):
1179
-        $post_meta_info = false;
1180
-        foreach ($field_ids as $id) {
1177
+	$count = 0;
1178
+	if (!empty($field_ids)):
1179
+		$post_meta_info = false;
1180
+		foreach ($field_ids as $id) {
1181 1181
 
1182
-            $cf = trim($id, '_');
1182
+			$cf = trim($id, '_');
1183 1183
 
1184
-            $post_meta_info = $wpdb->query(
1185
-                $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1184
+			$post_meta_info = $wpdb->query(
1185
+				$wpdb->prepare(
1186
+					"update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189
-                    array($count, $cf)
1190
-                )
1191
-            );
1192
-            $count++;
1193
-        }
1194
-
1195
-        return $post_meta_info;
1196
-    else:
1197
-        return false;
1198
-    endif;
1189
+					array($count, $cf)
1190
+				)
1191
+			);
1192
+			$count++;
1193
+		}
1194
+
1195
+		return $post_meta_info;
1196
+	else:
1197
+		return false;
1198
+	endif;
1199 1199
 }
1200 1200
 
1201 1201
 
1202 1202
 function geodir_get_cf_value($cf){
1203
-    global $gd_session;
1204
-    $value = '';
1205
-    if (is_admin()) {
1206
-        global $post,$gd_session;
1207
-
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1210
-    }
1211
-
1212
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
-        $post = $gd_ses_listing;
1214
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
-    } else {
1218
-        if ($value == '') {
1219
-            $value = $cf['default'];
1220
-        }
1221
-    }
1222
-    return $value;
1203
+	global $gd_session;
1204
+	$value = '';
1205
+	if (is_admin()) {
1206
+		global $post,$gd_session;
1207
+
1208
+		if (isset($_REQUEST['post']))
1209
+			$_REQUEST['pid'] = $_REQUEST['post'];
1210
+	}
1211
+
1212
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1213
+		$post = $gd_ses_listing;
1214
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1215
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1216
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1217
+	} else {
1218
+		if ($value == '') {
1219
+			$value = $cf['default'];
1220
+		}
1221
+	}
1222
+	return $value;
1223 1223
 }
1224 1224
 
1225 1225
 /**
@@ -1238,420 +1238,420 @@  discard block
 block discarded – undo
1238 1238
  * @param string $post_type Optional. The wordpress post type.
1239 1239
  */
1240 1240
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1241
-    global $is_default, $mapzoom, $gd_session;
1241
+	global $is_default, $mapzoom, $gd_session;
1242 1242
 
1243
-    $listing_type = $post_type;
1243
+	$listing_type = $post_type;
1244 1244
 
1245
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1245
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1246 1246
 
1247
-    foreach ($custom_fields as $key => $val) {
1248
-        $val = stripslashes_deep($val); // strip slashes from labels
1249
-        $name = $val['name'];
1250
-        $type = $val['type'];
1251
-        $is_default = $val['is_default'];
1247
+	foreach ($custom_fields as $key => $val) {
1248
+		$val = stripslashes_deep($val); // strip slashes from labels
1249
+		$name = $val['name'];
1250
+		$type = $val['type'];
1251
+		$is_default = $val['is_default'];
1252 1252
 
1253
-        /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
-        if ($for_admin_use && !is_super_admin()) {
1256
-            continue;
1257
-        }
1253
+		/* field available to site admin only for edit */
1254
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1255
+		if ($for_admin_use && !is_super_admin()) {
1256
+			continue;
1257
+		}
1258 1258
 
1259
-        if (is_admin()) {
1260
-            global $post;
1259
+		if (is_admin()) {
1260
+			global $post;
1261 1261
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1264
-        }
1262
+			if (isset($_REQUEST['post']))
1263
+				$_REQUEST['pid'] = $_REQUEST['post'];
1264
+		}
1265 1265
 
1266 1266
         
1267 1267
 
1268
-        /**
1269
-         * Called before the custom fields info is output for submitting a post.
1270
-         *
1271
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
-         *
1273
-         * @since 1.0.0
1274
-         * @param string $listing_type The post post type.
1275
-         * @param int $package_id The price package ID for the post.
1276
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
-         * @see 'geodir_after_custom_form_field_$name'
1278
-         */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
-
1281
-
1282
-        $custom_field = $val;
1283
-        $html ='';
1284
-        /**
1285
-         * Filter the output for custom fields.
1286
-         *
1287
-         * Here we can remove or add new functions depending on the field type.
1288
-         *
1289
-         * @param string $html The html to be filtered (blank).
1290
-         * @param array $custom_field The custom field array values.
1291
-         */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
-
1294
-
1295
-
1296
-        /**
1297
-         * Called after the custom fields info is output for submitting a post.
1298
-         *
1299
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
-         *
1301
-         * @since 1.0.0
1302
-         * @param string $listing_type The post post type.
1303
-         * @param int $package_id The price package ID for the post.
1304
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
-         * @see 'geodir_before_custom_form_field_$name'
1306
-         */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
-
1309
-    }
1268
+		/**
1269
+		 * Called before the custom fields info is output for submitting a post.
1270
+		 *
1271
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1272
+		 *
1273
+		 * @since 1.0.0
1274
+		 * @param string $listing_type The post post type.
1275
+		 * @param int $package_id The price package ID for the post.
1276
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277
+		 * @see 'geodir_after_custom_form_field_$name'
1278
+		 */
1279
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1280
+
1281
+
1282
+		$custom_field = $val;
1283
+		$html ='';
1284
+		/**
1285
+		 * Filter the output for custom fields.
1286
+		 *
1287
+		 * Here we can remove or add new functions depending on the field type.
1288
+		 *
1289
+		 * @param string $html The html to be filtered (blank).
1290
+		 * @param array $custom_field The custom field array values.
1291
+		 */
1292
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1293
+
1294
+
1295
+
1296
+		/**
1297
+		 * Called after the custom fields info is output for submitting a post.
1298
+		 *
1299
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1300
+		 *
1301
+		 * @since 1.0.0
1302
+		 * @param string $listing_type The post post type.
1303
+		 * @param int $package_id The price package ID for the post.
1304
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305
+		 * @see 'geodir_before_custom_form_field_$name'
1306
+		 */
1307
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1308
+
1309
+	}
1310 1310
 
1311 1311
 }
1312 1312
 
1313 1313
 
1314 1314
 if (!function_exists('geodir_get_field_infoby')) {
1315
-    /**
1316
-     * Get custom field using key and value.
1317
-     *
1318
-     * @since 1.0.0
1319
-     * @package GeoDirectory
1320
-     * @global object $wpdb WordPress Database object.
1321
-     * @param string $key The key you want to look for.
1322
-     * @param string $value The value of the key you want to look for.
1323
-     * @param string $geodir_post_type The post type.
1324
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1325
-     */
1326
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
-    {
1328
-
1329
-        global $wpdb;
1330
-
1331
-        $filter = $wpdb->get_row(
1332
-            $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
-                array($geodir_post_type)
1335
-            )
1336
-        );
1337
-
1338
-        if ($filter) {
1339
-            return $filter;
1340
-        } else {
1341
-            return false;
1342
-        }
1343
-
1344
-    }
1315
+	/**
1316
+	 * Get custom field using key and value.
1317
+	 *
1318
+	 * @since 1.0.0
1319
+	 * @package GeoDirectory
1320
+	 * @global object $wpdb WordPress Database object.
1321
+	 * @param string $key The key you want to look for.
1322
+	 * @param string $value The value of the key you want to look for.
1323
+	 * @param string $geodir_post_type The post type.
1324
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1325
+	 */
1326
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1327
+	{
1328
+
1329
+		global $wpdb;
1330
+
1331
+		$filter = $wpdb->get_row(
1332
+			$wpdb->prepare(
1333
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1334
+				array($geodir_post_type)
1335
+			)
1336
+		);
1337
+
1338
+		if ($filter) {
1339
+			return $filter;
1340
+		} else {
1341
+			return false;
1342
+		}
1343
+
1344
+	}
1345 1345
 }
1346 1346
 
1347 1347
 
1348 1348
 function geodir_field_icon_proccess($cf){
1349 1349
 
1350 1350
 
1351
-    if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1356
-        $field_icon = $cf['field_icon'];
1357
-    }
1351
+	if (strpos($cf['field_icon'], 'http') !== false) {
1352
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
+	}else{
1356
+		$field_icon = $cf['field_icon'];
1357
+	}
1358 1358
 
1359
-    return $field_icon;
1359
+	return $field_icon;
1360 1360
 }
1361 1361
 
1362 1362
 if (!function_exists('geodir_show_listing_info')) {
1363
-    /**
1364
-     * Show listing info depending on field location.
1365
-     *
1366
-     * @since 1.0.0
1367
-     * @since 1.5.7 Custom fields option values added to db translation.
1368
-     *              Changes to display url fields title.
1369
-     * @package GeoDirectory
1370
-     * @global object $wpdb WordPress Database object.
1371
-     * @global object $post The current post object.
1372
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
-     *
1374
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
-     * @return string Returns listing info html.
1376
-     */
1377
-    function geodir_show_listing_info($fields_location = '') {
1378
-        global $post, $preview, $wpdb, $send_to_friend;
1379
-
1380
-        $package_info = array();
1381
-
1382
-        $package_info = geodir_post_package_info($package_info, $post);
1383
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1384
-        $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
-        $send_to_friend = false;
1386
-
1387
-        ob_start();
1388
-        $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
-
1390
-        if (!empty($fields_info)) {
1391
-            $post = stripslashes_deep($post); // strip slashes
1363
+	/**
1364
+	 * Show listing info depending on field location.
1365
+	 *
1366
+	 * @since 1.0.0
1367
+	 * @since 1.5.7 Custom fields option values added to db translation.
1368
+	 *              Changes to display url fields title.
1369
+	 * @package GeoDirectory
1370
+	 * @global object $wpdb WordPress Database object.
1371
+	 * @global object $post The current post object.
1372
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1373
+	 *
1374
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1375
+	 * @return string Returns listing info html.
1376
+	 */
1377
+	function geodir_show_listing_info($fields_location = '') {
1378
+		global $post, $preview, $wpdb, $send_to_friend;
1379
+
1380
+		$package_info = array();
1381
+
1382
+		$package_info = geodir_post_package_info($package_info, $post);
1383
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
1384
+		$p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype();
1385
+		$send_to_friend = false;
1386
+
1387
+		ob_start();
1388
+		$fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location);
1389
+
1390
+		if (!empty($fields_info)) {
1391
+			$post = stripslashes_deep($post); // strip slashes
1392 1392
             
1393
-            //echo '<div class="geodir-company_info field-group">';
1394
-            global $field_set_start;
1395
-            $field_set_start = 0;
1393
+			//echo '<div class="geodir-company_info field-group">';
1394
+			global $field_set_start;
1395
+			$field_set_start = 0;
1396 1396
 
1397 1397
 
1398 1398
 
1399
-            foreach ($fields_info as $type) {
1400
-                $type = stripslashes_deep($type); // strip slashes
1401
-                $html = '';
1402
-                $field_icon = geodir_field_icon_proccess($type);
1403
-                $filed_type = $type['type'];
1404
-                $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1399
+			foreach ($fields_info as $type) {
1400
+				$type = stripslashes_deep($type); // strip slashes
1401
+				$html = '';
1402
+				$field_icon = geodir_field_icon_proccess($type);
1403
+				$filed_type = $type['type'];
1404
+				$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
+				if($html_var=='post'){$html_var='post_address';}
1406 1406
 
1407
-                /**
1408
-                 * Filter the output for custom fields.
1409
-                 *
1410
-                 * Here we can remove or add new functions depending on the field type.
1411
-                 *
1412
-                 * @param string $html The html to be filtered (blank).
1413
-                 * @param string $fields_location The location the field is to be show.
1414
-                 * @param array $type The array of field values.
1415
-                 */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1407
+				/**
1408
+				 * Filter the output for custom fields.
1409
+				 *
1410
+				 * Here we can remove or add new functions depending on the field type.
1411
+				 *
1412
+				 * @param string $html The html to be filtered (blank).
1413
+				 * @param string $fields_location The location the field is to be show.
1414
+				 * @param array $type The array of field values.
1415
+				 */
1416
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1417 1417
 
1418
-                $variables_array = array();
1418
+				$variables_array = array();
1419 1419
 
1420 1420
 //                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'))) {
1421 1421
 //                    continue;
1422 1422
 //                }
1423 1423
 
1424
-                if ($type['type'] != 'fieldset'):
1425
-                    $variables_array['post_id'] = $post->ID;
1426
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
-                    $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1430
-                endif;
1431
-
1432
-
1433
-                if ($html):
1434
-
1435
-                    /**
1436
-                     * Called before a custom fields is output on the frontend.
1437
-                     *
1438
-                     * @since 1.0.0
1439
-                     * @param string $html_var The HTML variable name for the field.
1440
-                     */
1441
-                    do_action("geodir_before_show_{$html_var}");
1442
-                    /**
1443
-                     * Filter custom field output.
1444
-                     *
1445
-                     * @since 1.0.0
1446
-                     *
1447
-                     * @param string $html_var The HTML variable name for the field.
1448
-                     * @param string $html Custom field unfiltered HTML.
1449
-                     * @param array $variables_array Custom field variables array.
1450
-                     */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1452
-
1453
-                    /**
1454
-                     * Called after a custom fields is output on the frontend.
1455
-                     *
1456
-                     * @since 1.0.0
1457
-                     * @param string $html_var The HTML variable name for the field.
1458
-                     */
1459
-                    do_action("geodir_after_show_{$html_var}");
1460
-
1461
-                endif;
1462
-
1463
-            }
1464
-
1465
-            //echo '</div>';
1466
-
1467
-        }
1468
-
1469
-
1470
-        $html = ob_get_clean();
1471
-
1472
-        /**
1473
-         * Filter the custom fields over all output.
1474
-         *
1475
-         * @param string $html The html of the custom fields.
1476
-         * @param string $fields_location The location the fields are being output.
1477
-         * @since 1.6.9
1478
-         */
1479
-        return apply_filters('geodir_show_listing_info',$html,$fields_location);
1480
-
1481
-    }
1424
+				if ($type['type'] != 'fieldset'):
1425
+					$variables_array['post_id'] = $post->ID;
1426
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1427
+					$variables_array['value'] = '';
1428
+					if (isset($post->{$type['htmlvar_name']}))
1429
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1430
+				endif;
1431
+
1432
+
1433
+				if ($html):
1434
+
1435
+					/**
1436
+					 * Called before a custom fields is output on the frontend.
1437
+					 *
1438
+					 * @since 1.0.0
1439
+					 * @param string $html_var The HTML variable name for the field.
1440
+					 */
1441
+					do_action("geodir_before_show_{$html_var}");
1442
+					/**
1443
+					 * Filter custom field output.
1444
+					 *
1445
+					 * @since 1.0.0
1446
+					 *
1447
+					 * @param string $html_var The HTML variable name for the field.
1448
+					 * @param string $html Custom field unfiltered HTML.
1449
+					 * @param array $variables_array Custom field variables array.
1450
+					 */
1451
+					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1452
+
1453
+					/**
1454
+					 * Called after a custom fields is output on the frontend.
1455
+					 *
1456
+					 * @since 1.0.0
1457
+					 * @param string $html_var The HTML variable name for the field.
1458
+					 */
1459
+					do_action("geodir_after_show_{$html_var}");
1460
+
1461
+				endif;
1462
+
1463
+			}
1464
+
1465
+			//echo '</div>';
1466
+
1467
+		}
1468
+
1469
+
1470
+		$html = ob_get_clean();
1471
+
1472
+		/**
1473
+		 * Filter the custom fields over all output.
1474
+		 *
1475
+		 * @param string $html The html of the custom fields.
1476
+		 * @param string $fields_location The location the fields are being output.
1477
+		 * @since 1.6.9
1478
+		 */
1479
+		return apply_filters('geodir_show_listing_info',$html,$fields_location);
1480
+
1481
+	}
1482 1482
 }
1483 1483
 
1484 1484
 if (!function_exists('geodir_default_date_format')) {
1485
-    /**
1486
-     * Returns default date format.
1487
-     *
1488
-     * @since 1.0.0
1489
-     * @package GeoDirectory
1490
-     * @return mixed|string|void Returns default date format.
1491
-     */
1492
-    function geodir_default_date_format()
1493
-    {
1494
-        if ($format = get_option('date_format'))
1495
-            return $format;
1496
-        else
1497
-            return 'dd-mm-yy';
1498
-    }
1485
+	/**
1486
+	 * Returns default date format.
1487
+	 *
1488
+	 * @since 1.0.0
1489
+	 * @package GeoDirectory
1490
+	 * @return mixed|string|void Returns default date format.
1491
+	 */
1492
+	function geodir_default_date_format()
1493
+	{
1494
+		if ($format = get_option('date_format'))
1495
+			return $format;
1496
+		else
1497
+			return 'dd-mm-yy';
1498
+	}
1499 1499
 }
1500 1500
 
1501 1501
 if (!function_exists('geodir_get_formated_date')) {
1502
-    /**
1503
-     * Returns formatted date.
1504
-     *
1505
-     * @since 1.0.0
1506
-     * @package GeoDirectory
1507
-     * @param string $date Date string to convert.
1508
-     * @return bool|int|string Returns formatted date.
1509
-     */
1510
-    function geodir_get_formated_date($date)
1511
-    {
1512
-        return mysql2date(get_option('date_format'), $date);
1513
-    }
1502
+	/**
1503
+	 * Returns formatted date.
1504
+	 *
1505
+	 * @since 1.0.0
1506
+	 * @package GeoDirectory
1507
+	 * @param string $date Date string to convert.
1508
+	 * @return bool|int|string Returns formatted date.
1509
+	 */
1510
+	function geodir_get_formated_date($date)
1511
+	{
1512
+		return mysql2date(get_option('date_format'), $date);
1513
+	}
1514 1514
 }
1515 1515
 
1516 1516
 if (!function_exists('geodir_get_formated_time')) {
1517
-    /**
1518
-     * Returns formatted time.
1519
-     *
1520
-     * @since 1.0.0
1521
-     * @package GeoDirectory
1522
-     * @param string $time Time string to convert.
1523
-     * @return bool|int|string Returns formatted time.
1524
-     */
1525
-    function geodir_get_formated_time($time)
1526
-    {
1527
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1528
-    }
1517
+	/**
1518
+	 * Returns formatted time.
1519
+	 *
1520
+	 * @since 1.0.0
1521
+	 * @package GeoDirectory
1522
+	 * @param string $time Time string to convert.
1523
+	 * @return bool|int|string Returns formatted time.
1524
+	 */
1525
+	function geodir_get_formated_time($time)
1526
+	{
1527
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1528
+	}
1529 1529
 }
1530 1530
 
1531 1531
 
1532 1532
 if (!function_exists('geodir_save_post_file_fields')) {
1533
-    /**
1534
-     * Save post file fields
1535
-     *
1536
-     * @since 1.0.0
1537
-     * @since 1.4.7 Added `$extra_fields` parameter.
1538
-     * @package GeoDirectory
1539
-     * @global object $wpdb WordPress Database object.
1540
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1541
-     * @global object $current_user Current user object.
1542
-     * @param int $post_id
1543
-     * @param string $field_id
1544
-     * @param array $post_image
1545
-     * @param array $extra_fields Array of extra fields.
1546
-     */
1547
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1548
-    {
1533
+	/**
1534
+	 * Save post file fields
1535
+	 *
1536
+	 * @since 1.0.0
1537
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1538
+	 * @package GeoDirectory
1539
+	 * @global object $wpdb WordPress Database object.
1540
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1541
+	 * @global object $current_user Current user object.
1542
+	 * @param int $post_id
1543
+	 * @param string $field_id
1544
+	 * @param array $post_image
1545
+	 * @param array $extra_fields Array of extra fields.
1546
+	 */
1547
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1548
+	{
1549 1549
 
1550
-        global $wpdb, $plugin_prefix, $current_user;
1550
+		global $wpdb, $plugin_prefix, $current_user;
1551 1551
 
1552
-        $post_type = get_post_type($post_id);
1553
-        //echo $field_id; exit;
1554
-        $table = $plugin_prefix . $post_type . '_detail';
1552
+		$post_type = get_post_type($post_id);
1553
+		//echo $field_id; exit;
1554
+		$table = $plugin_prefix . $post_type . '_detail';
1555 1555
 
1556
-        $postcurr_images = array();
1557
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1558
-        $file_urls = '';
1556
+		$postcurr_images = array();
1557
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1558
+		$file_urls = '';
1559 1559
 
1560
-        if (!empty($post_image)) {
1560
+		if (!empty($post_image)) {
1561 1561
 
1562
-            $invalid_files = array();
1562
+			$invalid_files = array();
1563 1563
 
1564
-            //Get and remove all old images of post from database to set by new order
1565
-            $geodir_uploaddir = '';
1566
-            $uploads = wp_upload_dir();
1567
-            $uploads_dir = $uploads['path'];
1564
+			//Get and remove all old images of post from database to set by new order
1565
+			$geodir_uploaddir = '';
1566
+			$uploads = wp_upload_dir();
1567
+			$uploads_dir = $uploads['path'];
1568 1568
 
1569
-            $geodir_uploadpath = $uploads['path'];
1570
-            $geodir_uploadurl = $uploads['url'];
1571
-            $sub_dir = $uploads['subdir'];
1569
+			$geodir_uploadpath = $uploads['path'];
1570
+			$geodir_uploadurl = $uploads['url'];
1571
+			$sub_dir = $uploads['subdir'];
1572 1572
 
1573
-            $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'] : '';
1573
+			$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'] : '';
1574 1574
 
1575
-            for ($m = 0; $m < count($post_image); $m++) {
1575
+			for ($m = 0; $m < count($post_image); $m++) {
1576 1576
 
1577
-                /* --------- start ------- */
1577
+				/* --------- start ------- */
1578 1578
 
1579
-                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)))) {
1579
+				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)))) {
1580 1580
 
1581 1581
 
1582
-                    $curr_img_url = $post_image[$m];
1583
-                    $image_name_arr = explode('/', $curr_img_url);
1584
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1585
-                    $filename = end($image_name_arr);
1586
-                    $img_name_arr = explode('.', $filename);
1582
+					$curr_img_url = $post_image[$m];
1583
+					$image_name_arr = explode('/', $curr_img_url);
1584
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1585
+					$filename = end($image_name_arr);
1586
+					$img_name_arr = explode('.', $filename);
1587 1587
 
1588
-                    $arr_file_type = wp_check_filetype($filename);
1588
+					$arr_file_type = wp_check_filetype($filename);
1589 1589
 
1590
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1591
-                        continue;
1592
-                    }
1590
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1591
+						continue;
1592
+					}
1593 1593
 
1594
-                    $uploaded_file_type = $arr_file_type['type'];
1595
-                    $uploaded_file_ext = $arr_file_type['ext'];
1594
+					$uploaded_file_type = $arr_file_type['type'];
1595
+					$uploaded_file_ext = $arr_file_type['ext'];
1596 1596
 
1597
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1598
-                        continue; // Invalid file type.
1599
-                    }
1597
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1598
+						continue; // Invalid file type.
1599
+					}
1600 1600
 
1601
-                    // Set an array containing a list of acceptable formats
1602
-                    //$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');
1601
+					// Set an array containing a list of acceptable formats
1602
+					//$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');
1603 1603
 
1604
-                    if (!function_exists('wp_handle_upload'))
1605
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1604
+					if (!function_exists('wp_handle_upload'))
1605
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1606 1606
 
1607
-                    if (!is_dir($geodir_uploadpath))
1608
-                        mkdir($geodir_uploadpath);
1607
+					if (!is_dir($geodir_uploadpath))
1608
+						mkdir($geodir_uploadpath);
1609 1609
 
1610
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1611
-                    $explode_sub_dir = explode("/", $sub_dir);
1612
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1613
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1614
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1615
-                    } else {
1616
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1617
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1618
-                    }
1610
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1611
+					$explode_sub_dir = explode("/", $sub_dir);
1612
+					if ($curr_img_dir == end($explode_sub_dir)) {
1613
+						$img_path = $geodir_uploadpath . '/' . $filename;
1614
+						$img_url = $geodir_uploadurl . '/' . $filename;
1615
+					} else {
1616
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1617
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1618
+					}
1619 1619
 
1620
-                    $uploaded_file = '';
1621
-                    if (file_exists($img_path))
1622
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1620
+					$uploaded_file = '';
1621
+					if (file_exists($img_path))
1622
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1623 1623
 
1624
-                    if ($curr_img_dir != $geodir_uploaddir) {
1625
-                        if (file_exists($img_path))
1626
-                            unlink($img_path);
1627
-                    }
1624
+					if ($curr_img_dir != $geodir_uploaddir) {
1625
+						if (file_exists($img_path))
1626
+							unlink($img_path);
1627
+					}
1628 1628
 
1629
-                    if (!empty($uploaded_file))
1630
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1629
+					if (!empty($uploaded_file))
1630
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1631 1631
 
1632
-                } else {
1633
-                    $file_urls = $post_image[$m];
1634
-                }
1635
-            }
1632
+				} else {
1633
+					$file_urls = $post_image[$m];
1634
+				}
1635
+			}
1636 1636
 
1637 1637
 
1638
-        }
1638
+		}
1639 1639
 
1640
-        //Remove all old attachments and temp images
1641
-        if (!empty($postcurr_images)) {
1640
+		//Remove all old attachments and temp images
1641
+		if (!empty($postcurr_images)) {
1642 1642
 
1643
-            if ($file_urls != $postcurr_images) {
1644
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1645
-                $invalid_files = (object)$invalid_files;
1646
-            }
1647
-        }
1643
+			if ($file_urls != $postcurr_images) {
1644
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1645
+				$invalid_files = (object)$invalid_files;
1646
+			}
1647
+		}
1648 1648
 
1649
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1649
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1650 1650
 
1651
-        if (!empty($invalid_files))
1652
-            geodir_remove_attachments($invalid_files);
1651
+		if (!empty($invalid_files))
1652
+			geodir_remove_attachments($invalid_files);
1653 1653
 
1654
-    }
1654
+	}
1655 1655
 }
1656 1656
 
1657 1657
 
@@ -1666,76 +1666,76 @@  discard block
 block discarded – undo
1666 1666
  */
1667 1667
 function geodir_custom_upload_mimes($existing_mimes = array())
1668 1668
 {
1669
-    $existing_mimes['wif'] = 'text/plain';
1670
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1671
-    $existing_mimes['gif'] = 'image/gif';
1672
-    $existing_mimes['png'] = 'image/png';
1673
-    $existing_mimes['pdf'] = 'application/pdf';
1674
-    $existing_mimes['txt'] = 'text/text';
1675
-    $existing_mimes['csv'] = 'application/octet-stream';
1676
-    $existing_mimes['doc'] = 'application/msword';
1677
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1678
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1679
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1680
-    return $existing_mimes;
1669
+	$existing_mimes['wif'] = 'text/plain';
1670
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1671
+	$existing_mimes['gif'] = 'image/gif';
1672
+	$existing_mimes['png'] = 'image/png';
1673
+	$existing_mimes['pdf'] = 'application/pdf';
1674
+	$existing_mimes['txt'] = 'text/text';
1675
+	$existing_mimes['csv'] = 'application/octet-stream';
1676
+	$existing_mimes['doc'] = 'application/msword';
1677
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1678
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1679
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1680
+	return $existing_mimes;
1681 1681
 }
1682 1682
 
1683 1683
 if (!function_exists('geodir_plupload_action')) {
1684 1684
 
1685
-    /**
1686
-     * Get upload directory path details
1687
-     *
1688
-     * @since 1.0.0
1689
-     * @package GeoDirectory
1690
-     * @global object $current_user Current user object.
1691
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1692
-     * @return mixed Returns upload directory details as an array.
1693
-     */
1694
-    function geodir_upload_dir($upload)
1695
-    {
1696
-        global $current_user;
1697
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1698
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1699
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1700
-        return $upload;
1701
-    }
1702
-
1703
-    /**
1704
-     * Handles place file and image upload.
1705
-     *
1706
-     * @since 1.0.0
1707
-     * @package GeoDirectory
1708
-     */
1709
-    function geodir_plupload_action()
1710
-    {
1711
-        // check ajax noonce
1712
-        $imgid = $_POST["imgid"];
1713
-
1714
-        check_ajax_referer($imgid . 'pluploadan');
1715
-
1716
-        // handle custom file uploaddir
1717
-        add_filter('upload_dir', 'geodir_upload_dir');
1718
-
1719
-        // change file orinetation if needed
1720
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1721
-
1722
-        // handle file upload
1723
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1724
-        // remove handle custom file uploaddir
1725
-        remove_filter('upload_dir', 'geodir_upload_dir');
1726
-
1727
-        if(!isset($status['url']) && isset($status['error'])){
1728
-            print_r($status);
1729
-        }
1730
-
1731
-        // send the uploaded file url in response
1732
-        if (isset($status['url'])) {
1733
-            echo $status['url'];
1734
-        } else {
1735
-            echo 'x';
1736
-        }
1737
-        exit;
1738
-    }
1685
+	/**
1686
+	 * Get upload directory path details
1687
+	 *
1688
+	 * @since 1.0.0
1689
+	 * @package GeoDirectory
1690
+	 * @global object $current_user Current user object.
1691
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1692
+	 * @return mixed Returns upload directory details as an array.
1693
+	 */
1694
+	function geodir_upload_dir($upload)
1695
+	{
1696
+		global $current_user;
1697
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1698
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1699
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1700
+		return $upload;
1701
+	}
1702
+
1703
+	/**
1704
+	 * Handles place file and image upload.
1705
+	 *
1706
+	 * @since 1.0.0
1707
+	 * @package GeoDirectory
1708
+	 */
1709
+	function geodir_plupload_action()
1710
+	{
1711
+		// check ajax noonce
1712
+		$imgid = $_POST["imgid"];
1713
+
1714
+		check_ajax_referer($imgid . 'pluploadan');
1715
+
1716
+		// handle custom file uploaddir
1717
+		add_filter('upload_dir', 'geodir_upload_dir');
1718
+
1719
+		// change file orinetation if needed
1720
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1721
+
1722
+		// handle file upload
1723
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1724
+		// remove handle custom file uploaddir
1725
+		remove_filter('upload_dir', 'geodir_upload_dir');
1726
+
1727
+		if(!isset($status['url']) && isset($status['error'])){
1728
+			print_r($status);
1729
+		}
1730
+
1731
+		// send the uploaded file url in response
1732
+		if (isset($status['url'])) {
1733
+			echo $status['url'];
1734
+		} else {
1735
+			echo 'x';
1736
+		}
1737
+		exit;
1738
+	}
1739 1739
 }
1740 1740
 
1741 1741
 /**
@@ -1750,17 +1750,17 @@  discard block
 block discarded – undo
1750 1750
  */
1751 1751
 function geodir_get_video($post_id)
1752 1752
 {
1753
-    global $wpdb, $plugin_prefix;
1753
+	global $wpdb, $plugin_prefix;
1754 1754
 
1755
-    $post_type = get_post_type($post_id);
1755
+	$post_type = get_post_type($post_id);
1756 1756
 
1757
-    $table = $plugin_prefix . $post_type . '_detail';
1757
+	$table = $plugin_prefix . $post_type . '_detail';
1758 1758
 
1759
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1759
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1760 1760
 
1761
-    if ($results) {
1762
-        return $results[0]->geodir_video;
1763
-    }
1761
+	if ($results) {
1762
+		return $results[0]->geodir_video;
1763
+	}
1764 1764
 
1765 1765
 }
1766 1766
 
@@ -1776,40 +1776,40 @@  discard block
 block discarded – undo
1776 1776
  */
1777 1777
 function geodir_get_special_offers($post_id)
1778 1778
 {
1779
-    global $wpdb, $plugin_prefix;
1779
+	global $wpdb, $plugin_prefix;
1780 1780
 
1781
-    $post_type = get_post_type($post_id);
1781
+	$post_type = get_post_type($post_id);
1782 1782
 
1783
-    $table = $plugin_prefix . $post_type . '_detail';
1783
+	$table = $plugin_prefix . $post_type . '_detail';
1784 1784
 
1785
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1785
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1786 1786
 
1787
-    if ($results) {
1788
-        return $results[0]->geodir_special_offers;
1789
-    }
1787
+	if ($results) {
1788
+		return $results[0]->geodir_special_offers;
1789
+	}
1790 1790
 
1791 1791
 }
1792 1792
 
1793 1793
 if (!function_exists('geodir_max_upload_size')) {
1794
-    /**
1795
-     * Get max upload file size
1796
-     *
1797
-     * @since 1.0.0
1798
-     * @package GeoDirectory
1799
-     * @return mixed|void Returns max upload file size.
1800
-     */
1801
-    function geodir_max_upload_size()
1802
-    {
1803
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1804
-
1805
-        if ($max_filesize > 0 && $max_filesize < 1) {
1806
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1807
-        } else {
1808
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1809
-        }
1810
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1811
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1812
-    }
1794
+	/**
1795
+	 * Get max upload file size
1796
+	 *
1797
+	 * @since 1.0.0
1798
+	 * @package GeoDirectory
1799
+	 * @return mixed|void Returns max upload file size.
1800
+	 */
1801
+	function geodir_max_upload_size()
1802
+	{
1803
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1804
+
1805
+		if ($max_filesize > 0 && $max_filesize < 1) {
1806
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1807
+		} else {
1808
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1809
+		}
1810
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1811
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1812
+	}
1813 1813
 }
1814 1814
 
1815 1815
 
@@ -1827,33 +1827,33 @@  discard block
 block discarded – undo
1827 1827
  */
1828 1828
 function geodir_add_custom_sort_options($fields, $post_type)
1829 1829
 {
1830
-    global $wpdb;
1830
+	global $wpdb;
1831 1831
 
1832
-    if ($post_type != '') {
1832
+	if ($post_type != '') {
1833 1833
 
1834
-        $all_postypes = geodir_get_posttypes();
1834
+		$all_postypes = geodir_get_posttypes();
1835 1835
 
1836
-        if (in_array($post_type, $all_postypes)) {
1836
+		if (in_array($post_type, $all_postypes)) {
1837 1837
 
1838
-            $custom_fields = $wpdb->get_results(
1839
-                $wpdb->prepare(
1840
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon 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",
1841
-                    array($post_type)
1842
-                ), 'ARRAY_A'
1843
-            );
1838
+			$custom_fields = $wpdb->get_results(
1839
+				$wpdb->prepare(
1840
+					"select post_type,data_type,field_type,site_title,htmlvar_name,field_icon 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",
1841
+					array($post_type)
1842
+				), 'ARRAY_A'
1843
+			);
1844 1844
 
1845
-            if (!empty($custom_fields)) {
1845
+			if (!empty($custom_fields)) {
1846 1846
 
1847
-                foreach ($custom_fields as $val) {
1848
-                    $fields[] = $val;
1849
-                }
1850
-            }
1847
+				foreach ($custom_fields as $val) {
1848
+					$fields[] = $val;
1849
+				}
1850
+			}
1851 1851
 
1852
-        }
1852
+		}
1853 1853
 
1854
-    }
1854
+	}
1855 1855
 
1856
-    return $fields;
1856
+	return $fields;
1857 1857
 }
1858 1858
 
1859 1859
 
@@ -1869,76 +1869,76 @@  discard block
 block discarded – undo
1869 1869
 function geodir_get_custom_sort_options($post_type = '')
1870 1870
 {
1871 1871
 
1872
-    global $wpdb;
1873
-
1874
-    if ($post_type != '') {
1875
-
1876
-        $all_postypes = geodir_get_posttypes();
1877
-
1878
-        if (!in_array($post_type, $all_postypes))
1879
-            return false;
1880
-
1881
-        $fields = array();
1882
-
1883
-        $fields[] = array(
1884
-            'post_type' => $post_type,
1885
-            'data_type' => '',
1886
-            'field_type' => 'random',
1887
-            'site_title' => 'Random',
1888
-            'htmlvar_name' => 'post_title',
1889
-            'field_icon' =>  'fa fa-random',
1890
-            'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1891
-        );
1892
-
1893
-        $fields[] = array(
1894
-            'post_type' => $post_type,
1895
-            'data_type' => '',
1896
-            'field_type' => 'datetime',
1897
-            'site_title' => __('Add date', 'geodirectory'),
1898
-            'htmlvar_name' => 'post_date',
1899
-            'field_icon' =>  'fa fa-calendar',
1900
-            'description' =>  __('Sort by date added', 'geodirectory')
1901
-        );
1902
-        $fields[] = array(
1903
-            'post_type' => $post_type,
1904
-            'data_type' => '',
1905
-            'field_type' => 'bigint',
1906
-            'site_title' => __('Review', 'geodirectory'),
1907
-            'htmlvar_name' => 'comment_count',
1908
-            'field_icon' =>  'fa fa-commenting-o',
1909
-            'description' =>  __('Sort by the number of reviews', 'geodirectory')
1910
-        );
1911
-        $fields[] = array(
1912
-            'post_type' => $post_type,
1913
-            'data_type' => '',
1914
-            'field_type' => 'float',
1915
-            'site_title' => __('Rating', 'geodirectory'),
1916
-            'htmlvar_name' => 'overall_rating',
1917
-            'field_icon' =>  'fa fa-star-o',
1918
-            'description' =>  __('Sort by the overall rating value', 'geodirectory')
1919
-        );
1920
-        $fields[] = array(
1921
-            'post_type' => $post_type,
1922
-            'data_type' => '',
1923
-            'field_type' => 'text',
1924
-            'site_title' => __('Title', 'geodirectory'),
1925
-            'htmlvar_name' => 'post_title',
1926
-            'field_icon' =>  'fa fa-sort-alpha-desc',
1927
-            'description' =>  __('Sort alphabetically by title', 'geodirectory')
1928
-        );
1929
-
1930
-        /**
1931
-         * Hook to add custom sort options.
1932
-         *
1933
-         * @since 1.0.0
1934
-         * @param array $fields Unmodified sort options array.
1935
-         * @param string $post_type Post type.
1936
-         */
1937
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1938
-
1939
-    }
1940
-
1941
-    return false;
1872
+	global $wpdb;
1873
+
1874
+	if ($post_type != '') {
1875
+
1876
+		$all_postypes = geodir_get_posttypes();
1877
+
1878
+		if (!in_array($post_type, $all_postypes))
1879
+			return false;
1880
+
1881
+		$fields = array();
1882
+
1883
+		$fields[] = array(
1884
+			'post_type' => $post_type,
1885
+			'data_type' => '',
1886
+			'field_type' => 'random',
1887
+			'site_title' => 'Random',
1888
+			'htmlvar_name' => 'post_title',
1889
+			'field_icon' =>  'fa fa-random',
1890
+			'description' =>  __('Random sort (not recommended for large sites)', 'geodirectory')
1891
+		);
1892
+
1893
+		$fields[] = array(
1894
+			'post_type' => $post_type,
1895
+			'data_type' => '',
1896
+			'field_type' => 'datetime',
1897
+			'site_title' => __('Add date', 'geodirectory'),
1898
+			'htmlvar_name' => 'post_date',
1899
+			'field_icon' =>  'fa fa-calendar',
1900
+			'description' =>  __('Sort by date added', 'geodirectory')
1901
+		);
1902
+		$fields[] = array(
1903
+			'post_type' => $post_type,
1904
+			'data_type' => '',
1905
+			'field_type' => 'bigint',
1906
+			'site_title' => __('Review', 'geodirectory'),
1907
+			'htmlvar_name' => 'comment_count',
1908
+			'field_icon' =>  'fa fa-commenting-o',
1909
+			'description' =>  __('Sort by the number of reviews', 'geodirectory')
1910
+		);
1911
+		$fields[] = array(
1912
+			'post_type' => $post_type,
1913
+			'data_type' => '',
1914
+			'field_type' => 'float',
1915
+			'site_title' => __('Rating', 'geodirectory'),
1916
+			'htmlvar_name' => 'overall_rating',
1917
+			'field_icon' =>  'fa fa-star-o',
1918
+			'description' =>  __('Sort by the overall rating value', 'geodirectory')
1919
+		);
1920
+		$fields[] = array(
1921
+			'post_type' => $post_type,
1922
+			'data_type' => '',
1923
+			'field_type' => 'text',
1924
+			'site_title' => __('Title', 'geodirectory'),
1925
+			'htmlvar_name' => 'post_title',
1926
+			'field_icon' =>  'fa fa-sort-alpha-desc',
1927
+			'description' =>  __('Sort alphabetically by title', 'geodirectory')
1928
+		);
1929
+
1930
+		/**
1931
+		 * Hook to add custom sort options.
1932
+		 *
1933
+		 * @since 1.0.0
1934
+		 * @param array $fields Unmodified sort options array.
1935
+		 * @param string $post_type Post type.
1936
+		 */
1937
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1938
+
1939
+	}
1940
+
1941
+	return false;
1942 1942
 }
1943 1943
 
1944 1944
 
@@ -1954,117 +1954,117 @@  discard block
 block discarded – undo
1954 1954
 function godir_set_sort_field_order($field_ids = array())
1955 1955
 {
1956 1956
 
1957
-    global $wpdb;
1957
+	global $wpdb;
1958 1958
 
1959
-    $count = 0;
1960
-    if (!empty($field_ids)):
1961
-        foreach ($field_ids as $id) {
1959
+	$count = 0;
1960
+	if (!empty($field_ids)):
1961
+		foreach ($field_ids as $id) {
1962 1962
 
1963
-            $cf = trim($id, '_');
1963
+			$cf = trim($id, '_');
1964 1964
 
1965
-            $post_meta_info = $wpdb->query(
1966
-                $wpdb->prepare(
1967
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1965
+			$post_meta_info = $wpdb->query(
1966
+				$wpdb->prepare(
1967
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1968 1968
 															sort_order=%d 
1969 1969
 															where id= %d",
1970
-                    array($count, $cf)
1971
-                )
1972
-            );
1973
-            $count++;
1974
-        }
1975
-
1976
-        return $field_ids;
1977
-    else:
1978
-        return false;
1979
-    endif;
1970
+					array($count, $cf)
1971
+				)
1972
+			);
1973
+			$count++;
1974
+		}
1975
+
1976
+		return $field_ids;
1977
+	else:
1978
+		return false;
1979
+	endif;
1980 1980
 }
1981 1981
 
1982 1982
 
1983 1983
 if (!function_exists('geodir_custom_sort_field_save')) {
1984
-    /**
1985
-     * Save or Update custom sort fields into the database.
1986
-     *
1987
-     * @since 1.0.0
1988
-     * @package GeoDirectory
1989
-     * @global object $wpdb WordPress Database object.
1990
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1991
-     * @param array $request_field {
1992
-     *    Attributes of the Request field.
1993
-     *
1994
-     *    @type string $action Ajax action name.
1995
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1996
-     *    @type string $create_field Do you want to create this field?.
1997
-     *    @type string $field_ins_upd Field created or updated?.
1998
-     *    @type string $_wpnonce Nonce value.
1999
-     *    @type string $listing_type The Post type.
2000
-     *    @type string $field_type Field Type.
2001
-     *    @type string $field_id Field ID.
2002
-     *    @type string $data_type Data Type.
2003
-     *    @type string $htmlvar_name HTML variable name.
2004
-     *    @type string $site_title Section title which you wish to display in frontend.
2005
-     *    @type string $is_default Is this default sorting?.
2006
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
2007
-     *    @type string $sort_order Sort Order.
2008
-     *
2009
-     * }
2010
-     * @param bool $default Not yet implemented.
2011
-     * @return int Returns the last affected db table row id.
2012
-     */
2013
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
2014
-    {
2015
-
2016
-        global $wpdb, $plugin_prefix;
2017
-
2018
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2019
-
2020
-        $cf = trim($result_str, '_');
2021
-
2022
-        /*-------- check dublicate validation --------*/
2023
-
2024
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2025
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2026
-
2027
-        $post_type = $request_field['listing_type'];
2028
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2029
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2030
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2031
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2032
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2033
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2034
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2035
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2036
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2037
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2038
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2039
-
2040
-        $default_order = '';
2041
-        if ($is_default != '') {
2042
-            $default_order = $is_default;
2043
-            $is_default = '1';
2044
-        }
2045
-
2046
-
2047
-        $check_html_variable = $wpdb->get_var(
2048
-            $wpdb->prepare(
2049
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2050
-                array($cehhtmlvar_name, $post_type, $field_type)
2051
-            )
2052
-        );
2053
-
2054
-        if ($is_default == 1) {
2055
-
2056
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2057
-
2058
-        }
2059
-
2060
-
2061
-        if (!$check_html_variable) {
2062
-
2063
-            $wpdb->query(
2064
-
2065
-                $wpdb->prepare(
2066
-
2067
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1984
+	/**
1985
+	 * Save or Update custom sort fields into the database.
1986
+	 *
1987
+	 * @since 1.0.0
1988
+	 * @package GeoDirectory
1989
+	 * @global object $wpdb WordPress Database object.
1990
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1991
+	 * @param array $request_field {
1992
+	 *    Attributes of the Request field.
1993
+	 *
1994
+	 *    @type string $action Ajax action name.
1995
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1996
+	 *    @type string $create_field Do you want to create this field?.
1997
+	 *    @type string $field_ins_upd Field created or updated?.
1998
+	 *    @type string $_wpnonce Nonce value.
1999
+	 *    @type string $listing_type The Post type.
2000
+	 *    @type string $field_type Field Type.
2001
+	 *    @type string $field_id Field ID.
2002
+	 *    @type string $data_type Data Type.
2003
+	 *    @type string $htmlvar_name HTML variable name.
2004
+	 *    @type string $site_title Section title which you wish to display in frontend.
2005
+	 *    @type string $is_default Is this default sorting?.
2006
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
2007
+	 *    @type string $sort_order Sort Order.
2008
+	 *
2009
+	 * }
2010
+	 * @param bool $default Not yet implemented.
2011
+	 * @return int Returns the last affected db table row id.
2012
+	 */
2013
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
2014
+	{
2015
+
2016
+		global $wpdb, $plugin_prefix;
2017
+
2018
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2019
+
2020
+		$cf = trim($result_str, '_');
2021
+
2022
+		/*-------- check dublicate validation --------*/
2023
+
2024
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2025
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2026
+
2027
+		$post_type = $request_field['listing_type'];
2028
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2029
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2030
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2031
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2032
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2033
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2034
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2035
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2036
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2037
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2038
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2039
+
2040
+		$default_order = '';
2041
+		if ($is_default != '') {
2042
+			$default_order = $is_default;
2043
+			$is_default = '1';
2044
+		}
2045
+
2046
+
2047
+		$check_html_variable = $wpdb->get_var(
2048
+			$wpdb->prepare(
2049
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2050
+				array($cehhtmlvar_name, $post_type, $field_type)
2051
+			)
2052
+		);
2053
+
2054
+		if ($is_default == 1) {
2055
+
2056
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2057
+
2058
+		}
2059
+
2060
+
2061
+		if (!$check_html_variable) {
2062
+
2063
+			$wpdb->query(
2064
+
2065
+				$wpdb->prepare(
2066
+
2067
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2068 2068
 				post_type = %s,
2069 2069
 				data_type = %s,
2070 2070
 				field_type = %s,
@@ -2079,23 +2079,23 @@  discard block
 block discarded – undo
2079 2079
 				asc_title = %s,
2080 2080
 				desc_title = %s",
2081 2081
 
2082
-                    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)
2083
-                )
2082
+					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)
2083
+				)
2084 2084
 
2085
-            );
2085
+			);
2086 2086
 
2087 2087
 
2088
-            $lastid = $wpdb->insert_id;
2088
+			$lastid = $wpdb->insert_id;
2089 2089
 
2090
-            $lastid = trim($lastid);
2090
+			$lastid = trim($lastid);
2091 2091
 
2092
-        } else {
2092
+		} else {
2093 2093
 
2094
-            $wpdb->query(
2094
+			$wpdb->query(
2095 2095
 
2096
-                $wpdb->prepare(
2096
+				$wpdb->prepare(
2097 2097
 
2098
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2098
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2099 2099
 				post_type = %s,
2100 2100
 				data_type = %s,
2101 2101
 				field_type = %s,
@@ -2111,123 +2111,123 @@  discard block
 block discarded – undo
2111 2111
 				desc_title = %s
2112 2112
 				where id = %d",
2113 2113
 
2114
-                    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)
2115
-                )
2114
+					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)
2115
+				)
2116 2116
 
2117
-            );
2117
+			);
2118 2118
 
2119
-            $lastid = trim($cf);
2119
+			$lastid = trim($cf);
2120 2120
 
2121
-        }
2121
+		}
2122 2122
 
2123 2123
 
2124
-        return (int)$lastid;
2124
+		return (int)$lastid;
2125 2125
 
2126
-    }
2126
+	}
2127 2127
 }
2128 2128
 
2129 2129
 
2130 2130
 if (!function_exists('geodir_custom_sort_field_delete')) {
2131
-    /**
2132
-     * Delete a custom sort field using field id.
2133
-     * @since 1.0.0
2134
-     * @package GeoDirectory
2135
-     * @global object $wpdb WordPress Database object.
2136
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2137
-     * @param string $field_id The field ID.
2138
-     * @return int|string Returns field id when successful deletion, else returns 0.
2139
-     */
2140
-    function geodir_custom_sort_field_delete($field_id = '')
2141
-    {
2142
-
2143
-        global $wpdb, $plugin_prefix;
2144
-        if ($field_id != '') {
2145
-            $cf = trim($field_id, '_');
2146
-
2147
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2148
-
2149
-            return $field_id;
2150
-
2151
-        } else
2152
-            return 0;
2153
-
2154
-    }
2131
+	/**
2132
+	 * Delete a custom sort field using field id.
2133
+	 * @since 1.0.0
2134
+	 * @package GeoDirectory
2135
+	 * @global object $wpdb WordPress Database object.
2136
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2137
+	 * @param string $field_id The field ID.
2138
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2139
+	 */
2140
+	function geodir_custom_sort_field_delete($field_id = '')
2141
+	{
2142
+
2143
+		global $wpdb, $plugin_prefix;
2144
+		if ($field_id != '') {
2145
+			$cf = trim($field_id, '_');
2146
+
2147
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2148
+
2149
+			return $field_id;
2150
+
2151
+		} else
2152
+			return 0;
2153
+
2154
+	}
2155 2155
 }
2156 2156
 
2157 2157
 
2158 2158
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2159
-    /**
2160
-     * Custom sort field admin html.
2161
-     *
2162
-     * @since 1.0.0
2163
-     * @package GeoDirectory
2164
-     * @global object $wpdb WordPress Database object.
2165
-     * @param string $field_type The form field type.
2166
-     * @param object|int $result_str The custom field results object or row id.
2167
-     * @param string $field_ins_upd When set to "submit" displays form.
2168
-     * @param bool $default when set to true field will be for admin use only.
2169
-     */
2170
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2171
-    {
2172
-        global $wpdb;
2173
-        $cf = $result_str;
2174
-        if (!is_object($cf)) {
2175
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2176
-        } else {
2177
-            $field_info = $cf;
2178
-            $result_str = $cf->id;
2179
-        }
2180
-
2181
-        $field_info = stripslashes_deep($field_info); // strip slashes
2182
-
2183
-        if (!isset($field_info->post_type)) {
2184
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2185
-        } else {
2186
-            $post_type = $field_info->post_type;
2187
-        }
2188
-
2189
-
2190
-        $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2191
-
2192
-        $site_title = '';
2193
-        if ($site_title == '')
2194
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2195
-
2196
-        if ($site_title == '') {
2197
-            $fields = geodir_get_custom_sort_options($post_type);
2198
-
2199
-            foreach ($fields as $val) {
2200
-                $val = stripslashes_deep($val); // strip slashes
2201
-
2202
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2203
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2204
-                }
2205
-            }
2206
-        }
2207
-
2208
-        if ($htmlvar_name == '')
2209
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2210
-
2211
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2212
-
2213
-        $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2214
-        $cso_arr = geodir_get_custom_sort_options($post_type);
2215
-
2216
-        $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2217
-        foreach($cso_arr as $cso){
2218
-            if($cur_field_type==$cso['field_type']){
2219
-
2220
-                if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2221
-                    $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2222
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2223
-                    $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2224
-                }
2225
-
2226
-            }
2227
-        }
2228
-
2229
-        $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2230
-        ?>
2159
+	/**
2160
+	 * Custom sort field admin html.
2161
+	 *
2162
+	 * @since 1.0.0
2163
+	 * @package GeoDirectory
2164
+	 * @global object $wpdb WordPress Database object.
2165
+	 * @param string $field_type The form field type.
2166
+	 * @param object|int $result_str The custom field results object or row id.
2167
+	 * @param string $field_ins_upd When set to "submit" displays form.
2168
+	 * @param bool $default when set to true field will be for admin use only.
2169
+	 */
2170
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2171
+	{
2172
+		global $wpdb;
2173
+		$cf = $result_str;
2174
+		if (!is_object($cf)) {
2175
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2176
+		} else {
2177
+			$field_info = $cf;
2178
+			$result_str = $cf->id;
2179
+		}
2180
+
2181
+		$field_info = stripslashes_deep($field_info); // strip slashes
2182
+
2183
+		if (!isset($field_info->post_type)) {
2184
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2185
+		} else {
2186
+			$post_type = $field_info->post_type;
2187
+		}
2188
+
2189
+
2190
+		$htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2191
+
2192
+		$site_title = '';
2193
+		if ($site_title == '')
2194
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2195
+
2196
+		if ($site_title == '') {
2197
+			$fields = geodir_get_custom_sort_options($post_type);
2198
+
2199
+			foreach ($fields as $val) {
2200
+				$val = stripslashes_deep($val); // strip slashes
2201
+
2202
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2203
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2204
+				}
2205
+			}
2206
+		}
2207
+
2208
+		if ($htmlvar_name == '')
2209
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2210
+
2211
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2212
+
2213
+		$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2214
+		$cso_arr = geodir_get_custom_sort_options($post_type);
2215
+
2216
+		$cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2217
+		foreach($cso_arr as $cso){
2218
+			if($cur_field_type==$cso['field_type']){
2219
+
2220
+				if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2221
+					$field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2222
+				}elseif(isset($cso['field_icon']) && $cso['field_icon']){
2223
+					$field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2224
+				}
2225
+
2226
+			}
2227
+		}
2228
+
2229
+		$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2230
+		?>
2231 2231
 
2232 2232
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2233 2233
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2237 2237
                 <?php
2238 2238
 
2239
-                ?>
2239
+				?>
2240 2240
 
2241 2241
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2242 2242
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2251,17 +2251,17 @@  discard block
 block discarded – undo
2251 2251
 
2252 2252
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2253 2253
                  style="display:<?php if ($field_ins_upd == 'submit') {
2254
-                     echo 'block;';
2255
-                 } else {
2256
-                     echo 'none;';
2257
-                 } ?>">
2254
+					 echo 'block;';
2255
+				 } else {
2256
+					 echo 'none;';
2257
+				 } ?>">
2258 2258
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2259 2259
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2260 2260
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2261 2261
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2262 2262
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2263
-                    echo $field_info->data_type;
2264
-                }?>"/>
2263
+					echo $field_info->data_type;
2264
+				}?>"/>
2265 2265
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2266 2266
 
2267 2267
 
@@ -2284,14 +2284,14 @@  discard block
 block discarded – undo
2284 2284
 
2285 2285
                                 <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2286 2286
                                     <?php if ($value == '1') {
2287
-                                        echo 'checked';
2288
-                                    } ?>/>
2287
+										echo 'checked';
2288
+									} ?>/>
2289 2289
                                 <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2290 2290
 
2291 2291
                                 <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2292 2292
                                     <?php if ($value == '0' || !$value) {
2293
-                                        echo 'checked';
2294
-                                    } ?>/>
2293
+										echo 'checked';
2294
+									} ?>/>
2295 2295
                                 <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2296 2296
 
2297 2297
                             </div>
@@ -2328,8 +2328,8 @@  discard block
 block discarded – undo
2328 2328
 
2329 2329
                                 <input type="radio" name="is_default"
2330 2330
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2331
-                                    echo 'checked="checked"';
2332
-                                } ?>/>
2331
+									echo 'checked="checked"';
2332
+								} ?>/>
2333 2333
                             </div>
2334 2334
 
2335 2335
                         </li>
@@ -2349,14 +2349,14 @@  discard block
 block discarded – undo
2349 2349
 
2350 2350
                                 <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2351 2351
                                     <?php if ($value == '1') {
2352
-                                        echo 'checked';
2353
-                                    } ?>/>
2352
+										echo 'checked';
2353
+									} ?>/>
2354 2354
                                 <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2355 2355
 
2356 2356
                                 <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2357 2357
                                     <?php if ($value == '0' || !$value) {
2358
-                                        echo 'checked';
2359
-                                    } ?>/>
2358
+										echo 'checked';
2359
+									} ?>/>
2360 2360
                                 <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2361 2361
 
2362 2362
                             </div>
@@ -2392,8 +2392,8 @@  discard block
 block discarded – undo
2392 2392
 
2393 2393
                                 <input type="radio" name="is_default"
2394 2394
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2395
-                                    echo 'checked="checked"';
2396
-                                } ?>/>
2395
+									echo 'checked="checked"';
2396
+								} ?>/>
2397 2397
                             </div>
2398 2398
 
2399 2399
                         </li>
@@ -2435,8 +2435,8 @@  discard block
 block discarded – undo
2435 2435
 
2436 2436
                                 <input type="checkbox" name="is_default"
2437 2437
                                        value="<?php echo $field_type; ?>"  <?php if (isset($value) && $value == '1') {
2438
-                                    echo 'checked="checked"';
2439
-                                } ?>/>
2438
+									echo 'checked="checked"';
2439
+								} ?>/>
2440 2440
                             </div>
2441 2441
 
2442 2442
 
@@ -2459,14 +2459,14 @@  discard block
 block discarded – undo
2459 2459
 
2460 2460
                             <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2461 2461
                                 <?php if ($value == '1') {
2462
-                                    echo 'checked';
2463
-                                } ?>/>
2462
+									echo 'checked';
2463
+								} ?>/>
2464 2464
                             <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2465 2465
 
2466 2466
                             <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2467 2467
                                 <?php if ($value == '0' || !$value) {
2468
-                                    echo 'checked';
2469
-                                } ?>/>
2468
+									echo 'checked';
2469
+								} ?>/>
2470 2470
                             <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2471 2471
 
2472 2472
                         </div>
@@ -2476,8 +2476,8 @@  discard block
 block discarded – undo
2476 2476
 
2477 2477
                     <input type="hidden" readonly="readonly" name="sort_order" id="sort_order"
2478 2478
                                                 value="<?php if (isset($field_info->sort_order)) {
2479
-                                                    echo esc_attr($field_info->sort_order);
2480
-                                                }?>" size="50"/>
2479
+													echo esc_attr($field_info->sort_order);
2480
+												}?>" size="50"/>
2481 2481
 
2482 2482
 
2483 2483
 
@@ -2501,38 +2501,38 @@  discard block
 block discarded – undo
2501 2501
             </form>
2502 2502
         </li> <?php
2503 2503
 
2504
-    }
2504
+	}
2505 2505
 }
2506 2506
 
2507 2507
 if (!function_exists('check_field_visibility')) {
2508
-    /**
2509
-     * Check field visibility as per price package.
2510
-     *
2511
-     * @since 1.0.0
2512
-     * @package GeoDirectory
2513
-     * @global object $wpdb WordPress Database object.
2514
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2515
-     * @param int|string $package_id The package ID.
2516
-     * @param string $field_name The field name.
2517
-     * @param string $post_type Optional. The wordpress post type.
2518
-     * @return bool Returns true when field visible, otherwise false.
2519
-     */
2520
-    function check_field_visibility($package_id, $field_name, $post_type)
2521
-    {
2522
-        global $wpdb, $geodir_addon_list;
2523
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2524
-            return true;
2525
-        }
2526
-        if (!$package_id || !$field_name || !$post_type) {
2527
-            return true;
2528
-        }
2529
-        $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));
2530
-
2531
-        if ($wpdb->get_var($sql)) {
2532
-            return true;
2533
-        }
2534
-        return false;
2535
-    }
2508
+	/**
2509
+	 * Check field visibility as per price package.
2510
+	 *
2511
+	 * @since 1.0.0
2512
+	 * @package GeoDirectory
2513
+	 * @global object $wpdb WordPress Database object.
2514
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2515
+	 * @param int|string $package_id The package ID.
2516
+	 * @param string $field_name The field name.
2517
+	 * @param string $post_type Optional. The wordpress post type.
2518
+	 * @return bool Returns true when field visible, otherwise false.
2519
+	 */
2520
+	function check_field_visibility($package_id, $field_name, $post_type)
2521
+	{
2522
+		global $wpdb, $geodir_addon_list;
2523
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2524
+			return true;
2525
+		}
2526
+		if (!$package_id || !$field_name || !$post_type) {
2527
+			return true;
2528
+		}
2529
+		$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));
2530
+
2531
+		if ($wpdb->get_var($sql)) {
2532
+			return true;
2533
+		}
2534
+		return false;
2535
+	}
2536 2536
 }
2537 2537
 
2538 2538
 /**
@@ -2547,43 +2547,43 @@  discard block
 block discarded – undo
2547 2547
  */
2548 2548
 function geodir_string_to_options($input = '', $translated = false)
2549 2549
 {
2550
-    $return = array();
2551
-    if ($input != '') {
2552
-        $input = trim($input);
2553
-        $input = rtrim($input, ",");
2554
-        $input = ltrim($input, ",");
2555
-        $input = trim($input);
2556
-    }
2557
-
2558
-    $input_arr = explode(',', $input);
2559
-
2560
-    if (!empty($input_arr)) {
2561
-        foreach ($input_arr as $input_str) {
2562
-            $input_str = trim($input_str);
2563
-
2564
-            if (strpos($input_str, "/") !== false) {
2565
-                $input_str = explode("/", $input_str, 2);
2566
-                $label = trim($input_str[0]);
2567
-                if ($translated && $label != '') {
2568
-                    $label = __($label, 'geodirectory');
2569
-                }
2570
-                $label = ucfirst($label);
2571
-                $value = trim($input_str[1]);
2572
-            } else {
2573
-                if ($translated && $input_str != '') {
2574
-                    $input_str = __($input_str, 'geodirectory');
2575
-                }
2576
-                $label = ucfirst($input_str);
2577
-                $value = $input_str;
2578
-            }
2579
-
2580
-            if ($label != '') {
2581
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2582
-            }
2583
-        }
2584
-    }
2585
-
2586
-    return $return;
2550
+	$return = array();
2551
+	if ($input != '') {
2552
+		$input = trim($input);
2553
+		$input = rtrim($input, ",");
2554
+		$input = ltrim($input, ",");
2555
+		$input = trim($input);
2556
+	}
2557
+
2558
+	$input_arr = explode(',', $input);
2559
+
2560
+	if (!empty($input_arr)) {
2561
+		foreach ($input_arr as $input_str) {
2562
+			$input_str = trim($input_str);
2563
+
2564
+			if (strpos($input_str, "/") !== false) {
2565
+				$input_str = explode("/", $input_str, 2);
2566
+				$label = trim($input_str[0]);
2567
+				if ($translated && $label != '') {
2568
+					$label = __($label, 'geodirectory');
2569
+				}
2570
+				$label = ucfirst($label);
2571
+				$value = trim($input_str[1]);
2572
+			} else {
2573
+				if ($translated && $input_str != '') {
2574
+					$input_str = __($input_str, 'geodirectory');
2575
+				}
2576
+				$label = ucfirst($input_str);
2577
+				$value = $input_str;
2578
+			}
2579
+
2580
+			if ($label != '') {
2581
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2582
+			}
2583
+		}
2584
+	}
2585
+
2586
+	return $return;
2587 2587
 }
2588 2588
 
2589 2589
 /**
@@ -2598,66 +2598,66 @@  discard block
 block discarded – undo
2598 2598
  */
2599 2599
 function geodir_string_values_to_options($option_values = '', $translated = false)
2600 2600
 {
2601
-    $options = array();
2602
-    if ($option_values == '') {
2603
-        return NULL;
2604
-    }
2605
-
2606
-    if (strpos($option_values, "{/optgroup}") !== false) {
2607
-        $option_values_arr = explode("{/optgroup}", $option_values);
2608
-
2609
-        foreach ($option_values_arr as $optgroup) {
2610
-            if (strpos($optgroup, "{optgroup}") !== false) {
2611
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2612
-
2613
-                $count = 0;
2614
-                foreach ($optgroup_arr as $optgroup_str) {
2615
-                    $count++;
2616
-                    $optgroup_str = trim($optgroup_str);
2617
-
2618
-                    $optgroup_label = '';
2619
-                    if (strpos($optgroup_str, "|") !== false) {
2620
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2621
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2622
-                        if ($translated && $optgroup_label != '') {
2623
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2624
-                        }
2625
-                        $optgroup_label = ucfirst($optgroup_label);
2626
-                        $optgroup_str = $optgroup_str_arr[1];
2627
-                    }
2628
-
2629
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2630
-
2631
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2632
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2633
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2634
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2635
-                    }
2636
-                    $options = array_merge($options, $optgroup3);
2637
-                }
2638
-            } else {
2639
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2640
-                $options = array_merge($options, $optgroup1);
2641
-            }
2642
-        }
2643
-    } else {
2644
-        $options = geodir_string_to_options($option_values, $translated);
2645
-    }
2646
-
2647
-    return $options;
2601
+	$options = array();
2602
+	if ($option_values == '') {
2603
+		return NULL;
2604
+	}
2605
+
2606
+	if (strpos($option_values, "{/optgroup}") !== false) {
2607
+		$option_values_arr = explode("{/optgroup}", $option_values);
2608
+
2609
+		foreach ($option_values_arr as $optgroup) {
2610
+			if (strpos($optgroup, "{optgroup}") !== false) {
2611
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2612
+
2613
+				$count = 0;
2614
+				foreach ($optgroup_arr as $optgroup_str) {
2615
+					$count++;
2616
+					$optgroup_str = trim($optgroup_str);
2617
+
2618
+					$optgroup_label = '';
2619
+					if (strpos($optgroup_str, "|") !== false) {
2620
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2621
+						$optgroup_label = trim($optgroup_str_arr[0]);
2622
+						if ($translated && $optgroup_label != '') {
2623
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2624
+						}
2625
+						$optgroup_label = ucfirst($optgroup_label);
2626
+						$optgroup_str = $optgroup_str_arr[1];
2627
+					}
2628
+
2629
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2630
+
2631
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2632
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2633
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2634
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2635
+					}
2636
+					$options = array_merge($options, $optgroup3);
2637
+				}
2638
+			} else {
2639
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2640
+				$options = array_merge($options, $optgroup1);
2641
+			}
2642
+		}
2643
+	} else {
2644
+		$options = geodir_string_to_options($option_values, $translated);
2645
+	}
2646
+
2647
+	return $options;
2648 2648
 }
2649 2649
 
2650 2650
 
2651 2651
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2652
-    ob_start();
2653
-
2654
-    $dt_value = '';
2655
-    if (isset($field_info->data_type)) {
2656
-        $dt_value  = esc_attr($field_info->data_type);
2657
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2658
-        $dt_value  = $cf['defaults']['data_type'];
2659
-    }
2660
-    ?>
2652
+	ob_start();
2653
+
2654
+	$dt_value = '';
2655
+	if (isset($field_info->data_type)) {
2656
+		$dt_value  = esc_attr($field_info->data_type);
2657
+	}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2658
+		$dt_value  = $cf['defaults']['data_type'];
2659
+	}
2660
+	?>
2661 2661
     <li>
2662 2662
         <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2663 2663
         <div class="gd-cf-input-wrap">
@@ -2666,16 +2666,16 @@  discard block
 block discarded – undo
2666 2666
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2667 2667
                 <option
2668 2668
                     value="XVARCHAR" <?php if ($dt_value  == 'VARCHAR') {
2669
-                    echo 'selected="selected"';
2670
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2669
+					echo 'selected="selected"';
2670
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2671 2671
                 <option
2672 2672
                     value="INT" <?php if ($dt_value   == 'INT') {
2673
-                    echo 'selected="selected"';
2674
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2673
+					echo 'selected="selected"';
2674
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2675 2675
                 <option
2676 2676
                     value="FLOAT" <?php if ($dt_value   == 'FLOAT') {
2677
-                    echo 'selected="selected"';
2678
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2677
+					echo 'selected="selected"';
2678
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2679 2679
             </select>
2680 2680
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2681 2681
 
@@ -2683,13 +2683,13 @@  discard block
 block discarded – undo
2683 2683
     </li>
2684 2684
 
2685 2685
     <?php
2686
-    $value = '';
2687
-    if (isset($field_info->decimal_point)) {
2688
-        $value = esc_attr($field_info->decimal_point);
2689
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2690
-        $value = $cf['defaults']['decimal_point'];
2691
-    }
2692
-    ?>
2686
+	$value = '';
2687
+	if (isset($field_info->decimal_point)) {
2688
+		$value = esc_attr($field_info->decimal_point);
2689
+	}elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2690
+		$value = $cf['defaults']['decimal_point'];
2691
+	}
2692
+	?>
2693 2693
 
2694 2694
     <li class="decimal-point-wrapper"
2695 2695
         style="<?php echo ($dt_value  == 'FLOAT') ? '' : 'display:none' ?>">
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
             <select name="decimal_point" id="decimal_point">
2699 2699
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2700 2700
                 <?php for ($i = 1; $i <= 10; $i++) {
2701
-                    $selected = $i == $value ? 'selected="selected"' : ''; ?>
2701
+					$selected = $i == $value ? 'selected="selected"' : ''; ?>
2702 2702
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2703 2703
                 <?php } ?>
2704 2704
             </select>
@@ -2707,8 +2707,8 @@  discard block
 block discarded – undo
2707 2707
     </li>
2708 2708
 <?php
2709 2709
 
2710
-    $output = ob_get_clean();
2711
-    return $output;
2710
+	$output = ob_get_clean();
2711
+	return $output;
2712 2712
 }
2713 2713
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2714 2714
 
@@ -2746,9 +2746,9 @@  discard block
 block discarded – undo
2746 2746
 
2747 2747
 
2748 2748
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2749
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2750
-    ob_start();
2751
-    ?>
2749
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2750
+	ob_start();
2751
+	?>
2752 2752
     <li>
2753 2753
         <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
2754 2754
             <div class="gdcf-tooltip">
@@ -2759,13 +2759,13 @@  discard block
 block discarded – undo
2759 2759
         <div class="gd-cf-input-wrap">
2760 2760
 
2761 2761
             <?php
2762
-            $selected = '';
2763
-            if (isset($field_info->extra_fields))
2764
-                $advanced_editor = unserialize($field_info->extra_fields);
2762
+			$selected = '';
2763
+			if (isset($field_info->extra_fields))
2764
+				$advanced_editor = unserialize($field_info->extra_fields);
2765 2765
 
2766
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2767
-                $selected = 'checked="checked"';
2768
-            ?>
2766
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2767
+				$selected = 'checked="checked"';
2768
+			?>
2769 2769
 
2770 2770
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2771 2771
                    value="1" <?php echo $selected; ?>/>
@@ -2774,22 +2774,22 @@  discard block
 block discarded – undo
2774 2774
     </li>
2775 2775
     <?php
2776 2776
 
2777
-    $output = ob_get_clean();
2778
-    return $output;
2777
+	$output = ob_get_clean();
2778
+	return $output;
2779 2779
 }
2780 2780
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2781 2781
 
2782 2782
 
2783 2783
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2784
-    ob_start();
2785
-
2786
-    $value = '';
2787
-    if (isset($field_info->validation_pattern)) {
2788
-        $value = esc_attr($field_info->validation_pattern);
2789
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2790
-        $value = esc_attr($cf['defaults']['validation_pattern']);
2791
-    }
2792
-    ?>
2784
+	ob_start();
2785
+
2786
+	$value = '';
2787
+	if (isset($field_info->validation_pattern)) {
2788
+		$value = esc_attr($field_info->validation_pattern);
2789
+	}elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2790
+		$value = esc_attr($cf['defaults']['validation_pattern']);
2791
+	}
2792
+	?>
2793 2793
     <li>
2794 2794
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2795 2795
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2803,13 +2803,13 @@  discard block
 block discarded – undo
2803 2803
         </div>
2804 2804
     </li>
2805 2805
     <?php
2806
-    $value = '';
2807
-    if (isset($field_info->validation_msg)) {
2808
-        $value = esc_attr($field_info->validation_msg);
2809
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2810
-        $value = esc_attr($cf['defaults']['validation_msg']);
2811
-    }
2812
-    ?>
2806
+	$value = '';
2807
+	if (isset($field_info->validation_msg)) {
2808
+		$value = esc_attr($field_info->validation_msg);
2809
+	}elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2810
+		$value = esc_attr($cf['defaults']['validation_msg']);
2811
+	}
2812
+	?>
2813 2813
     <li>
2814 2814
         <label for="validation_msg" class="gd-cf-tooltip-wrap">
2815 2815
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
@@ -2824,21 +2824,21 @@  discard block
 block discarded – undo
2824 2824
     </li>
2825 2825
     <?php
2826 2826
 
2827
-    $output = ob_get_clean();
2828
-    return $output;
2827
+	$output = ob_get_clean();
2828
+	return $output;
2829 2829
 }
2830 2830
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2831 2831
 
2832 2832
 
2833 2833
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2834
-    ob_start();
2835
-    global $post_type;
2836
-
2837
-    if (!isset($field_info->post_type)) {
2838
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2839
-    } else
2840
-        $post_type = $field_info->post_type;
2841
-    ?>
2834
+	ob_start();
2835
+	global $post_type;
2836
+
2837
+	if (!isset($field_info->post_type)) {
2838
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2839
+	} else
2840
+		$post_type = $field_info->post_type;
2841
+	?>
2842 2842
     <li style="display: none;">
2843 2843
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2844 2844
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2849,15 +2849,15 @@  discard block
 block discarded – undo
2849 2849
         <div class="gd-cf-input-wrap">
2850 2850
             <select name="htmlvar_name" id="htmlvar_name">
2851 2851
                 <?php
2852
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2852
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2853 2853
 
2854
-                foreach ($gd_taxonomy as $gd_tax) {
2855
-                    ?>
2854
+				foreach ($gd_taxonomy as $gd_tax) {
2855
+					?>
2856 2856
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2857
-                        echo 'selected="selected"';
2858
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2859
-                }
2860
-                ?>
2857
+						echo 'selected="selected"';
2858
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2859
+				}
2860
+				?>
2861 2861
             </select>
2862 2862
         </div>
2863 2863
     </li>
@@ -2873,49 +2873,49 @@  discard block
 block discarded – undo
2873 2873
 
2874 2874
             <select name="cat_display_type" id="cat_display_type">
2875 2875
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2876
-                    echo 'selected="selected"';
2877
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2876
+					echo 'selected="selected"';
2877
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2878 2878
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2879
-                    echo 'selected="selected"';
2880
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2879
+					echo 'selected="selected"';
2880
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2881 2881
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2882
-                    echo 'selected="selected"';
2883
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2882
+					echo 'selected="selected"';
2883
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2884 2884
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2885
-                    echo 'selected="selected"';
2886
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2885
+					echo 'selected="selected"';
2886
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2887 2887
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2888
-                    echo 'selected="selected"';
2889
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2888
+					echo 'selected="selected"';
2889
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2890 2890
             </select>
2891 2891
         </div>
2892 2892
     </li>
2893 2893
     <?php
2894 2894
 
2895
-    $output = ob_get_clean();
2896
-    return $output;
2895
+	$output = ob_get_clean();
2896
+	return $output;
2897 2897
 }
2898 2898
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2899 2899
 
2900 2900
 
2901 2901
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2902 2902
 
2903
-    ob_start();
2904
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2905
-        $address = unserialize($field_info->extra_fields);
2906
-    }
2903
+	ob_start();
2904
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2905
+		$address = unserialize($field_info->extra_fields);
2906
+	}
2907 2907
 
2908
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2909
-    ?>
2908
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
2909
+	?>
2910 2910
     <?php
2911
-    /**
2912
-     * Called on the add custom fields settings page before the address field is output.
2913
-     *
2914
-     * @since 1.0.0
2915
-     * @param array $address The address settings array.
2916
-     * @param object $field_info Extra fields info.
2917
-     */
2918
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2911
+	/**
2912
+	 * Called on the add custom fields settings page before the address field is output.
2913
+	 *
2914
+	 * @since 1.0.0
2915
+	 * @param array $address The address settings array.
2916
+	 * @param object $field_info Extra fields info.
2917
+	 */
2918
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2919 2919
 
2920 2920
     <li>
2921 2921
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2928,14 +2928,14 @@  discard block
 block discarded – undo
2928 2928
 
2929 2929
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2930 2930
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2931
-                    echo 'checked';
2932
-                } ?>/>
2931
+					echo 'checked';
2932
+				} ?>/>
2933 2933
             <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2934 2934
 
2935 2935
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2936 2936
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2937
-                    echo 'checked';
2938
-                } ?>/>
2937
+					echo 'checked';
2938
+				} ?>/>
2939 2939
             <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2940 2940
 
2941 2941
 
@@ -2952,8 +2952,8 @@  discard block
 block discarded – undo
2952 2952
         <div class="gd-cf-input-wrap">
2953 2953
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2954 2954
                    value="<?php if (isset($address['zip_lable'])) {
2955
-                       echo esc_attr($address['zip_lable']);
2956
-                   }?>"/>
2955
+					   echo esc_attr($address['zip_lable']);
2956
+				   }?>"/>
2957 2957
         </div>
2958 2958
     </li>
2959 2959
 
@@ -2970,8 +2970,8 @@  discard block
 block discarded – undo
2970 2970
         <div class="gd-cf-input-wrap">
2971 2971
             <input type="text" name="extra[map_lable]" id="map_lable"
2972 2972
                    value="<?php if (isset($address['map_lable'])) {
2973
-                       echo esc_attr($address['map_lable']);
2974
-                   }?>"/>
2973
+					   echo esc_attr($address['map_lable']);
2974
+				   }?>"/>
2975 2975
         </div>
2976 2976
     </li>
2977 2977
 
@@ -2986,14 +2986,14 @@  discard block
 block discarded – undo
2986 2986
 
2987 2987
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2988 2988
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2989
-                    echo 'checked';
2990
-                } ?>/>
2989
+					echo 'checked';
2990
+				} ?>/>
2991 2991
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2992 2992
 
2993 2993
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2994 2994
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2995
-                    echo 'checked';
2996
-                } ?>/>
2995
+					echo 'checked';
2996
+				} ?>/>
2997 2997
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2998 2998
 
2999 2999
         </div>
@@ -3010,14 +3010,14 @@  discard block
 block discarded – undo
3010 3010
 
3011 3011
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3012 3012
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
3013
-                    echo 'checked';
3014
-                } ?>/>
3013
+					echo 'checked';
3014
+				} ?>/>
3015 3015
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3016 3016
 
3017 3017
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3018 3018
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
3019
-                    echo 'checked';
3020
-                } ?>/>
3019
+					echo 'checked';
3020
+				} ?>/>
3021 3021
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3022 3022
 
3023 3023
         </div>
@@ -3034,8 +3034,8 @@  discard block
 block discarded – undo
3034 3034
         <div class="gd-cf-input-wrap">
3035 3035
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
3036 3036
                    value="<?php if (isset($address['mapview_lable'])) {
3037
-                       echo esc_attr($address['mapview_lable']);
3038
-                   }?>"/>
3037
+					   echo esc_attr($address['mapview_lable']);
3038
+				   }?>"/>
3039 3039
         </div>
3040 3040
     </li>
3041 3041
     <li>
@@ -3049,29 +3049,29 @@  discard block
 block discarded – undo
3049 3049
 
3050 3050
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3051 3051
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3052
-                    echo 'checked';
3053
-                } ?>/>
3052
+					echo 'checked';
3053
+				} ?>/>
3054 3054
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3055 3055
 
3056 3056
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3057 3057
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3058
-                    echo 'checked';
3059
-                } ?>/>
3058
+					echo 'checked';
3059
+				} ?>/>
3060 3060
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3061 3061
 
3062 3062
         </div>
3063 3063
     </li>
3064 3064
     <?php
3065 3065
 
3066
-    $html = ob_get_clean();
3067
-    return $output.$html;
3066
+	$html = ob_get_clean();
3067
+	return $output.$html;
3068 3068
 }
3069 3069
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3070 3070
 
3071 3071
 
3072 3072
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3073
-    ob_start();
3074
-    ?>
3073
+	ob_start();
3074
+	?>
3075 3075
     <li>
3076 3076
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3077 3077
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -3083,14 +3083,14 @@  discard block
 block discarded – undo
3083 3083
 
3084 3084
             <select name="multi_display_type" id="multi_display_type">
3085 3085
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3086
-                    echo 'selected="selected"';
3087
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3086
+					echo 'selected="selected"';
3087
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
3088 3088
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3089
-                    echo 'selected="selected"';
3090
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3089
+					echo 'selected="selected"';
3090
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3091 3091
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3092
-                    echo 'selected="selected"';
3093
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3092
+					echo 'selected="selected"';
3093
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3094 3094
             </select>
3095 3095
 
3096 3096
             <br/>
@@ -3098,25 +3098,25 @@  discard block
 block discarded – undo
3098 3098
     </li>
3099 3099
     <?php
3100 3100
 
3101
-    $html = ob_get_clean();
3102
-    return $output.$html;
3101
+	$html = ob_get_clean();
3102
+	return $output.$html;
3103 3103
 }
3104 3104
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3105 3105
 
3106 3106
 
3107 3107
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3108 3108
 
3109
-    ob_start();
3109
+	ob_start();
3110 3110
 
3111
-    $value = '';
3112
-    if (isset($field_info->option_values)) {
3113
-        $value = esc_attr($field_info->option_values);
3114
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3115
-        $value = esc_attr($cf['defaults']['option_values']);
3116
-    }
3111
+	$value = '';
3112
+	if (isset($field_info->option_values)) {
3113
+		$value = esc_attr($field_info->option_values);
3114
+	}elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3115
+		$value = esc_attr($cf['defaults']['option_values']);
3116
+	}
3117 3117
 
3118
-    $field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3119
-    ?>
3118
+	$field_type = isset($field_info->field_type) ? $field_info->field_type : '';
3119
+	?>
3120 3120
     <li>
3121 3121
         <label for="option_values" class="gd-cf-tooltip-wrap">
3122 3122
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -3143,8 +3143,8 @@  discard block
 block discarded – undo
3143 3143
     </li>
3144 3144
     <?php
3145 3145
 
3146
-    $html = ob_get_clean();
3147
-    return $output.$html;
3146
+	$html = ob_get_clean();
3147
+	return $output.$html;
3148 3148
 }
3149 3149
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3150 3150
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -3152,12 +3152,12 @@  discard block
 block discarded – undo
3152 3152
 
3153 3153
 
3154 3154
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3155
-    ob_start();
3156
-    $extra = array();
3157
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3158
-        $extra = unserialize($field_info->extra_fields);
3159
-    }
3160
-    ?>
3155
+	ob_start();
3156
+	$extra = array();
3157
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
3158
+		$extra = unserialize($field_info->extra_fields);
3159
+	}
3160
+	?>
3161 3161
     <li>
3162 3162
         <label for="date_format" class="gd-cf-tooltip-wrap">
3163 3163
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -3167,52 +3167,52 @@  discard block
 block discarded – undo
3167 3167
         </label>
3168 3168
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
3169 3169
             <?php
3170
-            $date_formats = array(
3171
-                'm/d/Y',
3172
-                'd/m/Y',
3173
-                'Y/m/d',
3174
-                'm-d-Y',
3175
-                'd-m-Y',
3176
-                'Y-m-d',
3177
-                'F j, Y',
3178
-            );
3179
-            /**
3180
-             * Filter the custom field date format options.
3181
-             *
3182
-             * @since 1.6.5
3183
-             * @param array $date_formats The PHP date format array.
3184
-             */
3185
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3186
-            ?>
3170
+			$date_formats = array(
3171
+				'm/d/Y',
3172
+				'd/m/Y',
3173
+				'Y/m/d',
3174
+				'm-d-Y',
3175
+				'd-m-Y',
3176
+				'Y-m-d',
3177
+				'F j, Y',
3178
+			);
3179
+			/**
3180
+			 * Filter the custom field date format options.
3181
+			 *
3182
+			 * @since 1.6.5
3183
+			 * @param array $date_formats The PHP date format array.
3184
+			 */
3185
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
3186
+			?>
3187 3187
             <select name="extra[date_format]" id="date_format">
3188 3188
                 <?php
3189
-                foreach($date_formats as $format){
3190
-                    $selected = '';
3191
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3192
-                        $selected = "selected='selected'";
3193
-                    }
3194
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3195
-                }
3196
-                ?>
3189
+				foreach($date_formats as $format){
3190
+					$selected = '';
3191
+					if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3192
+						$selected = "selected='selected'";
3193
+					}
3194
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3195
+				}
3196
+				?>
3197 3197
             </select>
3198 3198
 
3199 3199
         </div>
3200 3200
     </li>
3201 3201
     <?php
3202 3202
 
3203
-    $html = ob_get_clean();
3204
-    return $output.$html;
3203
+	$html = ob_get_clean();
3204
+	return $output.$html;
3205 3205
 }
3206 3206
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3207 3207
 
3208 3208
 
3209 3209
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3210
-    ob_start();
3211
-    $allowed_file_types = geodir_allowed_mime_types();
3210
+	ob_start();
3211
+	$allowed_file_types = geodir_allowed_mime_types();
3212 3212
 
3213
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3214
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3215
-    ?>
3213
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3214
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3215
+	?>
3216 3216
     <li>
3217 3217
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3218 3218
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3235,31 +3235,31 @@  discard block
 block discarded – undo
3235 3235
     </li>
3236 3236
     <?php
3237 3237
 
3238
-    $html = ob_get_clean();
3239
-    return $output.$html;
3238
+	$html = ob_get_clean();
3239
+	return $output.$html;
3240 3240
 }
3241 3241
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3242 3242
 
3243 3243
 function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
3244
-    ob_start();
3244
+	ob_start();
3245 3245
 
3246
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3246
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3247 3247
    // print_r($cf);echo '###';
3248 3248
 
3249 3249
 
3250 3250
 
3251
-    $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3251
+	$radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500);
3252 3252
 
3253 3253
 
3254
-    $value = '';
3255
-    if ($extra_fields && isset($extra_fields['is_price'])) {
3256
-    $value = esc_attr($extra_fields['is_price']);
3257
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3258
-    $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3259
-    }
3254
+	$value = '';
3255
+	if ($extra_fields && isset($extra_fields['is_price'])) {
3256
+	$value = esc_attr($extra_fields['is_price']);
3257
+	}elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3258
+	$value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3259
+	}
3260 3260
 
3261
-    $show_price_extra = ($value==1) ? 1 : 0;
3262
-    ?>
3261
+	$show_price_extra = ($value==1) ? 1 : 0;
3262
+	?>
3263 3263
     <li class="gdcf-price-extra-set">
3264 3264
         <label for="is_price" class="gd-cf-tooltip-wrap">
3265 3265
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
@@ -3271,14 +3271,14 @@  discard block
 block discarded – undo
3271 3271
 
3272 3272
             <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3273 3273
                 <?php if ($value == '1') {
3274
-                    echo 'checked';
3275
-                } ?>/>
3274
+					echo 'checked';
3275
+				} ?>/>
3276 3276
             <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3277 3277
 
3278 3278
             <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0"
3279 3279
                 <?php if ($value == '0' || !$value) {
3280
-                    echo 'checked';
3281
-                } ?>/>
3280
+					echo 'checked';
3281
+				} ?>/>
3282 3282
             <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3283 3283
 
3284 3284
         </div>
@@ -3286,13 +3286,13 @@  discard block
 block discarded – undo
3286 3286
 
3287 3287
     <?php
3288 3288
 
3289
-    $value = '';
3290
-    if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3291
-        $value = esc_attr($extra_fields['thousand_separator']);
3292
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3293
-        $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3294
-    }
3295
-    ?>
3289
+	$value = '';
3290
+	if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3291
+		$value = esc_attr($extra_fields['thousand_separator']);
3292
+	}elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3293
+		$value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3294
+	}
3295
+	?>
3296 3296
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3297 3297
         <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
3298 3298
             <div class="gdcf-tooltip">
@@ -3313,13 +3313,13 @@  discard block
 block discarded – undo
3313 3313
 
3314 3314
     <?php
3315 3315
 
3316
-    $value = '';
3317
-    if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3318
-        $value = esc_attr($extra_fields['decimal_separator']);
3319
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3320
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3321
-    }
3322
-    ?>
3316
+	$value = '';
3317
+	if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3318
+		$value = esc_attr($extra_fields['decimal_separator']);
3319
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3320
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3321
+	}
3322
+	?>
3323 3323
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3324 3324
         <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
3325 3325
             <div class="gdcf-tooltip">
@@ -3336,13 +3336,13 @@  discard block
 block discarded – undo
3336 3336
 
3337 3337
     <?php
3338 3338
 
3339
-    $value = '';
3340
-    if ($extra_fields && isset($extra_fields['decimal_display'])) {
3341
-        $value = esc_attr($extra_fields['decimal_display']);
3342
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3343
-        $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3344
-    }
3345
-    ?>
3339
+	$value = '';
3340
+	if ($extra_fields && isset($extra_fields['decimal_display'])) {
3341
+		$value = esc_attr($extra_fields['decimal_display']);
3342
+	}elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3343
+		$value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3344
+	}
3345
+	?>
3346 3346
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3347 3347
         <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
3348 3348
             <div class="gdcf-tooltip">
@@ -3359,13 +3359,13 @@  discard block
 block discarded – undo
3359 3359
 
3360 3360
     <?php
3361 3361
 
3362
-    $value = '';
3363
-    if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3364
-        $value = esc_attr($extra_fields['currency_symbol']);
3365
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3366
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3367
-    }
3368
-    ?>
3362
+	$value = '';
3363
+	if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3364
+		$value = esc_attr($extra_fields['currency_symbol']);
3365
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3366
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3367
+	}
3368
+	?>
3369 3369
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3370 3370
         <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
3371 3371
             <div class="gdcf-tooltip">
@@ -3380,13 +3380,13 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
     <?php
3382 3382
 
3383
-    $value = '';
3384
-    if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3385
-        $value = esc_attr($extra_fields['currency_symbol_placement']);
3386
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3387
-        $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3388
-    }
3389
-    ?>
3383
+	$value = '';
3384
+	if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3385
+		$value = esc_attr($extra_fields['currency_symbol_placement']);
3386
+	}elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3387
+		$value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3388
+	}
3389
+	?>
3390 3390
     <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3391 3391
         <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
3392 3392
             <div class="gdcf-tooltip">
@@ -3404,225 +3404,225 @@  discard block
 block discarded – undo
3404 3404
 
3405 3405
     <?php
3406 3406
 
3407
-    $html = ob_get_clean();
3408
-    return $output.$html;
3407
+	$html = ob_get_clean();
3408
+	return $output.$html;
3409 3409
 }
3410 3410
 add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
3411 3411
 
3412 3412
 function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3413
-    $fields = array();
3414
-    $package = ($package_id=='') ? '' : array($package_id);
3415
-
3416
-    $fields[] = array('listing_type' => $post_type,
3417
-                      'data_type' => 'VARCHAR',
3418
-                      'field_type' => 'taxonomy',
3419
-                      'admin_title' => __('Category', 'geodirectory'),
3420
-                      'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3421
-                      'site_title' => __('Category', 'geodirectory'),
3422
-                      'htmlvar_name' => $post_type.'category',
3423
-                      'default_value' => '',
3424
-                      'is_default' => '1',
3425
-                      'is_admin' => '1',
3426
-                      'is_required' => '1',
3427
-                      'show_in'   =>  '[detail]',
3428
-                      'show_on_pkg' => $package,
3429
-                      'clabels' => __('Category', 'geodirectory'));
3430
-
3431
-    $fields[] = array('listing_type' => $post_type,
3432
-                      'data_type' => 'VARCHAR',
3433
-                      'field_type' => 'address',
3434
-                      'admin_title' => __('Address', 'geodirectory'),
3435
-                      'admin_desc' => ADDRESS_MSG,
3436
-                      'site_title' => __('Address', 'geodirectory'),
3437
-                      'htmlvar_name' => 'post',
3438
-                      'default_value' => '',
3439
-                      'option_values' => '',
3440
-                      'is_default' => '1',
3441
-                      'is_admin' => '1',
3442
-                      'is_required' => '1',
3443
-                      'show_in'   =>  '[detail],[mapbubble]',
3444
-                      'show_on_pkg' => $package,
3445
-                      'required_msg' => __('Address fields are required', 'geodirectory'),
3446
-                      'clabels' => __('Address', 'geodirectory'),
3447
-                      'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3448
-                                       'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3449
-                                       'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3450
-                                       'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3451
-                                       'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3452
-                                       'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3453
-                                       'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3454
-                                       'show_latlng' => 1));
3455
-
3456
-    $fields[] = array('listing_type' => $post_type,
3457
-                      'data_type' => 'VARCHAR',
3458
-                      'field_type' => 'text',
3459
-                      'admin_title' => __('Time', 'geodirectory'),
3460
-                      'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3461
-                      'site_title' => __('Time', 'geodirectory'),
3462
-                      'htmlvar_name' => 'timing',
3463
-                      'default_value' => '',
3464
-                      'option_values' => '',
3465
-                      'is_default' => '1',
3466
-                      'is_admin' => '1',
3467
-                      'show_in' =>  '[detail],[mapbubble]',
3468
-                      'show_on_pkg' => $package,
3469
-                      'clabels' => __('Time', 'geodirectory'));
3470
-
3471
-    $fields[] = array('listing_type' => $post_type,
3472
-                      'data_type' => 'VARCHAR',
3473
-                      'field_type' => 'phone',
3474
-                      'admin_title' => __('Phone', 'geodirectory'),
3475
-                      'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3476
-                      'site_title' => __('Phone', 'geodirectory'),
3477
-                      'htmlvar_name' => 'contact',
3478
-                      'default_value' => '',
3479
-                      'option_values' => '',
3480
-                      'is_default' => '1',
3481
-                      'is_admin' => '1',
3482
-                      'show_in' =>  '[detail],[mapbubble]',
3483
-                      'show_on_pkg' => $package,
3484
-                      'clabels' => __('Phone', 'geodirectory'));
3485
-
3486
-    $fields[] = array('listing_type' => $post_type,
3487
-                      'data_type' => 'VARCHAR',
3488
-                      'field_type' => 'email',
3489
-                      'admin_title' => __('Email', 'geodirectory'),
3490
-                      'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3491
-                      'site_title' => __('Email', 'geodirectory'),
3492
-                      'htmlvar_name' => 'email',
3493
-                      'default_value' => '',
3494
-                      'option_values' => '',
3495
-                      'is_default' => '1',
3496
-                      'is_admin' => '1',
3497
-                      'show_in' => '[detail]',
3498
-                      'show_on_pkg' => $package,
3499
-                      'clabels' => __('Email', 'geodirectory'));
3500
-
3501
-    $fields[] = array('listing_type' => $post_type,
3502
-                      'data_type' => 'VARCHAR',
3503
-                      'field_type' => 'url',
3504
-                      'admin_title' => __('Website', 'geodirectory'),
3505
-                      'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3506
-                      'site_title' => __('Website', 'geodirectory'),
3507
-                      'htmlvar_name' => 'website',
3508
-                      'default_value' => '',
3509
-                      'option_values' => '',
3510
-                      'is_default' => '1',
3511
-                      'is_admin' => '1',
3512
-                      'show_in' => '[detail]',
3513
-                      'show_on_pkg' => $package,
3514
-                      'clabels' => __('Website', 'geodirectory'));
3515
-
3516
-    $fields[] = array('listing_type' => $post_type,
3517
-                      'data_type' => 'VARCHAR',
3518
-                      'field_type' => 'url',
3519
-                      'admin_title' => __('Twitter', 'geodirectory'),
3520
-                      'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3521
-                      'site_title' => __('Twitter', 'geodirectory'),
3522
-                      'htmlvar_name' => 'twitter',
3523
-                      'default_value' => '',
3524
-                      'option_values' => '',
3525
-                      'is_default' => '1',
3526
-                      'is_admin' => '1',
3527
-                      'show_in' => '[detail]',
3528
-                      'show_on_pkg' => $package,
3529
-                      'clabels' => __('Twitter', 'geodirectory'));
3530
-
3531
-    $fields[] = array('listing_type' => $post_type,
3532
-                      'data_type' => 'VARCHAR',
3533
-                      'field_type' => 'url',
3534
-                      'admin_title' => __('Facebook', 'geodirectory'),
3535
-                      'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3536
-                      'site_title' => __('Facebook', 'geodirectory'),
3537
-                      'htmlvar_name' => 'facebook',
3538
-                      'default_value' => '',
3539
-                      'option_values' => '',
3540
-                      'is_default' => '1',
3541
-                      'is_admin' => '1',
3542
-                      'show_in' => '[detail]',
3543
-                      'show_on_pkg' => $package,
3544
-                      'clabels' => __('Facebook', 'geodirectory'));
3545
-
3546
-    $fields[] = array('listing_type' => $post_type,
3547
-                      'data_type' => 'TEXT',
3548
-                      'field_type' => 'textarea',
3549
-                      'admin_title' => __('Video', 'geodirectory'),
3550
-                      'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3551
-                      'site_title' => __('Video', 'geodirectory'),
3552
-                      'htmlvar_name' => 'video',
3553
-                      'default_value' => '',
3554
-                      'option_values' => '',
3555
-                      'is_default' => '0',
3556
-                      'is_admin' => '1',
3557
-                      'show_in' => '[owntab]',
3558
-                      'show_on_pkg' => $package,
3559
-                      'clabels' => __('Video', 'geodirectory'));
3560
-
3561
-    $fields[] = array('listing_type' => $post_type,
3562
-                      'data_type' => 'TEXT',
3563
-                      'field_type' => 'textarea',
3564
-                      'admin_title' => __('Special Offers', 'geodirectory'),
3565
-                      'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3566
-                      'site_title' => __('Special Offers', 'geodirectory'),
3567
-                      'htmlvar_name' => 'special_offers',
3568
-                      'default_value' => '',
3569
-                      'option_values' => '',
3570
-                      'is_default' => '0',
3571
-                      'is_admin' => '1',
3572
-                      'show_in' => '[owntab]',
3573
-                      'show_on_pkg' => $package,
3574
-                      'clabels' => __('Special Offers', 'geodirectory'));
3575
-
3576
-    /**
3577
-     * Filter the array of default custom fields DB table data.
3578
-     *
3579
-     * @since 1.6.6
3580
-     * @param string $fields The default custom fields as an array.
3581
-     */
3582
-    $fields = apply_filters('geodir_default_custom_fields', $fields);
3583
-
3584
-    return  $fields;
3413
+	$fields = array();
3414
+	$package = ($package_id=='') ? '' : array($package_id);
3415
+
3416
+	$fields[] = array('listing_type' => $post_type,
3417
+					  'data_type' => 'VARCHAR',
3418
+					  'field_type' => 'taxonomy',
3419
+					  'admin_title' => __('Category', 'geodirectory'),
3420
+					  'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
3421
+					  'site_title' => __('Category', 'geodirectory'),
3422
+					  'htmlvar_name' => $post_type.'category',
3423
+					  'default_value' => '',
3424
+					  'is_default' => '1',
3425
+					  'is_admin' => '1',
3426
+					  'is_required' => '1',
3427
+					  'show_in'   =>  '[detail]',
3428
+					  'show_on_pkg' => $package,
3429
+					  'clabels' => __('Category', 'geodirectory'));
3430
+
3431
+	$fields[] = array('listing_type' => $post_type,
3432
+					  'data_type' => 'VARCHAR',
3433
+					  'field_type' => 'address',
3434
+					  'admin_title' => __('Address', 'geodirectory'),
3435
+					  'admin_desc' => ADDRESS_MSG,
3436
+					  'site_title' => __('Address', 'geodirectory'),
3437
+					  'htmlvar_name' => 'post',
3438
+					  'default_value' => '',
3439
+					  'option_values' => '',
3440
+					  'is_default' => '1',
3441
+					  'is_admin' => '1',
3442
+					  'is_required' => '1',
3443
+					  'show_in'   =>  '[detail],[mapbubble]',
3444
+					  'show_on_pkg' => $package,
3445
+					  'required_msg' => __('Address fields are required', 'geodirectory'),
3446
+					  'clabels' => __('Address', 'geodirectory'),
3447
+					  'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
3448
+									   'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
3449
+									   'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
3450
+									   'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
3451
+									   'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
3452
+									   'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
3453
+									   'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden',
3454
+									   'show_latlng' => 1));
3455
+
3456
+	$fields[] = array('listing_type' => $post_type,
3457
+					  'data_type' => 'VARCHAR',
3458
+					  'field_type' => 'text',
3459
+					  'admin_title' => __('Time', 'geodirectory'),
3460
+					  'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
3461
+					  'site_title' => __('Time', 'geodirectory'),
3462
+					  'htmlvar_name' => 'timing',
3463
+					  'default_value' => '',
3464
+					  'option_values' => '',
3465
+					  'is_default' => '1',
3466
+					  'is_admin' => '1',
3467
+					  'show_in' =>  '[detail],[mapbubble]',
3468
+					  'show_on_pkg' => $package,
3469
+					  'clabels' => __('Time', 'geodirectory'));
3470
+
3471
+	$fields[] = array('listing_type' => $post_type,
3472
+					  'data_type' => 'VARCHAR',
3473
+					  'field_type' => 'phone',
3474
+					  'admin_title' => __('Phone', 'geodirectory'),
3475
+					  'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
3476
+					  'site_title' => __('Phone', 'geodirectory'),
3477
+					  'htmlvar_name' => 'contact',
3478
+					  'default_value' => '',
3479
+					  'option_values' => '',
3480
+					  'is_default' => '1',
3481
+					  'is_admin' => '1',
3482
+					  'show_in' =>  '[detail],[mapbubble]',
3483
+					  'show_on_pkg' => $package,
3484
+					  'clabels' => __('Phone', 'geodirectory'));
3485
+
3486
+	$fields[] = array('listing_type' => $post_type,
3487
+					  'data_type' => 'VARCHAR',
3488
+					  'field_type' => 'email',
3489
+					  'admin_title' => __('Email', 'geodirectory'),
3490
+					  'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
3491
+					  'site_title' => __('Email', 'geodirectory'),
3492
+					  'htmlvar_name' => 'email',
3493
+					  'default_value' => '',
3494
+					  'option_values' => '',
3495
+					  'is_default' => '1',
3496
+					  'is_admin' => '1',
3497
+					  'show_in' => '[detail]',
3498
+					  'show_on_pkg' => $package,
3499
+					  'clabels' => __('Email', 'geodirectory'));
3500
+
3501
+	$fields[] = array('listing_type' => $post_type,
3502
+					  'data_type' => 'VARCHAR',
3503
+					  'field_type' => 'url',
3504
+					  'admin_title' => __('Website', 'geodirectory'),
3505
+					  'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
3506
+					  'site_title' => __('Website', 'geodirectory'),
3507
+					  'htmlvar_name' => 'website',
3508
+					  'default_value' => '',
3509
+					  'option_values' => '',
3510
+					  'is_default' => '1',
3511
+					  'is_admin' => '1',
3512
+					  'show_in' => '[detail]',
3513
+					  'show_on_pkg' => $package,
3514
+					  'clabels' => __('Website', 'geodirectory'));
3515
+
3516
+	$fields[] = array('listing_type' => $post_type,
3517
+					  'data_type' => 'VARCHAR',
3518
+					  'field_type' => 'url',
3519
+					  'admin_title' => __('Twitter', 'geodirectory'),
3520
+					  'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
3521
+					  'site_title' => __('Twitter', 'geodirectory'),
3522
+					  'htmlvar_name' => 'twitter',
3523
+					  'default_value' => '',
3524
+					  'option_values' => '',
3525
+					  'is_default' => '1',
3526
+					  'is_admin' => '1',
3527
+					  'show_in' => '[detail]',
3528
+					  'show_on_pkg' => $package,
3529
+					  'clabels' => __('Twitter', 'geodirectory'));
3530
+
3531
+	$fields[] = array('listing_type' => $post_type,
3532
+					  'data_type' => 'VARCHAR',
3533
+					  'field_type' => 'url',
3534
+					  'admin_title' => __('Facebook', 'geodirectory'),
3535
+					  'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
3536
+					  'site_title' => __('Facebook', 'geodirectory'),
3537
+					  'htmlvar_name' => 'facebook',
3538
+					  'default_value' => '',
3539
+					  'option_values' => '',
3540
+					  'is_default' => '1',
3541
+					  'is_admin' => '1',
3542
+					  'show_in' => '[detail]',
3543
+					  'show_on_pkg' => $package,
3544
+					  'clabels' => __('Facebook', 'geodirectory'));
3545
+
3546
+	$fields[] = array('listing_type' => $post_type,
3547
+					  'data_type' => 'TEXT',
3548
+					  'field_type' => 'textarea',
3549
+					  'admin_title' => __('Video', 'geodirectory'),
3550
+					  'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
3551
+					  'site_title' => __('Video', 'geodirectory'),
3552
+					  'htmlvar_name' => 'video',
3553
+					  'default_value' => '',
3554
+					  'option_values' => '',
3555
+					  'is_default' => '0',
3556
+					  'is_admin' => '1',
3557
+					  'show_in' => '[owntab]',
3558
+					  'show_on_pkg' => $package,
3559
+					  'clabels' => __('Video', 'geodirectory'));
3560
+
3561
+	$fields[] = array('listing_type' => $post_type,
3562
+					  'data_type' => 'TEXT',
3563
+					  'field_type' => 'textarea',
3564
+					  'admin_title' => __('Special Offers', 'geodirectory'),
3565
+					  'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
3566
+					  'site_title' => __('Special Offers', 'geodirectory'),
3567
+					  'htmlvar_name' => 'special_offers',
3568
+					  'default_value' => '',
3569
+					  'option_values' => '',
3570
+					  'is_default' => '0',
3571
+					  'is_admin' => '1',
3572
+					  'show_in' => '[owntab]',
3573
+					  'show_on_pkg' => $package,
3574
+					  'clabels' => __('Special Offers', 'geodirectory'));
3575
+
3576
+	/**
3577
+	 * Filter the array of default custom fields DB table data.
3578
+	 *
3579
+	 * @since 1.6.6
3580
+	 * @param string $fields The default custom fields as an array.
3581
+	 */
3582
+	$fields = apply_filters('geodir_default_custom_fields', $fields);
3583
+
3584
+	return  $fields;
3585 3585
 }
3586 3586
 
3587 3587
 function geodir_currency_format_number($number='',$cf=''){
3588 3588
 
3589
-    $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3589
+	$cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3590 3590
 
3591
-    $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3592
-    $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3593
-    $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3594
-    $decimalpoint = '.';
3591
+	$symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$';
3592
+	$decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2;
3593
+	$decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3594
+	$decimalpoint = '.';
3595 3595
 
3596
-    if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3597
-        $decimalpoint = ',';
3598
-    }
3596
+	if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3597
+		$decimalpoint = ',';
3598
+	}
3599 3599
 
3600
-    $separator = ',';
3600
+	$separator = ',';
3601 3601
 
3602
-    if(isset($cs['thousand_separator'])){
3603
-        if($cs['thousand_separator']=='comma'){$separator = ',';}
3604
-        if($cs['thousand_separator']=='slash'){$separator = '\\';}
3605
-        if($cs['thousand_separator']=='period'){$separator = '.';}
3606
-        if($cs['thousand_separator']=='space'){$separator = ' ';}
3607
-        if($cs['thousand_separator']=='none'){$separator = '';}
3608
-    }
3602
+	if(isset($cs['thousand_separator'])){
3603
+		if($cs['thousand_separator']=='comma'){$separator = ',';}
3604
+		if($cs['thousand_separator']=='slash'){$separator = '\\';}
3605
+		if($cs['thousand_separator']=='period'){$separator = '.';}
3606
+		if($cs['thousand_separator']=='space'){$separator = ' ';}
3607
+		if($cs['thousand_separator']=='none'){$separator = '';}
3608
+	}
3609 3609
 
3610
-    $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3610
+	$currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3611 3611
 
3612
-    if($decimals>0 && $decimal_display=='if'){
3613
-        if(is_int($number) || floor( $number ) == $number)
3614
-            $decimals = 0;
3615
-    }
3612
+	if($decimals>0 && $decimal_display=='if'){
3613
+		if(is_int($number) || floor( $number ) == $number)
3614
+			$decimals = 0;
3615
+	}
3616 3616
 
3617
-    $number = number_format($number,$decimals,$decimalpoint,$separator);
3617
+	$number = number_format($number,$decimals,$decimalpoint,$separator);
3618 3618
 
3619 3619
 
3620 3620
 
3621
-    if($currency_symbol_placement=='left'){
3622
-        $number = $symbol . $number;
3623
-    }else{
3624
-        $number = $number . $symbol;
3625
-    }
3621
+	if($currency_symbol_placement=='left'){
3622
+		$number = $symbol . $number;
3623
+	}else{
3624
+		$number = $number . $symbol;
3625
+	}
3626 3626
 
3627 3627
 
3628 3628
    return $number;
Please login to merge, or discard this patch.
Spacing   +408 added lines, -408 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52
-        $result = 0;// no rows affected
52
+        $result = 0; // no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54 54
             if (!empty($db) && !empty($column))
55 55
                 $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 {
75 75
     global $wpdb, $geodir_post_custom_fields_cache;
76 76
 
77
-    $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;
77
+    $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location;
78 78
 
79 79
     if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
80 80
         return $geodir_post_custom_fields_cache[$cache_stored];
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
         $default_query .= " and is_admin = '0' ";
89 89
 
90 90
     if ($fields_location == 'none') {
91
-    } else{
92
-        $fields_location = esc_sql( $fields_location );
91
+    } else {
92
+        $fields_location = esc_sql($fields_location);
93 93
         $default_query .= " and show_in LIKE '%%[$fields_location]%%' ";
94 94
     }
95 95
 
96 96
     $post_meta_info = $wpdb->get_results(
97 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",
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 99
             array($post_type)
100 100
         )
101 101
     );
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
      * @param string $field_ins_upd When set to "submit" displays form.
163 163
      * @param string $field_type_key The key of the custom field.
164 164
      */
165
-    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='')
165
+    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
166 166
     {
167 167
         global $wpdb;
168 168
         $cf = $result_str;
169 169
         if (!is_object($cf)) {
170 170
 
171
-            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
171
+            $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
172 172
 
173 173
         } else {
174 174
             $field_info = $cf;
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
         if ($field_id != '') {
203 203
             $cf = trim($field_id, '_');
204 204
 
205
-            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
206
-                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
205
+            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
206
+                $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
207 207
 
208 208
                 $post_type = $field->post_type;
209 209
                 $htmlvar_name = $field->htmlvar_name;
210 210
 
211 211
                 if ($post_type != '' && $htmlvar_name != '') {
212
-                    $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)));
212
+                    $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)));
213 213
                 }
214 214
 
215 215
                 /**
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
                 do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
224 224
 
225 225
                 if ($field->field_type == 'address') {
226
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
227
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
228
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
229
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
230
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
231
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
232
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
233
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
234
-                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
226
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
227
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
228
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
229
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
230
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
231
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
232
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
233
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
234
+                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
235 235
                 } else {
236 236
                     if ($field->field_type != 'fieldset') {
237
-                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
237
+                        $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
238 238
                     }
239 239
                 }
240 240
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
305 305
 
306 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'){
307
+        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
308 308
             $request_field['data_type'] = 'VARCHAR';
309 309
         }
310 310
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
         $post_type = $request_field['listing_type'];
318 318
 
319 319
         if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
320
-            $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;
320
+            $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;
321 321
         }
322 322
 
323 323
         $check_html_variable = $wpdb->get_var(
324 324
             $wpdb->prepare(
325
-                "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",
325
+                "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",
326 326
                 array($cf, $cehhtmlvar_name, $post_type)
327 327
             )
328 328
         );
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
                 $post_meta_info = $wpdb->get_row(
336 336
                     $wpdb->prepare(
337
-                        "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",
337
+                        "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",
338 338
                         array($cf)
339 339
                     )
340 340
                 );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 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 357
             $admin_title = $request_field['admin_title'];
358 358
             $site_title = $request_field['site_title'];
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
             $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';
381 381
 
382 382
             
383
-            if(is_array($show_in)){
383
+            if (is_array($show_in)) {
384 384
                 $show_in = implode(",", $request_field['show_in']);
385 385
             }
386 386
             
387 387
             if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
388
-                $htmlvar_name = 'geodir_' . $htmlvar_name;
388
+                $htmlvar_name = 'geodir_'.$htmlvar_name;
389 389
             }
390 390
 
391 391
             $option_values = '';
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 
427 427
             if ($sort_order == '') {
428 428
 
429
-                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429
+                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
430 430
 
431
-                $sort_order = (int)$last_order + 1;
431
+                $sort_order = (int) $last_order + 1;
432 432
             }
433 433
 
434 434
             $default_value_add = '';
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
                     case 'address':
441 441
 
442 442
                         if ($htmlvar_name != '') {
443
-                            $prefix = $htmlvar_name . '_';
443
+                            $prefix = $htmlvar_name.'_';
444 444
                         }
445
-                        $old_prefix = $old_html_variable . '_';
445
+                        $old_prefix = $old_html_variable.'_';
446 446
 
447 447
 
448
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";
448
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL";
449 449
 
450 450
                         if ($default_value != '') {
451
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
451
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
452 452
                         }
453 453
 
454 454
                         $wpdb->query($meta_field_add);
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 
458 458
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
459 459
 
460
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
460
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
461 461
                                 if ($is_column) {
462
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";
462
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL";
463 463
 
464 464
                                     if ($default_value != '') {
465
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
465
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
466 466
                                     }
467 467
 
468 468
                                     $wpdb->query($meta_field_add);
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 
471 471
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
472 472
                                     if ($default_value != '') {
473
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
473
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
474 474
                                     }
475
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
475
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
476 476
 
477 477
                                 }
478 478
 
@@ -482,36 +482,36 @@  discard block
 block discarded – undo
482 482
 
483 483
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
484 484
 
485
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
485
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
486 486
 
487 487
                                 if ($is_column) {
488
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";
488
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL";
489 489
 
490 490
                                     if ($default_value != '') {
491
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
491
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
492 492
                                     }
493 493
 
494 494
                                     $wpdb->query($meta_field_add);
495 495
                                 } else {
496 496
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
497 497
                                     if ($default_value != '') {
498
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
498
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
499 499
                                     }
500 500
 
501
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
501
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
502 502
                                 }
503 503
 
504 504
                             }
505 505
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
506 506
 
507
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
507
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
508 508
 
509 509
                                 if ($is_column) {
510 510
 
511
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";
511
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL";
512 512
 
513 513
                                     if ($default_value != '') {
514
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
514
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
515 515
                                     }
516 516
 
517 517
                                     $wpdb->query($meta_field_add);
@@ -519,24 +519,24 @@  discard block
 block discarded – undo
519 519
 
520 520
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
521 521
                                     if ($default_value != '') {
522
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
522
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
523 523
                                     }
524 524
 
525
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
525
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
526 526
 
527 527
                                 }
528 528
 
529 529
                             }
530 530
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
531 531
 
532
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
532
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
533 533
 
534 534
                                 if ($is_column) {
535 535
 
536
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";
536
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL";
537 537
 
538 538
                                     if ($default_value != '') {
539
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
539
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
540 540
                                     }
541 541
 
542 542
                                     $wpdb->query($meta_field_add);
@@ -544,128 +544,128 @@  discard block
 block discarded – undo
544 544
 
545 545
                                     $meta_field_add = "VARCHAR( 50 ) NULL";
546 546
                                     if ($default_value != '') {
547
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
547
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
548 548
                                     }
549 549
 
550
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
550
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
551 551
 
552 552
                                 }
553 553
 
554 554
                             }
555 555
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
556 556
 
557
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
557
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
558 558
                                 if ($is_column) {
559 559
 
560
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
560
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL";
561 561
 
562 562
                                     if ($default_value != '') {
563
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
563
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
564 564
                                     }
565 565
 
566 566
                                     $wpdb->query($meta_field_add);
567 567
                                 } else {
568 568
 
569
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
569
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
570 570
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
571 571
                                     if ($default_value != '') {
572
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
572
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
573 573
                                     }
574 574
 
575
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
575
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
576 576
 
577 577
                                 }
578 578
 
579 579
 
580
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
580
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
581 581
 
582 582
                                 if ($is_column) {
583
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
583
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL";
584 584
 
585 585
                                     if ($default_value != '') {
586
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
586
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
587 587
                                     }
588 588
 
589 589
                                     $wpdb->query($meta_field_add);
590 590
                                 } else {
591 591
 
592
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
592
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
593 593
                                     $meta_field_add = "VARCHAR( 20 ) NULL";
594 594
                                     if ($default_value != '') {
595
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
595
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
596 596
                                     }
597 597
 
598
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
598
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
599 599
                                 }
600 600
 
601 601
                             }
602 602
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
603 603
 
604
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
604
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
605 605
 
606 606
                                 if ($is_column) {
607
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
607
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL";
608 608
 
609 609
                                     if ($default_value != '') {
610
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
610
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
611 611
                                     }
612 612
 
613 613
                                     $wpdb->query($meta_field_add);
614 614
                                 } else {
615 615
 
616
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
616
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
617 617
 
618 618
                                     $meta_field_add = "VARCHAR( 15 ) NULL";
619 619
                                     if ($default_value != '') {
620
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
620
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
621 621
                                     }
622 622
 
623
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
623
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
624 624
                                 }
625 625
 
626 626
 
627 627
                             }
628 628
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
629 629
 
630
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
630
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
631 631
                                 if ($is_column) {
632
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
632
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
633 633
 
634 634
                                     if ($default_value != '') {
635
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
635
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
636 636
                                     }
637 637
 
638 638
                                     $wpdb->query($meta_field_add);
639 639
 
640 640
                                 } else {
641 641
 
642
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
642
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
643 643
 
644 644
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
645 645
                                     if ($default_value != '') {
646
-                                        $meta_field_add .= " DEFAULT '" . $default_value . "'";
646
+                                        $meta_field_add .= " DEFAULT '".$default_value."'";
647 647
                                     }
648 648
 
649
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
649
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
650 650
                                 }
651 651
 
652 652
                             }
653 653
                             // show lat lng
654 654
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
655
-                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
655
+                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
656 656
 
657 657
                                 if ($is_column) {
658
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
658
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL";
659 659
                                     $meta_field_add .= " DEFAULT '1'";
660 660
 
661 661
                                     $wpdb->query($meta_field_add);
662 662
                                 } else {
663
-                                    $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
663
+                                    $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
664 664
 
665 665
                                     $meta_field_add = "VARCHAR( 3 ) NULL";
666 666
                                     $meta_field_add .= " DEFAULT '1'";
667 667
 
668
-                                    geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
668
+                                    geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
669 669
                                 }
670 670
 
671 671
                             }
@@ -681,30 +681,30 @@  discard block
 block discarded – undo
681 681
                         $op_size = '500';
682 682
 
683 683
                         // only make the field as big as it needs to be.
684
-                        if(isset($option_values) && $option_values && $field_type=='select'){
685
-                            $option_values_arr = explode(',',$option_values);
686
-                            if(is_array($option_values_arr)){
684
+                        if (isset($option_values) && $option_values && $field_type == 'select') {
685
+                            $option_values_arr = explode(',', $option_values);
686
+                            if (is_array($option_values_arr)) {
687 687
                                 $op_max = 0;
688
-                                foreach($option_values_arr as $op_val){
689
-                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
688
+                                foreach ($option_values_arr as $op_val) {
689
+                                    if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
690 690
                                 }
691
-                                if($op_max){$op_size =$op_max; }
691
+                                if ($op_max) {$op_size = $op_max; }
692 692
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694
-                            if(strlen($option_values)){
695
-                                $op_size =  strlen($option_values);
693
+                        }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
694
+                            if (strlen($option_values)) {
695
+                                $op_size = strlen($option_values);
696 696
                             }
697 697
                         }
698 698
 
699
-                        $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";
699
+                        $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL";
700 700
 
701 701
                         if ($default_value != '') {
702
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
702
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
703 703
                         }
704 704
 
705 705
                         $alter_result = $wpdb->query($meta_field_add);
706
-                        if($alter_result===false){
707
-                            return __('Column change failed, you may have too many columns.','geodirectory');
706
+                        if ($alter_result === false) {
707
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
708 708
                         }
709 709
 
710 710
                         if (isset($request_field['cat_display_type']))
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
                     case 'url':
722 722
                     case 'file':
723 723
 
724
-                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
725
-                        if($alter_result===false){
726
-                            return __('Column change failed, you may have too many columns.','geodirectory');
724
+                        $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
725
+                        if ($alter_result === false) {
726
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
727 727
                         }
728 728
                         if (isset($request_field['advanced_editor']))
729 729
                             $extra_fields = $request_field['advanced_editor'];
@@ -737,24 +737,24 @@  discard block
 block discarded – undo
737 737
                     default:
738 738
                         if ($data_type != 'VARCHAR' && $data_type != '') {
739 739
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
740
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
740
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL";
741 741
                             } else {
742
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
742
+                                $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL";
743 743
                             }
744 744
 
745 745
                             if (is_numeric($default_value) && $default_value != '') {
746
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
746
+                                $default_value_add .= " DEFAULT '".$default_value."'";
747 747
                             }
748 748
                         } else {
749
-                            $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";
749
+                            $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL";
750 750
                             if ($default_value != '') {
751
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
751
+                                $default_value_add .= " DEFAULT '".$default_value."'";
752 752
                             }
753 753
                         }
754 754
 
755 755
                         $alter_result = $wpdb->query($default_value_add);
756
-                        if($alter_result===false){
757
-                            return __('Column change failed, you may have too many columns.','geodirectory');
756
+                        if ($alter_result === false) {
757
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
758 758
                         }
759 759
                         break;
760 760
                 endswitch;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 
771 771
                     $wpdb->prepare(
772 772
 
773
-                        "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
773
+                        "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
774 774
 					post_type = %s,
775 775
 					admin_title = %s,
776 776
 					site_title = %s,
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 					for_admin_use = %s
805 805
 					where id = %d",
806 806
 
807
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
807
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
808 808
                     )
809 809
 
810 810
                 );
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
                 $wpdb->query(
816 816
                     $wpdb->prepare(
817
-                        "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
817
+                        "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
818 818
 					 	site_title=%s
819 819
 					where post_type = %s and htmlvar_name = %s",
820 820
                         array($site_title, $post_type, $htmlvar_name)
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 
825 825
                 if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
826
+                    $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
827 827
 
828 828
 
829 829
                 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
                         $data_type = '';
844 844
 
845 845
                         if ($htmlvar_name != '') {
846
-                            $prefix = $htmlvar_name . '_';
846
+                            $prefix = $htmlvar_name.'_';
847 847
                         }
848 848
                         $old_prefix = $old_html_variable;
849 849
 
@@ -851,109 +851,109 @@  discard block
 block discarded – undo
851 851
 
852 852
                         $meta_field_add = "VARCHAR( 254 ) NULL";
853 853
                         if ($default_value != '') {
854
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
854
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
855 855
                         }
856 856
 
857
-                        geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);
857
+                        geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);
858 858
                         //$wpdb->query($meta_field_add);
859 859
 
860 860
 
861 861
                         if (!empty($extra_fields)) {
862 862
 
863 863
                             if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
864
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";
864
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";
865 865
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
866 866
                                 if ($default_value != '') {
867
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
867
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
868 868
                                 }
869 869
 
870
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);
870
+                                geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);
871 871
                                 //$wpdb->query($meta_field_add);
872 872
                             }
873 873
                             if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
874
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";
874
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";
875 875
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
876 876
                                 if ($default_value != '') {
877
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
877
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
878 878
                                 }
879 879
 
880
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);
880
+                                geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);
881 881
                                 //$wpdb->query($meta_field_add);
882 882
                             }
883 883
                             if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
884
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";
884
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";
885 885
 
886 886
                                 $meta_field_add = "VARCHAR( 30 ) NULL";
887 887
                                 if ($default_value != '') {
888
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
888
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
889 889
                                 }
890 890
 
891
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);
891
+                                geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);
892 892
                                 //$wpdb->query($meta_field_add);
893 893
                             }
894 894
                             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
895
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";
895
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";
896 896
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
897 897
                                 if ($default_value != '') {
898
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
898
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
899 899
                                 }
900 900
 
901
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);
901
+                                geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);
902 902
                                 //$wpdb->query($meta_field_add);
903 903
                             }
904 904
                             if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
905
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";
905
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";
906 906
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
907 907
                                 if ($default_value != '') {
908
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
908
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
909 909
                                 }
910 910
 
911
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);
911
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);
912 912
                                 //$wpdb->query($meta_field_add);
913 913
 
914
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";
914
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";
915 915
 
916 916
                                 $meta_field_add = "VARCHAR( 20 ) NULL";
917 917
                                 if ($default_value != '') {
918
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
918
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
919 919
                                 }
920 920
 
921
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);
921
+                                geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);
922 922
 
923 923
                                 //$wpdb->query($meta_field_add);
924 924
                             }
925 925
                             if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
926
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";
926
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";
927 927
 
928 928
                                 $meta_field_add = "VARCHAR( 15 ) NULL";
929 929
                                 if ($default_value != '') {
930
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
930
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
931 931
                                 }
932 932
 
933
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);
933
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);
934 934
 
935 935
                                 //$wpdb->query($meta_field_add);
936 936
                             }
937 937
                             if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
938
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";
938
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";
939 939
 
940 940
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
941 941
                                 if ($default_value != '') {
942
-                                    $meta_field_add .= " DEFAULT '" . $default_value . "'";
942
+                                    $meta_field_add .= " DEFAULT '".$default_value."'";
943 943
                                 }
944 944
 
945
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);
945
+                                geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);
946 946
 
947 947
                                 //$wpdb->query($meta_field_add);
948 948
                             }
949 949
                             // show lat lng
950 950
                             if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
951
-                                $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";
951
+                                $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";
952 952
 
953 953
                                 $meta_field_add = "VARCHAR( 3 ) NULL";
954 954
                                 $meta_field_add .= " DEFAULT '1'";
955 955
 
956
-                                geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);
956
+                                geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);
957 957
                                 //$wpdb->query($meta_field_add);
958 958
                             }
959 959
                         }
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
                     case 'checkbox':
964 964
                         $data_type = 'TINYINT';
965 965
 
966
-                        $meta_field_add = $data_type . "( 1 ) NOT NULL ";
967
-                        if ((int)$default_value === 1) {
966
+                        $meta_field_add = $data_type."( 1 ) NOT NULL ";
967
+                        if ((int) $default_value === 1) {
968 968
                             $meta_field_add .= " DEFAULT '1'";
969 969
                         }
970 970
 
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
                             }
998 998
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
999 999
                             if (strlen($option_values)) {
1000
-                                $op_size =  strlen($option_values);
1000
+                                $op_size = strlen($option_values);
1001 1001
                             }
1002 1002
 
1003 1003
                             if (isset($request_field['multi_display_type'])) {
@@ -1005,9 +1005,9 @@  discard block
 block discarded – undo
1005 1005
                             }
1006 1006
                         }
1007 1007
 
1008
-                        $meta_field_add = $data_type . "( $op_size ) NULL ";
1008
+                        $meta_field_add = $data_type."( $op_size ) NULL ";
1009 1009
                         if ($default_value != '') {
1010
-                            $meta_field_add .= " DEFAULT '" . $default_value . "'";
1010
+                            $meta_field_add .= " DEFAULT '".$default_value."'";
1011 1011
                         }
1012 1012
 
1013 1013
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
                         $data_type = 'TEXT';
1024 1024
 
1025
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1025
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1026 1026
 
1027
-                        $meta_field_add = $data_type . " NULL ";
1027
+                        $meta_field_add = $data_type." NULL ";
1028 1028
                         /*if($default_value != '')
1029 1029
 					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
1030 1030
 
@@ -1039,9 +1039,9 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
                         $data_type = 'DATE';
1041 1041
 
1042
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1042
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1043 1043
 
1044
-                        $meta_field_add = $data_type . " NULL ";
1044
+                        $meta_field_add = $data_type." NULL ";
1045 1045
 
1046 1046
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1047 1047
                         if ($add_result === false) {
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
                         $data_type = 'TIME';
1056 1056
 
1057
-                        $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";
1057
+                        $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";
1058 1058
 
1059
-                        $meta_field_add = $data_type . " NULL ";
1059
+                        $meta_field_add = $data_type." NULL ";
1060 1060
 
1061 1061
                         $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);
1062 1062
                         if ($add_result === false) {
@@ -1068,22 +1068,22 @@  discard block
 block discarded – undo
1068 1068
                     default:
1069 1069
 
1070 1070
                         if ($data_type != 'VARCHAR' && $data_type != '') {
1071
-                            $meta_field_add = $data_type . " NULL ";
1071
+                            $meta_field_add = $data_type." NULL ";
1072 1072
 
1073 1073
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1074
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1074
+                                $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";
1075 1075
                             }
1076 1076
 
1077 1077
                             if (is_numeric($default_value) && $default_value != '') {
1078
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1079
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1078
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1079
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1080 1080
                             }
1081 1081
                         } else {
1082 1082
                             $meta_field_add = " VARCHAR( 254 ) NULL ";
1083 1083
 
1084 1084
                             if ($default_value != '') {
1085
-                                $default_value_add .= " DEFAULT '" . $default_value . "'";
1086
-                                $meta_field_add .= " DEFAULT '" . $default_value . "'";
1085
+                                $default_value_add .= " DEFAULT '".$default_value."'";
1086
+                                $meta_field_add .= " DEFAULT '".$default_value."'";
1087 1087
                             }
1088 1088
                         }
1089 1089
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
                     $wpdb->prepare(
1107 1107
 
1108
-                        "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1108
+                        "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1109 1109
 					post_type = %s,
1110 1110
 					admin_title = %s,
1111 1111
 					site_title = %s,
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 					validation_msg = %s,
1139 1139
 					for_admin_use = %s ",
1140 1140
 
1141
-                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
1141
+                        array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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)
1142 1142
 
1143 1143
                     )
1144 1144
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
             }
1152 1152
 
1153
-            return (int)$lastid;
1153
+            return (int) $lastid;
1154 1154
 
1155 1155
 
1156 1156
         } else {
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
             $post_meta_info = $wpdb->query(
1185 1185
                 $wpdb->prepare(
1186
-                    "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set 
1186
+                    "update ".GEODIR_CUSTOM_FIELDS_TABLE." set 
1187 1187
 															sort_order=%d 
1188 1188
 															where id= %d",
1189 1189
                     array($count, $cf)
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
 }
1200 1200
 
1201 1201
 
1202
-function geodir_get_cf_value($cf){
1202
+function geodir_get_cf_value($cf) {
1203 1203
     global $gd_session;
1204 1204
     $value = '';
1205 1205
     if (is_admin()) {
1206
-        global $post,$gd_session;
1206
+        global $post, $gd_session;
1207 1207
 
1208 1208
         if (isset($_REQUEST['post']))
1209 1209
             $_REQUEST['pid'] = $_REQUEST['post'];
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
         $is_default = $val['is_default'];
1252 1252
 
1253 1253
         /* field available to site admin only for edit */
1254
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1254
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1255 1255
         if ($for_admin_use && !is_super_admin()) {
1256 1256
             continue;
1257 1257
         }
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1277 1277
          * @see 'geodir_after_custom_form_field_$name'
1278 1278
          */
1279
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1279
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1280 1280
 
1281 1281
 
1282 1282
         $custom_field = $val;
1283
-        $html ='';
1283
+        $html = '';
1284 1284
         /**
1285 1285
          * Filter the output for custom fields.
1286 1286
          *
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
          * @param string $html The html to be filtered (blank).
1290 1290
          * @param array $custom_field The custom field array values.
1291 1291
          */
1292
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1292
+        echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
1293 1293
 
1294 1294
 
1295 1295
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1305 1305
          * @see 'geodir_before_custom_form_field_$name'
1306 1306
          */
1307
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1307
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
1308 1308
 
1309 1309
     }
1310 1310
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
         $filter = $wpdb->get_row(
1332 1332
             $wpdb->prepare(
1333
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1333
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
1334 1334
                 array($geodir_post_type)
1335 1335
             )
1336 1336
         );
@@ -1345,14 +1345,14 @@  discard block
 block discarded – undo
1345 1345
 }
1346 1346
 
1347 1347
 
1348
-function geodir_field_icon_proccess($cf){
1348
+function geodir_field_icon_proccess($cf) {
1349 1349
 
1350 1350
 
1351 1351
     if (strpos($cf['field_icon'], 'http') !== false) {
1352
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1353
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1354
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
1355
+    } else {
1356 1356
         $field_icon = $cf['field_icon'];
1357 1357
     }
1358 1358
 
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
                 $field_icon = geodir_field_icon_proccess($type);
1403 1403
                 $filed_type = $type['type'];
1404 1404
                 $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
1405
-                if($html_var=='post'){$html_var='post_address';}
1405
+                if ($html_var == 'post') {$html_var = 'post_address'; }
1406 1406
 
1407 1407
                 /**
1408 1408
                  * Filter the output for custom fields.
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
                  * @param string $fields_location The location the field is to be show.
1414 1414
                  * @param array $type The array of field values.
1415 1415
                  */
1416
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1416
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
1417 1417
 
1418 1418
                 $variables_array = array();
1419 1419
 
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
          * @param string $fields_location The location the fields are being output.
1477 1477
          * @since 1.6.9
1478 1478
          */
1479
-        return apply_filters('geodir_show_listing_info',$html,$fields_location);
1479
+        return apply_filters('geodir_show_listing_info', $html, $fields_location);
1480 1480
 
1481 1481
     }
1482 1482
 }
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 
1552 1552
         $post_type = get_post_type($post_id);
1553 1553
         //echo $field_id; exit;
1554
-        $table = $plugin_prefix . $post_type . '_detail';
1554
+        $table = $plugin_prefix.$post_type.'_detail';
1555 1555
 
1556 1556
         $postcurr_images = array();
1557 1557
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -1570,13 +1570,13 @@  discard block
 block discarded – undo
1570 1570
             $geodir_uploadurl = $uploads['url'];
1571 1571
             $sub_dir = $uploads['subdir'];
1572 1572
 
1573
-            $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'] : '';
1573
+            $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'] : '';
1574 1574
 
1575 1575
             for ($m = 0; $m < count($post_image); $m++) {
1576 1576
 
1577 1577
                 /* --------- start ------- */
1578 1578
 
1579
-                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)))) {
1579
+                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)))) {
1580 1580
 
1581 1581
 
1582 1582
                     $curr_img_url = $post_image[$m];
@@ -1602,24 +1602,24 @@  discard block
 block discarded – undo
1602 1602
                     //$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');
1603 1603
 
1604 1604
                     if (!function_exists('wp_handle_upload'))
1605
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1605
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
1606 1606
 
1607 1607
                     if (!is_dir($geodir_uploadpath))
1608 1608
                         mkdir($geodir_uploadpath);
1609 1609
 
1610
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1610
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
1611 1611
                     $explode_sub_dir = explode("/", $sub_dir);
1612 1612
                     if ($curr_img_dir == end($explode_sub_dir)) {
1613
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1614
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1613
+                        $img_path = $geodir_uploadpath.'/'.$filename;
1614
+                        $img_url = $geodir_uploadurl.'/'.$filename;
1615 1615
                     } else {
1616
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1617
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1616
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1617
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1618 1618
                     }
1619 1619
 
1620 1620
                     $uploaded_file = '';
1621 1621
                     if (file_exists($img_path))
1622
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1622
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1623 1623
 
1624 1624
                     if ($curr_img_dir != $geodir_uploaddir) {
1625 1625
                         if (file_exists($img_path))
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
                     }
1628 1628
 
1629 1629
                     if (!empty($uploaded_file))
1630
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1630
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
1631 1631
 
1632 1632
                 } else {
1633 1633
                     $file_urls = $post_image[$m];
@@ -1641,8 +1641,8 @@  discard block
 block discarded – undo
1641 1641
         if (!empty($postcurr_images)) {
1642 1642
 
1643 1643
             if ($file_urls != $postcurr_images) {
1644
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1645
-                $invalid_files = (object)$invalid_files;
1644
+                $invalid_files[] = (object) array('src' => $postcurr_images);
1645
+                $invalid_files = (object) $invalid_files;
1646 1646
             }
1647 1647
         }
1648 1648
 
@@ -1694,9 +1694,9 @@  discard block
 block discarded – undo
1694 1694
     function geodir_upload_dir($upload)
1695 1695
     {
1696 1696
         global $current_user;
1697
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1698
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1699
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1697
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
1698
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
1699
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
1700 1700
         return $upload;
1701 1701
     }
1702 1702
 
@@ -1711,20 +1711,20 @@  discard block
 block discarded – undo
1711 1711
         // check ajax noonce
1712 1712
         $imgid = $_POST["imgid"];
1713 1713
 
1714
-        check_ajax_referer($imgid . 'pluploadan');
1714
+        check_ajax_referer($imgid.'pluploadan');
1715 1715
 
1716 1716
         // handle custom file uploaddir
1717 1717
         add_filter('upload_dir', 'geodir_upload_dir');
1718 1718
 
1719 1719
         // change file orinetation if needed
1720
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1720
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
1721 1721
 
1722 1722
         // handle file upload
1723 1723
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1724 1724
         // remove handle custom file uploaddir
1725 1725
         remove_filter('upload_dir', 'geodir_upload_dir');
1726 1726
 
1727
-        if(!isset($status['url']) && isset($status['error'])){
1727
+        if (!isset($status['url']) && isset($status['error'])) {
1728 1728
             print_r($status);
1729 1729
         }
1730 1730
 
@@ -1754,9 +1754,9 @@  discard block
 block discarded – undo
1754 1754
 
1755 1755
     $post_type = get_post_type($post_id);
1756 1756
 
1757
-    $table = $plugin_prefix . $post_type . '_detail';
1757
+    $table = $plugin_prefix.$post_type.'_detail';
1758 1758
 
1759
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1759
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
1760 1760
 
1761 1761
     if ($results) {
1762 1762
         return $results[0]->geodir_video;
@@ -1780,9 +1780,9 @@  discard block
 block discarded – undo
1780 1780
 
1781 1781
     $post_type = get_post_type($post_id);
1782 1782
 
1783
-    $table = $plugin_prefix . $post_type . '_detail';
1783
+    $table = $plugin_prefix.$post_type.'_detail';
1784 1784
 
1785
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1785
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
1786 1786
 
1787 1787
     if ($results) {
1788 1788
         return $results[0]->geodir_special_offers;
@@ -1800,12 +1800,12 @@  discard block
 block discarded – undo
1800 1800
      */
1801 1801
     function geodir_max_upload_size()
1802 1802
     {
1803
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1803
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1804 1804
 
1805 1805
         if ($max_filesize > 0 && $max_filesize < 1) {
1806
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1806
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
1807 1807
         } else {
1808
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1808
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1809 1809
         }
1810 1810
         /** Filter documented in geodirectory-functions/general_functions.php **/
1811 1811
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
 
1838 1838
             $custom_fields = $wpdb->get_results(
1839 1839
                 $wpdb->prepare(
1840
-                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon 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",
1840
+                    "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon 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",
1841 1841
                     array($post_type)
1842 1842
                 ), 'ARRAY_A'
1843 1843
             );
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 
1965 1965
             $post_meta_info = $wpdb->query(
1966 1966
                 $wpdb->prepare(
1967
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1967
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
1968 1968
 															sort_order=%d 
1969 1969
 															where id= %d",
1970 1970
                     array($count, $cf)
@@ -2046,14 +2046,14 @@  discard block
 block discarded – undo
2046 2046
 
2047 2047
         $check_html_variable = $wpdb->get_var(
2048 2048
             $wpdb->prepare(
2049
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2049
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2050 2050
                 array($cehhtmlvar_name, $post_type, $field_type)
2051 2051
             )
2052 2052
         );
2053 2053
 
2054 2054
         if ($is_default == 1) {
2055 2055
 
2056
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2056
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2057 2057
 
2058 2058
         }
2059 2059
 
@@ -2064,7 +2064,7 @@  discard block
 block discarded – undo
2064 2064
 
2065 2065
                 $wpdb->prepare(
2066 2066
 
2067
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2067
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2068 2068
 				post_type = %s,
2069 2069
 				data_type = %s,
2070 2070
 				field_type = %s,
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 
2096 2096
                 $wpdb->prepare(
2097 2097
 
2098
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2098
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2099 2099
 				post_type = %s,
2100 2100
 				data_type = %s,
2101 2101
 				field_type = %s,
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
         }
2122 2122
 
2123 2123
 
2124
-        return (int)$lastid;
2124
+        return (int) $lastid;
2125 2125
 
2126 2126
     }
2127 2127
 }
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
         if ($field_id != '') {
2145 2145
             $cf = trim($field_id, '_');
2146 2146
 
2147
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2147
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2148 2148
 
2149 2149
             return $field_id;
2150 2150
 
@@ -2167,12 +2167,12 @@  discard block
 block discarded – undo
2167 2167
      * @param string $field_ins_upd When set to "submit" displays form.
2168 2168
      * @param bool $default when set to true field will be for admin use only.
2169 2169
      */
2170
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='')
2170
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '')
2171 2171
     {
2172 2172
         global $wpdb;
2173 2173
         $cf = $result_str;
2174 2174
         if (!is_object($cf)) {
2175
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2175
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2176 2176
         } else {
2177 2177
             $field_info = $cf;
2178 2178
             $result_str = $cf->id;
@@ -2208,18 +2208,18 @@  discard block
 block discarded – undo
2208 2208
         if ($htmlvar_name == '')
2209 2209
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2210 2210
 
2211
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2211
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
2212 2212
 
2213 2213
         $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
2214 2214
         $cso_arr = geodir_get_custom_sort_options($post_type);
2215 2215
 
2216 2216
         $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']);
2217
-        foreach($cso_arr as $cso){
2218
-            if($cur_field_type==$cso['field_type']){
2217
+        foreach ($cso_arr as $cso) {
2218
+            if ($cur_field_type == $cso['field_type']) {
2219 2219
 
2220 2220
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2221 2221
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2222
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2222
+                }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
2223 2223
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2224 2224
                 }
2225 2225
 
@@ -2229,40 +2229,40 @@  discard block
 block discarded – undo
2229 2229
         $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500);
2230 2230
         ?>
2231 2231
 
2232
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
2232
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
2233 2233
             <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
2234
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
2235
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2236
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2234
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
2235
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
2236
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
2237 2237
                 <?php
2238 2238
 
2239 2239
                 ?>
2240 2240
 
2241
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2242
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2241
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
2242
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2243 2243
                      class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
2244 2244
 
2245 2245
 
2246
-                <?php echo $field_icon;?>
2246
+                <?php echo $field_icon; ?>
2247 2247
                 <b style="cursor:pointer;"
2248
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
2248
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
2249 2249
 
2250 2250
             </div>
2251 2251
 
2252
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2252
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
2253 2253
                  style="display:<?php if ($field_ins_upd == 'submit') {
2254 2254
                      echo 'block;';
2255 2255
                  } else {
2256 2256
                      echo 'none;';
2257 2257
                  } ?>">
2258 2258
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2259
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2260
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2261
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2259
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
2260
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
2261
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
2262 2262
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2263 2263
                     echo $field_info->data_type;
2264 2264
                 }?>"/>
2265
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2265
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
2266 2266
 
2267 2267
 
2268 2268
                 <ul class="widefat post fixed" border="0" style="width:100%;">
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
                         <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/>
2273 2273
 
2274 2274
                         <li>
2275
-                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?>
2275
+                            <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?>
2276 2276
 
2277 2277
                             <label for="asc" class="gd-cf-tooltip-wrap">
2278 2278
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
@@ -2282,24 +2282,24 @@  discard block
 block discarded – undo
2282 2282
                             </label>
2283 2283
                             <div class="gd-cf-input-wrap gd-switch">
2284 2284
 
2285
-                                <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled"  value="1"
2285
+                                <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled"  value="1"
2286 2286
                                     <?php if ($value == '1') {
2287 2287
                                         echo 'checked';
2288 2288
                                     } ?>/>
2289
-                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2289
+                                <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2290 2290
 
2291
-                                <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0"
2291
+                                <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0"
2292 2292
                                     <?php if ($value == '0' || !$value) {
2293 2293
                                         echo 'checked';
2294 2294
                                     } ?>/>
2295
-                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2295
+                                <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2296 2296
 
2297 2297
                             </div>
2298 2298
 
2299 2299
                         </li>
2300 2300
 
2301
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2302
-                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?>
2301
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2302
+                            <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?>
2303 2303
 
2304 2304
                             <label for="asc_title" class="gd-cf-tooltip-wrap">
2305 2305
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
@@ -2309,14 +2309,14 @@  discard block
 block discarded – undo
2309 2309
                             </label>
2310 2310
                             <div class="gd-cf-input-wrap">
2311 2311
 
2312
-                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" />
2312
+                                <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" />
2313 2313
                             </div>
2314 2314
 
2315 2315
 
2316 2316
                         </li>
2317 2317
 
2318 2318
 
2319
-                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
2319
+                        <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
2320 2320
 
2321 2321
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2322 2322
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2327,7 +2327,7 @@  discard block
 block discarded – undo
2327 2327
                             <div class="gd-cf-input-wrap">
2328 2328
 
2329 2329
                                 <input type="radio" name="is_default"
2330
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2330
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
2331 2331
                                     echo 'checked="checked"';
2332 2332
                                 } ?>/>
2333 2333
                             </div>
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
 
2338 2338
 
2339 2339
                         <li>
2340
-                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?>
2340
+                            <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?>
2341 2341
 
2342 2342
                             <label for="desc" class="gd-cf-tooltip-wrap">
2343 2343
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
@@ -2347,24 +2347,24 @@  discard block
 block discarded – undo
2347 2347
                             </label>
2348 2348
                             <div class="gd-cf-input-wrap gd-switch">
2349 2349
 
2350
-                                <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled"  value="1"
2350
+                                <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled"  value="1"
2351 2351
                                     <?php if ($value == '1') {
2352 2352
                                         echo 'checked';
2353 2353
                                     } ?>/>
2354
-                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2354
+                                <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2355 2355
 
2356
-                                <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0"
2356
+                                <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0"
2357 2357
                                     <?php if ($value == '0' || !$value) {
2358 2358
                                         echo 'checked';
2359 2359
                                     } ?>/>
2360
-                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2360
+                                <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2361 2361
 
2362 2362
                             </div>
2363 2363
 
2364 2364
                         </li>
2365 2365
 
2366
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2367
-                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?>
2366
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2367
+                            <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?>
2368 2368
 
2369 2369
                             <label for="desc_title" class="gd-cf-tooltip-wrap">
2370 2370
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
@@ -2374,13 +2374,13 @@  discard block
 block discarded – undo
2374 2374
                             </label>
2375 2375
                             <div class="gd-cf-input-wrap">
2376 2376
 
2377
-                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" />
2377
+                                <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" />
2378 2378
                             </div>
2379 2379
 
2380 2380
 
2381 2381
                         </li>
2382 2382
 
2383
-                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
2383
+                        <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
2384 2384
 
2385 2385
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2386 2386
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
                             <div class="gd-cf-input-wrap">
2392 2392
 
2393 2393
                                 <input type="radio" name="is_default"
2394
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2394
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
2395 2395
                                     echo 'checked="checked"';
2396 2396
                                 } ?>/>
2397 2397
                             </div>
@@ -2416,14 +2416,14 @@  discard block
 block discarded – undo
2416 2416
                             </label>
2417 2417
                             <div class="gd-cf-input-wrap">
2418 2418
 
2419
-                                <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" />
2419
+                                <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" />
2420 2420
                             </div>
2421 2421
 
2422 2422
 
2423 2423
                         </li>
2424 2424
 
2425 2425
                         <li>
2426
-                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?>
2426
+                            <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?>
2427 2427
 
2428 2428
                             <label for="is_default" class="gd-cf-tooltip-wrap">
2429 2429
                                 <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 
2448 2448
 
2449 2449
                     <li>
2450
-                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?>
2450
+                        <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?>
2451 2451
 
2452 2452
                         <label for="is_active" class="gd-cf-tooltip-wrap">
2453 2453
                             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
@@ -2457,17 +2457,17 @@  discard block
 block discarded – undo
2457 2457
                         </label>
2458 2458
                         <div class="gd-cf-input-wrap gd-switch">
2459 2459
 
2460
-                            <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
2460
+                            <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
2461 2461
                                 <?php if ($value == '1') {
2462 2462
                                     echo 'checked';
2463 2463
                                 } ?>/>
2464
-                            <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2464
+                            <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2465 2465
 
2466
-                            <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
2466
+                            <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
2467 2467
                                 <?php if ($value == '0' || !$value) {
2468 2468
                                     echo 'checked';
2469 2469
                                 } ?>/>
2470
-                            <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2470
+                            <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2471 2471
 
2472 2472
                         </div>
2473 2473
 
@@ -2488,10 +2488,10 @@  discard block
 block discarded – undo
2488 2488
                             <h3></h3>
2489 2489
                         </label>
2490 2490
                         <div class="gd-cf-input-wrap">
2491
-                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
2491
+                            <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
2492 2492
                                    onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
2493
-                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
2494
-                                                                    onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2493
+                                <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
2494
+                                                                    onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2495 2495
                                                                     class="button"/></a>
2496 2496
                         </div>
2497 2497
                     </li>
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
         if (!$package_id || !$field_name || !$post_type) {
2527 2527
             return true;
2528 2528
         }
2529
-        $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));
2529
+        $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));
2530 2530
 
2531 2531
         if ($wpdb->get_var($sql)) {
2532 2532
             return true;
@@ -2648,13 +2648,13 @@  discard block
 block discarded – undo
2648 2648
 }
2649 2649
 
2650 2650
 
2651
-function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2651
+function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
2652 2652
     ob_start();
2653 2653
 
2654 2654
     $dt_value = '';
2655 2655
     if (isset($field_info->data_type)) {
2656 2656
         $dt_value  = esc_attr($field_info->data_type);
2657
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2657
+    }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
2658 2658
         $dt_value  = $cf['defaults']['data_type'];
2659 2659
     }
2660 2660
     ?>
@@ -2665,15 +2665,15 @@  discard block
 block discarded – undo
2665 2665
             <select name="data_type" id="data_type"
2666 2666
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2667 2667
                 <option
2668
-                    value="XVARCHAR" <?php if ($dt_value  == 'VARCHAR') {
2668
+                    value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
2669 2669
                     echo 'selected="selected"';
2670 2670
                 } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2671 2671
                 <option
2672
-                    value="INT" <?php if ($dt_value   == 'INT') {
2672
+                    value="INT" <?php if ($dt_value == 'INT') {
2673 2673
                     echo 'selected="selected"';
2674 2674
                 } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2675 2675
                 <option
2676
-                    value="FLOAT" <?php if ($dt_value   == 'FLOAT') {
2676
+                    value="FLOAT" <?php if ($dt_value == 'FLOAT') {
2677 2677
                     echo 'selected="selected"';
2678 2678
                 } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2679 2679
             </select>
@@ -2686,13 +2686,13 @@  discard block
 block discarded – undo
2686 2686
     $value = '';
2687 2687
     if (isset($field_info->decimal_point)) {
2688 2688
         $value = esc_attr($field_info->decimal_point);
2689
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2689
+    }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
2690 2690
         $value = $cf['defaults']['decimal_point'];
2691 2691
     }
2692 2692
     ?>
2693 2693
 
2694 2694
     <li class="decimal-point-wrapper"
2695
-        style="<?php echo ($dt_value  == 'FLOAT') ? '' : 'display:none' ?>">
2695
+        style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>">
2696 2696
         <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
2697 2697
         <div class="gd-cf-input-wrap">
2698 2698
             <select name="decimal_point" id="decimal_point">
@@ -2710,43 +2710,43 @@  discard block
 block discarded – undo
2710 2710
     $output = ob_get_clean();
2711 2711
     return $output;
2712 2712
 }
2713
-add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2713
+add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
2714 2714
 
2715 2715
 // htmlvar not needed for fieldset and taxonomy
2716
-add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
2717
-add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
2716
+add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
2717
+add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
2718 2718
 
2719 2719
 
2720 2720
 // default_value not needed for textarea, html, file, fieldset, taxonomy, address
2721
-add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
2722
-add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
2723
-add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
2724
-add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
2725
-add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
2726
-add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
2721
+add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
2722
+add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
2723
+add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
2724
+add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
2725
+add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
2726
+add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
2727 2727
 
2728 2728
 // is_required not needed for fieldset
2729
-add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
2730
-add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
2729
+add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
2730
+add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
2731 2731
 
2732 2732
 // field_icon not needed for fieldset
2733
-add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
2734
-add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
2733
+add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
2734
+add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
2735 2735
 
2736 2736
 // cat_sort not needed for some fields
2737
-add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
2738
-add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
2739
-add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
2740
-add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
2741
-add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
2742
-add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
2743
-add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
2744
-add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
2737
+add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
2738
+add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
2739
+add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
2740
+add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
2741
+add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
2742
+add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
2743
+add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
2744
+add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
2745 2745
 
2746 2746
 
2747 2747
 
2748
-function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2749
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2748
+function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
2749
+    if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
2750 2750
     ob_start();
2751 2751
     ?>
2752 2752
     <li>
@@ -2777,16 +2777,16 @@  discard block
 block discarded – undo
2777 2777
     $output = ob_get_clean();
2778 2778
     return $output;
2779 2779
 }
2780
-add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2780
+add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
2781 2781
 
2782 2782
 
2783
-function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2783
+function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
2784 2784
     ob_start();
2785 2785
 
2786 2786
     $value = '';
2787 2787
     if (isset($field_info->validation_pattern)) {
2788 2788
         $value = esc_attr($field_info->validation_pattern);
2789
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2789
+    }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
2790 2790
         $value = esc_attr($cf['defaults']['validation_pattern']);
2791 2791
     }
2792 2792
     ?>
@@ -2806,7 +2806,7 @@  discard block
 block discarded – undo
2806 2806
     $value = '';
2807 2807
     if (isset($field_info->validation_msg)) {
2808 2808
         $value = esc_attr($field_info->validation_msg);
2809
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2809
+    }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
2810 2810
         $value = esc_attr($cf['defaults']['validation_msg']);
2811 2811
     }
2812 2812
     ?>
@@ -2827,10 +2827,10 @@  discard block
 block discarded – undo
2827 2827
     $output = ob_get_clean();
2828 2828
     return $output;
2829 2829
 }
2830
-add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2830
+add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
2831 2831
 
2832 2832
 
2833
-function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2833
+function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
2834 2834
     ob_start();
2835 2835
     global $post_type;
2836 2836
 
@@ -2855,7 +2855,7 @@  discard block
 block discarded – undo
2855 2855
                     ?>
2856 2856
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2857 2857
                         echo 'selected="selected"';
2858
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2858
+                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
2859 2859
                 }
2860 2860
                 ?>
2861 2861
             </select>
@@ -2866,7 +2866,7 @@  discard block
 block discarded – undo
2866 2866
         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
2867 2867
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
2868 2868
             <div class="gdcf-tooltip">
2869
-                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
2869
+                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
2870 2870
             </div>
2871 2871
         </label>
2872 2872
         <div class="gd-cf-input-wrap">
@@ -2874,19 +2874,19 @@  discard block
 block discarded – undo
2874 2874
             <select name="cat_display_type" id="cat_display_type">
2875 2875
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2876 2876
                     echo 'selected="selected"';
2877
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2877
+                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
2878 2878
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2879 2879
                     echo 'selected="selected"';
2880
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2880
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2881 2881
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2882 2882
                     echo 'selected="selected"';
2883
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2883
+                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
2884 2884
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2885 2885
                     echo 'selected="selected"';
2886
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2886
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2887 2887
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2888 2888
                     echo 'selected="selected"';
2889
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2889
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2890 2890
             </select>
2891 2891
         </div>
2892 2892
     </li>
@@ -2895,10 +2895,10 @@  discard block
 block discarded – undo
2895 2895
     $output = ob_get_clean();
2896 2896
     return $output;
2897 2897
 }
2898
-add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2898
+add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
2899 2899
 
2900 2900
 
2901
-function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2901
+function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
2902 2902
 
2903 2903
     ob_start();
2904 2904
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -2921,32 +2921,32 @@  discard block
 block discarded – undo
2921 2921
         <label for="show_zip" class="gd-cf-tooltip-wrap">
2922 2922
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
2923 2923
             <div class="gdcf-tooltip">
2924
-                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
2924
+                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
2925 2925
             </div>
2926 2926
         </label>
2927 2927
         <div class="gd-cf-input-wrap gd-switch">
2928 2928
 
2929
-            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2929
+            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2930 2930
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2931 2931
                     echo 'checked';
2932 2932
                 } ?>/>
2933
-            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2933
+            <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2934 2934
 
2935
-            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2935
+            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2936 2936
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2937 2937
                     echo 'checked';
2938 2938
                 } ?>/>
2939
-            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2939
+            <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2940 2940
 
2941 2941
 
2942 2942
         </div>
2943 2943
     </li>
2944 2944
 
2945
-    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
2945
+    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
2946 2946
         <label for="zip_lable" class="gd-cf-tooltip-wrap">
2947 2947
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
2948 2948
             <div class="gdcf-tooltip">
2949
-                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
2949
+                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
2950 2950
             </div>
2951 2951
         </label>
2952 2952
         <div class="gd-cf-input-wrap">
@@ -2964,7 +2964,7 @@  discard block
 block discarded – undo
2964 2964
         <label for="map_lable" class="gd-cf-tooltip-wrap">
2965 2965
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
2966 2966
             <div class="gdcf-tooltip">
2967
-                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
2967
+                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
2968 2968
             </div>
2969 2969
         </label>
2970 2970
         <div class="gd-cf-input-wrap">
@@ -2979,22 +2979,22 @@  discard block
 block discarded – undo
2979 2979
         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
2980 2980
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
2981 2981
             <div class="gdcf-tooltip">
2982
-                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
2982
+                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
2983 2983
             </div>
2984 2984
         </label>
2985 2985
         <div class="gd-cf-input-wrap gd-switch">
2986 2986
 
2987
-            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2987
+            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2988 2988
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2989 2989
                     echo 'checked';
2990 2990
                 } ?>/>
2991
-            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2991
+            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2992 2992
 
2993
-            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2993
+            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2994 2994
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2995 2995
                     echo 'checked';
2996 2996
                 } ?>/>
2997
-            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2997
+            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2998 2998
 
2999 2999
         </div>
3000 3000
     </li>
@@ -3003,22 +3003,22 @@  discard block
 block discarded – undo
3003 3003
         <label for="show_mapview" class="gd-cf-tooltip-wrap">
3004 3004
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
3005 3005
             <div class="gdcf-tooltip">
3006
-                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
3006
+                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
3007 3007
             </div>
3008 3008
         </label>
3009 3009
         <div class="gd-cf-input-wrap gd-switch">
3010 3010
 
3011
-            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3011
+            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
3012 3012
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
3013 3013
                     echo 'checked';
3014 3014
                 } ?>/>
3015
-            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3015
+            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3016 3016
 
3017
-            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3017
+            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
3018 3018
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
3019 3019
                     echo 'checked';
3020 3020
                 } ?>/>
3021
-            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3021
+            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3022 3022
 
3023 3023
         </div>
3024 3024
     </li>
@@ -3028,7 +3028,7 @@  discard block
 block discarded – undo
3028 3028
         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
3029 3029
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
3030 3030
             <div class="gdcf-tooltip">
3031
-                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
3031
+                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
3032 3032
             </div>
3033 3033
         </label>
3034 3034
         <div class="gd-cf-input-wrap">
@@ -3042,22 +3042,22 @@  discard block
 block discarded – undo
3042 3042
         <label for="show_latlng" class="gd-cf-tooltip-wrap">
3043 3043
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
3044 3044
             <div class="gdcf-tooltip">
3045
-                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
3045
+                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
3046 3046
             </div>
3047 3047
         </label>
3048 3048
         <div class="gd-cf-input-wrap gd-switch">
3049 3049
 
3050
-            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3050
+            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
3051 3051
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
3052 3052
                     echo 'checked';
3053 3053
                 } ?>/>
3054
-            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3054
+            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3055 3055
 
3056
-            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3056
+            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
3057 3057
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
3058 3058
                     echo 'checked';
3059 3059
                 } ?>/>
3060
-            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3060
+            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3061 3061
 
3062 3062
         </div>
3063 3063
     </li>
@@ -3066,17 +3066,17 @@  discard block
 block discarded – undo
3066 3066
     $html = ob_get_clean();
3067 3067
     return $output.$html;
3068 3068
 }
3069
-add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
3069
+add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
3070 3070
 
3071 3071
 
3072
-function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
3072
+function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
3073 3073
     ob_start();
3074 3074
     ?>
3075 3075
     <li>
3076 3076
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
3077 3077
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
3078 3078
             <div class="gdcf-tooltip">
3079
-                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
3079
+                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
3080 3080
             </div>
3081 3081
         </label>
3082 3082
         <div class="gd-cf-input-wrap">
@@ -3084,13 +3084,13 @@  discard block
 block discarded – undo
3084 3084
             <select name="multi_display_type" id="multi_display_type">
3085 3085
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
3086 3086
                     echo 'selected="selected"';
3087
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
3087
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
3088 3088
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
3089 3089
                     echo 'selected="selected"';
3090
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
3090
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
3091 3091
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
3092 3092
                     echo 'selected="selected"';
3093
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
3093
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
3094 3094
             </select>
3095 3095
 
3096 3096
             <br/>
@@ -3101,17 +3101,17 @@  discard block
 block discarded – undo
3101 3101
     $html = ob_get_clean();
3102 3102
     return $output.$html;
3103 3103
 }
3104
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
3104
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
3105 3105
 
3106 3106
 
3107
-function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
3107
+function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
3108 3108
 
3109 3109
     ob_start();
3110 3110
 
3111 3111
     $value = '';
3112 3112
     if (isset($field_info->option_values)) {
3113 3113
         $value = esc_attr($field_info->option_values);
3114
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3114
+    }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
3115 3115
         $value = esc_attr($cf['defaults']['option_values']);
3116 3116
     }
3117 3117
 
@@ -3121,11 +3121,11 @@  discard block
 block discarded – undo
3121 3121
         <label for="option_values" class="gd-cf-tooltip-wrap">
3122 3122
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
3123 3123
             <div class="gdcf-tooltip">
3124
-                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
3124
+                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
3125 3125
                 <br/>
3126
-                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
3126
+                <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
3127 3127
                     <br/>
3128
-                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
3128
+                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
3129 3129
                     <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
3130 3130
                         <br/>
3131 3131
                         <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -3136,7 +3136,7 @@  discard block
 block discarded – undo
3136 3136
         </label>
3137 3137
         <div class="gd-cf-input-wrap">
3138 3138
             <input type="text" name="option_values" id="option_values"
3139
-                   value="<?php echo $value;?>"/>
3139
+                   value="<?php echo $value; ?>"/>
3140 3140
             <br/>
3141 3141
 
3142 3142
         </div>
@@ -3146,12 +3146,12 @@  discard block
 block discarded – undo
3146 3146
     $html = ob_get_clean();
3147 3147
     return $output.$html;
3148 3148
 }
3149
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
3150
-add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
3151
-add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
3149
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
3150
+add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
3151
+add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
3152 3152
 
3153 3153
 
3154
-function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
3154
+function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
3155 3155
     ob_start();
3156 3156
     $extra = array();
3157 3157
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -3162,7 +3162,7 @@  discard block
 block discarded – undo
3162 3162
         <label for="date_format" class="gd-cf-tooltip-wrap">
3163 3163
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
3164 3164
             <div class="gdcf-tooltip">
3165
-                <?php _e('Select the date format.', 'geodirectory');?>
3165
+                <?php _e('Select the date format.', 'geodirectory'); ?>
3166 3166
             </div>
3167 3167
         </label>
3168 3168
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -3182,16 +3182,16 @@  discard block
 block discarded – undo
3182 3182
              * @since 1.6.5
3183 3183
              * @param array $date_formats The PHP date format array.
3184 3184
              */
3185
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
3185
+            $date_formats = apply_filters('geodir_date_formats', $date_formats);
3186 3186
             ?>
3187 3187
             <select name="extra[date_format]" id="date_format">
3188 3188
                 <?php
3189
-                foreach($date_formats as $format){
3189
+                foreach ($date_formats as $format) {
3190 3190
                     $selected = '';
3191
-                    if(!empty($extra) && esc_attr($extra['date_format'])==$format){
3191
+                    if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
3192 3192
                         $selected = "selected='selected'";
3193 3193
                     }
3194
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3194
+                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
3195 3195
                 }
3196 3196
                 ?>
3197 3197
             </select>
@@ -3203,10 +3203,10 @@  discard block
 block discarded – undo
3203 3203
     $html = ob_get_clean();
3204 3204
     return $output.$html;
3205 3205
 }
3206
-add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3206
+add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
3207 3207
 
3208 3208
 
3209
-function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3209
+function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
3210 3210
     ob_start();
3211 3211
     $allowed_file_types = geodir_allowed_mime_types();
3212 3212
 
@@ -3217,16 +3217,16 @@  discard block
 block discarded – undo
3217 3217
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3218 3218
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
3219 3219
             <div class="gdcf-tooltip">
3220
-                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
3220
+                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
3221 3221
             </div>
3222 3222
         </label>
3223 3223
         <div class="gd-cf-input-wrap">
3224 3224
             <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
3225
-                <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
3226
-                <?php foreach ( $allowed_file_types as $format => $types ) { ?>
3227
-                    <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
3228
-                        <?php foreach ( $types as $ext => $type ) { ?>
3229
-                            <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
3225
+                <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
3226
+                <?php foreach ($allowed_file_types as $format => $types) { ?>
3227
+                    <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
3228
+                        <?php foreach ($types as $ext => $type) { ?>
3229
+                            <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
3230 3230
                         <?php } ?>
3231 3231
                     </optgroup>
3232 3232
                 <?php } ?>
@@ -3238,9 +3238,9 @@  discard block
 block discarded – undo
3238 3238
     $html = ob_get_clean();
3239 3239
     return $output.$html;
3240 3240
 }
3241
-add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3241
+add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
3242 3242
 
3243
-function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
3243
+function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
3244 3244
     ob_start();
3245 3245
 
3246 3246
     $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
@@ -3254,11 +3254,11 @@  discard block
 block discarded – undo
3254 3254
     $value = '';
3255 3255
     if ($extra_fields && isset($extra_fields['is_price'])) {
3256 3256
     $value = esc_attr($extra_fields['is_price']);
3257
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3257
+    }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
3258 3258
     $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3259 3259
     }
3260 3260
 
3261
-    $show_price_extra = ($value==1) ? 1 : 0;
3261
+    $show_price_extra = ($value == 1) ? 1 : 0;
3262 3262
     ?>
3263 3263
     <li class="gdcf-price-extra-set">
3264 3264
         <label for="is_price" class="gd-cf-tooltip-wrap">
@@ -3269,17 +3269,17 @@  discard block
 block discarded – undo
3269 3269
         </label>
3270 3270
         <div class="gd-cf-input-wrap gd-switch">
3271 3271
 
3272
-            <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3272
+            <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled"  value="1"
3273 3273
                 <?php if ($value == '1') {
3274 3274
                     echo 'checked';
3275 3275
                 } ?>/>
3276
-            <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3276
+            <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
3277 3277
 
3278
-            <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0"
3278
+            <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0"
3279 3279
                 <?php if ($value == '0' || !$value) {
3280 3280
                     echo 'checked';
3281 3281
                 } ?>/>
3282
-            <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3282
+            <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
3283 3283
 
3284 3284
         </div>
3285 3285
     </li>
@@ -3289,23 +3289,23 @@  discard block
 block discarded – undo
3289 3289
     $value = '';
3290 3290
     if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3291 3291
         $value = esc_attr($extra_fields['thousand_separator']);
3292
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3292
+    }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
3293 3293
         $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3294 3294
     }
3295 3295
     ?>
3296
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3297
-        <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
3296
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3297
+        <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
3298 3298
             <div class="gdcf-tooltip">
3299 3299
                 <?php _e('Select the thousand separator.', 'geodirectory'); ?>
3300 3300
             </div>
3301 3301
         </label>
3302 3302
         <div class="gd-cf-input-wrap">
3303 3303
                 <select name="extra[thousand_separator]" id="thousand_separator">
3304
-                    <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3305
-                    <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
3306
-                    <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
3307
-                    <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
3308
-                    <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
3304
+                    <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3305
+                    <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
3306
+                    <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
3307
+                    <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
3308
+                    <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
3309 3309
                 </select>
3310 3310
         </div>
3311 3311
     </li>
@@ -3316,20 +3316,20 @@  discard block
 block discarded – undo
3316 3316
     $value = '';
3317 3317
     if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3318 3318
         $value = esc_attr($extra_fields['decimal_separator']);
3319
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3319
+    }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
3320 3320
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3321 3321
     }
3322 3322
     ?>
3323
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3324
-        <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
3323
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3324
+        <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
3325 3325
             <div class="gdcf-tooltip">
3326 3326
                 <?php _e('Select the decimal separator.', 'geodirectory'); ?>
3327 3327
             </div>
3328 3328
         </label>
3329 3329
         <div class="gd-cf-input-wrap">
3330 3330
             <select name="extra[decimal_separator]" id="decimal_separator">
3331
-                <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
3332
-                <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3331
+                <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
3332
+                <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
3333 3333
             </select>
3334 3334
         </div>
3335 3335
     </li>
@@ -3339,20 +3339,20 @@  discard block
 block discarded – undo
3339 3339
     $value = '';
3340 3340
     if ($extra_fields && isset($extra_fields['decimal_display'])) {
3341 3341
         $value = esc_attr($extra_fields['decimal_display']);
3342
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3342
+    }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
3343 3343
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3344 3344
     }
3345 3345
     ?>
3346
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3347
-        <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
3346
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3347
+        <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
3348 3348
             <div class="gdcf-tooltip">
3349 3349
                 <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
3350 3350
             </div>
3351 3351
         </label>
3352 3352
         <div class="gd-cf-input-wrap">
3353 3353
             <select name="extra[decimal_display]" id="decimal_display">
3354
-                <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
3355
-                <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
3354
+                <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
3355
+                <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
3356 3356
             </select>
3357 3357
         </div>
3358 3358
     </li>
@@ -3362,12 +3362,12 @@  discard block
 block discarded – undo
3362 3362
     $value = '';
3363 3363
     if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3364 3364
         $value = esc_attr($extra_fields['currency_symbol']);
3365
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3365
+    }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
3366 3366
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3367 3367
     }
3368 3368
     ?>
3369
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3370
-        <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
3369
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3370
+        <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
3371 3371
             <div class="gdcf-tooltip">
3372 3372
                 <?php _e('Select the currency symbol.', 'geodirectory'); ?>
3373 3373
             </div>
@@ -3383,20 +3383,20 @@  discard block
 block discarded – undo
3383 3383
     $value = '';
3384 3384
     if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3385 3385
         $value = esc_attr($extra_fields['currency_symbol_placement']);
3386
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3386
+    }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
3387 3387
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3388 3388
     }
3389 3389
     ?>
3390
-    <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
3391
-        <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
3390
+    <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
3391
+        <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory'); ?>
3392 3392
             <div class="gdcf-tooltip">
3393 3393
                 <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
3394 3394
             </div>
3395 3395
         </label>
3396 3396
         <div class="gd-cf-input-wrap">
3397 3397
             <select name="extra[currency_symbol_placement]" id="currency_symbol_placement">
3398
-                <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
3399
-                <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
3398
+                <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
3399
+                <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
3400 3400
             </select>
3401 3401
         </div>
3402 3402
     </li>
@@ -3407,11 +3407,11 @@  discard block
 block discarded – undo
3407 3407
     $html = ob_get_clean();
3408 3408
     return $output.$html;
3409 3409
 }
3410
-add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
3410
+add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
3411 3411
 
3412
-function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
3412
+function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
3413 3413
     $fields = array();
3414
-    $package = ($package_id=='') ? '' : array($package_id);
3414
+    $package = ($package_id == '') ? '' : array($package_id);
3415 3415
 
3416 3416
     $fields[] = array('listing_type' => $post_type,
3417 3417
                       'data_type' => 'VARCHAR',
@@ -3584,7 +3584,7 @@  discard block
 block discarded – undo
3584 3584
     return  $fields;
3585 3585
 }
3586 3586
 
3587
-function geodir_currency_format_number($number='',$cf=''){
3587
+function geodir_currency_format_number($number = '', $cf = '') {
3588 3588
 
3589 3589
     $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : '';
3590 3590
 
@@ -3593,35 +3593,35 @@  discard block
 block discarded – undo
3593 3593
     $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if';
3594 3594
     $decimalpoint = '.';
3595 3595
 
3596
-    if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
3596
+    if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
3597 3597
         $decimalpoint = ',';
3598 3598
     }
3599 3599
 
3600 3600
     $separator = ',';
3601 3601
 
3602
-    if(isset($cs['thousand_separator'])){
3603
-        if($cs['thousand_separator']=='comma'){$separator = ',';}
3604
-        if($cs['thousand_separator']=='slash'){$separator = '\\';}
3605
-        if($cs['thousand_separator']=='period'){$separator = '.';}
3606
-        if($cs['thousand_separator']=='space'){$separator = ' ';}
3607
-        if($cs['thousand_separator']=='none'){$separator = '';}
3602
+    if (isset($cs['thousand_separator'])) {
3603
+        if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
3604
+        if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
3605
+        if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
3606
+        if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
3607
+        if ($cs['thousand_separator'] == 'none') {$separator = ''; }
3608 3608
     }
3609 3609
 
3610 3610
     $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3611 3611
 
3612
-    if($decimals>0 && $decimal_display=='if'){
3613
-        if(is_int($number) || floor( $number ) == $number)
3612
+    if ($decimals > 0 && $decimal_display == 'if') {
3613
+        if (is_int($number) || floor($number) == $number)
3614 3614
             $decimals = 0;
3615 3615
     }
3616 3616
 
3617
-    $number = number_format($number,$decimals,$decimalpoint,$separator);
3617
+    $number = number_format($number, $decimals, $decimalpoint, $separator);
3618 3618
 
3619 3619
 
3620 3620
 
3621
-    if($currency_symbol_placement=='left'){
3622
-        $number = $symbol . $number;
3623
-    }else{
3624
-        $number = $number . $symbol;
3621
+    if ($currency_symbol_placement == 'left') {
3622
+        $number = $symbol.$number;
3623
+    } else {
3624
+        $number = $number.$symbol;
3625 3625
     }
3626 3626
 
3627 3627
 
Please login to merge, or discard this patch.
Braces   +136 added lines, -94 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query .= " and is_admin IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query .= " and is_admin = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query .= " and is_admin IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query .= " and is_admin = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'none') {
91 93
     } else{
@@ -239,10 +241,12 @@  discard block
 block discarded – undo
239 241
                 }
240 242
 
241 243
                 return $field_id;
242
-            } else
243
-                return 0;
244
-        } else
245
-            return 0;
244
+            } else {
245
+                            return 0;
246
+            }
247
+        } else {
248
+                    return 0;
249
+        }
246 250
     }
247 251
 }
248 252
 
@@ -349,7 +353,9 @@  discard block
 block discarded – undo
349 353
 
350 354
 
351 355
 
352
-            if ($post_type == '') $post_type = 'gd_place';
356
+            if ($post_type == '') {
357
+            	$post_type = 'gd_place';
358
+            }
353 359
 
354 360
 
355 361
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -389,16 +395,17 @@  discard block
 block discarded – undo
389 395
             }
390 396
 
391 397
             $option_values = '';
392
-            if (isset($request_field['option_values']))
393
-                $option_values = $request_field['option_values'];
398
+            if (isset($request_field['option_values'])) {
399
+                            $option_values = $request_field['option_values'];
400
+            }
394 401
 
395 402
             $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0';
396 403
 
397 404
             $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0';
398 405
 
399
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
400
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
401
-            else {
406
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
407
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
408
+            } else {
402 409
                 $package_info = array();
403 410
 
404 411
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -406,22 +413,29 @@  discard block
 block discarded – undo
406 413
             }
407 414
 
408 415
 
409
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
410
-                $extra_fields = $request_field['extra'];
416
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
417
+                            $extra_fields = $request_field['extra'];
418
+            }
411 419
 
412
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
413
-                $is_default = $request_field['is_default'];
414
-            else
415
-                $is_default = '0';
420
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
421
+                            $is_default = $request_field['is_default'];
422
+            } else {
423
+                            $is_default = '0';
424
+            }
416 425
 
417
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
418
-                $is_admin = $request_field['is_admin'];
419
-            else
420
-                $is_admin = '0';
426
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
427
+                            $is_admin = $request_field['is_admin'];
428
+            } else {
429
+                            $is_admin = '0';
430
+            }
421 431
 
422 432
 
423
-            if ($is_active == '') $is_active = 1;
424
-            if ($is_required == '') $is_required = 0;
433
+            if ($is_active == '') {
434
+            	$is_active = 1;
435
+            }
436
+            if ($is_required == '') {
437
+            	$is_required = 0;
438
+            }
425 439
 
426 440
 
427 441
             if ($sort_order == '') {
@@ -690,7 +704,7 @@  discard block
 block discarded – undo
690 704
                                 }
691 705
                                 if($op_max){$op_size =$op_max; }
692 706
                             }
693
-                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
707
+                        } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
694 708
                             if(strlen($option_values)){
695 709
                                 $op_size =  strlen($option_values);
696 710
                             }
@@ -707,11 +721,13 @@  discard block
 block discarded – undo
707 721
                             return __('Column change failed, you may have too many columns.','geodirectory');
708 722
                         }
709 723
 
710
-                        if (isset($request_field['cat_display_type']))
711
-                            $extra_fields = $request_field['cat_display_type'];
724
+                        if (isset($request_field['cat_display_type'])) {
725
+                                                    $extra_fields = $request_field['cat_display_type'];
726
+                        }
712 727
 
713
-                        if (isset($request_field['multi_display_type']))
714
-                            $extra_fields = $request_field['multi_display_type'];
728
+                        if (isset($request_field['multi_display_type'])) {
729
+                                                    $extra_fields = $request_field['multi_display_type'];
730
+                        }
715 731
 
716 732
 
717 733
                         break;
@@ -725,8 +741,9 @@  discard block
 block discarded – undo
725 741
                         if($alter_result===false){
726 742
                             return __('Column change failed, you may have too many columns.','geodirectory');
727 743
                         }
728
-                        if (isset($request_field['advanced_editor']))
729
-                            $extra_fields = $request_field['advanced_editor'];
744
+                        if (isset($request_field['advanced_editor'])) {
745
+                                                    $extra_fields = $request_field['advanced_editor'];
746
+                        }
730 747
 
731 748
                         break;
732 749
 
@@ -822,8 +839,9 @@  discard block
 block discarded – undo
822 839
                 );
823 840
 
824 841
 
825
-                if ($cat_sort == '')
826
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
842
+                if ($cat_sort == '') {
843
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
844
+                }
827 845
 
828 846
 
829 847
                 /**
@@ -1193,8 +1211,10 @@  discard block
 block discarded – undo
1193 1211
         }
1194 1212
 
1195 1213
         return $post_meta_info;
1196
-    else:
1197
-        return false;
1214
+    else {
1215
+    	:
1216
+        return false;
1217
+    }
1198 1218
     endif;
1199 1219
 }
1200 1220
 
@@ -1205,8 +1225,9 @@  discard block
 block discarded – undo
1205 1225
     if (is_admin()) {
1206 1226
         global $post,$gd_session;
1207 1227
 
1208
-        if (isset($_REQUEST['post']))
1209
-            $_REQUEST['pid'] = $_REQUEST['post'];
1228
+        if (isset($_REQUEST['post'])) {
1229
+                    $_REQUEST['pid'] = $_REQUEST['post'];
1230
+        }
1210 1231
     }
1211 1232
 
1212 1233
     if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1259,8 +1280,9 @@  discard block
 block discarded – undo
1259 1280
         if (is_admin()) {
1260 1281
             global $post;
1261 1282
 
1262
-            if (isset($_REQUEST['post']))
1263
-                $_REQUEST['pid'] = $_REQUEST['post'];
1283
+            if (isset($_REQUEST['post'])) {
1284
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1285
+            }
1264 1286
         }
1265 1287
 
1266 1288
         
@@ -1352,7 +1374,7 @@  discard block
 block discarded – undo
1352 1374
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1353 1375
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1354 1376
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1355
-    }else{
1377
+    } else{
1356 1378
         $field_icon = $cf['field_icon'];
1357 1379
     }
1358 1380
 
@@ -1425,8 +1447,9 @@  discard block
 block discarded – undo
1425 1447
                     $variables_array['post_id'] = $post->ID;
1426 1448
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1427 1449
                     $variables_array['value'] = '';
1428
-                    if (isset($post->{$type['htmlvar_name']}))
1429
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1450
+                    if (isset($post->{$type['htmlvar_name']})) {
1451
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1452
+                    }
1430 1453
                 endif;
1431 1454
 
1432 1455
 
@@ -1448,7 +1471,9 @@  discard block
 block discarded – undo
1448 1471
                      * @param string $html Custom field unfiltered HTML.
1449 1472
                      * @param array $variables_array Custom field variables array.
1450 1473
                      */
1451
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1474
+                    if ($html) {
1475
+                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
1476
+                    }
1452 1477
 
1453 1478
                     /**
1454 1479
                      * Called after a custom fields is output on the frontend.
@@ -1491,10 +1516,11 @@  discard block
 block discarded – undo
1491 1516
      */
1492 1517
     function geodir_default_date_format()
1493 1518
     {
1494
-        if ($format = get_option('date_format'))
1495
-            return $format;
1496
-        else
1497
-            return 'dd-mm-yy';
1519
+        if ($format = get_option('date_format')) {
1520
+                    return $format;
1521
+        } else {
1522
+                    return 'dd-mm-yy';
1523
+        }
1498 1524
     }
1499 1525
 }
1500 1526
 
@@ -1601,11 +1627,13 @@  discard block
 block discarded – undo
1601 1627
                     // Set an array containing a list of acceptable formats
1602 1628
                     //$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');
1603 1629
 
1604
-                    if (!function_exists('wp_handle_upload'))
1605
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1630
+                    if (!function_exists('wp_handle_upload')) {
1631
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1632
+                    }
1606 1633
 
1607
-                    if (!is_dir($geodir_uploadpath))
1608
-                        mkdir($geodir_uploadpath);
1634
+                    if (!is_dir($geodir_uploadpath)) {
1635
+                                            mkdir($geodir_uploadpath);
1636
+                    }
1609 1637
 
1610 1638
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1611 1639
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1618,16 +1646,19 @@  discard block
 block discarded – undo
1618 1646
                     }
1619 1647
 
1620 1648
                     $uploaded_file = '';
1621
-                    if (file_exists($img_path))
1622
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1649
+                    if (file_exists($img_path)) {
1650
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1651
+                    }
1623 1652
 
1624 1653
                     if ($curr_img_dir != $geodir_uploaddir) {
1625
-                        if (file_exists($img_path))
1626
-                            unlink($img_path);
1654
+                        if (file_exists($img_path)) {
1655
+                                                    unlink($img_path);
1656
+                        }
1627 1657
                     }
1628 1658
 
1629
-                    if (!empty($uploaded_file))
1630
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1659
+                    if (!empty($uploaded_file)) {
1660
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1661
+                    }
1631 1662
 
1632 1663
                 } else {
1633 1664
                     $file_urls = $post_image[$m];
@@ -1648,8 +1679,9 @@  discard block
 block discarded – undo
1648 1679
 
1649 1680
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1650 1681
 
1651
-        if (!empty($invalid_files))
1652
-            geodir_remove_attachments($invalid_files);
1682
+        if (!empty($invalid_files)) {
1683
+                    geodir_remove_attachments($invalid_files);
1684
+        }
1653 1685
 
1654 1686
     }
1655 1687
 }
@@ -1875,8 +1907,9 @@  discard block
 block discarded – undo
1875 1907
 
1876 1908
         $all_postypes = geodir_get_posttypes();
1877 1909
 
1878
-        if (!in_array($post_type, $all_postypes))
1879
-            return false;
1910
+        if (!in_array($post_type, $all_postypes)) {
1911
+                    return false;
1912
+        }
1880 1913
 
1881 1914
         $fields = array();
1882 1915
 
@@ -1974,8 +2007,10 @@  discard block
 block discarded – undo
1974 2007
         }
1975 2008
 
1976 2009
         return $field_ids;
1977
-    else:
1978
-        return false;
2010
+    else {
2011
+    	:
2012
+        return false;
2013
+    }
1979 2014
     endif;
1980 2015
 }
1981 2016
 
@@ -2148,8 +2183,9 @@  discard block
 block discarded – undo
2148 2183
 
2149 2184
             return $field_id;
2150 2185
 
2151
-        } else
2152
-            return 0;
2186
+        } else {
2187
+                    return 0;
2188
+        }
2153 2189
 
2154 2190
     }
2155 2191
 }
@@ -2190,8 +2226,9 @@  discard block
 block discarded – undo
2190 2226
         $htmlvar_name = isset($field_type_key) ? $field_type_key : '';
2191 2227
 
2192 2228
         $site_title = '';
2193
-        if ($site_title == '')
2194
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2229
+        if ($site_title == '') {
2230
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2231
+        }
2195 2232
 
2196 2233
         if ($site_title == '') {
2197 2234
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2205,8 +2242,9 @@  discard block
 block discarded – undo
2205 2242
             }
2206 2243
         }
2207 2244
 
2208
-        if ($htmlvar_name == '')
2209
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2245
+        if ($htmlvar_name == '') {
2246
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2247
+        }
2210 2248
 
2211 2249
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2212 2250
 
@@ -2219,7 +2257,7 @@  discard block
 block discarded – undo
2219 2257
 
2220 2258
                 if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
2221 2259
                     $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>';
2222
-                }elseif(isset($cso['field_icon']) && $cso['field_icon']){
2260
+                } elseif(isset($cso['field_icon']) && $cso['field_icon']){
2223 2261
                     $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
2224 2262
                 }
2225 2263
 
@@ -2654,7 +2692,7 @@  discard block
 block discarded – undo
2654 2692
     $dt_value = '';
2655 2693
     if (isset($field_info->data_type)) {
2656 2694
         $dt_value  = esc_attr($field_info->data_type);
2657
-    }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2695
+    } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
2658 2696
         $dt_value  = $cf['defaults']['data_type'];
2659 2697
     }
2660 2698
     ?>
@@ -2686,7 +2724,7 @@  discard block
 block discarded – undo
2686 2724
     $value = '';
2687 2725
     if (isset($field_info->decimal_point)) {
2688 2726
         $value = esc_attr($field_info->decimal_point);
2689
-    }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2727
+    } elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
2690 2728
         $value = $cf['defaults']['decimal_point'];
2691 2729
     }
2692 2730
     ?>
@@ -2760,11 +2798,13 @@  discard block
 block discarded – undo
2760 2798
 
2761 2799
             <?php
2762 2800
             $selected = '';
2763
-            if (isset($field_info->extra_fields))
2764
-                $advanced_editor = unserialize($field_info->extra_fields);
2801
+            if (isset($field_info->extra_fields)) {
2802
+                            $advanced_editor = unserialize($field_info->extra_fields);
2803
+            }
2765 2804
 
2766
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2767
-                $selected = 'checked="checked"';
2805
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2806
+                            $selected = 'checked="checked"';
2807
+            }
2768 2808
             ?>
2769 2809
 
2770 2810
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2786,7 +2826,7 @@  discard block
 block discarded – undo
2786 2826
     $value = '';
2787 2827
     if (isset($field_info->validation_pattern)) {
2788 2828
         $value = esc_attr($field_info->validation_pattern);
2789
-    }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2829
+    } elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
2790 2830
         $value = esc_attr($cf['defaults']['validation_pattern']);
2791 2831
     }
2792 2832
     ?>
@@ -2806,7 +2846,7 @@  discard block
 block discarded – undo
2806 2846
     $value = '';
2807 2847
     if (isset($field_info->validation_msg)) {
2808 2848
         $value = esc_attr($field_info->validation_msg);
2809
-    }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2849
+    } elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
2810 2850
         $value = esc_attr($cf['defaults']['validation_msg']);
2811 2851
     }
2812 2852
     ?>
@@ -2836,8 +2876,9 @@  discard block
 block discarded – undo
2836 2876
 
2837 2877
     if (!isset($field_info->post_type)) {
2838 2878
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2839
-    } else
2840
-        $post_type = $field_info->post_type;
2879
+    } else {
2880
+            $post_type = $field_info->post_type;
2881
+    }
2841 2882
     ?>
2842 2883
     <li style="display: none;">
2843 2884
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
@@ -3111,7 +3152,7 @@  discard block
 block discarded – undo
3111 3152
     $value = '';
3112 3153
     if (isset($field_info->option_values)) {
3113 3154
         $value = esc_attr($field_info->option_values);
3114
-    }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3155
+    } elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
3115 3156
         $value = esc_attr($cf['defaults']['option_values']);
3116 3157
     }
3117 3158
 
@@ -3254,7 +3295,7 @@  discard block
 block discarded – undo
3254 3295
     $value = '';
3255 3296
     if ($extra_fields && isset($extra_fields['is_price'])) {
3256 3297
     $value = esc_attr($extra_fields['is_price']);
3257
-    }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3298
+    } elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
3258 3299
     $value = esc_attr($cf['defaults']['extra_fields']['is_price']);
3259 3300
     }
3260 3301
 
@@ -3289,7 +3330,7 @@  discard block
 block discarded – undo
3289 3330
     $value = '';
3290 3331
     if ($extra_fields && isset($extra_fields['thousand_separator'])) {
3291 3332
         $value = esc_attr($extra_fields['thousand_separator']);
3292
-    }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3333
+    } elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
3293 3334
         $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']);
3294 3335
     }
3295 3336
     ?>
@@ -3316,7 +3357,7 @@  discard block
 block discarded – undo
3316 3357
     $value = '';
3317 3358
     if ($extra_fields && isset($extra_fields['decimal_separator'])) {
3318 3359
         $value = esc_attr($extra_fields['decimal_separator']);
3319
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3360
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
3320 3361
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']);
3321 3362
     }
3322 3363
     ?>
@@ -3339,7 +3380,7 @@  discard block
 block discarded – undo
3339 3380
     $value = '';
3340 3381
     if ($extra_fields && isset($extra_fields['decimal_display'])) {
3341 3382
         $value = esc_attr($extra_fields['decimal_display']);
3342
-    }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3383
+    } elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
3343 3384
         $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']);
3344 3385
     }
3345 3386
     ?>
@@ -3362,7 +3403,7 @@  discard block
 block discarded – undo
3362 3403
     $value = '';
3363 3404
     if ($extra_fields && isset($extra_fields['currency_symbol'])) {
3364 3405
         $value = esc_attr($extra_fields['currency_symbol']);
3365
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3406
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
3366 3407
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']);
3367 3408
     }
3368 3409
     ?>
@@ -3383,7 +3424,7 @@  discard block
 block discarded – undo
3383 3424
     $value = '';
3384 3425
     if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
3385 3426
         $value = esc_attr($extra_fields['currency_symbol_placement']);
3386
-    }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3427
+    } elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
3387 3428
         $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']);
3388 3429
     }
3389 3430
     ?>
@@ -3610,8 +3651,9 @@  discard block
 block discarded – undo
3610 3651
     $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left';
3611 3652
 
3612 3653
     if($decimals>0 && $decimal_display=='if'){
3613
-        if(is_int($number) || floor( $number ) == $number)
3614
-            $decimals = 0;
3654
+        if(is_int($number) || floor( $number ) == $number) {
3655
+                    $decimals = 0;
3656
+        }
3615 3657
     }
3616 3658
 
3617 3659
     $number = number_format($number,$decimals,$decimalpoint,$separator);
@@ -3620,7 +3662,7 @@  discard block
 block discarded – undo
3620 3662
 
3621 3663
     if($currency_symbol_placement=='left'){
3622 3664
         $number = $symbol . $number;
3623
-    }else{
3665
+    } else{
3624 3666
         $number = $number . $symbol;
3625 3667
     }
3626 3668
 
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 2 patches
Indentation   +1538 added lines, -1538 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = unserialize($cf['extra_fields']);
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = unserialize($cf['extra_fields']);
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,96 +617,96 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>';
692 692
 
693
-            $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
-                $extra_fields = maybe_unserialize($cf['extra_fields']);
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    $value = geodir_currency_format_number($value,$cf);
698
-                }
699
-            }
693
+			$value = $post->{$cf['htmlvar_name']};
694
+			if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
+				$extra_fields = maybe_unserialize($cf['extra_fields']);
696
+				if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
+					$value = geodir_currency_format_number($value,$cf);
698
+				}
699
+			}
700 700
 
701 701
 
702
-            $html .= $value;
703
-            $html .= '</div>';
702
+			$html .= $value;
703
+			$html .= '</div>';
704 704
 
705
-        endif;
705
+		endif;
706 706
 
707
-    }
707
+	}
708 708
 
709
-    return $html;
709
+	return $html;
710 710
 }
711 711
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
712 712
 
@@ -723,98 +723,98 @@  discard block
 block discarded – undo
723 723
  */
724 724
 function geodir_cf_radio($html,$location,$cf,$p=''){
725 725
 
726
-    // check we have the post value
727
-    if(is_int($p)){$post = geodir_get_post_info($p);}
728
-    else{ global $post;}
729
-
730
-    if(!is_array($cf) && $cf!=''){
731
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
732
-        if(!$cf){return NULL;}
733
-    }
734
-
735
-    $html_var = $cf['htmlvar_name'];
736
-
737
-    // Check if there is a location specific filter.
738
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
-        /**
740
-         * Filter the radio html by location.
741
-         *
742
-         * @param string $html The html to filter.
743
-         * @param array $cf The custom field array.
744
-         * @since 1.6.6
745
-         */
746
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
-    }
748
-
749
-    // Check if there is a custom field specific filter.
750
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
-        /**
752
-         * Filter the radio html by individual custom field.
753
-         *
754
-         * @param string $html The html to filter.
755
-         * @param string $location The location to output the html.
756
-         * @param array $cf The custom field array.
757
-         * @since 1.6.6
758
-         */
759
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
-    }
761
-
762
-    // Check if there is a custom field key specific filter.
763
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
-        /**
765
-         * Filter the radio html by field type key.
766
-         *
767
-         * @param string $html The html to filter.
768
-         * @param string $location The location to output the html.
769
-         * @param array $cf The custom field array.
770
-         * @since 1.6.6
771
-         */
772
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
-    }
774
-
775
-    // If not html then we run the standard output.
776
-    if(empty($html)){
777
-
778
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
779
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
780
-
781
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
782
-                $html_val = __('No', 'geodirectory');
783
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
784
-                $html_val = __('Yes', 'geodirectory');
785
-            } else {
786
-                if (!empty($cf['option_values'])) {
787
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
788
-
789
-                    if (!empty($cf_option_values)) {
790
-                        foreach ($cf_option_values as $cf_option_value) {
791
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
792
-                                $html_val = $cf_option_value['label'];
793
-                            }
794
-                        }
795
-                    }
796
-                }
797
-            }
798
-
799
-            $field_icon = geodir_field_icon_proccess($cf);
800
-            if (strpos($field_icon, 'http') !== false) {
801
-                $field_icon_af = '';
802
-            } elseif ($field_icon == '') {
803
-                $field_icon_af = '';
804
-            } else {
805
-                $field_icon_af = $field_icon;
806
-                $field_icon = '';
807
-            }
808
-
809
-
810
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
811
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
812
-            $html .= '</span>' . $html_val . '</div>';
813
-        endif;
814
-
815
-    }
816
-
817
-    return $html;
726
+	// check we have the post value
727
+	if(is_int($p)){$post = geodir_get_post_info($p);}
728
+	else{ global $post;}
729
+
730
+	if(!is_array($cf) && $cf!=''){
731
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
732
+		if(!$cf){return NULL;}
733
+	}
734
+
735
+	$html_var = $cf['htmlvar_name'];
736
+
737
+	// Check if there is a location specific filter.
738
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
+		/**
740
+		 * Filter the radio html by location.
741
+		 *
742
+		 * @param string $html The html to filter.
743
+		 * @param array $cf The custom field array.
744
+		 * @since 1.6.6
745
+		 */
746
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
+	}
748
+
749
+	// Check if there is a custom field specific filter.
750
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
+		/**
752
+		 * Filter the radio html by individual custom field.
753
+		 *
754
+		 * @param string $html The html to filter.
755
+		 * @param string $location The location to output the html.
756
+		 * @param array $cf The custom field array.
757
+		 * @since 1.6.6
758
+		 */
759
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
+	}
761
+
762
+	// Check if there is a custom field key specific filter.
763
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
+		/**
765
+		 * Filter the radio html by field type key.
766
+		 *
767
+		 * @param string $html The html to filter.
768
+		 * @param string $location The location to output the html.
769
+		 * @param array $cf The custom field array.
770
+		 * @since 1.6.6
771
+		 */
772
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
+	}
774
+
775
+	// If not html then we run the standard output.
776
+	if(empty($html)){
777
+
778
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
779
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
780
+
781
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
782
+				$html_val = __('No', 'geodirectory');
783
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
784
+				$html_val = __('Yes', 'geodirectory');
785
+			} else {
786
+				if (!empty($cf['option_values'])) {
787
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
788
+
789
+					if (!empty($cf_option_values)) {
790
+						foreach ($cf_option_values as $cf_option_value) {
791
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
792
+								$html_val = $cf_option_value['label'];
793
+							}
794
+						}
795
+					}
796
+				}
797
+			}
798
+
799
+			$field_icon = geodir_field_icon_proccess($cf);
800
+			if (strpos($field_icon, 'http') !== false) {
801
+				$field_icon_af = '';
802
+			} elseif ($field_icon == '') {
803
+				$field_icon_af = '';
804
+			} else {
805
+				$field_icon_af = $field_icon;
806
+				$field_icon = '';
807
+			}
808
+
809
+
810
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
811
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
812
+			$html .= '</span>' . $html_val . '</div>';
813
+		endif;
814
+
815
+	}
816
+
817
+	return $html;
818 818
 }
819 819
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
820 820
 
@@ -831,92 +831,92 @@  discard block
 block discarded – undo
831 831
  */
832 832
 function geodir_cf_select($html,$location,$cf,$p=''){
833 833
 
834
-    // check we have the post value
835
-    if(is_int($p)){$post = geodir_get_post_info($p);}
836
-    else{ global $post;}
837
-
838
-    if(!is_array($cf) && $cf!=''){
839
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
840
-        if(!$cf){return NULL;}
841
-    }
842
-
843
-    $html_var = $cf['htmlvar_name'];
844
-
845
-    // Check if there is a location specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
847
-        /**
848
-         * Filter the select html by location.
849
-         *
850
-         * @param string $html The html to filter.
851
-         * @param array $cf The custom field array.
852
-         * @since 1.6.6
853
-         */
854
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
855
-    }
856
-
857
-    // Check if there is a custom field specific filter.
858
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
859
-        /**
860
-         * Filter the select html by individual custom field.
861
-         *
862
-         * @param string $html The html to filter.
863
-         * @param string $location The location to output the html.
864
-         * @param array $cf The custom field array.
865
-         * @since 1.6.6
866
-         */
867
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
868
-    }
869
-
870
-    // Check if there is a custom field key specific filter.
871
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
872
-        /**
873
-         * Filter the select html by field type key.
874
-         *
875
-         * @param string $html The html to filter.
876
-         * @param string $location The location to output the html.
877
-         * @param array $cf The custom field array.
878
-         * @since 1.6.6
879
-         */
880
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
881
-    }
882
-
883
-    // If not html then we run the standard output.
884
-    if(empty($html)){
885
-
886
-        if ($post->{$cf['htmlvar_name']}):
887
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
888
-
889
-            if (!empty($cf['option_values'])) {
890
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
891
-
892
-                if (!empty($cf_option_values)) {
893
-                    foreach ($cf_option_values as $cf_option_value) {
894
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
895
-                            //$field_value = $cf_option_value['label']; // no longer needed here.
896
-                        }
897
-                    }
898
-                }
899
-            }
900
-
901
-            $field_icon = geodir_field_icon_proccess($cf);
902
-            if (strpos($field_icon, 'http') !== false) {
903
-                $field_icon_af = '';
904
-            } elseif ($field_icon == '') {
905
-                $field_icon_af = '';
906
-            } else {
907
-                $field_icon_af = $field_icon;
908
-                $field_icon = '';
909
-            }
910
-
911
-
912
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
913
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
914
-            $html .= '</span>' . $field_value . '</div>';
915
-        endif;
916
-
917
-    }
918
-
919
-    return $html;
834
+	// check we have the post value
835
+	if(is_int($p)){$post = geodir_get_post_info($p);}
836
+	else{ global $post;}
837
+
838
+	if(!is_array($cf) && $cf!=''){
839
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
840
+		if(!$cf){return NULL;}
841
+	}
842
+
843
+	$html_var = $cf['htmlvar_name'];
844
+
845
+	// Check if there is a location specific filter.
846
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
847
+		/**
848
+		 * Filter the select html by location.
849
+		 *
850
+		 * @param string $html The html to filter.
851
+		 * @param array $cf The custom field array.
852
+		 * @since 1.6.6
853
+		 */
854
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
855
+	}
856
+
857
+	// Check if there is a custom field specific filter.
858
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
859
+		/**
860
+		 * Filter the select html by individual custom field.
861
+		 *
862
+		 * @param string $html The html to filter.
863
+		 * @param string $location The location to output the html.
864
+		 * @param array $cf The custom field array.
865
+		 * @since 1.6.6
866
+		 */
867
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
868
+	}
869
+
870
+	// Check if there is a custom field key specific filter.
871
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
872
+		/**
873
+		 * Filter the select html by field type key.
874
+		 *
875
+		 * @param string $html The html to filter.
876
+		 * @param string $location The location to output the html.
877
+		 * @param array $cf The custom field array.
878
+		 * @since 1.6.6
879
+		 */
880
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
881
+	}
882
+
883
+	// If not html then we run the standard output.
884
+	if(empty($html)){
885
+
886
+		if ($post->{$cf['htmlvar_name']}):
887
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
888
+
889
+			if (!empty($cf['option_values'])) {
890
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
891
+
892
+				if (!empty($cf_option_values)) {
893
+					foreach ($cf_option_values as $cf_option_value) {
894
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
895
+							//$field_value = $cf_option_value['label']; // no longer needed here.
896
+						}
897
+					}
898
+				}
899
+			}
900
+
901
+			$field_icon = geodir_field_icon_proccess($cf);
902
+			if (strpos($field_icon, 'http') !== false) {
903
+				$field_icon_af = '';
904
+			} elseif ($field_icon == '') {
905
+				$field_icon_af = '';
906
+			} else {
907
+				$field_icon_af = $field_icon;
908
+				$field_icon = '';
909
+			}
910
+
911
+
912
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
913
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
914
+			$html .= '</span>' . $field_value . '</div>';
915
+		endif;
916
+
917
+	}
918
+
919
+	return $html;
920 920
 }
921 921
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
922 922
 
@@ -933,117 +933,117 @@  discard block
 block discarded – undo
933 933
  */
934 934
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
935 935
 
936
-    // check we have the post value
937
-    if(is_int($p)){$post = geodir_get_post_info($p);}
938
-    else{ global $post;}
939
-
940
-    if(!is_array($cf) && $cf!=''){
941
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
942
-        if(!$cf){return NULL;}
943
-    }
944
-
945
-    $html_var = $cf['htmlvar_name'];
946
-
947
-    // Check if there is a location specific filter.
948
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
949
-        /**
950
-         * Filter the multiselect html by location.
951
-         *
952
-         * @param string $html The html to filter.
953
-         * @param array $cf The custom field array.
954
-         * @since 1.6.6
955
-         */
956
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
957
-    }
958
-
959
-    // Check if there is a custom field specific filter.
960
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
961
-        /**
962
-         * Filter the multiselect html by individual custom field.
963
-         *
964
-         * @param string $html The html to filter.
965
-         * @param string $location The location to output the html.
966
-         * @param array $cf The custom field array.
967
-         * @since 1.6.6
968
-         */
969
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
970
-    }
971
-
972
-    // Check if there is a custom field key specific filter.
973
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
974
-        /**
975
-         * Filter the multiselect html by field type key.
976
-         *
977
-         * @param string $html The html to filter.
978
-         * @param string $location The location to output the html.
979
-         * @param array $cf The custom field array.
980
-         * @since 1.6.6
981
-         */
982
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
983
-    }
984
-
985
-    // If not html then we run the standard output.
986
-    if(empty($html)){
987
-
988
-
989
-        if (!empty($post->{$cf['htmlvar_name']})):
990
-
991
-            if (is_array($post->{$cf['htmlvar_name']})) {
992
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
993
-            }
994
-
995
-            $field_icon = geodir_field_icon_proccess($cf);
996
-            if (strpos($field_icon, 'http') !== false) {
997
-                $field_icon_af = '';
998
-            } elseif ($field_icon == '') {
999
-                $field_icon_af = '';
1000
-            } else {
1001
-                $field_icon_af = $field_icon;
1002
-                $field_icon = '';
1003
-            }
1004
-
1005
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1006
-
1007
-            if(is_array($field_values)){
1008
-                $field_values = array_map('trim', $field_values);
1009
-            }
1010
-
1011
-            $option_values = array();
1012
-            if (!empty($cf['option_values'])) {
1013
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1014
-
1015
-                if (!empty($cf_option_values)) {
1016
-                    foreach ($cf_option_values as $cf_option_value) {
1017
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1018
-                            $option_values[] = $cf_option_value['label'];
1019
-                        }
1020
-                    }
1021
-                }
1022
-            }
1023
-
1024
-
1025
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1026
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1027
-            $html .= '</span>';
1028
-
1029
-            if (count($option_values) > 1) {
1030
-                $html .= '<ul>';
1031
-
1032
-                foreach ($option_values as $val) {
1033
-                    $html .= '<li>' . $val . '</li>';
1034
-                }
1035
-
1036
-                $html .= '</ul>';
1037
-            } else {
1038
-                $html .= $post->{$cf['htmlvar_name']};
1039
-            }
1040
-
1041
-            $html .= '</div>';
1042
-        endif;
1043
-
1044
-    }
1045
-
1046
-    return $html;
936
+	// check we have the post value
937
+	if(is_int($p)){$post = geodir_get_post_info($p);}
938
+	else{ global $post;}
939
+
940
+	if(!is_array($cf) && $cf!=''){
941
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
942
+		if(!$cf){return NULL;}
943
+	}
944
+
945
+	$html_var = $cf['htmlvar_name'];
946
+
947
+	// Check if there is a location specific filter.
948
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
949
+		/**
950
+		 * Filter the multiselect html by location.
951
+		 *
952
+		 * @param string $html The html to filter.
953
+		 * @param array $cf The custom field array.
954
+		 * @since 1.6.6
955
+		 */
956
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
957
+	}
958
+
959
+	// Check if there is a custom field specific filter.
960
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
961
+		/**
962
+		 * Filter the multiselect html by individual custom field.
963
+		 *
964
+		 * @param string $html The html to filter.
965
+		 * @param string $location The location to output the html.
966
+		 * @param array $cf The custom field array.
967
+		 * @since 1.6.6
968
+		 */
969
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
970
+	}
971
+
972
+	// Check if there is a custom field key specific filter.
973
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
974
+		/**
975
+		 * Filter the multiselect html by field type key.
976
+		 *
977
+		 * @param string $html The html to filter.
978
+		 * @param string $location The location to output the html.
979
+		 * @param array $cf The custom field array.
980
+		 * @since 1.6.6
981
+		 */
982
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
983
+	}
984
+
985
+	// If not html then we run the standard output.
986
+	if(empty($html)){
987
+
988
+
989
+		if (!empty($post->{$cf['htmlvar_name']})):
990
+
991
+			if (is_array($post->{$cf['htmlvar_name']})) {
992
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
993
+			}
994
+
995
+			$field_icon = geodir_field_icon_proccess($cf);
996
+			if (strpos($field_icon, 'http') !== false) {
997
+				$field_icon_af = '';
998
+			} elseif ($field_icon == '') {
999
+				$field_icon_af = '';
1000
+			} else {
1001
+				$field_icon_af = $field_icon;
1002
+				$field_icon = '';
1003
+			}
1004
+
1005
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1006
+
1007
+			if(is_array($field_values)){
1008
+				$field_values = array_map('trim', $field_values);
1009
+			}
1010
+
1011
+			$option_values = array();
1012
+			if (!empty($cf['option_values'])) {
1013
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1014
+
1015
+				if (!empty($cf_option_values)) {
1016
+					foreach ($cf_option_values as $cf_option_value) {
1017
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1018
+							$option_values[] = $cf_option_value['label'];
1019
+						}
1020
+					}
1021
+				}
1022
+			}
1023
+
1024
+
1025
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1026
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1027
+			$html .= '</span>';
1028
+
1029
+			if (count($option_values) > 1) {
1030
+				$html .= '<ul>';
1031
+
1032
+				foreach ($option_values as $val) {
1033
+					$html .= '<li>' . $val . '</li>';
1034
+				}
1035
+
1036
+				$html .= '</ul>';
1037
+			} else {
1038
+				$html .= $post->{$cf['htmlvar_name']};
1039
+			}
1040
+
1041
+			$html .= '</div>';
1042
+		endif;
1043
+
1044
+	}
1045
+
1046
+	return $html;
1047 1047
 }
1048 1048
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1049 1049
 
@@ -1060,152 +1060,152 @@  discard block
 block discarded – undo
1060 1060
  */
1061 1061
 function geodir_cf_email($html,$location,$cf,$p=''){
1062 1062
 
1063
-    // check we have the post value
1064
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1065
-    else{ global $post;}
1066
-
1067
-    if(!is_array($cf) && $cf!=''){
1068
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1069
-        if(!$cf){return NULL;}
1070
-    }
1071
-
1072
-    $html_var = $cf['htmlvar_name'];
1073
-
1074
-    // Check if there is a location specific filter.
1075
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1076
-        /**
1077
-         * Filter the email html by location.
1078
-         *
1079
-         * @param string $html The html to filter.
1080
-         * @param array $cf The custom field array.
1081
-         * @since 1.6.6
1082
-         */
1083
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1084
-    }
1085
-
1086
-    // Check if there is a custom field specific filter.
1087
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1088
-        /**
1089
-         * Filter the email html by individual custom field.
1090
-         *
1091
-         * @param string $html The html to filter.
1092
-         * @param string $location The location to output the html.
1093
-         * @param array $cf The custom field array.
1094
-         * @since 1.6.6
1095
-         */
1096
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1097
-    }
1098
-
1099
-    // Check if there is a custom field key specific filter.
1100
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1101
-        /**
1102
-         * Filter the email html by field type key.
1103
-         *
1104
-         * @param string $html The html to filter.
1105
-         * @param string $location The location to output the html.
1106
-         * @param array $cf The custom field array.
1107
-         * @since 1.6.6
1108
-         */
1109
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1110
-    }
1111
-
1112
-    // If not html then we run the standard output.
1113
-    if(empty($html)){
1114
-
1115
-        global $preview;
1116
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1117
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1118
-        }
1119
-
1120
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1121
-
1122
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1123
-            $send_to_friend = true;
1124
-            $b_send_inquiry = '';
1125
-            $b_sendtofriend = '';
1126
-
1127
-            $html = '';
1128
-            if (!$preview) {
1129
-                $b_send_inquiry = 'b_send_inquiry';
1130
-                $b_sendtofriend = 'b_sendtofriend';
1131
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1132
-            }
1133
-
1134
-            $field_icon = geodir_field_icon_proccess($cf);
1135
-            if (strpos($field_icon, 'http') !== false) {
1136
-                $field_icon_af = '';
1137
-            } elseif ($field_icon == '') {
1138
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1139
-            } else {
1140
-                $field_icon_af = $field_icon;
1141
-                $field_icon = '';
1142
-            }
1143
-
1144
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1145
-            $seperator = '';
1146
-            if ($post->{$cf['htmlvar_name']}) {
1147
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1148
-                $seperator = ' | ';
1149
-            }
1150
-
1151
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1152
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1153
-            }
1154
-
1155
-            $html .= '</span></div>';
1156
-
1157
-
1158
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1159
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1160
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1161
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1162
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1163
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1164
-            }
1165
-
1166
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1167
-
1168
-        } else {
1169
-
1170
-            if ($post->{$cf['htmlvar_name']}) {
1171
-
1172
-                $field_icon = geodir_field_icon_proccess($cf);
1173
-                if (strpos($field_icon, 'http') !== false) {
1174
-                    $field_icon_af = '';
1175
-                } elseif ($field_icon == '') {
1176
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1177
-                } else {
1178
-                    $field_icon_af = $field_icon;
1179
-                    $field_icon = '';
1180
-                }
1181
-
1182
-
1183
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1184
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1185
-                $html .= '</span><span class="geodir-email-address-output">';
1186
-                $email = $post->{$cf['htmlvar_name']} ;
1187
-                if($e_split = explode('@',$email)){
1188
-                    /**
1189
-                     * Filter email custom field name output.
1190
-                     *
1191
-                     * @since 1.5.3
1192
-                     *
1193
-                     * @param string $email The email string being output.
1194
-                     * @param array $cf Custom field variables array.
1195
-                     */
1196
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1197
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1198
-                }else{
1199
-                    $html .=  $email;
1200
-                }
1201
-                $html .= '</span></div>';
1202
-            }
1203
-
1204
-        }
1205
-
1206
-    }
1207
-
1208
-    return $html;
1063
+	// check we have the post value
1064
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1065
+	else{ global $post;}
1066
+
1067
+	if(!is_array($cf) && $cf!=''){
1068
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1069
+		if(!$cf){return NULL;}
1070
+	}
1071
+
1072
+	$html_var = $cf['htmlvar_name'];
1073
+
1074
+	// Check if there is a location specific filter.
1075
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1076
+		/**
1077
+		 * Filter the email html by location.
1078
+		 *
1079
+		 * @param string $html The html to filter.
1080
+		 * @param array $cf The custom field array.
1081
+		 * @since 1.6.6
1082
+		 */
1083
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1084
+	}
1085
+
1086
+	// Check if there is a custom field specific filter.
1087
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1088
+		/**
1089
+		 * Filter the email html by individual custom field.
1090
+		 *
1091
+		 * @param string $html The html to filter.
1092
+		 * @param string $location The location to output the html.
1093
+		 * @param array $cf The custom field array.
1094
+		 * @since 1.6.6
1095
+		 */
1096
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1097
+	}
1098
+
1099
+	// Check if there is a custom field key specific filter.
1100
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1101
+		/**
1102
+		 * Filter the email html by field type key.
1103
+		 *
1104
+		 * @param string $html The html to filter.
1105
+		 * @param string $location The location to output the html.
1106
+		 * @param array $cf The custom field array.
1107
+		 * @since 1.6.6
1108
+		 */
1109
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1110
+	}
1111
+
1112
+	// If not html then we run the standard output.
1113
+	if(empty($html)){
1114
+
1115
+		global $preview;
1116
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1117
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1118
+		}
1119
+
1120
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1121
+
1122
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1123
+			$send_to_friend = true;
1124
+			$b_send_inquiry = '';
1125
+			$b_sendtofriend = '';
1126
+
1127
+			$html = '';
1128
+			if (!$preview) {
1129
+				$b_send_inquiry = 'b_send_inquiry';
1130
+				$b_sendtofriend = 'b_sendtofriend';
1131
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1132
+			}
1133
+
1134
+			$field_icon = geodir_field_icon_proccess($cf);
1135
+			if (strpos($field_icon, 'http') !== false) {
1136
+				$field_icon_af = '';
1137
+			} elseif ($field_icon == '') {
1138
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1139
+			} else {
1140
+				$field_icon_af = $field_icon;
1141
+				$field_icon = '';
1142
+			}
1143
+
1144
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1145
+			$seperator = '';
1146
+			if ($post->{$cf['htmlvar_name']}) {
1147
+				$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1148
+				$seperator = ' | ';
1149
+			}
1150
+
1151
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1152
+				$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1153
+			}
1154
+
1155
+			$html .= '</span></div>';
1156
+
1157
+
1158
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1159
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1160
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1161
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1162
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1163
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1164
+			}
1165
+
1166
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1167
+
1168
+		} else {
1169
+
1170
+			if ($post->{$cf['htmlvar_name']}) {
1171
+
1172
+				$field_icon = geodir_field_icon_proccess($cf);
1173
+				if (strpos($field_icon, 'http') !== false) {
1174
+					$field_icon_af = '';
1175
+				} elseif ($field_icon == '') {
1176
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1177
+				} else {
1178
+					$field_icon_af = $field_icon;
1179
+					$field_icon = '';
1180
+				}
1181
+
1182
+
1183
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1184
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1185
+				$html .= '</span><span class="geodir-email-address-output">';
1186
+				$email = $post->{$cf['htmlvar_name']} ;
1187
+				if($e_split = explode('@',$email)){
1188
+					/**
1189
+					 * Filter email custom field name output.
1190
+					 *
1191
+					 * @since 1.5.3
1192
+					 *
1193
+					 * @param string $email The email string being output.
1194
+					 * @param array $cf Custom field variables array.
1195
+					 */
1196
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1197
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1198
+				}else{
1199
+					$html .=  $email;
1200
+				}
1201
+				$html .= '</span></div>';
1202
+			}
1203
+
1204
+		}
1205
+
1206
+	}
1207
+
1208
+	return $html;
1209 1209
 }
1210 1210
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1211 1211
 
@@ -1222,130 +1222,130 @@  discard block
 block discarded – undo
1222 1222
  */
1223 1223
 function geodir_cf_file($html,$location,$cf,$p=''){
1224 1224
 
1225
-    // check we have the post value
1226
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1227
-    else{ global $post;}
1228
-
1229
-    if(!is_array($cf) && $cf!=''){
1230
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1231
-        if(!$cf){return NULL;}
1232
-    }
1233
-
1234
-    $html_var = $cf['htmlvar_name'];
1235
-
1236
-    // Check if there is a location specific filter.
1237
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1238
-        /**
1239
-         * Filter the file html by location.
1240
-         *
1241
-         * @param string $html The html to filter.
1242
-         * @param array $cf The custom field array.
1243
-         * @since 1.6.6
1244
-         */
1245
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1246
-    }
1247
-
1248
-    // Check if there is a custom field specific filter.
1249
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1250
-        /**
1251
-         * Filter the file html by individual custom field.
1252
-         *
1253
-         * @param string $html The html to filter.
1254
-         * @param string $location The location to output the html.
1255
-         * @param array $cf The custom field array.
1256
-         * @since 1.6.6
1257
-         */
1258
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1259
-    }
1260
-
1261
-    // Check if there is a custom field key specific filter.
1262
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1263
-        /**
1264
-         * Filter the file html by field type key.
1265
-         *
1266
-         * @param string $html The html to filter.
1267
-         * @param string $location The location to output the html.
1268
-         * @param array $cf The custom field array.
1269
-         * @since 1.6.6
1270
-         */
1271
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1272
-    }
1273
-
1274
-    // If not html then we run the standard output.
1275
-    if(empty($html)){
1276
-
1277
-        if (!empty($post->{$cf['htmlvar_name']})):
1278
-
1279
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1280
-            if (!empty($files)):
1281
-
1282
-                $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1283
-                $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'] : '';
1284
-
1285
-                $file_paths = '';
1286
-                foreach ($files as $file) {
1287
-                    if (!empty($file)) {
1288
-
1289
-                        // $filetype = wp_check_filetype($file);
1290
-
1291
-                        $image_name_arr = explode('/', $file);
1292
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1293
-                        $filename = end($image_name_arr);
1294
-                        $img_name_arr = explode('.', $filename);
1295
-
1296
-                        $arr_file_type = wp_check_filetype($filename);
1297
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1298
-                            continue;
1299
-                        }
1300
-
1301
-                        $uploaded_file_type = $arr_file_type['type'];
1302
-                        $uploaded_file_ext = $arr_file_type['ext'];
1303
-
1304
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1305
-                            continue; // Invalid file type.
1306
-                        }
1307
-
1308
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1309
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1310
-
1311
-                        // If the uploaded file is image
1312
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1313
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1314
-                            $file_paths .= '<a href="'.$file.'">';
1315
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1316
-                            $file_paths .= '</a>';
1317
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1318
-                            $file_paths .= '</div>';
1319
-                        } else {
1320
-                            $ext_path = '_' . $html_var . '_';
1321
-                            $filename = explode($ext_path, $filename);
1322
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1323
-                        }
1324
-                    }
1325
-                }
1326
-
1327
-                $field_icon = geodir_field_icon_proccess($cf);
1328
-                if (strpos($field_icon, 'http') !== false) {
1329
-                    $field_icon_af = '';
1330
-                } elseif ($field_icon == '') {
1331
-                    $field_icon_af = '';
1332
-                } else {
1333
-                    $field_icon_af = $field_icon;
1334
-                    $field_icon = '';
1335
-                }
1336
-
1337
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1338
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1339
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1340
-                $html .= '</span>';
1341
-                $html .= $file_paths . '</div></div>';
1342
-
1343
-            endif;
1344
-        endif;
1345
-
1346
-    }
1347
-
1348
-    return $html;
1225
+	// check we have the post value
1226
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1227
+	else{ global $post;}
1228
+
1229
+	if(!is_array($cf) && $cf!=''){
1230
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1231
+		if(!$cf){return NULL;}
1232
+	}
1233
+
1234
+	$html_var = $cf['htmlvar_name'];
1235
+
1236
+	// Check if there is a location specific filter.
1237
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1238
+		/**
1239
+		 * Filter the file html by location.
1240
+		 *
1241
+		 * @param string $html The html to filter.
1242
+		 * @param array $cf The custom field array.
1243
+		 * @since 1.6.6
1244
+		 */
1245
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1246
+	}
1247
+
1248
+	// Check if there is a custom field specific filter.
1249
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1250
+		/**
1251
+		 * Filter the file html by individual custom field.
1252
+		 *
1253
+		 * @param string $html The html to filter.
1254
+		 * @param string $location The location to output the html.
1255
+		 * @param array $cf The custom field array.
1256
+		 * @since 1.6.6
1257
+		 */
1258
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1259
+	}
1260
+
1261
+	// Check if there is a custom field key specific filter.
1262
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1263
+		/**
1264
+		 * Filter the file html by field type key.
1265
+		 *
1266
+		 * @param string $html The html to filter.
1267
+		 * @param string $location The location to output the html.
1268
+		 * @param array $cf The custom field array.
1269
+		 * @since 1.6.6
1270
+		 */
1271
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1272
+	}
1273
+
1274
+	// If not html then we run the standard output.
1275
+	if(empty($html)){
1276
+
1277
+		if (!empty($post->{$cf['htmlvar_name']})):
1278
+
1279
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1280
+			if (!empty($files)):
1281
+
1282
+				$extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1283
+				$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'] : '';
1284
+
1285
+				$file_paths = '';
1286
+				foreach ($files as $file) {
1287
+					if (!empty($file)) {
1288
+
1289
+						// $filetype = wp_check_filetype($file);
1290
+
1291
+						$image_name_arr = explode('/', $file);
1292
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1293
+						$filename = end($image_name_arr);
1294
+						$img_name_arr = explode('.', $filename);
1295
+
1296
+						$arr_file_type = wp_check_filetype($filename);
1297
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1298
+							continue;
1299
+						}
1300
+
1301
+						$uploaded_file_type = $arr_file_type['type'];
1302
+						$uploaded_file_ext = $arr_file_type['ext'];
1303
+
1304
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1305
+							continue; // Invalid file type.
1306
+						}
1307
+
1308
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1309
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1310
+
1311
+						// If the uploaded file is image
1312
+						if (in_array($uploaded_file_type, $image_file_types)) {
1313
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1314
+							$file_paths .= '<a href="'.$file.'">';
1315
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1316
+							$file_paths .= '</a>';
1317
+							//$file_paths .= '<img src="'.$file.'"  />';	
1318
+							$file_paths .= '</div>';
1319
+						} else {
1320
+							$ext_path = '_' . $html_var . '_';
1321
+							$filename = explode($ext_path, $filename);
1322
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1323
+						}
1324
+					}
1325
+				}
1326
+
1327
+				$field_icon = geodir_field_icon_proccess($cf);
1328
+				if (strpos($field_icon, 'http') !== false) {
1329
+					$field_icon_af = '';
1330
+				} elseif ($field_icon == '') {
1331
+					$field_icon_af = '';
1332
+				} else {
1333
+					$field_icon_af = $field_icon;
1334
+					$field_icon = '';
1335
+				}
1336
+
1337
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1338
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1339
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1340
+				$html .= '</span>';
1341
+				$html .= $file_paths . '</div></div>';
1342
+
1343
+			endif;
1344
+		endif;
1345
+
1346
+	}
1347
+
1348
+	return $html;
1349 1349
 }
1350 1350
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1351 1351
 
@@ -1363,80 +1363,80 @@  discard block
 block discarded – undo
1363 1363
  */
1364 1364
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1365 1365
 
1366
-    // check we have the post value
1367
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1368
-    else{ global $post;}
1369
-
1370
-    if(!is_array($cf) && $cf!=''){
1371
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1372
-        if(!$cf){return NULL;}
1373
-    }
1374
-
1375
-    $html_var = $cf['htmlvar_name'];
1376
-
1377
-    // Check if there is a location specific filter.
1378
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1379
-        /**
1380
-         * Filter the textarea html by location.
1381
-         *
1382
-         * @param string $html The html to filter.
1383
-         * @param array $cf The custom field array.
1384
-         * @since 1.6.6
1385
-         */
1386
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1387
-    }
1388
-
1389
-    // Check if there is a custom field specific filter.
1390
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1391
-        /**
1392
-         * Filter the textarea html by individual custom field.
1393
-         *
1394
-         * @param string $html The html to filter.
1395
-         * @param string $location The location to output the html.
1396
-         * @param array $cf The custom field array.
1397
-         * @since 1.6.6
1398
-         */
1399
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1400
-    }
1401
-
1402
-    // Check if there is a custom field key specific filter.
1403
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1404
-        /**
1405
-         * Filter the textarea html by field type key.
1406
-         *
1407
-         * @param string $html The html to filter.
1408
-         * @param string $location The location to output the html.
1409
-         * @param array $cf The custom field array.
1410
-         * @since 1.6.6
1411
-         */
1412
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1413
-    }
1414
-
1415
-    // If not html then we run the standard output.
1416
-    if(empty($html)){
1417
-
1418
-        if (!empty($post->{$cf['htmlvar_name']})) {
1419
-
1420
-            $field_icon = geodir_field_icon_proccess($cf);
1421
-            if (strpos($field_icon, 'http') !== false) {
1422
-                $field_icon_af = '';
1423
-            } elseif ($field_icon == '') {
1424
-                $field_icon_af = '';
1425
-            } else {
1426
-                $field_icon_af = $field_icon;
1427
-                $field_icon = '';
1428
-            }
1429
-
1430
-
1431
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1432
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1433
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1434
-
1435
-        }
1436
-
1437
-    }
1438
-
1439
-    return $html;
1366
+	// check we have the post value
1367
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1368
+	else{ global $post;}
1369
+
1370
+	if(!is_array($cf) && $cf!=''){
1371
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1372
+		if(!$cf){return NULL;}
1373
+	}
1374
+
1375
+	$html_var = $cf['htmlvar_name'];
1376
+
1377
+	// Check if there is a location specific filter.
1378
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1379
+		/**
1380
+		 * Filter the textarea html by location.
1381
+		 *
1382
+		 * @param string $html The html to filter.
1383
+		 * @param array $cf The custom field array.
1384
+		 * @since 1.6.6
1385
+		 */
1386
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1387
+	}
1388
+
1389
+	// Check if there is a custom field specific filter.
1390
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1391
+		/**
1392
+		 * Filter the textarea html by individual custom field.
1393
+		 *
1394
+		 * @param string $html The html to filter.
1395
+		 * @param string $location The location to output the html.
1396
+		 * @param array $cf The custom field array.
1397
+		 * @since 1.6.6
1398
+		 */
1399
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1400
+	}
1401
+
1402
+	// Check if there is a custom field key specific filter.
1403
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1404
+		/**
1405
+		 * Filter the textarea html by field type key.
1406
+		 *
1407
+		 * @param string $html The html to filter.
1408
+		 * @param string $location The location to output the html.
1409
+		 * @param array $cf The custom field array.
1410
+		 * @since 1.6.6
1411
+		 */
1412
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1413
+	}
1414
+
1415
+	// If not html then we run the standard output.
1416
+	if(empty($html)){
1417
+
1418
+		if (!empty($post->{$cf['htmlvar_name']})) {
1419
+
1420
+			$field_icon = geodir_field_icon_proccess($cf);
1421
+			if (strpos($field_icon, 'http') !== false) {
1422
+				$field_icon_af = '';
1423
+			} elseif ($field_icon == '') {
1424
+				$field_icon_af = '';
1425
+			} else {
1426
+				$field_icon_af = $field_icon;
1427
+				$field_icon = '';
1428
+			}
1429
+
1430
+
1431
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1432
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1433
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1434
+
1435
+		}
1436
+
1437
+	}
1438
+
1439
+	return $html;
1440 1440
 }
1441 1441
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1442 1442
 
@@ -1454,79 +1454,79 @@  discard block
 block discarded – undo
1454 1454
  */
1455 1455
 function geodir_cf_html($html,$location,$cf,$p=''){
1456 1456
 
1457
-    // check we have the post value
1458
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1459
-    else{ global $post;}
1460
-
1461
-    if(!is_array($cf) && $cf!=''){
1462
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1463
-        if(!$cf){return NULL;}
1464
-    }
1465
-
1466
-    $html_var = $cf['htmlvar_name'];
1467
-
1468
-    // Check if there is a location specific filter.
1469
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1470
-        /**
1471
-         * Filter the html html by location.
1472
-         *
1473
-         * @param string $html The html to filter.
1474
-         * @param array $cf The custom field array.
1475
-         * @since 1.6.6
1476
-         */
1477
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1478
-    }
1479
-
1480
-    // Check if there is a custom field specific filter.
1481
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1482
-        /**
1483
-         * Filter the html html by individual custom field.
1484
-         *
1485
-         * @param string $html The html to filter.
1486
-         * @param string $location The location to output the html.
1487
-         * @param array $cf The custom field array.
1488
-         * @since 1.6.6
1489
-         */
1490
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1491
-    }
1492
-
1493
-    // Check if there is a custom field key specific filter.
1494
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1495
-        /**
1496
-         * Filter the html html by field type key.
1497
-         *
1498
-         * @param string $html The html to filter.
1499
-         * @param string $location The location to output the html.
1500
-         * @param array $cf The custom field array.
1501
-         * @since 1.6.6
1502
-         */
1503
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1504
-    }
1505
-
1506
-    // If not html then we run the standard output.
1507
-    if(empty($html)){
1508
-
1509
-        if (!empty($post->{$cf['htmlvar_name']})) {
1510
-
1511
-            $field_icon = geodir_field_icon_proccess($cf);
1512
-            if (strpos($field_icon, 'http') !== false) {
1513
-                $field_icon_af = '';
1514
-            } elseif ($field_icon == '') {
1515
-                $field_icon_af = '';
1516
-            } else {
1517
-                $field_icon_af = $field_icon;
1518
-                $field_icon = '';
1519
-            }
1520
-
1521
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1522
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1523
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1524
-
1525
-        }
1526
-
1527
-    }
1528
-
1529
-    return $html;
1457
+	// check we have the post value
1458
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1459
+	else{ global $post;}
1460
+
1461
+	if(!is_array($cf) && $cf!=''){
1462
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1463
+		if(!$cf){return NULL;}
1464
+	}
1465
+
1466
+	$html_var = $cf['htmlvar_name'];
1467
+
1468
+	// Check if there is a location specific filter.
1469
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1470
+		/**
1471
+		 * Filter the html html by location.
1472
+		 *
1473
+		 * @param string $html The html to filter.
1474
+		 * @param array $cf The custom field array.
1475
+		 * @since 1.6.6
1476
+		 */
1477
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1478
+	}
1479
+
1480
+	// Check if there is a custom field specific filter.
1481
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1482
+		/**
1483
+		 * Filter the html html by individual custom field.
1484
+		 *
1485
+		 * @param string $html The html to filter.
1486
+		 * @param string $location The location to output the html.
1487
+		 * @param array $cf The custom field array.
1488
+		 * @since 1.6.6
1489
+		 */
1490
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1491
+	}
1492
+
1493
+	// Check if there is a custom field key specific filter.
1494
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1495
+		/**
1496
+		 * Filter the html html by field type key.
1497
+		 *
1498
+		 * @param string $html The html to filter.
1499
+		 * @param string $location The location to output the html.
1500
+		 * @param array $cf The custom field array.
1501
+		 * @since 1.6.6
1502
+		 */
1503
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1504
+	}
1505
+
1506
+	// If not html then we run the standard output.
1507
+	if(empty($html)){
1508
+
1509
+		if (!empty($post->{$cf['htmlvar_name']})) {
1510
+
1511
+			$field_icon = geodir_field_icon_proccess($cf);
1512
+			if (strpos($field_icon, 'http') !== false) {
1513
+				$field_icon_af = '';
1514
+			} elseif ($field_icon == '') {
1515
+				$field_icon_af = '';
1516
+			} else {
1517
+				$field_icon_af = $field_icon;
1518
+				$field_icon = '';
1519
+			}
1520
+
1521
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1522
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1523
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1524
+
1525
+		}
1526
+
1527
+	}
1528
+
1529
+	return $html;
1530 1530
 }
1531 1531
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1532 1532
 
@@ -1544,113 +1544,113 @@  discard block
 block discarded – undo
1544 1544
  */
1545 1545
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1546 1546
 
1547
-    // check we have the post value
1548
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1549
-    else{ global $post;}
1550
-
1551
-    if(!is_array($cf) && $cf!=''){
1552
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1553
-        if(!$cf){return NULL;}
1554
-    }
1555
-
1556
-    $html_var = $cf['htmlvar_name'];
1557
-
1558
-    // Check if there is a location specific filter.
1559
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1560
-        /**
1561
-         * Filter the taxonomy html by location.
1562
-         *
1563
-         * @param string $html The html to filter.
1564
-         * @param array $cf The custom field array.
1565
-         * @since 1.6.6
1566
-         */
1567
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1568
-    }
1569
-
1570
-    // Check if there is a custom field specific filter.
1571
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1572
-        /**
1573
-         * Filter the taxonomy html by individual custom field.
1574
-         *
1575
-         * @param string $html The html to filter.
1576
-         * @param string $location The location to output the html.
1577
-         * @param array $cf The custom field array.
1578
-         * @since 1.6.6
1579
-         */
1580
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1581
-    }
1582
-
1583
-    // Check if there is a custom field key specific filter.
1584
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1585
-        /**
1586
-         * Filter the taxonomy html by field type key.
1587
-         *
1588
-         * @param string $html The html to filter.
1589
-         * @param string $location The location to output the html.
1590
-         * @param array $cf The custom field array.
1591
-         * @since 1.6.6
1592
-         */
1593
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1594
-    }
1595
-
1596
-    // If not html then we run the standard output.
1597
-    if(empty($html)){
1598
-
1599
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1600
-            $post_taxonomy = $post->post_type . 'category';
1601
-            $field_value = $post->{$html_var};
1602
-            $links = array();
1603
-            $terms = array();
1604
-            $termsOrdered = array();
1605
-            if (!is_array($field_value)) {
1606
-                $field_value = explode(",", trim($field_value, ","));
1607
-            }
1608
-
1609
-            $field_value = array_unique($field_value);
1610
-
1611
-            if (!empty($field_value)) {
1612
-                foreach ($field_value as $term) {
1613
-                    $term = trim($term);
1614
-
1615
-                    if ($term != '') {
1616
-                        $term = get_term_by('id', $term, $html_var);
1617
-                        if (is_object($term)) {
1618
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1619
-                            $terms[] = $term;
1620
-                        }
1621
-                    }
1622
-                }
1623
-                if (!empty($links)) {
1624
-                    // order alphabetically
1625
-                    asort($links);
1626
-                    foreach (array_keys($links) as $key) {
1627
-                        $termsOrdered[$key] = $terms[$key];
1628
-                    }
1629
-                    $terms = $termsOrdered;
1630
-                }
1631
-            }
1632
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1633
-
1634
-            if ($html_value != '') {
1635
-                $field_icon = geodir_field_icon_proccess($cf);
1636
-                if (strpos($field_icon, 'http') !== false) {
1637
-                    $field_icon_af = '';
1638
-                } else if ($field_icon == '') {
1639
-                    $field_icon_af = '';
1640
-                } else {
1641
-                    $field_icon_af = $field_icon;
1642
-                    $field_icon = '';
1643
-                }
1644
-
1645
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1646
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1647
-                $html .= '</span> ' . $html_value . '</div>';
1648
-            }
1649
-        }
1650
-
1651
-    }
1652
-
1653
-    return $html;
1547
+	// check we have the post value
1548
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1549
+	else{ global $post;}
1550
+
1551
+	if(!is_array($cf) && $cf!=''){
1552
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1553
+		if(!$cf){return NULL;}
1554
+	}
1555
+
1556
+	$html_var = $cf['htmlvar_name'];
1557
+
1558
+	// Check if there is a location specific filter.
1559
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1560
+		/**
1561
+		 * Filter the taxonomy html by location.
1562
+		 *
1563
+		 * @param string $html The html to filter.
1564
+		 * @param array $cf The custom field array.
1565
+		 * @since 1.6.6
1566
+		 */
1567
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1568
+	}
1569
+
1570
+	// Check if there is a custom field specific filter.
1571
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1572
+		/**
1573
+		 * Filter the taxonomy html by individual custom field.
1574
+		 *
1575
+		 * @param string $html The html to filter.
1576
+		 * @param string $location The location to output the html.
1577
+		 * @param array $cf The custom field array.
1578
+		 * @since 1.6.6
1579
+		 */
1580
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1581
+	}
1582
+
1583
+	// Check if there is a custom field key specific filter.
1584
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1585
+		/**
1586
+		 * Filter the taxonomy html by field type key.
1587
+		 *
1588
+		 * @param string $html The html to filter.
1589
+		 * @param string $location The location to output the html.
1590
+		 * @param array $cf The custom field array.
1591
+		 * @since 1.6.6
1592
+		 */
1593
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1594
+	}
1595
+
1596
+	// If not html then we run the standard output.
1597
+	if(empty($html)){
1598
+
1599
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1600
+			$post_taxonomy = $post->post_type . 'category';
1601
+			$field_value = $post->{$html_var};
1602
+			$links = array();
1603
+			$terms = array();
1604
+			$termsOrdered = array();
1605
+			if (!is_array($field_value)) {
1606
+				$field_value = explode(",", trim($field_value, ","));
1607
+			}
1608
+
1609
+			$field_value = array_unique($field_value);
1610
+
1611
+			if (!empty($field_value)) {
1612
+				foreach ($field_value as $term) {
1613
+					$term = trim($term);
1614
+
1615
+					if ($term != '') {
1616
+						$term = get_term_by('id', $term, $html_var);
1617
+						if (is_object($term)) {
1618
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1619
+							$terms[] = $term;
1620
+						}
1621
+					}
1622
+				}
1623
+				if (!empty($links)) {
1624
+					// order alphabetically
1625
+					asort($links);
1626
+					foreach (array_keys($links) as $key) {
1627
+						$termsOrdered[$key] = $terms[$key];
1628
+					}
1629
+					$terms = $termsOrdered;
1630
+				}
1631
+			}
1632
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1633
+
1634
+			if ($html_value != '') {
1635
+				$field_icon = geodir_field_icon_proccess($cf);
1636
+				if (strpos($field_icon, 'http') !== false) {
1637
+					$field_icon_af = '';
1638
+				} else if ($field_icon == '') {
1639
+					$field_icon_af = '';
1640
+				} else {
1641
+					$field_icon_af = $field_icon;
1642
+					$field_icon = '';
1643
+				}
1644
+
1645
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1646
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1647
+				$html .= '</span> ' . $html_value . '</div>';
1648
+			}
1649
+		}
1650
+
1651
+	}
1652
+
1653
+	return $html;
1654 1654
 }
1655 1655
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1656 1656
 
@@ -1667,162 +1667,162 @@  discard block
 block discarded – undo
1667 1667
  */
1668 1668
 function geodir_cf_address($html,$location,$cf,$p=''){
1669 1669
 
1670
-    // check we have the post value
1671
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1672
-    else{ global $post;}
1673
-
1674
-    if(!is_array($cf) && $cf!=''){
1675
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1676
-        if(!$cf){return NULL;}
1677
-    }
1678
-
1679
-    $html_var = $cf['htmlvar_name'];
1680
-
1681
-    // Check if there is a location specific filter.
1682
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1683
-        /**
1684
-         * Filter the address html by location.
1685
-         *
1686
-         * @param string $html The html to filter.
1687
-         * @param array $cf The custom field array.
1688
-         * @since 1.6.6
1689
-         */
1690
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1691
-    }
1692
-
1693
-    // Check if there is a custom field specific filter.
1694
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1695
-        /**
1696
-         * Filter the address html by individual custom field.
1697
-         *
1698
-         * @param string $html The html to filter.
1699
-         * @param string $location The location to output the html.
1700
-         * @param array $cf The custom field array.
1701
-         * @since 1.6.6
1702
-         */
1703
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1704
-    }
1705
-
1706
-    // Check if there is a custom field key specific filter.
1707
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1708
-        /**
1709
-         * Filter the address html by field type key.
1710
-         *
1711
-         * @param string $html The html to filter.
1712
-         * @param string $location The location to output the html.
1713
-         * @param array $cf The custom field array.
1714
-         * @since 1.6.6
1715
-         */
1716
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1717
-    }
1718
-
1719
-    // If not html then we run the standard output.
1720
-    if(empty($html)){
1721
-
1722
-        global $preview;
1723
-        $html_var = $cf['htmlvar_name'] . '_address';
1724
-
1725
-        if ($cf['extra_fields']) {
1726
-
1727
-            $extra_fields = unserialize($cf['extra_fields']);
1728
-
1729
-            $addition_fields = '';
1730
-
1731
-            if (!empty($extra_fields)) {
1732
-
1733
-                $show_city_in_address = false;
1734
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1735
-                    $show_city_in_address = true;
1736
-                }
1737
-                /**
1738
-                 * Filter "show city in address" value.
1739
-                 *
1740
-                 * @since 1.0.0
1741
-                 */
1742
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1743
-
1744
-
1745
-                $show_region_in_address = false;
1746
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1747
-                    $show_region_in_address = true;
1748
-                }
1749
-                /**
1750
-                 * Filter "show region in address" value.
1751
-                 *
1752
-                 * @since 1.6.6
1753
-                 */
1754
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1755
-
1756
-                $show_country_in_address = false;
1757
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1758
-                    $show_country_in_address = true;
1759
-                }
1760
-                /**
1761
-                 * Filter "show country in address" value.
1762
-                 *
1763
-                 * @since 1.6.6
1764
-                 */
1765
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1766
-
1767
-                $show_zip_in_address = false;
1768
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1769
-                    $show_zip_in_address = true;
1770
-                }
1771
-                /**
1772
-                 * Filter "show zip in address" value.
1773
-                 *
1774
-                 * @since 1.6.6
1775
-                 */
1776
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1777
-
1778
-
1779
-            }
1780
-
1781
-        }
1782
-
1783
-
1784
-        if ($post->{$html_var}) {
1785
-
1786
-            $field_icon = geodir_field_icon_proccess( $cf );
1787
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1788
-                $field_icon_af = '';
1789
-            } elseif ( $field_icon == '' ) {
1790
-                $field_icon_af = '<i class="fa fa-home"></i>';
1791
-            } else {
1792
-                $field_icon_af = $field_icon;
1793
-                $field_icon    = '';
1794
-            }
1670
+	// check we have the post value
1671
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1672
+	else{ global $post;}
1673
+
1674
+	if(!is_array($cf) && $cf!=''){
1675
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1676
+		if(!$cf){return NULL;}
1677
+	}
1678
+
1679
+	$html_var = $cf['htmlvar_name'];
1680
+
1681
+	// Check if there is a location specific filter.
1682
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1683
+		/**
1684
+		 * Filter the address html by location.
1685
+		 *
1686
+		 * @param string $html The html to filter.
1687
+		 * @param array $cf The custom field array.
1688
+		 * @since 1.6.6
1689
+		 */
1690
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1691
+	}
1692
+
1693
+	// Check if there is a custom field specific filter.
1694
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1695
+		/**
1696
+		 * Filter the address html by individual custom field.
1697
+		 *
1698
+		 * @param string $html The html to filter.
1699
+		 * @param string $location The location to output the html.
1700
+		 * @param array $cf The custom field array.
1701
+		 * @since 1.6.6
1702
+		 */
1703
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1704
+	}
1705
+
1706
+	// Check if there is a custom field key specific filter.
1707
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1708
+		/**
1709
+		 * Filter the address html by field type key.
1710
+		 *
1711
+		 * @param string $html The html to filter.
1712
+		 * @param string $location The location to output the html.
1713
+		 * @param array $cf The custom field array.
1714
+		 * @since 1.6.6
1715
+		 */
1716
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1717
+	}
1718
+
1719
+	// If not html then we run the standard output.
1720
+	if(empty($html)){
1721
+
1722
+		global $preview;
1723
+		$html_var = $cf['htmlvar_name'] . '_address';
1724
+
1725
+		if ($cf['extra_fields']) {
1726
+
1727
+			$extra_fields = unserialize($cf['extra_fields']);
1728
+
1729
+			$addition_fields = '';
1730
+
1731
+			if (!empty($extra_fields)) {
1732
+
1733
+				$show_city_in_address = false;
1734
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1735
+					$show_city_in_address = true;
1736
+				}
1737
+				/**
1738
+				 * Filter "show city in address" value.
1739
+				 *
1740
+				 * @since 1.0.0
1741
+				 */
1742
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1743
+
1744
+
1745
+				$show_region_in_address = false;
1746
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1747
+					$show_region_in_address = true;
1748
+				}
1749
+				/**
1750
+				 * Filter "show region in address" value.
1751
+				 *
1752
+				 * @since 1.6.6
1753
+				 */
1754
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1755
+
1756
+				$show_country_in_address = false;
1757
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1758
+					$show_country_in_address = true;
1759
+				}
1760
+				/**
1761
+				 * Filter "show country in address" value.
1762
+				 *
1763
+				 * @since 1.6.6
1764
+				 */
1765
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1766
+
1767
+				$show_zip_in_address = false;
1768
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1769
+					$show_zip_in_address = true;
1770
+				}
1771
+				/**
1772
+				 * Filter "show zip in address" value.
1773
+				 *
1774
+				 * @since 1.6.6
1775
+				 */
1776
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1777
+
1778
+
1779
+			}
1780
+
1781
+		}
1782
+
1783
+
1784
+		if ($post->{$html_var}) {
1785
+
1786
+			$field_icon = geodir_field_icon_proccess( $cf );
1787
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1788
+				$field_icon_af = '';
1789
+			} elseif ( $field_icon == '' ) {
1790
+				$field_icon_af = '<i class="fa fa-home"></i>';
1791
+			} else {
1792
+				$field_icon_af = $field_icon;
1793
+				$field_icon    = '';
1794
+			}
1795 1795
             
1796 1796
 
1797 1797
 
1798
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1799
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1800
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1801
-            $html .= '</span>';
1798
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1799
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1800
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1801
+			$html .= '</span>';
1802 1802
 
1803 1803
 
1804
-            if ( $post->post_address ) {
1805
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1806
-            }
1807
-            if ($show_city_in_address && $post->post_city ) {
1808
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1809
-            }
1810
-            if ($show_region_in_address && $post->post_region ) {
1811
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1812
-            }
1813
-            if ($show_zip_in_address && $post->post_zip ) {
1814
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1815
-            }
1816
-            if ($show_country_in_address && $post->post_country ) {
1817
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1818
-            }
1819
-            $html .= '</div>';
1804
+			if ( $post->post_address ) {
1805
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1806
+			}
1807
+			if ($show_city_in_address && $post->post_city ) {
1808
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1809
+			}
1810
+			if ($show_region_in_address && $post->post_region ) {
1811
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1812
+			}
1813
+			if ($show_zip_in_address && $post->post_zip ) {
1814
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1815
+			}
1816
+			if ($show_country_in_address && $post->post_country ) {
1817
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1818
+			}
1819
+			$html .= '</div>';
1820 1820
 
1821
-        }
1821
+		}
1822 1822
 
1823
-    }
1823
+	}
1824 1824
 
1825 1825
 
1826
-    return $html;
1826
+	return $html;
1827 1827
 }
1828 1828
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1829 1829
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,15 +686,15 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
690
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
691 691
             $html .= '</span>';
692 692
 
693 693
             $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
694
+            if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) {
695 695
                 $extra_fields = maybe_unserialize($cf['extra_fields']);
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    $value = geodir_currency_format_number($value,$cf);
696
+                if (isset($extra_fields['is_price']) && $extra_fields['is_price']) {
697
+                    $value = geodir_currency_format_number($value, $cf);
698 698
                 }
699 699
             }
700 700
 
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
     return $html;
710 710
 }
711
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
711
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
712 712
 
713 713
 
714 714
 /**
@@ -721,21 +721,21 @@  discard block
 block discarded – undo
721 721
  *
722 722
  * @return string The html to output for the custom field.
723 723
  */
724
-function geodir_cf_radio($html,$location,$cf,$p=''){
724
+function geodir_cf_radio($html, $location, $cf, $p = '') {
725 725
 
726 726
     // check we have the post value
727
-    if(is_int($p)){$post = geodir_get_post_info($p);}
728
-    else{ global $post;}
727
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
728
+    else { global $post; }
729 729
 
730
-    if(!is_array($cf) && $cf!=''){
730
+    if (!is_array($cf) && $cf != '') {
731 731
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
732
-        if(!$cf){return NULL;}
732
+        if (!$cf) {return NULL; }
733 733
     }
734 734
 
735 735
     $html_var = $cf['htmlvar_name'];
736 736
 
737 737
     // Check if there is a location specific filter.
738
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
738
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
739 739
         /**
740 740
          * Filter the radio html by location.
741 741
          *
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
          * @param array $cf The custom field array.
744 744
          * @since 1.6.6
745 745
          */
746
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
746
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
747 747
     }
748 748
 
749 749
     // Check if there is a custom field specific filter.
750
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
750
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
751 751
         /**
752 752
          * Filter the radio html by individual custom field.
753 753
          *
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
          * @param array $cf The custom field array.
757 757
          * @since 1.6.6
758 758
          */
759
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
759
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
760 760
     }
761 761
 
762 762
     // Check if there is a custom field key specific filter.
763
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
763
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
764 764
         /**
765 765
          * Filter the radio html by field type key.
766 766
          *
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
          * @param array $cf The custom field array.
770 770
          * @since 1.6.6
771 771
          */
772
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
772
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
773 773
     }
774 774
 
775 775
     // If not html then we run the standard output.
776
-    if(empty($html)){
776
+    if (empty($html)) {
777 777
 
778 778
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
779 779
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -807,16 +807,16 @@  discard block
 block discarded – undo
807 807
             }
808 808
 
809 809
 
810
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
811
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
812
-            $html .= '</span>' . $html_val . '</div>';
810
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
811
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
812
+            $html .= '</span>'.$html_val.'</div>';
813 813
         endif;
814 814
 
815 815
     }
816 816
 
817 817
     return $html;
818 818
 }
819
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
819
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
820 820
 
821 821
 
822 822
 /**
@@ -829,21 +829,21 @@  discard block
 block discarded – undo
829 829
  *
830 830
  * @return string The html to output for the custom field.
831 831
  */
832
-function geodir_cf_select($html,$location,$cf,$p=''){
832
+function geodir_cf_select($html, $location, $cf, $p = '') {
833 833
 
834 834
     // check we have the post value
835
-    if(is_int($p)){$post = geodir_get_post_info($p);}
836
-    else{ global $post;}
835
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
836
+    else { global $post; }
837 837
 
838
-    if(!is_array($cf) && $cf!=''){
838
+    if (!is_array($cf) && $cf != '') {
839 839
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
840
-        if(!$cf){return NULL;}
840
+        if (!$cf) {return NULL; }
841 841
     }
842 842
 
843 843
     $html_var = $cf['htmlvar_name'];
844 844
 
845 845
     // Check if there is a location specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
846
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
847 847
         /**
848 848
          * Filter the select html by location.
849 849
          *
@@ -851,11 +851,11 @@  discard block
 block discarded – undo
851 851
          * @param array $cf The custom field array.
852 852
          * @since 1.6.6
853 853
          */
854
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
854
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
855 855
     }
856 856
 
857 857
     // Check if there is a custom field specific filter.
858
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
858
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
859 859
         /**
860 860
          * Filter the select html by individual custom field.
861 861
          *
@@ -864,11 +864,11 @@  discard block
 block discarded – undo
864 864
          * @param array $cf The custom field array.
865 865
          * @since 1.6.6
866 866
          */
867
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
867
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
868 868
     }
869 869
 
870 870
     // Check if there is a custom field key specific filter.
871
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
871
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
872 872
         /**
873 873
          * Filter the select html by field type key.
874 874
          *
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
          * @param array $cf The custom field array.
878 878
          * @since 1.6.6
879 879
          */
880
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
880
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
881 881
     }
882 882
 
883 883
     // If not html then we run the standard output.
884
-    if(empty($html)){
884
+    if (empty($html)) {
885 885
 
886 886
         if ($post->{$cf['htmlvar_name']}):
887 887
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -909,16 +909,16 @@  discard block
 block discarded – undo
909 909
             }
910 910
 
911 911
 
912
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
913
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
914
-            $html .= '</span>' . $field_value . '</div>';
912
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
913
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
914
+            $html .= '</span>'.$field_value.'</div>';
915 915
         endif;
916 916
 
917 917
     }
918 918
 
919 919
     return $html;
920 920
 }
921
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
921
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
922 922
 
923 923
 
924 924
 /**
@@ -931,21 +931,21 @@  discard block
 block discarded – undo
931 931
  *
932 932
  * @return string The html to output for the custom field.
933 933
  */
934
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
934
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
935 935
 
936 936
     // check we have the post value
937
-    if(is_int($p)){$post = geodir_get_post_info($p);}
938
-    else{ global $post;}
937
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
938
+    else { global $post; }
939 939
 
940
-    if(!is_array($cf) && $cf!=''){
940
+    if (!is_array($cf) && $cf != '') {
941 941
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
942
-        if(!$cf){return NULL;}
942
+        if (!$cf) {return NULL; }
943 943
     }
944 944
 
945 945
     $html_var = $cf['htmlvar_name'];
946 946
 
947 947
     // Check if there is a location specific filter.
948
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
948
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
949 949
         /**
950 950
          * Filter the multiselect html by location.
951 951
          *
@@ -953,11 +953,11 @@  discard block
 block discarded – undo
953 953
          * @param array $cf The custom field array.
954 954
          * @since 1.6.6
955 955
          */
956
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
956
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
957 957
     }
958 958
 
959 959
     // Check if there is a custom field specific filter.
960
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
960
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
961 961
         /**
962 962
          * Filter the multiselect html by individual custom field.
963 963
          *
@@ -966,11 +966,11 @@  discard block
 block discarded – undo
966 966
          * @param array $cf The custom field array.
967 967
          * @since 1.6.6
968 968
          */
969
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
969
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
970 970
     }
971 971
 
972 972
     // Check if there is a custom field key specific filter.
973
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
973
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
974 974
         /**
975 975
          * Filter the multiselect html by field type key.
976 976
          *
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
          * @param array $cf The custom field array.
980 980
          * @since 1.6.6
981 981
          */
982
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
982
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
983 983
     }
984 984
 
985 985
     // If not html then we run the standard output.
986
-    if(empty($html)){
986
+    if (empty($html)) {
987 987
 
988 988
 
989 989
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
             $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1006 1006
 
1007
-            if(is_array($field_values)){
1007
+            if (is_array($field_values)) {
1008 1008
                 $field_values = array_map('trim', $field_values);
1009 1009
             }
1010 1010
 
@@ -1022,15 +1022,15 @@  discard block
 block discarded – undo
1022 1022
             }
1023 1023
 
1024 1024
 
1025
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1026
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1025
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1026
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1027 1027
             $html .= '</span>';
1028 1028
 
1029 1029
             if (count($option_values) > 1) {
1030 1030
                 $html .= '<ul>';
1031 1031
 
1032 1032
                 foreach ($option_values as $val) {
1033
-                    $html .= '<li>' . $val . '</li>';
1033
+                    $html .= '<li>'.$val.'</li>';
1034 1034
                 }
1035 1035
 
1036 1036
                 $html .= '</ul>';
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
     return $html;
1047 1047
 }
1048
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1048
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1049 1049
 
1050 1050
 
1051 1051
 /**
@@ -1058,21 +1058,21 @@  discard block
 block discarded – undo
1058 1058
  *
1059 1059
  * @return string The html to output for the custom field.
1060 1060
  */
1061
-function geodir_cf_email($html,$location,$cf,$p=''){
1061
+function geodir_cf_email($html, $location, $cf, $p = '') {
1062 1062
 
1063 1063
     // check we have the post value
1064
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1065
-    else{ global $post;}
1064
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1065
+    else { global $post; }
1066 1066
 
1067
-    if(!is_array($cf) && $cf!=''){
1067
+    if (!is_array($cf) && $cf != '') {
1068 1068
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1069
-        if(!$cf){return NULL;}
1069
+        if (!$cf) {return NULL; }
1070 1070
     }
1071 1071
 
1072 1072
     $html_var = $cf['htmlvar_name'];
1073 1073
 
1074 1074
     // Check if there is a location specific filter.
1075
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1075
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1076 1076
         /**
1077 1077
          * Filter the email html by location.
1078 1078
          *
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
          * @param array $cf The custom field array.
1081 1081
          * @since 1.6.6
1082 1082
          */
1083
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1083
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1084 1084
     }
1085 1085
 
1086 1086
     // Check if there is a custom field specific filter.
1087
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1087
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1088 1088
         /**
1089 1089
          * Filter the email html by individual custom field.
1090 1090
          *
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
          * @param array $cf The custom field array.
1094 1094
          * @since 1.6.6
1095 1095
          */
1096
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1096
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1097 1097
     }
1098 1098
 
1099 1099
     // Check if there is a custom field key specific filter.
1100
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1100
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1101 1101
         /**
1102 1102
          * Filter the email html by field type key.
1103 1103
          *
@@ -1106,18 +1106,18 @@  discard block
 block discarded – undo
1106 1106
          * @param array $cf The custom field array.
1107 1107
          * @since 1.6.6
1108 1108
          */
1109
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1109
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1110 1110
     }
1111 1111
 
1112 1112
     // If not html then we run the standard output.
1113
-    if(empty($html)){
1113
+    if (empty($html)) {
1114 1114
 
1115 1115
         global $preview;
1116 1116
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1117 1117
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1118 1118
         }
1119 1119
 
1120
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1120
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1121 1121
 
1122 1122
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1123 1123
             $send_to_friend = true;
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
             if (!$preview) {
1129 1129
                 $b_send_inquiry = 'b_send_inquiry';
1130 1130
                 $b_sendtofriend = 'b_sendtofriend';
1131
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1131
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1132 1132
             }
1133 1133
 
1134 1134
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1141,26 +1141,26 @@  discard block
 block discarded – undo
1141 1141
                 $field_icon = '';
1142 1142
             }
1143 1143
 
1144
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1144
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1145 1145
             $seperator = '';
1146 1146
             if ($post->{$cf['htmlvar_name']}) {
1147
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1147
+                $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1148 1148
                 $seperator = ' | ';
1149 1149
             }
1150 1150
 
1151 1151
             if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1152
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1152
+                $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1153 1153
             }
1154 1154
 
1155 1155
             $html .= '</span></div>';
1156 1156
 
1157 1157
 
1158 1158
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1159
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1159
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1160 1160
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1161
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1161
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1162 1162
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1163
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1163
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1164 1164
             }
1165 1165
 
1166 1166
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1180,11 +1180,11 @@  discard block
 block discarded – undo
1180 1180
                 }
1181 1181
 
1182 1182
 
1183
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1184
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1183
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1184
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1185 1185
                 $html .= '</span><span class="geodir-email-address-output">';
1186 1186
                 $email = $post->{$cf['htmlvar_name']} ;
1187
-                if($e_split = explode('@',$email)){
1187
+                if ($e_split = explode('@', $email)) {
1188 1188
                     /**
1189 1189
                      * Filter email custom field name output.
1190 1190
                      *
@@ -1193,10 +1193,10 @@  discard block
 block discarded – undo
1193 1193
                      * @param string $email The email string being output.
1194 1194
                      * @param array $cf Custom field variables array.
1195 1195
                      */
1196
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1197
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1198
-                }else{
1199
-                    $html .=  $email;
1196
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1197
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1198
+                } else {
1199
+                    $html .= $email;
1200 1200
                 }
1201 1201
                 $html .= '</span></div>';
1202 1202
             }
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 
1208 1208
     return $html;
1209 1209
 }
1210
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1210
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1211 1211
 
1212 1212
 
1213 1213
 /**
@@ -1220,21 +1220,21 @@  discard block
 block discarded – undo
1220 1220
  *
1221 1221
  * @return string The html to output for the custom field.
1222 1222
  */
1223
-function geodir_cf_file($html,$location,$cf,$p=''){
1223
+function geodir_cf_file($html, $location, $cf, $p = '') {
1224 1224
 
1225 1225
     // check we have the post value
1226
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1227
-    else{ global $post;}
1226
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1227
+    else { global $post; }
1228 1228
 
1229
-    if(!is_array($cf) && $cf!=''){
1229
+    if (!is_array($cf) && $cf != '') {
1230 1230
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1231
-        if(!$cf){return NULL;}
1231
+        if (!$cf) {return NULL; }
1232 1232
     }
1233 1233
 
1234 1234
     $html_var = $cf['htmlvar_name'];
1235 1235
 
1236 1236
     // Check if there is a location specific filter.
1237
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1237
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1238 1238
         /**
1239 1239
          * Filter the file html by location.
1240 1240
          *
@@ -1242,11 +1242,11 @@  discard block
 block discarded – undo
1242 1242
          * @param array $cf The custom field array.
1243 1243
          * @since 1.6.6
1244 1244
          */
1245
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1245
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1246 1246
     }
1247 1247
 
1248 1248
     // Check if there is a custom field specific filter.
1249
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1249
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1250 1250
         /**
1251 1251
          * Filter the file html by individual custom field.
1252 1252
          *
@@ -1255,11 +1255,11 @@  discard block
 block discarded – undo
1255 1255
          * @param array $cf The custom field array.
1256 1256
          * @since 1.6.6
1257 1257
          */
1258
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1258
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1259 1259
     }
1260 1260
 
1261 1261
     // Check if there is a custom field key specific filter.
1262
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1262
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1263 1263
         /**
1264 1264
          * Filter the file html by field type key.
1265 1265
          *
@@ -1268,11 +1268,11 @@  discard block
 block discarded – undo
1268 1268
          * @param array $cf The custom field array.
1269 1269
          * @since 1.6.6
1270 1270
          */
1271
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1271
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1272 1272
     }
1273 1273
 
1274 1274
     // If not html then we run the standard output.
1275
-    if(empty($html)){
1275
+    if (empty($html)) {
1276 1276
 
1277 1277
         if (!empty($post->{$cf['htmlvar_name']})):
1278 1278
 
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
             if (!empty($files)):
1281 1281
 
1282 1282
                 $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1283
-                $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'] : '';
1283
+                $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'] : '';
1284 1284
 
1285 1285
                 $file_paths = '';
1286 1286
                 foreach ($files as $file) {
@@ -1317,9 +1317,9 @@  discard block
 block discarded – undo
1317 1317
                             //$file_paths .= '<img src="'.$file.'"  />';	
1318 1318
                             $file_paths .= '</div>';
1319 1319
                         } else {
1320
-                            $ext_path = '_' . $html_var . '_';
1320
+                            $ext_path = '_'.$html_var.'_';
1321 1321
                             $filename = explode($ext_path, $filename);
1322
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1322
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1323 1323
                         }
1324 1324
                     }
1325 1325
                 }
@@ -1334,11 +1334,11 @@  discard block
 block discarded – undo
1334 1334
                     $field_icon = '';
1335 1335
                 }
1336 1336
 
1337
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1337
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1338 1338
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1339
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1339
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1340 1340
                 $html .= '</span>';
1341
-                $html .= $file_paths . '</div></div>';
1341
+                $html .= $file_paths.'</div></div>';
1342 1342
 
1343 1343
             endif;
1344 1344
         endif;
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
     return $html;
1349 1349
 }
1350
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1350
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1351 1351
 
1352 1352
 
1353 1353
 
@@ -1361,21 +1361,21 @@  discard block
 block discarded – undo
1361 1361
  *
1362 1362
  * @return string The html to output for the custom field.
1363 1363
  */
1364
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1364
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1365 1365
 
1366 1366
     // check we have the post value
1367
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1368
-    else{ global $post;}
1367
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1368
+    else { global $post; }
1369 1369
 
1370
-    if(!is_array($cf) && $cf!=''){
1370
+    if (!is_array($cf) && $cf != '') {
1371 1371
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1372
-        if(!$cf){return NULL;}
1372
+        if (!$cf) {return NULL; }
1373 1373
     }
1374 1374
 
1375 1375
     $html_var = $cf['htmlvar_name'];
1376 1376
 
1377 1377
     // Check if there is a location specific filter.
1378
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1378
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1379 1379
         /**
1380 1380
          * Filter the textarea html by location.
1381 1381
          *
@@ -1383,11 +1383,11 @@  discard block
 block discarded – undo
1383 1383
          * @param array $cf The custom field array.
1384 1384
          * @since 1.6.6
1385 1385
          */
1386
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1386
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1387 1387
     }
1388 1388
 
1389 1389
     // Check if there is a custom field specific filter.
1390
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1390
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1391 1391
         /**
1392 1392
          * Filter the textarea html by individual custom field.
1393 1393
          *
@@ -1396,11 +1396,11 @@  discard block
 block discarded – undo
1396 1396
          * @param array $cf The custom field array.
1397 1397
          * @since 1.6.6
1398 1398
          */
1399
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1399
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1400 1400
     }
1401 1401
 
1402 1402
     // Check if there is a custom field key specific filter.
1403
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1403
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1404 1404
         /**
1405 1405
          * Filter the textarea html by field type key.
1406 1406
          *
@@ -1409,11 +1409,11 @@  discard block
 block discarded – undo
1409 1409
          * @param array $cf The custom field array.
1410 1410
          * @since 1.6.6
1411 1411
          */
1412
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1412
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1413 1413
     }
1414 1414
 
1415 1415
     // If not html then we run the standard output.
1416
-    if(empty($html)){
1416
+    if (empty($html)) {
1417 1417
 
1418 1418
         if (!empty($post->{$cf['htmlvar_name']})) {
1419 1419
 
@@ -1428,9 +1428,9 @@  discard block
 block discarded – undo
1428 1428
             }
1429 1429
 
1430 1430
 
1431
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1432
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1433
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1431
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1432
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1433
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1434 1434
 
1435 1435
         }
1436 1436
 
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
 
1439 1439
     return $html;
1440 1440
 }
1441
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1441
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1442 1442
 
1443 1443
 
1444 1444
 
@@ -1452,21 +1452,21 @@  discard block
 block discarded – undo
1452 1452
  *
1453 1453
  * @return string The html to output for the custom field.
1454 1454
  */
1455
-function geodir_cf_html($html,$location,$cf,$p=''){
1455
+function geodir_cf_html($html, $location, $cf, $p = '') {
1456 1456
 
1457 1457
     // check we have the post value
1458
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1459
-    else{ global $post;}
1458
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1459
+    else { global $post; }
1460 1460
 
1461
-    if(!is_array($cf) && $cf!=''){
1461
+    if (!is_array($cf) && $cf != '') {
1462 1462
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1463
-        if(!$cf){return NULL;}
1463
+        if (!$cf) {return NULL; }
1464 1464
     }
1465 1465
 
1466 1466
     $html_var = $cf['htmlvar_name'];
1467 1467
 
1468 1468
     // Check if there is a location specific filter.
1469
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1469
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1470 1470
         /**
1471 1471
          * Filter the html html by location.
1472 1472
          *
@@ -1474,11 +1474,11 @@  discard block
 block discarded – undo
1474 1474
          * @param array $cf The custom field array.
1475 1475
          * @since 1.6.6
1476 1476
          */
1477
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1477
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1478 1478
     }
1479 1479
 
1480 1480
     // Check if there is a custom field specific filter.
1481
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1481
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1482 1482
         /**
1483 1483
          * Filter the html html by individual custom field.
1484 1484
          *
@@ -1487,11 +1487,11 @@  discard block
 block discarded – undo
1487 1487
          * @param array $cf The custom field array.
1488 1488
          * @since 1.6.6
1489 1489
          */
1490
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1490
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1491 1491
     }
1492 1492
 
1493 1493
     // Check if there is a custom field key specific filter.
1494
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1494
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1495 1495
         /**
1496 1496
          * Filter the html html by field type key.
1497 1497
          *
@@ -1500,11 +1500,11 @@  discard block
 block discarded – undo
1500 1500
          * @param array $cf The custom field array.
1501 1501
          * @since 1.6.6
1502 1502
          */
1503
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1503
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1504 1504
     }
1505 1505
 
1506 1506
     // If not html then we run the standard output.
1507
-    if(empty($html)){
1507
+    if (empty($html)) {
1508 1508
 
1509 1509
         if (!empty($post->{$cf['htmlvar_name']})) {
1510 1510
 
@@ -1518,9 +1518,9 @@  discard block
 block discarded – undo
1518 1518
                 $field_icon = '';
1519 1519
             }
1520 1520
 
1521
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1522
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1523
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1521
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1522
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1523
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1524 1524
 
1525 1525
         }
1526 1526
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 
1529 1529
     return $html;
1530 1530
 }
1531
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1531
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1532 1532
 
1533 1533
 
1534 1534
 
@@ -1542,21 +1542,21 @@  discard block
 block discarded – undo
1542 1542
  *
1543 1543
  * @return string The html to output for the custom field.
1544 1544
  */
1545
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1545
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1546 1546
 
1547 1547
     // check we have the post value
1548
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1549
-    else{ global $post;}
1548
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1549
+    else { global $post; }
1550 1550
 
1551
-    if(!is_array($cf) && $cf!=''){
1551
+    if (!is_array($cf) && $cf != '') {
1552 1552
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1553
-        if(!$cf){return NULL;}
1553
+        if (!$cf) {return NULL; }
1554 1554
     }
1555 1555
 
1556 1556
     $html_var = $cf['htmlvar_name'];
1557 1557
 
1558 1558
     // Check if there is a location specific filter.
1559
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1559
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1560 1560
         /**
1561 1561
          * Filter the taxonomy html by location.
1562 1562
          *
@@ -1564,11 +1564,11 @@  discard block
 block discarded – undo
1564 1564
          * @param array $cf The custom field array.
1565 1565
          * @since 1.6.6
1566 1566
          */
1567
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1567
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1568 1568
     }
1569 1569
 
1570 1570
     // Check if there is a custom field specific filter.
1571
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1571
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1572 1572
         /**
1573 1573
          * Filter the taxonomy html by individual custom field.
1574 1574
          *
@@ -1577,11 +1577,11 @@  discard block
 block discarded – undo
1577 1577
          * @param array $cf The custom field array.
1578 1578
          * @since 1.6.6
1579 1579
          */
1580
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1580
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1581 1581
     }
1582 1582
 
1583 1583
     // Check if there is a custom field key specific filter.
1584
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1584
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1585 1585
         /**
1586 1586
          * Filter the taxonomy html by field type key.
1587 1587
          *
@@ -1590,14 +1590,14 @@  discard block
 block discarded – undo
1590 1590
          * @param array $cf The custom field array.
1591 1591
          * @since 1.6.6
1592 1592
          */
1593
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1593
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1594 1594
     }
1595 1595
 
1596 1596
     // If not html then we run the standard output.
1597
-    if(empty($html)){
1597
+    if (empty($html)) {
1598 1598
 
1599
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1600
-            $post_taxonomy = $post->post_type . 'category';
1599
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1600
+            $post_taxonomy = $post->post_type.'category';
1601 1601
             $field_value = $post->{$html_var};
1602 1602
             $links = array();
1603 1603
             $terms = array();
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
                     if ($term != '') {
1616 1616
                         $term = get_term_by('id', $term, $html_var);
1617 1617
                         if (is_object($term)) {
1618
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1618
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1619 1619
                             $terms[] = $term;
1620 1620
                         }
1621 1621
                     }
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
                     $terms = $termsOrdered;
1630 1630
                 }
1631 1631
             }
1632
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1632
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1633 1633
 
1634 1634
             if ($html_value != '') {
1635 1635
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1642,9 +1642,9 @@  discard block
 block discarded – undo
1642 1642
                     $field_icon = '';
1643 1643
                 }
1644 1644
 
1645
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1646
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1647
-                $html .= '</span> ' . $html_value . '</div>';
1645
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1646
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1647
+                $html .= '</span> '.$html_value.'</div>';
1648 1648
             }
1649 1649
         }
1650 1650
 
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 
1653 1653
     return $html;
1654 1654
 }
1655
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1655
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1656 1656
 
1657 1657
 
1658 1658
 /**
@@ -1665,21 +1665,21 @@  discard block
 block discarded – undo
1665 1665
  *
1666 1666
  * @return string The html to output for the custom field.
1667 1667
  */
1668
-function geodir_cf_address($html,$location,$cf,$p=''){
1668
+function geodir_cf_address($html, $location, $cf, $p = '') {
1669 1669
 
1670 1670
     // check we have the post value
1671
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1672
-    else{ global $post;}
1671
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1672
+    else { global $post; }
1673 1673
 
1674
-    if(!is_array($cf) && $cf!=''){
1674
+    if (!is_array($cf) && $cf != '') {
1675 1675
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1676
-        if(!$cf){return NULL;}
1676
+        if (!$cf) {return NULL; }
1677 1677
     }
1678 1678
 
1679 1679
     $html_var = $cf['htmlvar_name'];
1680 1680
 
1681 1681
     // Check if there is a location specific filter.
1682
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1682
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1683 1683
         /**
1684 1684
          * Filter the address html by location.
1685 1685
          *
@@ -1687,11 +1687,11 @@  discard block
 block discarded – undo
1687 1687
          * @param array $cf The custom field array.
1688 1688
          * @since 1.6.6
1689 1689
          */
1690
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1690
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1691 1691
     }
1692 1692
 
1693 1693
     // Check if there is a custom field specific filter.
1694
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1694
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1695 1695
         /**
1696 1696
          * Filter the address html by individual custom field.
1697 1697
          *
@@ -1700,11 +1700,11 @@  discard block
 block discarded – undo
1700 1700
          * @param array $cf The custom field array.
1701 1701
          * @since 1.6.6
1702 1702
          */
1703
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1703
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1704 1704
     }
1705 1705
 
1706 1706
     // Check if there is a custom field key specific filter.
1707
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1707
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1708 1708
         /**
1709 1709
          * Filter the address html by field type key.
1710 1710
          *
@@ -1713,14 +1713,14 @@  discard block
 block discarded – undo
1713 1713
          * @param array $cf The custom field array.
1714 1714
          * @since 1.6.6
1715 1715
          */
1716
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1716
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1717 1717
     }
1718 1718
 
1719 1719
     // If not html then we run the standard output.
1720
-    if(empty($html)){
1720
+    if (empty($html)) {
1721 1721
 
1722 1722
         global $preview;
1723
-        $html_var = $cf['htmlvar_name'] . '_address';
1723
+        $html_var = $cf['htmlvar_name'].'_address';
1724 1724
 
1725 1725
         if ($cf['extra_fields']) {
1726 1726
 
@@ -1783,10 +1783,10 @@  discard block
 block discarded – undo
1783 1783
 
1784 1784
         if ($post->{$html_var}) {
1785 1785
 
1786
-            $field_icon = geodir_field_icon_proccess( $cf );
1787
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1786
+            $field_icon = geodir_field_icon_proccess($cf);
1787
+            if (strpos($field_icon, 'http') !== false) {
1788 1788
                 $field_icon_af = '';
1789
-            } elseif ( $field_icon == '' ) {
1789
+            } elseif ($field_icon == '') {
1790 1790
                 $field_icon_af = '<i class="fa fa-home"></i>';
1791 1791
             } else {
1792 1792
                 $field_icon_af = $field_icon;
@@ -1795,26 +1795,26 @@  discard block
 block discarded – undo
1795 1795
             
1796 1796
 
1797 1797
 
1798
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1799
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1800
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1798
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1799
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1800
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1801 1801
             $html .= '</span>';
1802 1802
 
1803 1803
 
1804
-            if ( $post->post_address ) {
1805
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1804
+            if ($post->post_address) {
1805
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1806 1806
             }
1807
-            if ($show_city_in_address && $post->post_city ) {
1808
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1807
+            if ($show_city_in_address && $post->post_city) {
1808
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1809 1809
             }
1810
-            if ($show_region_in_address && $post->post_region ) {
1811
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1810
+            if ($show_region_in_address && $post->post_region) {
1811
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1812 1812
             }
1813
-            if ($show_zip_in_address && $post->post_zip ) {
1814
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1813
+            if ($show_zip_in_address && $post->post_zip) {
1814
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1815 1815
             }
1816
-            if ($show_country_in_address && $post->post_country ) {
1817
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1816
+            if ($show_country_in_address && $post->post_country) {
1817
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1818 1818
             }
1819 1819
             $html .= '</div>';
1820 1820
 
@@ -1825,4 +1825,4 @@  discard block
 block discarded – undo
1825 1825
 
1826 1826
     return $html;
1827 1827
 }
1828
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1829 1828
\ No newline at end of file
1829
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1830 1830
\ No newline at end of file
Please login to merge, or discard this patch.