Test Failed
Push — master ( d1dc8e...305a97 )
by Stiofan
09:28
created
geodirectory-functions/custom_fields_functions.php 4 patches
Doc Comments   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2174,6 +2174,9 @@  discard block
 block discarded – undo
2174 2174
 }
2175 2175
 
2176 2176
 
2177
+/**
2178
+ * @return string
2179
+ */
2177 2180
 function geodir_field_icon_proccess($cf){
2178 2181
 
2179 2182
 
@@ -2567,7 +2570,7 @@  discard block
 block discarded – undo
2567 2570
  * @global object $wpdb WordPress Database object.
2568 2571
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2569 2572
  * @param int $post_id The post ID.
2570
- * @return mixed Returns video.
2573
+ * @return string Returns video.
2571 2574
  */
2572 2575
 function geodir_get_video($post_id)
2573 2576
 {
@@ -2593,7 +2596,7 @@  discard block
 block discarded – undo
2593 2596
  * @global object $wpdb WordPress Database object.
2594 2597
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2595 2598
  * @param int $post_id The post ID.
2596
- * @return mixed Returns special offers.
2599
+ * @return string Returns special offers.
2597 2600
  */
2598 2601
 function geodir_get_special_offers($post_id)
2599 2602
 {
@@ -2617,7 +2620,7 @@  discard block
 block discarded – undo
2617 2620
      *
2618 2621
      * @since 1.0.0
2619 2622
      * @package GeoDirectory
2620
-     * @return mixed|void Returns max upload file size.
2623
+     * @return string|null Returns max upload file size.
2621 2624
      */
2622 2625
     function geodir_max_upload_size()
2623 2626
     {
Please login to merge, or discard this patch.
Indentation   +1940 added lines, -1940 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 = $request_field['field_type_key'];
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 = $request_field['field_type_key'];
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 = $package_info->pid;
406
-            }
404
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
405
+				$price_pkg = $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,53 +1172,53 @@  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
-    $value = '';
1204
-    if (is_admin()) {
1205
-        global $post,$gd_session;
1206
-
1207
-        if (isset($_REQUEST['post']))
1208
-            $_REQUEST['pid'] = $_REQUEST['post'];
1209
-    }
1210
-
1211
-    if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1212
-        $post = $gd_ses_listing;
1213
-        $value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1214
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1215
-        $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1216
-    } else {
1217
-        if ($value == '') {
1218
-            $value = $cf['default'];
1219
-        }
1220
-    }
1221
-    return $value;
1203
+	$value = '';
1204
+	if (is_admin()) {
1205
+		global $post,$gd_session;
1206
+
1207
+		if (isset($_REQUEST['post']))
1208
+			$_REQUEST['pid'] = $_REQUEST['post'];
1209
+	}
1210
+
1211
+	if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1212
+		$post = $gd_ses_listing;
1213
+		$value = isset($post[$cf['name']]) ? $post[$cf['name']] : '';
1214
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1215
+		$value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true);
1216
+	} else {
1217
+		if ($value == '') {
1218
+			$value = $cf['default'];
1219
+		}
1220
+	}
1221
+	return $value;
1222 1222
 }
1223 1223
 
1224 1224
 /**
@@ -1237,412 +1237,412 @@  discard block
 block discarded – undo
1237 1237
  * @param string $post_type Optional. The wordpress post type.
1238 1238
  */
1239 1239
 function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
1240
-    global $is_default, $mapzoom, $gd_session;
1240
+	global $is_default, $mapzoom, $gd_session;
1241 1241
 
1242
-    $listing_type = $post_type;
1242
+	$listing_type = $post_type;
1243 1243
 
1244
-    $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1244
+	$custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1245 1245
 
1246
-    foreach ($custom_fields as $key => $val) {
1247
-        $val = stripslashes_deep($val); // strip slashes from labels
1248
-        $name = $val['name'];
1249
-        $type = $val['type'];
1250
-        $is_default = $val['is_default'];
1246
+	foreach ($custom_fields as $key => $val) {
1247
+		$val = stripslashes_deep($val); // strip slashes from labels
1248
+		$name = $val['name'];
1249
+		$type = $val['type'];
1250
+		$is_default = $val['is_default'];
1251 1251
 
1252
-        /* field available to site admin only for edit */
1253
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1254
-        if ($for_admin_use && !is_super_admin()) {
1255
-            continue;
1256
-        }
1252
+		/* field available to site admin only for edit */
1253
+		$for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1254
+		if ($for_admin_use && !is_super_admin()) {
1255
+			continue;
1256
+		}
1257 1257
 
1258
-        if (is_admin()) {
1259
-            global $post;
1258
+		if (is_admin()) {
1259
+			global $post;
1260 1260
 
1261
-            if (isset($_REQUEST['post']))
1262
-                $_REQUEST['pid'] = $_REQUEST['post'];
1263
-        }
1261
+			if (isset($_REQUEST['post']))
1262
+				$_REQUEST['pid'] = $_REQUEST['post'];
1263
+		}
1264 1264
 
1265 1265
         
1266 1266
 
1267
-        /**
1268
-         * Called before the custom fields info is output for submitting a post.
1269
-         *
1270
-         * Used dynamic hook type geodir_before_custom_form_field_$name.
1271
-         *
1272
-         * @since 1.0.0
1273
-         * @param string $listing_type The post post type.
1274
-         * @param int $package_id The price package ID for the post.
1275
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1276
-         * @see 'geodir_after_custom_form_field_$name'
1277
-         */
1278
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1279
-
1280
-
1281
-        $custom_field = $val;
1282
-        $html ='';
1283
-        /**
1284
-         * Filter the output for custom fields.
1285
-         *
1286
-         * Here we can remove or add new functions depending on the field type.
1287
-         *
1288
-         * @param string $html The html to be filtered (blank).
1289
-         * @param array $custom_field The custom field array values.
1290
-         */
1291
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1292
-
1293
-
1294
-
1295
-        /**
1296
-         * Called after the custom fields info is output for submitting a post.
1297
-         *
1298
-         * Used dynamic hook type geodir_after_custom_form_field_$name.
1299
-         *
1300
-         * @since 1.0.0
1301
-         * @param string $listing_type The post post type.
1302
-         * @param int $package_id The price package ID for the post.
1303
-         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1304
-         * @see 'geodir_before_custom_form_field_$name'
1305
-         */
1306
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1307
-
1308
-    }
1267
+		/**
1268
+		 * Called before the custom fields info is output for submitting a post.
1269
+		 *
1270
+		 * Used dynamic hook type geodir_before_custom_form_field_$name.
1271
+		 *
1272
+		 * @since 1.0.0
1273
+		 * @param string $listing_type The post post type.
1274
+		 * @param int $package_id The price package ID for the post.
1275
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1276
+		 * @see 'geodir_after_custom_form_field_$name'
1277
+		 */
1278
+		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1279
+
1280
+
1281
+		$custom_field = $val;
1282
+		$html ='';
1283
+		/**
1284
+		 * Filter the output for custom fields.
1285
+		 *
1286
+		 * Here we can remove or add new functions depending on the field type.
1287
+		 *
1288
+		 * @param string $html The html to be filtered (blank).
1289
+		 * @param array $custom_field The custom field array values.
1290
+		 */
1291
+		echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1292
+
1293
+
1294
+
1295
+		/**
1296
+		 * Called after the custom fields info is output for submitting a post.
1297
+		 *
1298
+		 * Used dynamic hook type geodir_after_custom_form_field_$name.
1299
+		 *
1300
+		 * @since 1.0.0
1301
+		 * @param string $listing_type The post post type.
1302
+		 * @param int $package_id The price package ID for the post.
1303
+		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1304
+		 * @see 'geodir_before_custom_form_field_$name'
1305
+		 */
1306
+		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1307
+
1308
+	}
1309 1309
 
1310 1310
 }
1311 1311
 
1312 1312
 
1313 1313
 if (!function_exists('geodir_get_field_infoby')) {
1314
-    /**
1315
-     * Get custom field using key and value.
1316
-     *
1317
-     * @since 1.0.0
1318
-     * @package GeoDirectory
1319
-     * @global object $wpdb WordPress Database object.
1320
-     * @param string $key The key you want to look for.
1321
-     * @param string $value The value of the key you want to look for.
1322
-     * @param string $geodir_post_type The post type.
1323
-     * @return bool|mixed Returns field info when available. otherwise returns false.
1324
-     */
1325
-    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1326
-    {
1327
-
1328
-        global $wpdb;
1329
-
1330
-        $filter = $wpdb->get_row(
1331
-            $wpdb->prepare(
1332
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1333
-                array($geodir_post_type)
1334
-            )
1335
-        );
1336
-
1337
-        if ($filter) {
1338
-            return $filter;
1339
-        } else {
1340
-            return false;
1341
-        }
1342
-
1343
-    }
1314
+	/**
1315
+	 * Get custom field using key and value.
1316
+	 *
1317
+	 * @since 1.0.0
1318
+	 * @package GeoDirectory
1319
+	 * @global object $wpdb WordPress Database object.
1320
+	 * @param string $key The key you want to look for.
1321
+	 * @param string $value The value of the key you want to look for.
1322
+	 * @param string $geodir_post_type The post type.
1323
+	 * @return bool|mixed Returns field info when available. otherwise returns false.
1324
+	 */
1325
+	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
1326
+	{
1327
+
1328
+		global $wpdb;
1329
+
1330
+		$filter = $wpdb->get_row(
1331
+			$wpdb->prepare(
1332
+				"SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1333
+				array($geodir_post_type)
1334
+			)
1335
+		);
1336
+
1337
+		if ($filter) {
1338
+			return $filter;
1339
+		} else {
1340
+			return false;
1341
+		}
1342
+
1343
+	}
1344 1344
 }
1345 1345
 
1346 1346
 
1347 1347
 function geodir_field_icon_proccess($cf){
1348 1348
 
1349 1349
 
1350
-    if (strpos($cf['field_icon'], 'http') !== false) {
1351
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352
-    } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1353
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1354
-    }else{
1355
-        $field_icon = $cf['field_icon'];
1356
-    }
1350
+	if (strpos($cf['field_icon'], 'http') !== false) {
1351
+		$field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352
+	} elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1353
+		$field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1354
+	}else{
1355
+		$field_icon = $cf['field_icon'];
1356
+	}
1357 1357
 
1358
-    return $field_icon;
1358
+	return $field_icon;
1359 1359
 }
1360 1360
 
1361 1361
 if (!function_exists('geodir_show_listing_info')) {
1362
-    /**
1363
-     * Show listing info depending on field location.
1364
-     *
1365
-     * @since 1.0.0
1366
-     * @since 1.5.7 Custom fields option values added to db translation.
1367
-     *              Changes to display url fields title.
1368
-     * @package GeoDirectory
1369
-     * @global object $wpdb WordPress Database object.
1370
-     * @global object $post The current post object.
1371
-     * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1372
-     *
1373
-     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1374
-     * @return string Returns listing info html.
1375
-     */
1376
-    function geodir_show_listing_info($fields_location = '') {
1377
-        global $post, $preview, $wpdb, $send_to_friend;
1378
-
1379
-        $payment_info = array();
1380
-        $package_info = array();
1381
-
1382
-        $package_info = geodir_post_package_info($package_info, $post);
1383
-        $post_package_id = $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
1362
+	/**
1363
+	 * Show listing info depending on field location.
1364
+	 *
1365
+	 * @since 1.0.0
1366
+	 * @since 1.5.7 Custom fields option values added to db translation.
1367
+	 *              Changes to display url fields title.
1368
+	 * @package GeoDirectory
1369
+	 * @global object $wpdb WordPress Database object.
1370
+	 * @global object $post The current post object.
1371
+	 * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
1372
+	 *
1373
+	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
1374
+	 * @return string Returns listing info html.
1375
+	 */
1376
+	function geodir_show_listing_info($fields_location = '') {
1377
+		global $post, $preview, $wpdb, $send_to_friend;
1378
+
1379
+		$payment_info = array();
1380
+		$package_info = array();
1381
+
1382
+		$package_info = geodir_post_package_info($package_info, $post);
1383
+		$post_package_id = $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;
1396
-
1397
-
1398
-
1399
-            foreach ($fields_info as $type) {
1400
-                $type = stripslashes_deep($type); // strip slashes
1401
-                $html = '';
1402
-                $html_var = '';
1403
-                $field_icon = geodir_field_icon_proccess($type);
1404
-                $filed_type = $type['type'];
1405
-
1406
-                /**
1407
-                 * Filter the output for custom fields.
1408
-                 *
1409
-                 * Here we can remove or add new functions depending on the field type.
1410
-                 *
1411
-                 * @param string $html The html to be filtered (blank).
1412
-                 * @param string $fields_location The location the field is to be show.
1413
-                 * @param array $type The array of field values.
1414
-                 */
1415
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1416
-
1417
-                $variables_array = array();
1418
-
1419
-                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'))) {
1420
-                    continue;
1421
-                }
1422
-
1423
-                if ($type['type'] != 'fieldset'):
1424
-                    $variables_array['post_id'] = $post->ID;
1425
-                    $variables_array['label'] = __($type['site_title'], 'geodirectory');
1426
-                    $variables_array['value'] = '';
1427
-                    if (isset($post->{$type['htmlvar_name']}))
1428
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1429
-                endif;
1430
-
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
-        return $html = ob_get_clean();
1471
-
1472
-    }
1393
+			//echo '<div class="geodir-company_info field-group">';
1394
+			global $field_set_start;
1395
+			$field_set_start = 0;
1396
+
1397
+
1398
+
1399
+			foreach ($fields_info as $type) {
1400
+				$type = stripslashes_deep($type); // strip slashes
1401
+				$html = '';
1402
+				$html_var = '';
1403
+				$field_icon = geodir_field_icon_proccess($type);
1404
+				$filed_type = $type['type'];
1405
+
1406
+				/**
1407
+				 * Filter the output for custom fields.
1408
+				 *
1409
+				 * Here we can remove or add new functions depending on the field type.
1410
+				 *
1411
+				 * @param string $html The html to be filtered (blank).
1412
+				 * @param string $fields_location The location the field is to be show.
1413
+				 * @param array $type The array of field values.
1414
+				 */
1415
+				$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1416
+
1417
+				$variables_array = array();
1418
+
1419
+				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'))) {
1420
+					continue;
1421
+				}
1422
+
1423
+				if ($type['type'] != 'fieldset'):
1424
+					$variables_array['post_id'] = $post->ID;
1425
+					$variables_array['label'] = __($type['site_title'], 'geodirectory');
1426
+					$variables_array['value'] = '';
1427
+					if (isset($post->{$type['htmlvar_name']}))
1428
+						$variables_array['value'] = $post->{$type['htmlvar_name']};
1429
+				endif;
1430
+
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
+		return $html = ob_get_clean();
1471
+
1472
+	}
1473 1473
 }
1474 1474
 
1475 1475
 if (!function_exists('geodir_default_date_format')) {
1476
-    /**
1477
-     * Returns default date format.
1478
-     *
1479
-     * @since 1.0.0
1480
-     * @package GeoDirectory
1481
-     * @return mixed|string|void Returns default date format.
1482
-     */
1483
-    function geodir_default_date_format()
1484
-    {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1489
-    }
1476
+	/**
1477
+	 * Returns default date format.
1478
+	 *
1479
+	 * @since 1.0.0
1480
+	 * @package GeoDirectory
1481
+	 * @return mixed|string|void Returns default date format.
1482
+	 */
1483
+	function geodir_default_date_format()
1484
+	{
1485
+		if ($format = get_option('date_format'))
1486
+			return $format;
1487
+		else
1488
+			return 'dd-mm-yy';
1489
+	}
1490 1490
 }
1491 1491
 
1492 1492
 if (!function_exists('geodir_get_formated_date')) {
1493
-    /**
1494
-     * Returns formatted date.
1495
-     *
1496
-     * @since 1.0.0
1497
-     * @package GeoDirectory
1498
-     * @param string $date Date string to convert.
1499
-     * @return bool|int|string Returns formatted date.
1500
-     */
1501
-    function geodir_get_formated_date($date)
1502
-    {
1503
-        return mysql2date(get_option('date_format'), $date);
1504
-    }
1493
+	/**
1494
+	 * Returns formatted date.
1495
+	 *
1496
+	 * @since 1.0.0
1497
+	 * @package GeoDirectory
1498
+	 * @param string $date Date string to convert.
1499
+	 * @return bool|int|string Returns formatted date.
1500
+	 */
1501
+	function geodir_get_formated_date($date)
1502
+	{
1503
+		return mysql2date(get_option('date_format'), $date);
1504
+	}
1505 1505
 }
1506 1506
 
1507 1507
 if (!function_exists('geodir_get_formated_time')) {
1508
-    /**
1509
-     * Returns formatted time.
1510
-     *
1511
-     * @since 1.0.0
1512
-     * @package GeoDirectory
1513
-     * @param string $time Time string to convert.
1514
-     * @return bool|int|string Returns formatted time.
1515
-     */
1516
-    function geodir_get_formated_time($time)
1517
-    {
1518
-        return mysql2date(get_option('time_format'), $time, $translate = true);
1519
-    }
1508
+	/**
1509
+	 * Returns formatted time.
1510
+	 *
1511
+	 * @since 1.0.0
1512
+	 * @package GeoDirectory
1513
+	 * @param string $time Time string to convert.
1514
+	 * @return bool|int|string Returns formatted time.
1515
+	 */
1516
+	function geodir_get_formated_time($time)
1517
+	{
1518
+		return mysql2date(get_option('time_format'), $time, $translate = true);
1519
+	}
1520 1520
 }
1521 1521
 
1522 1522
 
1523 1523
 if (!function_exists('geodir_save_post_file_fields')) {
1524
-    /**
1525
-     * Save post file fields
1526
-     *
1527
-     * @since 1.0.0
1528
-     * @since 1.4.7 Added `$extra_fields` parameter.
1529
-     * @package GeoDirectory
1530
-     * @global object $wpdb WordPress Database object.
1531
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
-     * @global object $current_user Current user object.
1533
-     * @param int $post_id
1534
-     * @param string $field_id
1535
-     * @param array $post_image
1536
-     * @param array $extra_fields Array of extra fields.
1537
-     */
1538
-    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
-    {
1524
+	/**
1525
+	 * Save post file fields
1526
+	 *
1527
+	 * @since 1.0.0
1528
+	 * @since 1.4.7 Added `$extra_fields` parameter.
1529
+	 * @package GeoDirectory
1530
+	 * @global object $wpdb WordPress Database object.
1531
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1532
+	 * @global object $current_user Current user object.
1533
+	 * @param int $post_id
1534
+	 * @param string $field_id
1535
+	 * @param array $post_image
1536
+	 * @param array $extra_fields Array of extra fields.
1537
+	 */
1538
+	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
1539
+	{
1540 1540
 
1541
-        global $wpdb, $plugin_prefix, $current_user;
1541
+		global $wpdb, $plugin_prefix, $current_user;
1542 1542
 
1543
-        $post_type = get_post_type($post_id);
1544
-        //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1543
+		$post_type = get_post_type($post_id);
1544
+		//echo $field_id; exit;
1545
+		$table = $plugin_prefix . $post_type . '_detail';
1546 1546
 
1547
-        $postcurr_images = array();
1548
-        $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
-        $file_urls = '';
1547
+		$postcurr_images = array();
1548
+		$postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
1549
+		$file_urls = '';
1550 1550
 
1551
-        if (!empty($post_image)) {
1551
+		if (!empty($post_image)) {
1552 1552
 
1553
-            $invalid_files = array();
1553
+			$invalid_files = array();
1554 1554
 
1555
-            //Get and remove all old images of post from database to set by new order
1556
-            $geodir_uploaddir = '';
1557
-            $uploads = wp_upload_dir();
1558
-            $uploads_dir = $uploads['path'];
1555
+			//Get and remove all old images of post from database to set by new order
1556
+			$geodir_uploaddir = '';
1557
+			$uploads = wp_upload_dir();
1558
+			$uploads_dir = $uploads['path'];
1559 1559
 
1560
-            $geodir_uploadpath = $uploads['path'];
1561
-            $geodir_uploadurl = $uploads['url'];
1562
-            $sub_dir = $uploads['subdir'];
1560
+			$geodir_uploadpath = $uploads['path'];
1561
+			$geodir_uploadurl = $uploads['url'];
1562
+			$sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $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'] : '';
1564
+			$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'] : '';
1565 1565
 
1566
-            for ($m = 0; $m < count($post_image); $m++) {
1566
+			for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568
-                /* --------- start ------- */
1568
+				/* --------- start ------- */
1569 1569
 
1570
-                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)))) {
1570
+				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)))) {
1571 1571
 
1572 1572
 
1573
-                    $curr_img_url = $post_image[$m];
1574
-                    $image_name_arr = explode('/', $curr_img_url);
1575
-                    $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
-                    $filename = end($image_name_arr);
1577
-                    $img_name_arr = explode('.', $filename);
1573
+					$curr_img_url = $post_image[$m];
1574
+					$image_name_arr = explode('/', $curr_img_url);
1575
+					$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1576
+					$filename = end($image_name_arr);
1577
+					$img_name_arr = explode('.', $filename);
1578 1578
 
1579
-                    $arr_file_type = wp_check_filetype($filename);
1579
+					$arr_file_type = wp_check_filetype($filename);
1580 1580
 
1581
-                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
-                        continue;
1583
-                    }
1581
+					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1582
+						continue;
1583
+					}
1584 1584
 
1585
-                    $uploaded_file_type = $arr_file_type['type'];
1586
-                    $uploaded_file_ext = $arr_file_type['ext'];
1585
+					$uploaded_file_type = $arr_file_type['type'];
1586
+					$uploaded_file_ext = $arr_file_type['ext'];
1587 1587
 
1588
-                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
-                        continue; // Invalid file type.
1590
-                    }
1588
+					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1589
+						continue; // Invalid file type.
1590
+					}
1591 1591
 
1592
-                    // Set an array containing a list of acceptable formats
1593
-                    //$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');
1592
+					// Set an array containing a list of acceptable formats
1593
+					//$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');
1594 1594
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1595
+					if (!function_exists('wp_handle_upload'))
1596
+						require_once(ABSPATH . 'wp-admin/includes/file.php');
1597 1597
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1598
+					if (!is_dir($geodir_uploadpath))
1599
+						mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
-                    $explode_sub_dir = explode("/", $sub_dir);
1603
-                    if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1606
-                    } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
-                    }
1601
+					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602
+					$explode_sub_dir = explode("/", $sub_dir);
1603
+					if ($curr_img_dir == end($explode_sub_dir)) {
1604
+						$img_path = $geodir_uploadpath . '/' . $filename;
1605
+						$img_url = $geodir_uploadurl . '/' . $filename;
1606
+					} else {
1607
+						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
+						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1609
+					}
1610 1610
 
1611
-                    $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1611
+					$uploaded_file = '';
1612
+					if (file_exists($img_path))
1613
+						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1614 1614
 
1615
-                    if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1618
-                    }
1615
+					if ($curr_img_dir != $geodir_uploaddir) {
1616
+						if (file_exists($img_path))
1617
+							unlink($img_path);
1618
+					}
1619 1619
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1620
+					if (!empty($uploaded_file))
1621
+						$file_urls = $geodir_uploadurl . '/' . $new_name;
1622 1622
 
1623
-                } else {
1624
-                    $file_urls = $post_image[$m];
1625
-                }
1626
-            }
1623
+				} else {
1624
+					$file_urls = $post_image[$m];
1625
+				}
1626
+			}
1627 1627
 
1628 1628
 
1629
-        }
1629
+		}
1630 1630
 
1631
-        //Remove all old attachments and temp images
1632
-        if (!empty($postcurr_images)) {
1631
+		//Remove all old attachments and temp images
1632
+		if (!empty($postcurr_images)) {
1633 1633
 
1634
-            if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1637
-            }
1638
-        }
1634
+			if ($file_urls != $postcurr_images) {
1635
+				$invalid_files[] = (object)array('src' => $postcurr_images);
1636
+				$invalid_files = (object)$invalid_files;
1637
+			}
1638
+		}
1639 1639
 
1640
-        geodir_save_post_meta($post_id, $field_id, $file_urls);
1640
+		geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1641
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1642
+		if (!empty($invalid_files))
1643
+			geodir_remove_attachments($invalid_files);
1644 1644
 
1645
-    }
1645
+	}
1646 1646
 }
1647 1647
 
1648 1648
 
@@ -1657,76 +1657,76 @@  discard block
 block discarded – undo
1657 1657
  */
1658 1658
 function geodir_custom_upload_mimes($existing_mimes = array())
1659 1659
 {
1660
-    $existing_mimes['wif'] = 'text/plain';
1661
-    $existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
-    $existing_mimes['gif'] = 'image/gif';
1663
-    $existing_mimes['png'] = 'image/png';
1664
-    $existing_mimes['pdf'] = 'application/pdf';
1665
-    $existing_mimes['txt'] = 'text/text';
1666
-    $existing_mimes['csv'] = 'application/octet-stream';
1667
-    $existing_mimes['doc'] = 'application/msword';
1668
-    $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
-    $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
-    $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
-    return $existing_mimes;
1660
+	$existing_mimes['wif'] = 'text/plain';
1661
+	$existing_mimes['jpg|jpeg'] = 'image/jpeg';
1662
+	$existing_mimes['gif'] = 'image/gif';
1663
+	$existing_mimes['png'] = 'image/png';
1664
+	$existing_mimes['pdf'] = 'application/pdf';
1665
+	$existing_mimes['txt'] = 'text/text';
1666
+	$existing_mimes['csv'] = 'application/octet-stream';
1667
+	$existing_mimes['doc'] = 'application/msword';
1668
+	$existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';
1669
+	$existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
1670
+	$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
1671
+	return $existing_mimes;
1672 1672
 }
1673 1673
 
1674 1674
 if (!function_exists('geodir_plupload_action')) {
1675 1675
 
1676
-    /**
1677
-     * Get upload directory path details
1678
-     *
1679
-     * @since 1.0.0
1680
-     * @package GeoDirectory
1681
-     * @global object $current_user Current user object.
1682
-     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
-     * @return mixed Returns upload directory details as an array.
1684
-     */
1685
-    function geodir_upload_dir($upload)
1686
-    {
1687
-        global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
-        return $upload;
1692
-    }
1693
-
1694
-    /**
1695
-     * Handles place file and image upload.
1696
-     *
1697
-     * @since 1.0.0
1698
-     * @package GeoDirectory
1699
-     */
1700
-    function geodir_plupload_action()
1701
-    {
1702
-        // check ajax noonce
1703
-        $imgid = $_POST["imgid"];
1704
-
1705
-        check_ajax_referer($imgid . 'pluploadan');
1706
-
1707
-        // handle custom file uploaddir
1708
-        add_filter('upload_dir', 'geodir_upload_dir');
1709
-
1710
-        // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
-
1713
-        // handle file upload
1714
-        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
-        // remove handle custom file uploaddir
1716
-        remove_filter('upload_dir', 'geodir_upload_dir');
1717
-
1718
-        if(!isset($status['url']) && isset($status['error'])){
1719
-            print_r($status);
1720
-        }
1721
-
1722
-        // send the uploaded file url in response
1723
-        if (isset($status['url'])) {
1724
-            echo $status['url'];
1725
-        } else {
1726
-            echo 'x';
1727
-        }
1728
-        exit;
1729
-    }
1676
+	/**
1677
+	 * Get upload directory path details
1678
+	 *
1679
+	 * @since 1.0.0
1680
+	 * @package GeoDirectory
1681
+	 * @global object $current_user Current user object.
1682
+	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
1683
+	 * @return mixed Returns upload directory details as an array.
1684
+	 */
1685
+	function geodir_upload_dir($upload)
1686
+	{
1687
+		global $current_user;
1688
+		$upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
+		$upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
+		$upload['url'] = $upload['baseurl'] . $upload['subdir'];
1691
+		return $upload;
1692
+	}
1693
+
1694
+	/**
1695
+	 * Handles place file and image upload.
1696
+	 *
1697
+	 * @since 1.0.0
1698
+	 * @package GeoDirectory
1699
+	 */
1700
+	function geodir_plupload_action()
1701
+	{
1702
+		// check ajax noonce
1703
+		$imgid = $_POST["imgid"];
1704
+
1705
+		check_ajax_referer($imgid . 'pluploadan');
1706
+
1707
+		// handle custom file uploaddir
1708
+		add_filter('upload_dir', 'geodir_upload_dir');
1709
+
1710
+		// change file orinetation if needed
1711
+		$fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1712
+
1713
+		// handle file upload
1714
+		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715
+		// remove handle custom file uploaddir
1716
+		remove_filter('upload_dir', 'geodir_upload_dir');
1717
+
1718
+		if(!isset($status['url']) && isset($status['error'])){
1719
+			print_r($status);
1720
+		}
1721
+
1722
+		// send the uploaded file url in response
1723
+		if (isset($status['url'])) {
1724
+			echo $status['url'];
1725
+		} else {
1726
+			echo 'x';
1727
+		}
1728
+		exit;
1729
+	}
1730 1730
 }
1731 1731
 
1732 1732
 /**
@@ -1741,17 +1741,17 @@  discard block
 block discarded – undo
1741 1741
  */
1742 1742
 function geodir_get_video($post_id)
1743 1743
 {
1744
-    global $wpdb, $plugin_prefix;
1744
+	global $wpdb, $plugin_prefix;
1745 1745
 
1746
-    $post_type = get_post_type($post_id);
1746
+	$post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+	$table = $plugin_prefix . $post_type . '_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1751 1751
 
1752
-    if ($results) {
1753
-        return $results[0]->geodir_video;
1754
-    }
1752
+	if ($results) {
1753
+		return $results[0]->geodir_video;
1754
+	}
1755 1755
 
1756 1756
 }
1757 1757
 
@@ -1767,40 +1767,40 @@  discard block
 block discarded – undo
1767 1767
  */
1768 1768
 function geodir_get_special_offers($post_id)
1769 1769
 {
1770
-    global $wpdb, $plugin_prefix;
1770
+	global $wpdb, $plugin_prefix;
1771 1771
 
1772
-    $post_type = get_post_type($post_id);
1772
+	$post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+	$table = $plugin_prefix . $post_type . '_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1777 1777
 
1778
-    if ($results) {
1779
-        return $results[0]->geodir_special_offers;
1780
-    }
1778
+	if ($results) {
1779
+		return $results[0]->geodir_special_offers;
1780
+	}
1781 1781
 
1782 1782
 }
1783 1783
 
1784 1784
 if (!function_exists('geodir_max_upload_size')) {
1785
-    /**
1786
-     * Get max upload file size
1787
-     *
1788
-     * @since 1.0.0
1789
-     * @package GeoDirectory
1790
-     * @return mixed|void Returns max upload file size.
1791
-     */
1792
-    function geodir_max_upload_size()
1793
-    {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
-
1796
-        if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
-        } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
-        }
1801
-        /** Filter documented in geodirectory-functions/general_functions.php **/
1802
-        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
-    }
1785
+	/**
1786
+	 * Get max upload file size
1787
+	 *
1788
+	 * @since 1.0.0
1789
+	 * @package GeoDirectory
1790
+	 * @return mixed|void Returns max upload file size.
1791
+	 */
1792
+	function geodir_max_upload_size()
1793
+	{
1794
+		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1795
+
1796
+		if ($max_filesize > 0 && $max_filesize < 1) {
1797
+			$max_filesize = (int)($max_filesize * 1024) . 'kb';
1798
+		} else {
1799
+			$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1800
+		}
1801
+		/** Filter documented in geodirectory-functions/general_functions.php **/
1802
+		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1803
+	}
1804 1804
 }
1805 1805
 
1806 1806
 
@@ -1818,33 +1818,33 @@  discard block
 block discarded – undo
1818 1818
  */
1819 1819
 function geodir_add_custom_sort_options($fields, $post_type)
1820 1820
 {
1821
-    global $wpdb;
1821
+	global $wpdb;
1822 1822
 
1823
-    if ($post_type != '') {
1823
+	if ($post_type != '') {
1824 1824
 
1825
-        $all_postypes = geodir_get_posttypes();
1825
+		$all_postypes = geodir_get_posttypes();
1826 1826
 
1827
-        if (in_array($post_type, $all_postypes)) {
1827
+		if (in_array($post_type, $all_postypes)) {
1828 1828
 
1829
-            $custom_fields = $wpdb->get_results(
1830
-                $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
-                    array($post_type)
1833
-                ), 'ARRAY_A'
1834
-            );
1829
+			$custom_fields = $wpdb->get_results(
1830
+				$wpdb->prepare(
1831
+					"select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832
+					array($post_type)
1833
+				), 'ARRAY_A'
1834
+			);
1835 1835
 
1836
-            if (!empty($custom_fields)) {
1836
+			if (!empty($custom_fields)) {
1837 1837
 
1838
-                foreach ($custom_fields as $val) {
1839
-                    $fields[] = $val;
1840
-                }
1841
-            }
1838
+				foreach ($custom_fields as $val) {
1839
+					$fields[] = $val;
1840
+				}
1841
+			}
1842 1842
 
1843
-        }
1843
+		}
1844 1844
 
1845
-    }
1845
+	}
1846 1846
 
1847
-    return $fields;
1847
+	return $fields;
1848 1848
 }
1849 1849
 
1850 1850
 
@@ -1860,66 +1860,66 @@  discard block
 block discarded – undo
1860 1860
 function geodir_get_custom_sort_options($post_type = '')
1861 1861
 {
1862 1862
 
1863
-    global $wpdb;
1864
-
1865
-    if ($post_type != '') {
1866
-
1867
-        $all_postypes = geodir_get_posttypes();
1868
-
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1871
-
1872
-        $fields = array();
1873
-
1874
-        $fields[] = array(
1875
-            'post_type' => $post_type,
1876
-            'data_type' => '',
1877
-            'field_type' => 'random',
1878
-            'site_title' => 'Random',
1879
-            'htmlvar_name' => 'post_title'
1880
-        );
1881
-
1882
-        $fields[] = array(
1883
-            'post_type' => $post_type,
1884
-            'data_type' => '',
1885
-            'field_type' => 'datetime',
1886
-            'site_title' => __('Add date', 'geodirectory'),
1887
-            'htmlvar_name' => 'post_date'
1888
-        );
1889
-        $fields[] = array(
1890
-            'post_type' => $post_type,
1891
-            'data_type' => '',
1892
-            'field_type' => 'bigint',
1893
-            'site_title' => __('Review', 'geodirectory'),
1894
-            'htmlvar_name' => 'comment_count'
1895
-        );
1896
-        $fields[] = array(
1897
-            'post_type' => $post_type,
1898
-            'data_type' => '',
1899
-            'field_type' => 'float',
1900
-            'site_title' => __('Rating', 'geodirectory'),
1901
-            'htmlvar_name' => 'overall_rating'
1902
-        );
1903
-        $fields[] = array(
1904
-            'post_type' => $post_type,
1905
-            'data_type' => '',
1906
-            'field_type' => 'text',
1907
-            'site_title' => __('Title', 'geodirectory'),
1908
-            'htmlvar_name' => 'post_title'
1909
-        );
1910
-
1911
-        /**
1912
-         * Hook to add custom sort options.
1913
-         *
1914
-         * @since 1.0.0
1915
-         * @param array $fields Unmodified sort options array.
1916
-         * @param string $post_type Post type.
1917
-         */
1918
-        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1919
-
1920
-    }
1921
-
1922
-    return false;
1863
+	global $wpdb;
1864
+
1865
+	if ($post_type != '') {
1866
+
1867
+		$all_postypes = geodir_get_posttypes();
1868
+
1869
+		if (!in_array($post_type, $all_postypes))
1870
+			return false;
1871
+
1872
+		$fields = array();
1873
+
1874
+		$fields[] = array(
1875
+			'post_type' => $post_type,
1876
+			'data_type' => '',
1877
+			'field_type' => 'random',
1878
+			'site_title' => 'Random',
1879
+			'htmlvar_name' => 'post_title'
1880
+		);
1881
+
1882
+		$fields[] = array(
1883
+			'post_type' => $post_type,
1884
+			'data_type' => '',
1885
+			'field_type' => 'datetime',
1886
+			'site_title' => __('Add date', 'geodirectory'),
1887
+			'htmlvar_name' => 'post_date'
1888
+		);
1889
+		$fields[] = array(
1890
+			'post_type' => $post_type,
1891
+			'data_type' => '',
1892
+			'field_type' => 'bigint',
1893
+			'site_title' => __('Review', 'geodirectory'),
1894
+			'htmlvar_name' => 'comment_count'
1895
+		);
1896
+		$fields[] = array(
1897
+			'post_type' => $post_type,
1898
+			'data_type' => '',
1899
+			'field_type' => 'float',
1900
+			'site_title' => __('Rating', 'geodirectory'),
1901
+			'htmlvar_name' => 'overall_rating'
1902
+		);
1903
+		$fields[] = array(
1904
+			'post_type' => $post_type,
1905
+			'data_type' => '',
1906
+			'field_type' => 'text',
1907
+			'site_title' => __('Title', 'geodirectory'),
1908
+			'htmlvar_name' => 'post_title'
1909
+		);
1910
+
1911
+		/**
1912
+		 * Hook to add custom sort options.
1913
+		 *
1914
+		 * @since 1.0.0
1915
+		 * @param array $fields Unmodified sort options array.
1916
+		 * @param string $post_type Post type.
1917
+		 */
1918
+		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
1919
+
1920
+	}
1921
+
1922
+	return false;
1923 1923
 }
1924 1924
 
1925 1925
 
@@ -1935,117 +1935,117 @@  discard block
 block discarded – undo
1935 1935
 function godir_set_sort_field_order($field_ids = array())
1936 1936
 {
1937 1937
 
1938
-    global $wpdb;
1938
+	global $wpdb;
1939 1939
 
1940
-    $count = 0;
1941
-    if (!empty($field_ids)):
1942
-        foreach ($field_ids as $id) {
1940
+	$count = 0;
1941
+	if (!empty($field_ids)):
1942
+		foreach ($field_ids as $id) {
1943 1943
 
1944
-            $cf = trim($id, '_');
1944
+			$cf = trim($id, '_');
1945 1945
 
1946
-            $post_meta_info = $wpdb->query(
1947
-                $wpdb->prepare(
1948
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1946
+			$post_meta_info = $wpdb->query(
1947
+				$wpdb->prepare(
1948
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1949 1949
 															sort_order=%d 
1950 1950
 															where id= %d",
1951
-                    array($count, $cf)
1952
-                )
1953
-            );
1954
-            $count++;
1955
-        }
1956
-
1957
-        return $field_ids;
1958
-    else:
1959
-        return false;
1960
-    endif;
1951
+					array($count, $cf)
1952
+				)
1953
+			);
1954
+			$count++;
1955
+		}
1956
+
1957
+		return $field_ids;
1958
+	else:
1959
+		return false;
1960
+	endif;
1961 1961
 }
1962 1962
 
1963 1963
 
1964 1964
 if (!function_exists('geodir_custom_sort_field_save')) {
1965
-    /**
1966
-     * Save or Update custom sort fields into the database.
1967
-     *
1968
-     * @since 1.0.0
1969
-     * @package GeoDirectory
1970
-     * @global object $wpdb WordPress Database object.
1971
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1972
-     * @param array $request_field {
1973
-     *    Attributes of the Request field.
1974
-     *
1975
-     *    @type string $action Ajax action name.
1976
-     *    @type string $manage_field_type Manage field type Default "sorting_options".
1977
-     *    @type string $create_field Do you want to create this field?.
1978
-     *    @type string $field_ins_upd Field created or updated?.
1979
-     *    @type string $_wpnonce Nonce value.
1980
-     *    @type string $listing_type The Post type.
1981
-     *    @type string $field_type Field Type.
1982
-     *    @type string $field_id Field ID.
1983
-     *    @type string $data_type Data Type.
1984
-     *    @type string $htmlvar_name HTML variable name.
1985
-     *    @type string $site_title Section title which you wish to display in frontend.
1986
-     *    @type string $is_default Is this default sorting?.
1987
-     *    @type string $is_active If not active then the field will not be displayed anywhere.
1988
-     *    @type string $sort_order Sort Order.
1989
-     *
1990
-     * }
1991
-     * @param bool $default Not yet implemented.
1992
-     * @return int Returns the last affected db table row id.
1993
-     */
1994
-    function geodir_custom_sort_field_save($request_field = array(), $default = false)
1995
-    {
1996
-
1997
-        global $wpdb, $plugin_prefix;
1998
-
1999
-        $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2000
-
2001
-        $cf = trim($result_str, '_');
2002
-
2003
-        /*-------- check dublicate validation --------*/
2004
-
2005
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2006
-        $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2007
-
2008
-        $post_type = $request_field['listing_type'];
2009
-        $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2010
-        $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2011
-        $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2012
-        $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2013
-        $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2014
-        $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2015
-        $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2016
-        $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2017
-        $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2018
-        $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2019
-        $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2020
-
2021
-        $default_order = '';
2022
-        if ($is_default != '') {
2023
-            $default_order = $is_default;
2024
-            $is_default = '1';
2025
-        }
2026
-
2027
-
2028
-        $check_html_variable = $wpdb->get_var(
2029
-            $wpdb->prepare(
2030
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2031
-                array($cehhtmlvar_name, $post_type, $field_type)
2032
-            )
2033
-        );
2034
-
2035
-        if ($is_default == 1) {
2036
-
2037
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2038
-
2039
-        }
2040
-
2041
-
2042
-        if (!$check_html_variable) {
2043
-
2044
-            $wpdb->query(
2045
-
2046
-                $wpdb->prepare(
2047
-
2048
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1965
+	/**
1966
+	 * Save or Update custom sort fields into the database.
1967
+	 *
1968
+	 * @since 1.0.0
1969
+	 * @package GeoDirectory
1970
+	 * @global object $wpdb WordPress Database object.
1971
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1972
+	 * @param array $request_field {
1973
+	 *    Attributes of the Request field.
1974
+	 *
1975
+	 *    @type string $action Ajax action name.
1976
+	 *    @type string $manage_field_type Manage field type Default "sorting_options".
1977
+	 *    @type string $create_field Do you want to create this field?.
1978
+	 *    @type string $field_ins_upd Field created or updated?.
1979
+	 *    @type string $_wpnonce Nonce value.
1980
+	 *    @type string $listing_type The Post type.
1981
+	 *    @type string $field_type Field Type.
1982
+	 *    @type string $field_id Field ID.
1983
+	 *    @type string $data_type Data Type.
1984
+	 *    @type string $htmlvar_name HTML variable name.
1985
+	 *    @type string $site_title Section title which you wish to display in frontend.
1986
+	 *    @type string $is_default Is this default sorting?.
1987
+	 *    @type string $is_active If not active then the field will not be displayed anywhere.
1988
+	 *    @type string $sort_order Sort Order.
1989
+	 *
1990
+	 * }
1991
+	 * @param bool $default Not yet implemented.
1992
+	 * @return int Returns the last affected db table row id.
1993
+	 */
1994
+	function geodir_custom_sort_field_save($request_field = array(), $default = false)
1995
+	{
1996
+
1997
+		global $wpdb, $plugin_prefix;
1998
+
1999
+		$result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';
2000
+
2001
+		$cf = trim($result_str, '_');
2002
+
2003
+		/*-------- check dublicate validation --------*/
2004
+
2005
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2006
+		$cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2007
+
2008
+		$post_type = $request_field['listing_type'];
2009
+		$data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';
2010
+		$field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';
2011
+		$site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';
2012
+		$htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';
2013
+		$sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;
2014
+		$is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;
2015
+		$is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';
2016
+		$asc = isset($request_field['asc']) ? $request_field['asc'] : 0;
2017
+		$desc = isset($request_field['desc']) ? $request_field['desc'] : 0;
2018
+		$asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';
2019
+		$desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';
2020
+
2021
+		$default_order = '';
2022
+		if ($is_default != '') {
2023
+			$default_order = $is_default;
2024
+			$is_default = '1';
2025
+		}
2026
+
2027
+
2028
+		$check_html_variable = $wpdb->get_var(
2029
+			$wpdb->prepare(
2030
+				"select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2031
+				array($cehhtmlvar_name, $post_type, $field_type)
2032
+			)
2033
+		);
2034
+
2035
+		if ($is_default == 1) {
2036
+
2037
+			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2038
+
2039
+		}
2040
+
2041
+
2042
+		if (!$check_html_variable) {
2043
+
2044
+			$wpdb->query(
2045
+
2046
+				$wpdb->prepare(
2047
+
2048
+					"insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2049 2049
 				post_type = %s,
2050 2050
 				data_type = %s,
2051 2051
 				field_type = %s,
@@ -2060,23 +2060,23 @@  discard block
 block discarded – undo
2060 2060
 				asc_title = %s,
2061 2061
 				desc_title = %s",
2062 2062
 
2063
-                    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)
2064
-                )
2063
+					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)
2064
+				)
2065 2065
 
2066
-            );
2066
+			);
2067 2067
 
2068 2068
 
2069
-            $lastid = $wpdb->insert_id;
2069
+			$lastid = $wpdb->insert_id;
2070 2070
 
2071
-            $lastid = trim($lastid);
2071
+			$lastid = trim($lastid);
2072 2072
 
2073
-        } else {
2073
+		} else {
2074 2074
 
2075
-            $wpdb->query(
2075
+			$wpdb->query(
2076 2076
 
2077
-                $wpdb->prepare(
2077
+				$wpdb->prepare(
2078 2078
 
2079
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2079
+					"update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2080 2080
 				post_type = %s,
2081 2081
 				data_type = %s,
2082 2082
 				field_type = %s,
@@ -2092,115 +2092,115 @@  discard block
 block discarded – undo
2092 2092
 				desc_title = %s
2093 2093
 				where id = %d",
2094 2094
 
2095
-                    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)
2096
-                )
2095
+					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)
2096
+				)
2097 2097
 
2098
-            );
2098
+			);
2099 2099
 
2100
-            $lastid = trim($cf);
2100
+			$lastid = trim($cf);
2101 2101
 
2102
-        }
2102
+		}
2103 2103
 
2104 2104
 
2105
-        return (int)$lastid;
2105
+		return (int)$lastid;
2106 2106
 
2107
-    }
2107
+	}
2108 2108
 }
2109 2109
 
2110 2110
 
2111 2111
 if (!function_exists('geodir_custom_sort_field_delete')) {
2112
-    /**
2113
-     * Delete a custom sort field using field id.
2114
-     * @since 1.0.0
2115
-     * @package GeoDirectory
2116
-     * @global object $wpdb WordPress Database object.
2117
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2118
-     * @param string $field_id The field ID.
2119
-     * @return int|string Returns field id when successful deletion, else returns 0.
2120
-     */
2121
-    function geodir_custom_sort_field_delete($field_id = '')
2122
-    {
2123
-
2124
-        global $wpdb, $plugin_prefix;
2125
-        if ($field_id != '') {
2126
-            $cf = trim($field_id, '_');
2127
-
2128
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2129
-
2130
-            return $field_id;
2131
-
2132
-        } else
2133
-            return 0;
2134
-
2135
-    }
2112
+	/**
2113
+	 * Delete a custom sort field using field id.
2114
+	 * @since 1.0.0
2115
+	 * @package GeoDirectory
2116
+	 * @global object $wpdb WordPress Database object.
2117
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2118
+	 * @param string $field_id The field ID.
2119
+	 * @return int|string Returns field id when successful deletion, else returns 0.
2120
+	 */
2121
+	function geodir_custom_sort_field_delete($field_id = '')
2122
+	{
2123
+
2124
+		global $wpdb, $plugin_prefix;
2125
+		if ($field_id != '') {
2126
+			$cf = trim($field_id, '_');
2127
+
2128
+			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2129
+
2130
+			return $field_id;
2131
+
2132
+		} else
2133
+			return 0;
2134
+
2135
+	}
2136 2136
 }
2137 2137
 
2138 2138
 
2139 2139
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
2140
-    /**
2141
-     * Custom sort field admin html.
2142
-     *
2143
-     * @since 1.0.0
2144
-     * @package GeoDirectory
2145
-     * @global object $wpdb WordPress Database object.
2146
-     * @param string $field_type The form field type.
2147
-     * @param object|int $result_str The custom field results object or row id.
2148
-     * @param string $field_ins_upd When set to "submit" displays form.
2149
-     * @param bool $default when set to true field will be for admin use only.
2150
-     */
2151
-    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
2152
-    {
2153
-        global $wpdb;
2154
-        $cf = $result_str;
2155
-        if (!is_object($cf)) {
2156
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2157
-        } else {
2158
-            $field_info = $cf;
2159
-            $result_str = $cf->id;
2160
-        }
2161
-
2162
-        $field_info = stripslashes_deep($field_info); // strip slashes
2163
-
2164
-        if (!isset($field_info->post_type)) {
2165
-            $post_type = sanitize_text_field($_REQUEST['listing_type']);
2166
-        } else {
2167
-            $post_type = $field_info->post_type;
2168
-        }
2169
-
2170
-        $field_types = explode('-_-', $field_type);
2171
-        $field_type = $field_types[0];
2172
-        $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
2173
-
2174
-        $site_title = '';
2175
-        if ($site_title == '')
2176
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2177
-
2178
-        if ($site_title == '') {
2179
-            $fields = geodir_get_custom_sort_options($post_type);
2180
-
2181
-            foreach ($fields as $val) {
2182
-                $val = stripslashes_deep($val); // strip slashes
2183
-
2184
-                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2185
-                    $site_title = isset($val['site_title']) ? $val['site_title'] : '';
2186
-                }
2187
-            }
2188
-        }
2189
-
2190
-        if ($htmlvar_name == '')
2191
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2192
-
2193
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2194
-
2195
-        ?>
2140
+	/**
2141
+	 * Custom sort field admin html.
2142
+	 *
2143
+	 * @since 1.0.0
2144
+	 * @package GeoDirectory
2145
+	 * @global object $wpdb WordPress Database object.
2146
+	 * @param string $field_type The form field type.
2147
+	 * @param object|int $result_str The custom field results object or row id.
2148
+	 * @param string $field_ins_upd When set to "submit" displays form.
2149
+	 * @param bool $default when set to true field will be for admin use only.
2150
+	 */
2151
+	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
2152
+	{
2153
+		global $wpdb;
2154
+		$cf = $result_str;
2155
+		if (!is_object($cf)) {
2156
+			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2157
+		} else {
2158
+			$field_info = $cf;
2159
+			$result_str = $cf->id;
2160
+		}
2161
+
2162
+		$field_info = stripslashes_deep($field_info); // strip slashes
2163
+
2164
+		if (!isset($field_info->post_type)) {
2165
+			$post_type = sanitize_text_field($_REQUEST['listing_type']);
2166
+		} else {
2167
+			$post_type = $field_info->post_type;
2168
+		}
2169
+
2170
+		$field_types = explode('-_-', $field_type);
2171
+		$field_type = $field_types[0];
2172
+		$htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
2173
+
2174
+		$site_title = '';
2175
+		if ($site_title == '')
2176
+			$site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2177
+
2178
+		if ($site_title == '') {
2179
+			$fields = geodir_get_custom_sort_options($post_type);
2180
+
2181
+			foreach ($fields as $val) {
2182
+				$val = stripslashes_deep($val); // strip slashes
2183
+
2184
+				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
2185
+					$site_title = isset($val['site_title']) ? $val['site_title'] : '';
2186
+				}
2187
+			}
2188
+		}
2189
+
2190
+		if ($htmlvar_name == '')
2191
+			$htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2192
+
2193
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
2194
+
2195
+		?>
2196 2196
         <li class="text" id="licontainer_<?php echo $result_str;?>">
2197 2197
             <div class="title title<?php echo $result_str;?> gt-fieldset"
2198 2198
                  title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2199 2199
                  ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2200 2200
                 <?php
2201 2201
 
2202
-                $nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
-                ?>
2202
+				$nonce = wp_create_nonce('custom_fields_' . $result_str);
2203
+				?>
2204 2204
 
2205 2205
                 <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2206 2206
                      onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
@@ -2213,17 +2213,17 @@  discard block
 block discarded – undo
2213 2213
 
2214 2214
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2215 2215
                  style="display:<?php if ($field_ins_upd == 'submit') {
2216
-                     echo 'block;';
2217
-                 } else {
2218
-                     echo 'none;';
2219
-                 } ?>">
2216
+					 echo 'block;';
2217
+				 } else {
2218
+					 echo 'none;';
2219
+				 } ?>">
2220 2220
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2221 2221
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2222 2222
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2223 2223
                 <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2224 2224
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2225
-                    echo $field_info->data_type;
2226
-                }?>"/>
2225
+					echo $field_info->data_type;
2226
+				}?>"/>
2227 2227
                 <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2228 2228
 
2229 2229
 
@@ -2238,19 +2238,19 @@  discard block
 block discarded – undo
2238 2238
                             <td>
2239 2239
                                 <input type="checkbox" name="asc" id="asc"
2240 2240
                                        value="1" <?php if (isset($field_info->sort_asc) && $field_info->sort_asc == '1') {
2241
-                                    echo 'checked="checked"';
2242
-                                } ?>/>
2241
+									echo 'checked="checked"';
2242
+								} ?>/>
2243 2243
 
2244 2244
                                 <input type="text" name="asc_title" id="asc_title"
2245 2245
                                        placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
2246 2246
                                        value="<?php if (isset($field_info->asc_title)) {
2247
-                                           echo esc_attr($field_info->asc_title);
2248
-                                       } ?>" style="width:45%;"/>
2247
+										   echo esc_attr($field_info->asc_title);
2248
+									   } ?>" style="width:45%;"/>
2249 2249
 
2250 2250
                                 <input type="radio" name="is_default"
2251 2251
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2252
-                                    echo 'checked="checked"';
2253
-                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
2252
+									echo 'checked="checked"';
2253
+								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
2254 2254
 
2255 2255
                                 <br/>
2256 2256
                                 <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
@@ -2262,18 +2262,18 @@  discard block
 block discarded – undo
2262 2262
                             <td>
2263 2263
                                 <input type="checkbox" name="desc" id="desc"
2264 2264
                                        value="1" <?php if (isset($field_info->sort_desc) && $field_info->sort_desc == '1') {
2265
-                                    echo 'checked="checked"';
2266
-                                } ?>/>
2265
+									echo 'checked="checked"';
2266
+								} ?>/>
2267 2267
 
2268 2268
                                 <input type="text" name="desc_title" id="desc_title"
2269 2269
                                        placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
2270 2270
                                        value="<?php if (isset($field_info->desc_title)) {
2271
-                                           echo esc_attr($field_info->desc_title);
2272
-                                       } ?>" style="width:45%;"/>
2271
+										   echo esc_attr($field_info->desc_title);
2272
+									   } ?>" style="width:45%;"/>
2273 2273
                                 <input type="radio" name="is_default"
2274 2274
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2275
-                                    echo 'checked="checked"';
2276
-                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
2275
+									echo 'checked="checked"';
2276
+								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
2277 2277
                                 <br/>
2278 2278
                                 <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
2279 2279
                             </td>
@@ -2296,8 +2296,8 @@  discard block
 block discarded – undo
2296 2296
                             <td align="left">
2297 2297
                                 <input type="checkbox" name="is_default"
2298 2298
                                        value="<?php echo $field_type; ?>"  <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
2299
-                                    echo 'checked="checked"';
2300
-                                } ?>/>
2299
+									echo 'checked="checked"';
2300
+								} ?>/>
2301 2301
                                 <br/>
2302 2302
                                 <span><?php _e('If field is checked then the field will be use as default sort.', 'geodirectory'); ?></span>
2303 2303
                             </td>
@@ -2311,12 +2311,12 @@  discard block
 block discarded – undo
2311 2311
                             <select name="is_active" id="is_active">
2312 2312
                                 <option
2313 2313
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
2314
-                                    echo 'selected="selected"';
2315
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
2314
+									echo 'selected="selected"';
2315
+								}?>><?php _e('Yes', 'geodirectory');?></option>
2316 2316
                                 <option
2317 2317
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
2318
-                                    echo 'selected="selected"';
2319
-                                }?>><?php _e('No', 'geodirectory');?></option>
2318
+									echo 'selected="selected"';
2319
+								}?>><?php _e('No', 'geodirectory');?></option>
2320 2320
                             </select>
2321 2321
                             <br/>
2322 2322
                             <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
@@ -2327,8 +2327,8 @@  discard block
 block discarded – undo
2327 2327
                         <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
2328 2328
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
2329 2329
                                                 value="<?php if (isset($field_info->sort_order)) {
2330
-                                                    echo esc_attr($field_info->sort_order);
2331
-                                                }?>" size="50"/>
2330
+													echo esc_attr($field_info->sort_order);
2331
+												}?>" size="50"/>
2332 2332
                             <br/>
2333 2333
                             <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
2334 2334
                         </td>
@@ -2351,38 +2351,38 @@  discard block
 block discarded – undo
2351 2351
             </div>
2352 2352
         </li> <?php
2353 2353
 
2354
-    }
2354
+	}
2355 2355
 }
2356 2356
 
2357 2357
 if (!function_exists('check_field_visibility')) {
2358
-    /**
2359
-     * Check field visibility as per price package.
2360
-     *
2361
-     * @since 1.0.0
2362
-     * @package GeoDirectory
2363
-     * @global object $wpdb WordPress Database object.
2364
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
2365
-     * @param int|string $package_id The package ID.
2366
-     * @param string $field_name The field name.
2367
-     * @param string $post_type Optional. The wordpress post type.
2368
-     * @return bool Returns true when field visible, otherwise false.
2369
-     */
2370
-    function check_field_visibility($package_id, $field_name, $post_type)
2371
-    {
2372
-        global $wpdb, $geodir_addon_list;
2373
-        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2374
-            return true;
2375
-        }
2376
-        if (!$package_id || !$field_name || !$post_type) {
2377
-            return true;
2378
-        }
2379
-        $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));
2380
-
2381
-        if ($wpdb->get_var($sql)) {
2382
-            return true;
2383
-        }
2384
-        return false;
2385
-    }
2358
+	/**
2359
+	 * Check field visibility as per price package.
2360
+	 *
2361
+	 * @since 1.0.0
2362
+	 * @package GeoDirectory
2363
+	 * @global object $wpdb WordPress Database object.
2364
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
2365
+	 * @param int|string $package_id The package ID.
2366
+	 * @param string $field_name The field name.
2367
+	 * @param string $post_type Optional. The wordpress post type.
2368
+	 * @return bool Returns true when field visible, otherwise false.
2369
+	 */
2370
+	function check_field_visibility($package_id, $field_name, $post_type)
2371
+	{
2372
+		global $wpdb, $geodir_addon_list;
2373
+		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
2374
+			return true;
2375
+		}
2376
+		if (!$package_id || !$field_name || !$post_type) {
2377
+			return true;
2378
+		}
2379
+		$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));
2380
+
2381
+		if ($wpdb->get_var($sql)) {
2382
+			return true;
2383
+		}
2384
+		return false;
2385
+	}
2386 2386
 }
2387 2387
 
2388 2388
 /**
@@ -2397,43 +2397,43 @@  discard block
 block discarded – undo
2397 2397
  */
2398 2398
 function geodir_string_to_options($input = '', $translated = false)
2399 2399
 {
2400
-    $return = array();
2401
-    if ($input != '') {
2402
-        $input = trim($input);
2403
-        $input = rtrim($input, ",");
2404
-        $input = ltrim($input, ",");
2405
-        $input = trim($input);
2406
-    }
2407
-
2408
-    $input_arr = explode(',', $input);
2409
-
2410
-    if (!empty($input_arr)) {
2411
-        foreach ($input_arr as $input_str) {
2412
-            $input_str = trim($input_str);
2413
-
2414
-            if (strpos($input_str, "/") !== false) {
2415
-                $input_str = explode("/", $input_str, 2);
2416
-                $label = trim($input_str[0]);
2417
-                if ($translated && $label != '') {
2418
-                    $label = __($label, 'geodirectory');
2419
-                }
2420
-                $label = ucfirst($label);
2421
-                $value = trim($input_str[1]);
2422
-            } else {
2423
-                if ($translated && $input_str != '') {
2424
-                    $input_str = __($input_str, 'geodirectory');
2425
-                }
2426
-                $label = ucfirst($input_str);
2427
-                $value = $input_str;
2428
-            }
2429
-
2430
-            if ($label != '') {
2431
-                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2432
-            }
2433
-        }
2434
-    }
2435
-
2436
-    return $return;
2400
+	$return = array();
2401
+	if ($input != '') {
2402
+		$input = trim($input);
2403
+		$input = rtrim($input, ",");
2404
+		$input = ltrim($input, ",");
2405
+		$input = trim($input);
2406
+	}
2407
+
2408
+	$input_arr = explode(',', $input);
2409
+
2410
+	if (!empty($input_arr)) {
2411
+		foreach ($input_arr as $input_str) {
2412
+			$input_str = trim($input_str);
2413
+
2414
+			if (strpos($input_str, "/") !== false) {
2415
+				$input_str = explode("/", $input_str, 2);
2416
+				$label = trim($input_str[0]);
2417
+				if ($translated && $label != '') {
2418
+					$label = __($label, 'geodirectory');
2419
+				}
2420
+				$label = ucfirst($label);
2421
+				$value = trim($input_str[1]);
2422
+			} else {
2423
+				if ($translated && $input_str != '') {
2424
+					$input_str = __($input_str, 'geodirectory');
2425
+				}
2426
+				$label = ucfirst($input_str);
2427
+				$value = $input_str;
2428
+			}
2429
+
2430
+			if ($label != '') {
2431
+				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
2432
+			}
2433
+		}
2434
+	}
2435
+
2436
+	return $return;
2437 2437
 }
2438 2438
 
2439 2439
 /**
@@ -2448,59 +2448,59 @@  discard block
 block discarded – undo
2448 2448
  */
2449 2449
 function geodir_string_values_to_options($option_values = '', $translated = false)
2450 2450
 {
2451
-    $options = array();
2452
-    if ($option_values == '') {
2453
-        return NULL;
2454
-    }
2455
-
2456
-    if (strpos($option_values, "{/optgroup}") !== false) {
2457
-        $option_values_arr = explode("{/optgroup}", $option_values);
2458
-
2459
-        foreach ($option_values_arr as $optgroup) {
2460
-            if (strpos($optgroup, "{optgroup}") !== false) {
2461
-                $optgroup_arr = explode("{optgroup}", $optgroup);
2462
-
2463
-                $count = 0;
2464
-                foreach ($optgroup_arr as $optgroup_str) {
2465
-                    $count++;
2466
-                    $optgroup_str = trim($optgroup_str);
2467
-
2468
-                    $optgroup_label = '';
2469
-                    if (strpos($optgroup_str, "|") !== false) {
2470
-                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
2471
-                        $optgroup_label = trim($optgroup_str_arr[0]);
2472
-                        if ($translated && $optgroup_label != '') {
2473
-                            $optgroup_label = __($optgroup_label, 'geodirectory');
2474
-                        }
2475
-                        $optgroup_label = ucfirst($optgroup_label);
2476
-                        $optgroup_str = $optgroup_str_arr[1];
2477
-                    }
2478
-
2479
-                    $optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2480
-
2481
-                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2482
-                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2483
-                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2484
-                        $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2485
-                    }
2486
-                    $options = array_merge($options, $optgroup3);
2487
-                }
2488
-            } else {
2489
-                $optgroup1 = geodir_string_to_options($optgroup, $translated);
2490
-                $options = array_merge($options, $optgroup1);
2491
-            }
2492
-        }
2493
-    } else {
2494
-        $options = geodir_string_to_options($option_values, $translated);
2495
-    }
2496
-
2497
-    return $options;
2451
+	$options = array();
2452
+	if ($option_values == '') {
2453
+		return NULL;
2454
+	}
2455
+
2456
+	if (strpos($option_values, "{/optgroup}") !== false) {
2457
+		$option_values_arr = explode("{/optgroup}", $option_values);
2458
+
2459
+		foreach ($option_values_arr as $optgroup) {
2460
+			if (strpos($optgroup, "{optgroup}") !== false) {
2461
+				$optgroup_arr = explode("{optgroup}", $optgroup);
2462
+
2463
+				$count = 0;
2464
+				foreach ($optgroup_arr as $optgroup_str) {
2465
+					$count++;
2466
+					$optgroup_str = trim($optgroup_str);
2467
+
2468
+					$optgroup_label = '';
2469
+					if (strpos($optgroup_str, "|") !== false) {
2470
+						$optgroup_str_arr = explode("|", $optgroup_str, 2);
2471
+						$optgroup_label = trim($optgroup_str_arr[0]);
2472
+						if ($translated && $optgroup_label != '') {
2473
+							$optgroup_label = __($optgroup_label, 'geodirectory');
2474
+						}
2475
+						$optgroup_label = ucfirst($optgroup_label);
2476
+						$optgroup_str = $optgroup_str_arr[1];
2477
+					}
2478
+
2479
+					$optgroup3 = geodir_string_to_options($optgroup_str, $translated);
2480
+
2481
+					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
2482
+						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
2483
+						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
2484
+						$optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);
2485
+					}
2486
+					$options = array_merge($options, $optgroup3);
2487
+				}
2488
+			} else {
2489
+				$optgroup1 = geodir_string_to_options($optgroup, $translated);
2490
+				$options = array_merge($options, $optgroup1);
2491
+			}
2492
+		}
2493
+	} else {
2494
+		$options = geodir_string_to_options($option_values, $translated);
2495
+	}
2496
+
2497
+	return $options;
2498 2498
 }
2499 2499
 
2500 2500
 
2501 2501
 function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2502
-    ob_start();
2503
-    ?>
2502
+	ob_start();
2503
+	?>
2504 2504
     <li>
2505 2505
         <label for="data_type""><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
2506 2506
         <div class="gd-cf-input-wrap">
@@ -2509,16 +2509,16 @@  discard block
 block discarded – undo
2509 2509
                     onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">
2510 2510
                 <option
2511 2511
                     value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
2512
-                    echo 'selected="selected"';
2513
-                } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2512
+					echo 'selected="selected"';
2513
+				} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
2514 2514
                 <option
2515 2515
                     value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
2516
-                    echo 'selected="selected"';
2517
-                } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2516
+					echo 'selected="selected"';
2517
+				} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
2518 2518
                 <option
2519 2519
                     value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
2520
-                    echo 'selected="selected"';
2521
-                } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2520
+					echo 'selected="selected"';
2521
+				} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
2522 2522
             </select>
2523 2523
             <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
2524 2524
 
@@ -2531,8 +2531,8 @@  discard block
 block discarded – undo
2531 2531
             <select name="decimal_point" id="decimal_point">
2532 2532
                 <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
2533 2533
                 <?php for ($i = 1; $i <= 10; $i++) {
2534
-                    $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2535
-                    $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2534
+					$decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';
2535
+					$selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>
2536 2536
                     <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
2537 2537
                 <?php } ?>
2538 2538
             </select>
@@ -2541,8 +2541,8 @@  discard block
 block discarded – undo
2541 2541
     </li>
2542 2542
 <?php
2543 2543
 
2544
-    $output = ob_get_clean();
2545
-    return $output;
2544
+	$output = ob_get_clean();
2545
+	return $output;
2546 2546
 }
2547 2547
 add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2548 2548
 
@@ -2580,9 +2580,9 @@  discard block
 block discarded – undo
2580 2580
 
2581 2581
 
2582 2582
 function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2583
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2584
-    ob_start();
2585
-    ?>
2583
+	if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2584
+	ob_start();
2585
+	?>
2586 2586
     <li>
2587 2587
         <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'); ?>
2588 2588
             <div class="gdcf-tooltip">
@@ -2593,13 +2593,13 @@  discard block
 block discarded – undo
2593 2593
         <div class="gd-cf-input-wrap">
2594 2594
 
2595 2595
             <?php
2596
-            $selected = '';
2597
-            if (isset($field_info->extra_fields))
2598
-                $advanced_editor = unserialize($field_info->extra_fields);
2596
+			$selected = '';
2597
+			if (isset($field_info->extra_fields))
2598
+				$advanced_editor = unserialize($field_info->extra_fields);
2599 2599
 
2600
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2601
-                $selected = 'checked="checked"';
2602
-            ?>
2600
+			if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2601
+				$selected = 'checked="checked"';
2602
+			?>
2603 2603
 
2604 2604
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
2605 2605
                    value="1" <?php echo $selected; ?>/>
@@ -2608,15 +2608,15 @@  discard block
 block discarded – undo
2608 2608
     </li>
2609 2609
     <?php
2610 2610
 
2611
-    $output = ob_get_clean();
2612
-    return $output;
2611
+	$output = ob_get_clean();
2612
+	return $output;
2613 2613
 }
2614 2614
 add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2615 2615
 
2616 2616
 
2617 2617
 function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2618
-    ob_start();
2619
-    ?>
2618
+	ob_start();
2619
+	?>
2620 2620
     <li>
2621 2621
         <label for="validation_pattern" class="gd-cf-tooltip-wrap">
2622 2622
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
@@ -2627,8 +2627,8 @@  discard block
 block discarded – undo
2627 2627
         <div class="gd-cf-input-wrap">
2628 2628
             <input type="text" name="validation_pattern" id="validation_pattern"
2629 2629
                    value="<?php if (isset($field_info->validation_pattern)) {
2630
-                       echo esc_attr($field_info->validation_pattern);
2631
-                   } ?>"/>
2630
+					   echo esc_attr($field_info->validation_pattern);
2631
+				   } ?>"/>
2632 2632
         </div>
2633 2633
     </li>
2634 2634
 
@@ -2642,27 +2642,27 @@  discard block
 block discarded – undo
2642 2642
         <div class="gd-cf-input-wrap">
2643 2643
             <input type="text" name="validation_msg" id="validation_msg"
2644 2644
                    value="<?php if (isset($field_info->validation_msg)) {
2645
-                       echo esc_attr($field_info->validation_msg);
2646
-                   } ?>"/>
2645
+					   echo esc_attr($field_info->validation_msg);
2646
+				   } ?>"/>
2647 2647
         </div>
2648 2648
     </li>
2649 2649
     <?php
2650 2650
 
2651
-    $output = ob_get_clean();
2652
-    return $output;
2651
+	$output = ob_get_clean();
2652
+	return $output;
2653 2653
 }
2654 2654
 add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2655 2655
 
2656 2656
 
2657 2657
 function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2658
-    ob_start();
2659
-    global $post_type;
2660
-
2661
-    if (!isset($field_info->post_type)) {
2662
-        $post_type = sanitize_text_field($_REQUEST['listing_type']);
2663
-    } else
2664
-        $post_type = $field_info->post_type;
2665
-    ?>
2658
+	ob_start();
2659
+	global $post_type;
2660
+
2661
+	if (!isset($field_info->post_type)) {
2662
+		$post_type = sanitize_text_field($_REQUEST['listing_type']);
2663
+	} else
2664
+		$post_type = $field_info->post_type;
2665
+	?>
2666 2666
     <li style="display: none;">
2667 2667
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
2668 2668
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
@@ -2673,15 +2673,15 @@  discard block
 block discarded – undo
2673 2673
         <div class="gd-cf-input-wrap">
2674 2674
             <select name="htmlvar_name" id="htmlvar_name">
2675 2675
                 <?php
2676
-                $gd_taxonomy = geodir_get_taxonomies($post_type);
2676
+				$gd_taxonomy = geodir_get_taxonomies($post_type);
2677 2677
 
2678
-                foreach ($gd_taxonomy as $gd_tax) {
2679
-                    ?>
2678
+				foreach ($gd_taxonomy as $gd_tax) {
2679
+					?>
2680 2680
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2681
-                        echo 'selected="selected"';
2682
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2683
-                }
2684
-                ?>
2681
+						echo 'selected="selected"';
2682
+					}?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2683
+				}
2684
+				?>
2685 2685
             </select>
2686 2686
         </div>
2687 2687
     </li>
@@ -2697,47 +2697,47 @@  discard block
 block discarded – undo
2697 2697
 
2698 2698
             <select name="cat_display_type" id="cat_display_type">
2699 2699
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2700
-                    echo 'selected="selected"';
2701
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2700
+					echo 'selected="selected"';
2701
+				}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2702 2702
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2703
-                    echo 'selected="selected"';
2704
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2703
+					echo 'selected="selected"';
2704
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2705 2705
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2706
-                    echo 'selected="selected"';
2707
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2706
+					echo 'selected="selected"';
2707
+				}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2708 2708
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2709
-                    echo 'selected="selected"';
2710
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2709
+					echo 'selected="selected"';
2710
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2711 2711
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2712
-                    echo 'selected="selected"';
2713
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2712
+					echo 'selected="selected"';
2713
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2714 2714
             </select>
2715 2715
         </div>
2716 2716
     </li>
2717 2717
     <?php
2718 2718
 
2719
-    $output = ob_get_clean();
2720
-    return $output;
2719
+	$output = ob_get_clean();
2720
+	return $output;
2721 2721
 }
2722 2722
 add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2723 2723
 
2724 2724
 
2725 2725
 function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2726 2726
 
2727
-    ob_start();
2728
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2729
-        $address = unserialize($field_info->extra_fields);
2730
-    }
2731
-    ?>
2727
+	ob_start();
2728
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2729
+		$address = unserialize($field_info->extra_fields);
2730
+	}
2731
+	?>
2732 2732
     <?php
2733
-    /**
2734
-     * Called on the add custom fields settings page before the address field is output.
2735
-     *
2736
-     * @since 1.0.0
2737
-     * @param array $address The address settings array.
2738
-     * @param object $field_info Extra fields info.
2739
-     */
2740
-    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2733
+	/**
2734
+	 * Called on the add custom fields settings page before the address field is output.
2735
+	 *
2736
+	 * @since 1.0.0
2737
+	 * @param array $address The address settings array.
2738
+	 * @param object $field_info Extra fields info.
2739
+	 */
2740
+	do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
2741 2741
 
2742 2742
     <li>
2743 2743
         <label for="show_zip" class="gd-cf-tooltip-wrap">
@@ -2750,14 +2750,14 @@  discard block
 block discarded – undo
2750 2750
 
2751 2751
             <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2752 2752
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2753
-                    echo 'checked';
2754
-                } ?>/>
2753
+					echo 'checked';
2754
+				} ?>/>
2755 2755
             <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>
2756 2756
 
2757 2757
             <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2758 2758
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2759
-                    echo 'checked';
2760
-                } ?>/>
2759
+					echo 'checked';
2760
+				} ?>/>
2761 2761
             <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>
2762 2762
 
2763 2763
 
@@ -2774,8 +2774,8 @@  discard block
 block discarded – undo
2774 2774
         <div class="gd-cf-input-wrap">
2775 2775
             <input type="text" name="extra[zip_lable]" id="zip_lable"
2776 2776
                    value="<?php if (isset($address['zip_lable'])) {
2777
-                       echo esc_attr($address['zip_lable']);
2778
-                   }?>"/>
2777
+					   echo esc_attr($address['zip_lable']);
2778
+				   }?>"/>
2779 2779
         </div>
2780 2780
     </li>
2781 2781
 
@@ -2792,8 +2792,8 @@  discard block
 block discarded – undo
2792 2792
         <div class="gd-cf-input-wrap">
2793 2793
             <input type="text" name="extra[map_lable]" id="map_lable"
2794 2794
                    value="<?php if (isset($address['map_lable'])) {
2795
-                       echo esc_attr($address['map_lable']);
2796
-                   }?>"/>
2795
+					   echo esc_attr($address['map_lable']);
2796
+				   }?>"/>
2797 2797
         </div>
2798 2798
     </li>
2799 2799
 
@@ -2808,14 +2808,14 @@  discard block
 block discarded – undo
2808 2808
 
2809 2809
             <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2810 2810
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2811
-                    echo 'checked';
2812
-                } ?>/>
2811
+					echo 'checked';
2812
+				} ?>/>
2813 2813
             <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2814 2814
 
2815 2815
             <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2816 2816
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2817
-                    echo 'checked';
2818
-                } ?>/>
2817
+					echo 'checked';
2818
+				} ?>/>
2819 2819
             <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2820 2820
 
2821 2821
         </div>
@@ -2832,14 +2832,14 @@  discard block
 block discarded – undo
2832 2832
 
2833 2833
             <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2834 2834
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2835
-                    echo 'checked';
2836
-                } ?>/>
2835
+					echo 'checked';
2836
+				} ?>/>
2837 2837
             <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2838 2838
 
2839 2839
             <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2840 2840
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2841
-                    echo 'checked';
2842
-                } ?>/>
2841
+					echo 'checked';
2842
+				} ?>/>
2843 2843
             <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2844 2844
 
2845 2845
         </div>
@@ -2856,8 +2856,8 @@  discard block
 block discarded – undo
2856 2856
         <div class="gd-cf-input-wrap">
2857 2857
             <input type="text" name="extra[mapview_lable]" id="mapview_lable"
2858 2858
                    value="<?php if (isset($address['mapview_lable'])) {
2859
-                       echo esc_attr($address['mapview_lable']);
2860
-                   }?>"/>
2859
+					   echo esc_attr($address['mapview_lable']);
2860
+				   }?>"/>
2861 2861
         </div>
2862 2862
     </li>
2863 2863
     <li>
@@ -2871,29 +2871,29 @@  discard block
 block discarded – undo
2871 2871
 
2872 2872
             <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
2873 2873
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
2874
-                    echo 'checked';
2875
-                } ?>/>
2874
+					echo 'checked';
2875
+				} ?>/>
2876 2876
             <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2877 2877
 
2878 2878
             <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
2879 2879
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
2880
-                    echo 'checked';
2881
-                } ?>/>
2880
+					echo 'checked';
2881
+				} ?>/>
2882 2882
             <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2883 2883
 
2884 2884
         </div>
2885 2885
     </li>
2886 2886
     <?php
2887 2887
 
2888
-    $output = ob_get_clean();
2889
-    return $output;
2888
+	$output = ob_get_clean();
2889
+	return $output;
2890 2890
 }
2891 2891
 add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
2892 2892
 
2893 2893
 
2894 2894
 function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
2895
-    ob_start();
2896
-    ?>
2895
+	ob_start();
2896
+	?>
2897 2897
     <li>
2898 2898
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
2899 2899
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
@@ -2905,14 +2905,14 @@  discard block
 block discarded – undo
2905 2905
 
2906 2906
             <select name="multi_display_type" id="multi_display_type">
2907 2907
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2908
-                    echo 'selected="selected"';
2909
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2908
+					echo 'selected="selected"';
2909
+				}?> value="select"><?php _e('Select', 'geodirectory');?></option>
2910 2910
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2911
-                    echo 'selected="selected"';
2912
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2911
+					echo 'selected="selected"';
2912
+				}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2913 2913
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2914
-                    echo 'selected="selected"';
2915
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2914
+					echo 'selected="selected"';
2915
+				}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2916 2916
             </select>
2917 2917
 
2918 2918
             <br/>
@@ -2920,15 +2920,15 @@  discard block
 block discarded – undo
2920 2920
     </li>
2921 2921
     <?php
2922 2922
 
2923
-    $output = ob_get_clean();
2924
-    return $output;
2923
+	$output = ob_get_clean();
2924
+	return $output;
2925 2925
 }
2926 2926
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
2927 2927
 
2928 2928
 
2929 2929
 function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
2930
-    ob_start();
2931
-    ?>
2930
+	ob_start();
2931
+	?>
2932 2932
     <li>
2933 2933
         <label for="option_values" class="gd-cf-tooltip-wrap">
2934 2934
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
@@ -2949,16 +2949,16 @@  discard block
 block discarded – undo
2949 2949
         <div class="gd-cf-input-wrap">
2950 2950
             <input type="text" name="option_values" id="option_values"
2951 2951
                    value="<?php if (isset($field_info->option_values)) {
2952
-                       echo esc_attr($field_info->option_values);
2953
-                   }?>"/>
2952
+					   echo esc_attr($field_info->option_values);
2953
+				   }?>"/>
2954 2954
             <br/>
2955 2955
 
2956 2956
         </div>
2957 2957
     </li>
2958 2958
     <?php
2959 2959
 
2960
-    $output = ob_get_clean();
2961
-    return $output;
2960
+	$output = ob_get_clean();
2961
+	return $output;
2962 2962
 }
2963 2963
 add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
2964 2964
 add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
@@ -2966,11 +2966,11 @@  discard block
 block discarded – undo
2966 2966
 
2967 2967
 
2968 2968
 function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
2969
-    ob_start();
2970
-    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2971
-        $extra = unserialize($field_info->extra_fields);
2972
-    }
2973
-    ?>
2969
+	ob_start();
2970
+	if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2971
+		$extra = unserialize($field_info->extra_fields);
2972
+	}
2973
+	?>
2974 2974
     <li>
2975 2975
         <label for="date_format" class="gd-cf-tooltip-wrap">
2976 2976
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
@@ -2980,52 +2980,52 @@  discard block
 block discarded – undo
2980 2980
         </label>
2981 2981
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
2982 2982
             <?php
2983
-            $date_formats = array(
2984
-                'm/d/Y',
2985
-                'd/m/Y',
2986
-                'Y/m/d',
2987
-                'm-d-Y',
2988
-                'd-m-Y',
2989
-                'Y-m-d',
2990
-                'F j, Y',
2991
-            );
2992
-            /**
2993
-             * Filter the custom field date format options.
2994
-             *
2995
-             * @since 1.6.5
2996
-             * @param array $date_formats The PHP date format array.
2997
-             */
2998
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
2999
-            ?>
2983
+			$date_formats = array(
2984
+				'm/d/Y',
2985
+				'd/m/Y',
2986
+				'Y/m/d',
2987
+				'm-d-Y',
2988
+				'd-m-Y',
2989
+				'Y-m-d',
2990
+				'F j, Y',
2991
+			);
2992
+			/**
2993
+			 * Filter the custom field date format options.
2994
+			 *
2995
+			 * @since 1.6.5
2996
+			 * @param array $date_formats The PHP date format array.
2997
+			 */
2998
+			$date_formats = apply_filters('geodir_date_formats',$date_formats);
2999
+			?>
3000 3000
             <select name="extra[date_format]" id="date_format">
3001 3001
                 <?php
3002
-                foreach($date_formats as $format){
3003
-                    $selected = '';
3004
-                    if(esc_attr($extra['date_format'])==$format){
3005
-                        $selected = "selected='selected'";
3006
-                    }
3007
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3008
-                }
3009
-                ?>
3002
+				foreach($date_formats as $format){
3003
+					$selected = '';
3004
+					if(esc_attr($extra['date_format'])==$format){
3005
+						$selected = "selected='selected'";
3006
+					}
3007
+					echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3008
+				}
3009
+				?>
3010 3010
             </select>
3011 3011
 
3012 3012
         </div>
3013 3013
     </li>
3014 3014
     <?php
3015 3015
 
3016
-    $output = ob_get_clean();
3017
-    return $output;
3016
+	$output = ob_get_clean();
3017
+	return $output;
3018 3018
 }
3019 3019
 add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3020 3020
 
3021 3021
 
3022 3022
 function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3023
-    ob_start();
3024
-    $allowed_file_types = geodir_allowed_mime_types();
3023
+	ob_start();
3024
+	$allowed_file_types = geodir_allowed_mime_types();
3025 3025
 
3026
-    $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3027
-    $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3028
-    ?>
3026
+	$extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : '';
3027
+	$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
3028
+	?>
3029 3029
     <li>
3030 3030
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3031 3031
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
     </li>
3049 3049
     <?php
3050 3050
 
3051
-    $output = ob_get_clean();
3052
-    return $output;
3051
+	$output = ob_get_clean();
3052
+	return $output;
3053 3053
 }
3054 3054
 add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3055 3055
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +324 added lines, -324 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,10 +1199,10 @@  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
     $value = '';
1204 1204
     if (is_admin()) {
1205
-        global $post,$gd_session;
1205
+        global $post, $gd_session;
1206 1206
 
1207 1207
         if (isset($_REQUEST['post']))
1208 1208
             $_REQUEST['pid'] = $_REQUEST['post'];
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
         $is_default = $val['is_default'];
1251 1251
 
1252 1252
         /* field available to site admin only for edit */
1253
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1253
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1254 1254
         if ($for_admin_use && !is_super_admin()) {
1255 1255
             continue;
1256 1256
         }
@@ -1275,11 +1275,11 @@  discard block
 block discarded – undo
1275 1275
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1276 1276
          * @see 'geodir_after_custom_form_field_$name'
1277 1277
          */
1278
-        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1278
+        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
1279 1279
 
1280 1280
 
1281 1281
         $custom_field = $val;
1282
-        $html ='';
1282
+        $html = '';
1283 1283
         /**
1284 1284
          * Filter the output for custom fields.
1285 1285
          *
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
          * @param string $html The html to be filtered (blank).
1289 1289
          * @param array $custom_field The custom field array values.
1290 1290
          */
1291
-        echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
1291
+        echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
1292 1292
 
1293 1293
 
1294 1294
 
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
          * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
1304 1304
          * @see 'geodir_before_custom_form_field_$name'
1305 1305
          */
1306
-        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
1306
+        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
1307 1307
 
1308 1308
     }
1309 1309
 
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 
1330 1330
         $filter = $wpdb->get_row(
1331 1331
             $wpdb->prepare(
1332
-                "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",
1332
+                "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",
1333 1333
                 array($geodir_post_type)
1334 1334
             )
1335 1335
         );
@@ -1344,14 +1344,14 @@  discard block
 block discarded – undo
1344 1344
 }
1345 1345
 
1346 1346
 
1347
-function geodir_field_icon_proccess($cf){
1347
+function geodir_field_icon_proccess($cf) {
1348 1348
 
1349 1349
 
1350 1350
     if (strpos($cf['field_icon'], 'http') !== false) {
1351
-        $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1351
+        $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352 1352
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1353
-        $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1354
-    }else{
1353
+        $field_icon = '<i class="'.$cf['field_icon'].'"></i>';
1354
+    } else {
1355 1355
         $field_icon = $cf['field_icon'];
1356 1356
     }
1357 1357
 
@@ -1412,11 +1412,11 @@  discard block
 block discarded – undo
1412 1412
                  * @param string $fields_location The location the field is to be show.
1413 1413
                  * @param array $type The array of field values.
1414 1414
                  */
1415
-                $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
1415
+                $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
1416 1416
 
1417 1417
                 $variables_array = array();
1418 1418
 
1419
-                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'))) {
1419
+                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'))) {
1420 1420
                     continue;
1421 1421
                 }
1422 1422
 
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 
1543 1543
         $post_type = get_post_type($post_id);
1544 1544
         //echo $field_id; exit;
1545
-        $table = $plugin_prefix . $post_type . '_detail';
1545
+        $table = $plugin_prefix.$post_type.'_detail';
1546 1546
 
1547 1547
         $postcurr_images = array();
1548 1548
         $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);
@@ -1561,13 +1561,13 @@  discard block
 block discarded – undo
1561 1561
             $geodir_uploadurl = $uploads['url'];
1562 1562
             $sub_dir = $uploads['subdir'];
1563 1563
 
1564
-            $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'] : '';
1564
+            $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'] : '';
1565 1565
 
1566 1566
             for ($m = 0; $m < count($post_image); $m++) {
1567 1567
 
1568 1568
                 /* --------- start ------- */
1569 1569
 
1570
-                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)))) {
1570
+                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)))) {
1571 1571
 
1572 1572
 
1573 1573
                     $curr_img_url = $post_image[$m];
@@ -1593,24 +1593,24 @@  discard block
 block discarded – undo
1593 1593
                     //$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');
1594 1594
 
1595 1595
                     if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1596
+                        require_once(ABSPATH.'wp-admin/includes/file.php');
1597 1597
 
1598 1598
                     if (!is_dir($geodir_uploadpath))
1599 1599
                         mkdir($geodir_uploadpath);
1600 1600
 
1601
-                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1601
+                    $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];
1602 1602
                     $explode_sub_dir = explode("/", $sub_dir);
1603 1603
                     if ($curr_img_dir == end($explode_sub_dir)) {
1604
-                        $img_path = $geodir_uploadpath . '/' . $filename;
1605
-                        $img_url = $geodir_uploadurl . '/' . $filename;
1604
+                        $img_path = $geodir_uploadpath.'/'.$filename;
1605
+                        $img_url = $geodir_uploadurl.'/'.$filename;
1606 1606
                     } else {
1607
-                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1608
-                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1607
+                        $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1608
+                        $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1609 1609
                     }
1610 1610
 
1611 1611
                     $uploaded_file = '';
1612 1612
                     if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1613
+                        $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1614 1614
 
1615 1615
                     if ($curr_img_dir != $geodir_uploaddir) {
1616 1616
                         if (file_exists($img_path))
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     }
1619 1619
 
1620 1620
                     if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1621
+                        $file_urls = $geodir_uploadurl.'/'.$new_name;
1622 1622
 
1623 1623
                 } else {
1624 1624
                     $file_urls = $post_image[$m];
@@ -1632,8 +1632,8 @@  discard block
 block discarded – undo
1632 1632
         if (!empty($postcurr_images)) {
1633 1633
 
1634 1634
             if ($file_urls != $postcurr_images) {
1635
-                $invalid_files[] = (object)array('src' => $postcurr_images);
1636
-                $invalid_files = (object)$invalid_files;
1635
+                $invalid_files[] = (object) array('src' => $postcurr_images);
1636
+                $invalid_files = (object) $invalid_files;
1637 1637
             }
1638 1638
         }
1639 1639
 
@@ -1685,9 +1685,9 @@  discard block
 block discarded – undo
1685 1685
     function geodir_upload_dir($upload)
1686 1686
     {
1687 1687
         global $current_user;
1688
-        $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
1689
-        $upload['path'] = $upload['basedir'] . $upload['subdir'];
1690
-        $upload['url'] = $upload['baseurl'] . $upload['subdir'];
1688
+        $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;
1689
+        $upload['path'] = $upload['basedir'].$upload['subdir'];
1690
+        $upload['url'] = $upload['baseurl'].$upload['subdir'];
1691 1691
         return $upload;
1692 1692
     }
1693 1693
 
@@ -1702,20 +1702,20 @@  discard block
 block discarded – undo
1702 1702
         // check ajax noonce
1703 1703
         $imgid = $_POST["imgid"];
1704 1704
 
1705
-        check_ajax_referer($imgid . 'pluploadan');
1705
+        check_ajax_referer($imgid.'pluploadan');
1706 1706
 
1707 1707
         // handle custom file uploaddir
1708 1708
         add_filter('upload_dir', 'geodir_upload_dir');
1709 1709
 
1710 1710
         // change file orinetation if needed
1711
-        $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);
1711
+        $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);
1712 1712
 
1713 1713
         // handle file upload
1714 1714
         $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
1715 1715
         // remove handle custom file uploaddir
1716 1716
         remove_filter('upload_dir', 'geodir_upload_dir');
1717 1717
 
1718
-        if(!isset($status['url']) && isset($status['error'])){
1718
+        if (!isset($status['url']) && isset($status['error'])) {
1719 1719
             print_r($status);
1720 1720
         }
1721 1721
 
@@ -1745,9 +1745,9 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
     $post_type = get_post_type($post_id);
1747 1747
 
1748
-    $table = $plugin_prefix . $post_type . '_detail';
1748
+    $table = $plugin_prefix.$post_type.'_detail';
1749 1749
 
1750
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
1750
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
1751 1751
 
1752 1752
     if ($results) {
1753 1753
         return $results[0]->geodir_video;
@@ -1771,9 +1771,9 @@  discard block
 block discarded – undo
1771 1771
 
1772 1772
     $post_type = get_post_type($post_id);
1773 1773
 
1774
-    $table = $plugin_prefix . $post_type . '_detail';
1774
+    $table = $plugin_prefix.$post_type.'_detail';
1775 1775
 
1776
-    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
1776
+    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
1777 1777
 
1778 1778
     if ($results) {
1779 1779
         return $results[0]->geodir_special_offers;
@@ -1791,12 +1791,12 @@  discard block
 block discarded – undo
1791 1791
      */
1792 1792
     function geodir_max_upload_size()
1793 1793
     {
1794
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1794
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1795 1795
 
1796 1796
         if ($max_filesize > 0 && $max_filesize < 1) {
1797
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
1797
+            $max_filesize = (int) ($max_filesize * 1024).'kb';
1798 1798
         } else {
1799
-            $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1799
+            $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1800 1800
         }
1801 1801
         /** Filter documented in geodirectory-functions/general_functions.php **/
1802 1802
         return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 
1829 1829
             $custom_fields = $wpdb->get_results(
1830 1830
                 $wpdb->prepare(
1831
-                    "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1831
+                    "select post_type,data_type,field_type,site_title,htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",
1832 1832
                     array($post_type)
1833 1833
                 ), 'ARRAY_A'
1834 1834
             );
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 
1946 1946
             $post_meta_info = $wpdb->query(
1947 1947
                 $wpdb->prepare(
1948
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
1948
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
1949 1949
 															sort_order=%d 
1950 1950
 															where id= %d",
1951 1951
                     array($count, $cf)
@@ -2027,14 +2027,14 @@  discard block
 block discarded – undo
2027 2027
 
2028 2028
         $check_html_variable = $wpdb->get_var(
2029 2029
             $wpdb->prepare(
2030
-                "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",
2030
+                "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",
2031 2031
                 array($cehhtmlvar_name, $post_type, $field_type)
2032 2032
             )
2033 2033
         );
2034 2034
 
2035 2035
         if ($is_default == 1) {
2036 2036
 
2037
-            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
2037
+            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
2038 2038
 
2039 2039
         }
2040 2040
 
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
 
2046 2046
                 $wpdb->prepare(
2047 2047
 
2048
-                    "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2048
+                    "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2049 2049
 				post_type = %s,
2050 2050
 				data_type = %s,
2051 2051
 				field_type = %s,
@@ -2076,7 +2076,7 @@  discard block
 block discarded – undo
2076 2076
 
2077 2077
                 $wpdb->prepare(
2078 2078
 
2079
-                    "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set 
2079
+                    "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set 
2080 2080
 				post_type = %s,
2081 2081
 				data_type = %s,
2082 2082
 				field_type = %s,
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
         }
2103 2103
 
2104 2104
 
2105
-        return (int)$lastid;
2105
+        return (int) $lastid;
2106 2106
 
2107 2107
     }
2108 2108
 }
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
         if ($field_id != '') {
2126 2126
             $cf = trim($field_id, '_');
2127 2127
 
2128
-            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
2128
+            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
2129 2129
 
2130 2130
             return $field_id;
2131 2131
 
@@ -2153,7 +2153,7 @@  discard block
 block discarded – undo
2153 2153
         global $wpdb;
2154 2154
         $cf = $result_str;
2155 2155
         if (!is_object($cf)) {
2156
-            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
2156
+            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
2157 2157
         } else {
2158 2158
             $field_info = $cf;
2159 2159
             $result_str = $cf->id;
@@ -2190,41 +2190,41 @@  discard block
 block discarded – undo
2190 2190
         if ($htmlvar_name == '')
2191 2191
             $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2192 2192
 
2193
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
2193
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
2194 2194
 
2195 2195
         ?>
2196
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
2197
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
2198
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
2199
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
2196
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
2197
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
2198
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
2199
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
2200 2200
                 <?php
2201 2201
 
2202
-                $nonce = wp_create_nonce('custom_fields_' . $result_str);
2202
+                $nonce = wp_create_nonce('custom_fields_'.$result_str);
2203 2203
                 ?>
2204 2204
 
2205
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
2206
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2205
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
2206
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2207 2207
                      class="handlediv close"></div>
2208 2208
 
2209 2209
                 <b style="cursor:pointer;"
2210
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
2210
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
2211 2211
 
2212 2212
             </div>
2213 2213
 
2214
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
2214
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
2215 2215
                  style="display:<?php if ($field_ins_upd == 'submit') {
2216 2216
                      echo 'block;';
2217 2217
                  } else {
2218 2218
                      echo 'none;';
2219 2219
                  } ?>">
2220 2220
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
2221
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
2222
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
2223
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
2221
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
2222
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
2223
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
2224 2224
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
2225 2225
                     echo $field_info->data_type;
2226 2226
                 }?>"/>
2227
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
2227
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
2228 2228
 
2229 2229
 
2230 2230
                 <table class="widefat post fixed" border="0" style="width:100%;">
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
                                        } ?>" style="width:45%;"/>
2249 2249
 
2250 2250
                                 <input type="radio" name="is_default"
2251
-                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
2251
+                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
2252 2252
                                     echo 'checked="checked"';
2253 2253
                                 } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
2254 2254
 
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
                                            echo esc_attr($field_info->desc_title);
2272 2272
                                        } ?>" style="width:45%;"/>
2273 2273
                                 <input type="radio" name="is_default"
2274
-                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
2274
+                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
2275 2275
                                     echo 'checked="checked"';
2276 2276
                                 } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
2277 2277
                                 <br/>
@@ -2306,42 +2306,42 @@  discard block
 block discarded – undo
2306 2306
                     <?php } ?>
2307 2307
 
2308 2308
                     <tr>
2309
-                        <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
2309
+                        <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
2310 2310
                         <td align="left">
2311 2311
                             <select name="is_active" id="is_active">
2312 2312
                                 <option
2313 2313
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
2314 2314
                                     echo 'selected="selected"';
2315
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
2315
+                                }?>><?php _e('Yes', 'geodirectory'); ?></option>
2316 2316
                                 <option
2317 2317
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
2318 2318
                                     echo 'selected="selected"';
2319
-                                }?>><?php _e('No', 'geodirectory');?></option>
2319
+                                }?>><?php _e('No', 'geodirectory'); ?></option>
2320 2320
                             </select>
2321 2321
                             <br/>
2322
-                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
2322
+                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
2323 2323
                         </td>
2324 2324
                     </tr>
2325 2325
 
2326 2326
                     <tr>
2327
-                        <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
2327
+                        <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
2328 2328
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
2329 2329
                                                 value="<?php if (isset($field_info->sort_order)) {
2330 2330
                                                     echo esc_attr($field_info->sort_order);
2331 2331
                                                 }?>" size="50"/>
2332 2332
                             <br/>
2333
-                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
2333
+                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
2334 2334
                         </td>
2335 2335
                     </tr>
2336 2336
 
2337 2337
                     <tr>
2338 2338
                         <td>&nbsp;</td>
2339 2339
                         <td align="left">
2340
-                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
2341
-                                   onclick="save_sort_field('<?php echo $result_str;?>')"/>
2340
+                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
2341
+                                   onclick="save_sort_field('<?php echo $result_str; ?>')"/>
2342 2342
 
2343
-                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
2344
-                                                                onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
2343
+                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
2344
+                                                                onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
2345 2345
                                                                 class="button_n"/></a>
2346 2346
 
2347 2347
                         </td>
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
         if (!$package_id || !$field_name || !$post_type) {
2377 2377
             return true;
2378 2378
         }
2379
-        $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));
2379
+        $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));
2380 2380
 
2381 2381
         if ($wpdb->get_var($sql)) {
2382 2382
             return true;
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
 }
2499 2499
 
2500 2500
 
2501
-function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
2501
+function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
2502 2502
     ob_start();
2503 2503
     ?>
2504 2504
     <li>
@@ -2544,43 +2544,43 @@  discard block
 block discarded – undo
2544 2544
     $output = ob_get_clean();
2545 2545
     return $output;
2546 2546
 }
2547
-add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
2547
+add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
2548 2548
 
2549 2549
 // htmlvar not needed for fieldset and taxonomy
2550
-add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
2551
-add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
2550
+add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
2551
+add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
2552 2552
 
2553 2553
 
2554 2554
 // default_value not needed for textarea, html, file, fieldset, taxonomy, address
2555
-add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
2556
-add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
2557
-add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
2558
-add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
2559
-add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
2560
-add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
2555
+add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
2556
+add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
2557
+add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
2558
+add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
2559
+add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
2560
+add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
2561 2561
 
2562 2562
 // is_required not needed for fieldset
2563
-add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
2564
-add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
2563
+add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
2564
+add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
2565 2565
 
2566 2566
 // field_icon not needed for fieldset
2567
-add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
2568
-add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
2567
+add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
2568
+add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
2569 2569
 
2570 2570
 // cat_sort not needed for some fields
2571
-add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
2572
-add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
2573
-add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
2574
-add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
2575
-add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
2576
-add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
2577
-add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
2578
-add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
2571
+add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
2572
+add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
2573
+add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
2574
+add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
2575
+add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
2576
+add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
2577
+add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
2578
+add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
2579 2579
 
2580 2580
 
2581 2581
 
2582
-function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
2583
-    if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
2582
+function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
2583
+    if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
2584 2584
     ob_start();
2585 2585
     ?>
2586 2586
     <li>
@@ -2611,10 +2611,10 @@  discard block
 block discarded – undo
2611 2611
     $output = ob_get_clean();
2612 2612
     return $output;
2613 2613
 }
2614
-add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
2614
+add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
2615 2615
 
2616 2616
 
2617
-function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
2617
+function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
2618 2618
     ob_start();
2619 2619
     ?>
2620 2620
     <li>
@@ -2651,10 +2651,10 @@  discard block
 block discarded – undo
2651 2651
     $output = ob_get_clean();
2652 2652
     return $output;
2653 2653
 }
2654
-add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
2654
+add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
2655 2655
 
2656 2656
 
2657
-function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
2657
+function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
2658 2658
     ob_start();
2659 2659
     global $post_type;
2660 2660
 
@@ -2679,7 +2679,7 @@  discard block
 block discarded – undo
2679 2679
                     ?>
2680 2680
                     <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
2681 2681
                         echo 'selected="selected"';
2682
-                    }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php
2682
+                    }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php
2683 2683
                 }
2684 2684
                 ?>
2685 2685
             </select>
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
         <label for="cat_display_type" class="gd-cf-tooltip-wrap">
2691 2691
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
2692 2692
             <div class="gdcf-tooltip">
2693
-                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
2693
+                <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
2694 2694
             </div>
2695 2695
         </label>
2696 2696
         <div class="gd-cf-input-wrap">
@@ -2698,19 +2698,19 @@  discard block
 block discarded – undo
2698 2698
             <select name="cat_display_type" id="cat_display_type">
2699 2699
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
2700 2700
                     echo 'selected="selected"';
2701
-                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
2701
+                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
2702 2702
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2703 2703
                     echo 'selected="selected"';
2704
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2704
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2705 2705
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
2706 2706
                     echo 'selected="selected"';
2707
-                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
2707
+                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
2708 2708
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2709 2709
                     echo 'selected="selected"';
2710
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2710
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2711 2711
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2712 2712
                     echo 'selected="selected"';
2713
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2713
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2714 2714
             </select>
2715 2715
         </div>
2716 2716
     </li>
@@ -2719,10 +2719,10 @@  discard block
 block discarded – undo
2719 2719
     $output = ob_get_clean();
2720 2720
     return $output;
2721 2721
 }
2722
-add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
2722
+add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
2723 2723
 
2724 2724
 
2725
-function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
2725
+function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
2726 2726
 
2727 2727
     ob_start();
2728 2728
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
@@ -2743,32 +2743,32 @@  discard block
 block discarded – undo
2743 2743
         <label for="show_zip" class="gd-cf-tooltip-wrap">
2744 2744
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
2745 2745
             <div class="gdcf-tooltip">
2746
-                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
2746
+                <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
2747 2747
             </div>
2748 2748
         </label>
2749 2749
         <div class="gd-cf-input-wrap gd-switch">
2750 2750
 
2751
-            <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2751
+            <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled"  value="1"
2752 2752
                 <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
2753 2753
                     echo 'checked';
2754 2754
                 } ?>/>
2755
-            <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>
2755
+            <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>
2756 2756
 
2757
-            <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2757
+            <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0"
2758 2758
                 <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
2759 2759
                     echo 'checked';
2760 2760
                 } ?>/>
2761
-            <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>
2761
+            <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>
2762 2762
 
2763 2763
 
2764 2764
         </div>
2765 2765
     </li>
2766 2766
 
2767
-    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
2767
+    <li class="cf-zip-lable"  <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
2768 2768
         <label for="zip_lable" class="gd-cf-tooltip-wrap">
2769 2769
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
2770 2770
             <div class="gdcf-tooltip">
2771
-                <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
2771
+                <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
2772 2772
             </div>
2773 2773
         </label>
2774 2774
         <div class="gd-cf-input-wrap">
@@ -2786,7 +2786,7 @@  discard block
 block discarded – undo
2786 2786
         <label for="map_lable" class="gd-cf-tooltip-wrap">
2787 2787
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
2788 2788
             <div class="gdcf-tooltip">
2789
-                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
2789
+                <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
2790 2790
             </div>
2791 2791
         </label>
2792 2792
         <div class="gd-cf-input-wrap">
@@ -2801,22 +2801,22 @@  discard block
 block discarded – undo
2801 2801
         <label for="show_mapzoom" class="gd-cf-tooltip-wrap">
2802 2802
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
2803 2803
             <div class="gdcf-tooltip">
2804
-                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
2804
+                <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
2805 2805
             </div>
2806 2806
         </label>
2807 2807
         <div class="gd-cf-input-wrap gd-switch">
2808 2808
 
2809
-            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2809
+            <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled"  value="1"
2810 2810
                 <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
2811 2811
                     echo 'checked';
2812 2812
                 } ?>/>
2813
-            <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2813
+            <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2814 2814
 
2815
-            <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2815
+            <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0"
2816 2816
                 <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
2817 2817
                     echo 'checked';
2818 2818
                 } ?>/>
2819
-            <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2819
+            <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2820 2820
 
2821 2821
         </div>
2822 2822
     </li>
@@ -2825,22 +2825,22 @@  discard block
 block discarded – undo
2825 2825
         <label for="show_mapview" class="gd-cf-tooltip-wrap">
2826 2826
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
2827 2827
             <div class="gdcf-tooltip">
2828
-                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
2828
+                <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
2829 2829
             </div>
2830 2830
         </label>
2831 2831
         <div class="gd-cf-input-wrap gd-switch">
2832 2832
 
2833
-            <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2833
+            <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled"  value="1"
2834 2834
                 <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
2835 2835
                     echo 'checked';
2836 2836
                 } ?>/>
2837
-            <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2837
+            <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2838 2838
 
2839
-            <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2839
+            <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0"
2840 2840
                 <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
2841 2841
                     echo 'checked';
2842 2842
                 } ?>/>
2843
-            <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2843
+            <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2844 2844
 
2845 2845
         </div>
2846 2846
     </li>
@@ -2850,7 +2850,7 @@  discard block
 block discarded – undo
2850 2850
         <label for="mapview_lable" class="gd-cf-tooltip-wrap">
2851 2851
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
2852 2852
             <div class="gdcf-tooltip">
2853
-                <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
2853
+                <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
2854 2854
             </div>
2855 2855
         </label>
2856 2856
         <div class="gd-cf-input-wrap">
@@ -2864,22 +2864,22 @@  discard block
 block discarded – undo
2864 2864
         <label for="show_latlng" class="gd-cf-tooltip-wrap">
2865 2865
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
2866 2866
             <div class="gdcf-tooltip">
2867
-                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
2867
+                <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
2868 2868
             </div>
2869 2869
         </label>
2870 2870
         <div class="gd-cf-input-wrap gd-switch">
2871 2871
 
2872
-            <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
2872
+            <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled"  value="1"
2873 2873
                 <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
2874 2874
                     echo 'checked';
2875 2875
                 } ?>/>
2876
-            <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2876
+            <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
2877 2877
 
2878
-            <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
2878
+            <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0"
2879 2879
                 <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
2880 2880
                     echo 'checked';
2881 2881
                 } ?>/>
2882
-            <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2882
+            <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
2883 2883
 
2884 2884
         </div>
2885 2885
     </li>
@@ -2888,17 +2888,17 @@  discard block
 block discarded – undo
2888 2888
     $output = ob_get_clean();
2889 2889
     return $output;
2890 2890
 }
2891
-add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
2891
+add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
2892 2892
 
2893 2893
 
2894
-function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
2894
+function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
2895 2895
     ob_start();
2896 2896
     ?>
2897 2897
     <li>
2898 2898
         <label for="multi_display_type" class="gd-cf-tooltip-wrap">
2899 2899
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
2900 2900
             <div class="gdcf-tooltip">
2901
-                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
2901
+                <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
2902 2902
             </div>
2903 2903
         </label>
2904 2904
         <div class="gd-cf-input-wrap">
@@ -2906,13 +2906,13 @@  discard block
 block discarded – undo
2906 2906
             <select name="multi_display_type" id="multi_display_type">
2907 2907
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
2908 2908
                     echo 'selected="selected"';
2909
-                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
2909
+                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
2910 2910
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
2911 2911
                     echo 'selected="selected"';
2912
-                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
2912
+                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
2913 2913
                 <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
2914 2914
                     echo 'selected="selected"';
2915
-                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
2915
+                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
2916 2916
             </select>
2917 2917
 
2918 2918
             <br/>
@@ -2923,21 +2923,21 @@  discard block
 block discarded – undo
2923 2923
     $output = ob_get_clean();
2924 2924
     return $output;
2925 2925
 }
2926
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
2926
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
2927 2927
 
2928 2928
 
2929
-function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
2929
+function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
2930 2930
     ob_start();
2931 2931
     ?>
2932 2932
     <li>
2933 2933
         <label for="option_values" class="gd-cf-tooltip-wrap">
2934 2934
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
2935 2935
             <div class="gdcf-tooltip">
2936
-                <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
2936
+                <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
2937 2937
                 <br/>
2938
-                <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>
2938
+                <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>
2939 2939
                     <br/>
2940
-                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
2940
+                    <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
2941 2941
                     <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
2942 2942
                         <br/>
2943 2943
                         <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
@@ -2960,12 +2960,12 @@  discard block
 block discarded – undo
2960 2960
     $output = ob_get_clean();
2961 2961
     return $output;
2962 2962
 }
2963
-add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
2964
-add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
2965
-add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
2963
+add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
2964
+add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
2965
+add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
2966 2966
 
2967 2967
 
2968
-function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
2968
+function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
2969 2969
     ob_start();
2970 2970
     if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
2971 2971
         $extra = unserialize($field_info->extra_fields);
@@ -2975,7 +2975,7 @@  discard block
 block discarded – undo
2975 2975
         <label for="date_format" class="gd-cf-tooltip-wrap">
2976 2976
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
2977 2977
             <div class="gdcf-tooltip">
2978
-                <?php _e('Select the date format.', 'geodirectory');?>
2978
+                <?php _e('Select the date format.', 'geodirectory'); ?>
2979 2979
             </div>
2980 2980
         </label>
2981 2981
         <div class="gd-cf-input-wrap" style="overflow:inherit;">
@@ -2995,16 +2995,16 @@  discard block
 block discarded – undo
2995 2995
              * @since 1.6.5
2996 2996
              * @param array $date_formats The PHP date format array.
2997 2997
              */
2998
-            $date_formats = apply_filters('geodir_date_formats',$date_formats);
2998
+            $date_formats = apply_filters('geodir_date_formats', $date_formats);
2999 2999
             ?>
3000 3000
             <select name="extra[date_format]" id="date_format">
3001 3001
                 <?php
3002
-                foreach($date_formats as $format){
3002
+                foreach ($date_formats as $format) {
3003 3003
                     $selected = '';
3004
-                    if(esc_attr($extra['date_format'])==$format){
3004
+                    if (esc_attr($extra['date_format']) == $format) {
3005 3005
                         $selected = "selected='selected'";
3006 3006
                     }
3007
-                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
3007
+                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
3008 3008
                 }
3009 3009
                 ?>
3010 3010
             </select>
@@ -3016,10 +3016,10 @@  discard block
 block discarded – undo
3016 3016
     $output = ob_get_clean();
3017 3017
     return $output;
3018 3018
 }
3019
-add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
3019
+add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
3020 3020
 
3021 3021
 
3022
-function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
3022
+function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
3023 3023
     ob_start();
3024 3024
     $allowed_file_types = geodir_allowed_mime_types();
3025 3025
 
@@ -3030,16 +3030,16 @@  discard block
 block discarded – undo
3030 3030
         <label for="gd_file_types" class="gd-cf-tooltip-wrap">
3031 3031
             <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
3032 3032
             <div class="gdcf-tooltip">
3033
-                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
3033
+                <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
3034 3034
             </div>
3035 3035
         </label>
3036 3036
         <div class="gd-cf-input-wrap">
3037 3037
             <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">
3038
-                <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
3039
-                <?php foreach ( $allowed_file_types as $format => $types ) { ?>
3040
-                    <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
3041
-                        <?php foreach ( $types as $ext => $type ) { ?>
3042
-                            <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>
3038
+                <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
3039
+                <?php foreach ($allowed_file_types as $format => $types) { ?>
3040
+                    <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
3041
+                        <?php foreach ($types as $ext => $type) { ?>
3042
+                            <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>
3043 3043
                         <?php } ?>
3044 3044
                     </optgroup>
3045 3045
                 <?php } ?>
@@ -3051,4 +3051,4 @@  discard block
 block discarded – undo
3051 3051
     $output = ob_get_clean();
3052 3052
     return $output;
3053 3053
 }
3054
-add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
3055 3054
\ No newline at end of file
3055
+add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
3056 3056
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +120 added lines, -79 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
 
@@ -1204,8 +1224,9 @@  discard block
 block discarded – undo
1204 1224
     if (is_admin()) {
1205 1225
         global $post,$gd_session;
1206 1226
 
1207
-        if (isset($_REQUEST['post']))
1208
-            $_REQUEST['pid'] = $_REQUEST['post'];
1227
+        if (isset($_REQUEST['post'])) {
1228
+                    $_REQUEST['pid'] = $_REQUEST['post'];
1229
+        }
1209 1230
     }
1210 1231
 
1211 1232
     if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1258,8 +1279,9 @@  discard block
 block discarded – undo
1258 1279
         if (is_admin()) {
1259 1280
             global $post;
1260 1281
 
1261
-            if (isset($_REQUEST['post']))
1262
-                $_REQUEST['pid'] = $_REQUEST['post'];
1282
+            if (isset($_REQUEST['post'])) {
1283
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1284
+            }
1263 1285
         }
1264 1286
 
1265 1287
         
@@ -1351,7 +1373,7 @@  discard block
 block discarded – undo
1351 1373
         $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
1352 1374
     } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
1353 1375
         $field_icon = '<i class="' . $cf['field_icon'] . '"></i>';
1354
-    }else{
1376
+    } else{
1355 1377
         $field_icon = $cf['field_icon'];
1356 1378
     }
1357 1379
 
@@ -1424,8 +1446,9 @@  discard block
 block discarded – undo
1424 1446
                     $variables_array['post_id'] = $post->ID;
1425 1447
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
1426 1448
                     $variables_array['value'] = '';
1427
-                    if (isset($post->{$type['htmlvar_name']}))
1428
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
1449
+                    if (isset($post->{$type['htmlvar_name']})) {
1450
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
1451
+                    }
1429 1452
                 endif;
1430 1453
 
1431 1454
 
@@ -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.
@@ -1482,10 +1507,11 @@  discard block
 block discarded – undo
1482 1507
      */
1483 1508
     function geodir_default_date_format()
1484 1509
     {
1485
-        if ($format = get_option('date_format'))
1486
-            return $format;
1487
-        else
1488
-            return 'dd-mm-yy';
1510
+        if ($format = get_option('date_format')) {
1511
+                    return $format;
1512
+        } else {
1513
+                    return 'dd-mm-yy';
1514
+        }
1489 1515
     }
1490 1516
 }
1491 1517
 
@@ -1592,11 +1618,13 @@  discard block
 block discarded – undo
1592 1618
                     // Set an array containing a list of acceptable formats
1593 1619
                     //$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');
1594 1620
 
1595
-                    if (!function_exists('wp_handle_upload'))
1596
-                        require_once(ABSPATH . 'wp-admin/includes/file.php');
1621
+                    if (!function_exists('wp_handle_upload')) {
1622
+                                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1623
+                    }
1597 1624
 
1598
-                    if (!is_dir($geodir_uploadpath))
1599
-                        mkdir($geodir_uploadpath);
1625
+                    if (!is_dir($geodir_uploadpath)) {
1626
+                                            mkdir($geodir_uploadpath);
1627
+                    }
1600 1628
 
1601 1629
                     $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
1602 1630
                     $explode_sub_dir = explode("/", $sub_dir);
@@ -1609,16 +1637,19 @@  discard block
 block discarded – undo
1609 1637
                     }
1610 1638
 
1611 1639
                     $uploaded_file = '';
1612
-                    if (file_exists($img_path))
1613
-                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1640
+                    if (file_exists($img_path)) {
1641
+                                            $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1642
+                    }
1614 1643
 
1615 1644
                     if ($curr_img_dir != $geodir_uploaddir) {
1616
-                        if (file_exists($img_path))
1617
-                            unlink($img_path);
1645
+                        if (file_exists($img_path)) {
1646
+                                                    unlink($img_path);
1647
+                        }
1618 1648
                     }
1619 1649
 
1620
-                    if (!empty($uploaded_file))
1621
-                        $file_urls = $geodir_uploadurl . '/' . $new_name;
1650
+                    if (!empty($uploaded_file)) {
1651
+                                            $file_urls = $geodir_uploadurl . '/' . $new_name;
1652
+                    }
1622 1653
 
1623 1654
                 } else {
1624 1655
                     $file_urls = $post_image[$m];
@@ -1639,8 +1670,9 @@  discard block
 block discarded – undo
1639 1670
 
1640 1671
         geodir_save_post_meta($post_id, $field_id, $file_urls);
1641 1672
 
1642
-        if (!empty($invalid_files))
1643
-            geodir_remove_attachments($invalid_files);
1673
+        if (!empty($invalid_files)) {
1674
+                    geodir_remove_attachments($invalid_files);
1675
+        }
1644 1676
 
1645 1677
     }
1646 1678
 }
@@ -1866,8 +1898,9 @@  discard block
 block discarded – undo
1866 1898
 
1867 1899
         $all_postypes = geodir_get_posttypes();
1868 1900
 
1869
-        if (!in_array($post_type, $all_postypes))
1870
-            return false;
1901
+        if (!in_array($post_type, $all_postypes)) {
1902
+                    return false;
1903
+        }
1871 1904
 
1872 1905
         $fields = array();
1873 1906
 
@@ -1955,8 +1988,10 @@  discard block
 block discarded – undo
1955 1988
         }
1956 1989
 
1957 1990
         return $field_ids;
1958
-    else:
1959
-        return false;
1991
+    else {
1992
+    	:
1993
+        return false;
1994
+    }
1960 1995
     endif;
1961 1996
 }
1962 1997
 
@@ -2129,8 +2164,9 @@  discard block
 block discarded – undo
2129 2164
 
2130 2165
             return $field_id;
2131 2166
 
2132
-        } else
2133
-            return 0;
2167
+        } else {
2168
+                    return 0;
2169
+        }
2134 2170
 
2135 2171
     }
2136 2172
 }
@@ -2172,8 +2208,9 @@  discard block
 block discarded – undo
2172 2208
         $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
2173 2209
 
2174 2210
         $site_title = '';
2175
-        if ($site_title == '')
2176
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2211
+        if ($site_title == '') {
2212
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
2213
+        }
2177 2214
 
2178 2215
         if ($site_title == '') {
2179 2216
             $fields = geodir_get_custom_sort_options($post_type);
@@ -2187,8 +2224,9 @@  discard block
 block discarded – undo
2187 2224
             }
2188 2225
         }
2189 2226
 
2190
-        if ($htmlvar_name == '')
2191
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2227
+        if ($htmlvar_name == '') {
2228
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
2229
+        }
2192 2230
 
2193 2231
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
2194 2232
 
@@ -2594,11 +2632,13 @@  discard block
 block discarded – undo
2594 2632
 
2595 2633
             <?php
2596 2634
             $selected = '';
2597
-            if (isset($field_info->extra_fields))
2598
-                $advanced_editor = unserialize($field_info->extra_fields);
2635
+            if (isset($field_info->extra_fields)) {
2636
+                            $advanced_editor = unserialize($field_info->extra_fields);
2637
+            }
2599 2638
 
2600
-            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
2601
-                $selected = 'checked="checked"';
2639
+            if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) {
2640
+                            $selected = 'checked="checked"';
2641
+            }
2602 2642
             ?>
2603 2643
 
2604 2644
             <input type="checkbox" name="advanced_editor[]" id="advanced_editor"
@@ -2660,8 +2700,9 @@  discard block
 block discarded – undo
2660 2700
 
2661 2701
     if (!isset($field_info->post_type)) {
2662 2702
         $post_type = sanitize_text_field($_REQUEST['listing_type']);
2663
-    } else
2664
-        $post_type = $field_info->post_type;
2703
+    } else {
2704
+            $post_type = $field_info->post_type;
2705
+    }
2665 2706
     ?>
2666 2707
     <li style="display: none;">
2667 2708
         <label for="htmlvar_name" class="gd-cf-tooltip-wrap">
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
  * @global string $table_prefix  WordPress Database Table prefix.
2302 2302
  *
2303 2303
  * @param array $query_args      The query array.
2304
- * @param  int|bool $count_only  If true returns listings count only, otherwise returns array
2304
+ * @param  boolean $count_only  If true returns listings count only, otherwise returns array
2305 2305
  *
2306 2306
  * @return mixed Result object.
2307 2307
  */
@@ -3958,7 +3958,7 @@  discard block
 block discarded – undo
3958 3958
  * @since   1.0.0
3959 3959
  * @since   1.6.1 Fixed add listing page load time.
3960 3960
  * @package GeoDirectory
3961
- * @return bool
3961
+ * @return null|boolean
3962 3962
  */
3963 3963
 function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3964 3964
 	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			break;
302 302
 		case 'preview':
303 303
 			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
304
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
304
+				 && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
305 305
 			) {
306 306
 				return true;
307 307
 			}
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
 
506 506
 //check if homepage
507 507
 		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
508
-		     && ! isset( $wp->query_vars['page_id'] )
509
-		     && ! isset( $wp->query_vars['pagename'] )
510
-		     && is_page_geodir_home()
508
+			 && ! isset( $wp->query_vars['page_id'] )
509
+			 && ! isset( $wp->query_vars['pagename'] )
510
+			 && is_page_geodir_home()
511 511
 		) {
512 512
 			$wp->query_vars['gd_is_geodir_page'] = true;
513 513
 		}
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
693 693
 		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
694 694
 		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
695
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
696
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
695
+						  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
696
+						  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
697 697
 		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
698 698
 		$distance       = $earthMeanRadius * $c;
699 699
 
Please login to merge, or discard this patch.
Spacing   +1371 added lines, -1371 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Get All Plugin functions from WordPress
12 12
  */
13
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
13
+include_once(ABSPATH.'wp-admin/includes/plugin.php');
14 14
 
15 15
 /*-----------------------------------------------------------------------------------*/
16 16
 /* Helper functions */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function geodir_plugin_url() {
29 29
 
30
-	if ( is_ssl() ) :
31
-		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
30
+	if (is_ssl()) :
31
+		return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
32 32
 	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
33
+		return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__)));
34 34
 	endif;
35 35
 }
36 36
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
  * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory
46 46
  */
47 47
 function geodir_plugin_path() {
48
-	if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
49
-		return dirname( dirname( __FILE__ ) );
48
+	if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
49
+		return dirname(dirname(__FILE__));
50 50
 	} else {
51
-		return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
51
+		return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__)));
52 52
 	}
53 53
 }
54 54
 
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
  * @return bool true or false.
64 64
  * @todo    check if this is faster than normal WP check and remove if not.
65 65
  */
66
-function geodir_is_plugin_active( $plugin ) {
67
-	$active_plugins = get_option( 'active_plugins' );
68
-	foreach ( $active_plugins as $key => $active_plugin ) {
69
-		if ( strstr( $active_plugin, $plugin ) ) {
66
+function geodir_is_plugin_active($plugin) {
67
+	$active_plugins = get_option('active_plugins');
68
+	foreach ($active_plugins as $key => $active_plugin) {
69
+		if (strstr($active_plugin, $plugin)) {
70 70
 			return true;
71 71
 		}
72 72
 	}
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @return bool|int|string the formatted date.
90 90
  */
91
-function geodir_get_formated_date( $date ) {
92
-	return mysql2date( get_option( 'date_format' ), $date );
91
+function geodir_get_formated_date($date) {
92
+	return mysql2date(get_option('date_format'), $date);
93 93
 }
94 94
 
95 95
 /**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return bool|int|string the formatted time.
107 107
  */
108
-function geodir_get_formated_time( $time ) {
109
-	return mysql2date( get_option( 'time_format' ), $time, $translate = true );
108
+function geodir_get_formated_time($time) {
109
+	return mysql2date(get_option('time_format'), $time, $translate = true);
110 110
 }
111 111
 
112 112
 
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return string Formatted link.
126 126
  */
127
-function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
128
-	if ( $use_existing_arguments ) {
127
+function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
128
+	if ($use_existing_arguments) {
129 129
 		$params = $params + $_GET;
130 130
 	}
131
-	if ( ! $params ) {
131
+	if (!$params) {
132 132
 		return $url;
133 133
 	}
134 134
 	$link = $url;
135
-	if ( strpos( $link, '?' ) === false ) {
135
+	if (strpos($link, '?') === false) {
136 136
 		$link .= '?';
137 137
 	} //If there is no '?' add one at the end
138
-	elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
138
+	elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
139 139
 		$link .= '&amp;';
140 140
 	} //If there is no '&' at the END, add one.
141
-	elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
141
+	elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
142 142
 		$link .= '&';
143 143
 	} //If there is no '&' at the END, add one.
144 144
 
145 145
 	$params_arr = array();
146
-	foreach ( $params as $key => $value ) {
147
-		if ( gettype( $value ) == 'array' ) { //Handle array data properly
148
-			foreach ( $value as $val ) {
149
-				$params_arr[] = $key . '[]=' . urlencode( $val );
146
+	foreach ($params as $key => $value) {
147
+		if (gettype($value) == 'array') { //Handle array data properly
148
+			foreach ($value as $val) {
149
+				$params_arr[] = $key.'[]='.urlencode($val);
150 150
 			}
151 151
 		} else {
152
-			$params_arr[] = $key . '=' . urlencode( $value );
152
+			$params_arr[] = $key.'='.urlencode($value);
153 153
 		}
154 154
 	}
155
-	$link .= implode( '&', $params_arr );
155
+	$link .= implode('&', $params_arr);
156 156
 
157 157
 	return $link;
158 158
 }
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @return string Listing page url if valid. Otherwise home url will be returned.
171 171
  */
172
-function geodir_get_addlisting_link( $post_type = '' ) {
172
+function geodir_get_addlisting_link($post_type = '') {
173 173
 	global $wpdb;
174 174
 
175 175
 	//$check_pkg  = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
176 176
 	$check_pkg = 1;
177
-	if ( post_type_exists( $post_type ) && $check_pkg ) {
177
+	if (post_type_exists($post_type) && $check_pkg) {
178 178
 
179
-		$add_listing_link = get_page_link( geodir_add_listing_page_id() );
179
+		$add_listing_link = get_page_link(geodir_add_listing_page_id());
180 180
 
181
-		return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) );
181
+		return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
182 182
 	} else {
183
-		return get_bloginfo( 'url' );
183
+		return get_bloginfo('url');
184 184
 	}
185 185
 }
186 186
 
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function geodir_curPageURL() {
196 196
 	$pageURL = 'http';
197
-	if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
197
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
198 198
 		$pageURL .= "s";
199 199
 	}
200 200
 	$pageURL .= "://";
201
-	$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
201
+	$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
202 202
 
203 203
 	/**
204 204
 	 * Filter the current page URL returned by function geodir_curPageURL().
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $pageURL The URL of the current page.
209 209
 	 */
210
-	return apply_filters( 'geodir_curPageURL', $pageURL );
210
+	return apply_filters('geodir_curPageURL', $pageURL);
211 211
 }
212 212
 
213 213
 
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return string Cleaned variable.
225 225
  */
226
-function geodir_clean( $string ) {
226
+function geodir_clean($string) {
227 227
 
228
-	$string = trim( strip_tags( stripslashes( $string ) ) );
229
-	$string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens.
230
-	$string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars.
231
-	$string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one.
228
+	$string = trim(strip_tags(stripslashes($string)));
229
+	$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
230
+	$string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
231
+	$string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
232 232
 
233 233
 	return $string;
234 234
 }
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
  */
243 243
 function geodir_get_weekday() {
244 244
 	return array(
245
-		__( 'Sunday', 'geodirectory' ),
246
-		__( 'Monday', 'geodirectory' ),
247
-		__( 'Tuesday', 'geodirectory' ),
248
-		__( 'Wednesday', 'geodirectory' ),
249
-		__( 'Thursday', 'geodirectory' ),
250
-		__( 'Friday', 'geodirectory' ),
251
-		__( 'Saturday', 'geodirectory' )
245
+		__('Sunday', 'geodirectory'),
246
+		__('Monday', 'geodirectory'),
247
+		__('Tuesday', 'geodirectory'),
248
+		__('Wednesday', 'geodirectory'),
249
+		__('Thursday', 'geodirectory'),
250
+		__('Friday', 'geodirectory'),
251
+		__('Saturday', 'geodirectory')
252 252
 	);
253 253
 }
254 254
 
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
  */
262 262
 function geodir_get_weeks() {
263 263
 	return array(
264
-		__( 'First', 'geodirectory' ),
265
-		__( 'Second', 'geodirectory' ),
266
-		__( 'Third', 'geodirectory' ),
267
-		__( 'Fourth', 'geodirectory' ),
268
-		__( 'Last', 'geodirectory' )
264
+		__('First', 'geodirectory'),
265
+		__('Second', 'geodirectory'),
266
+		__('Third', 'geodirectory'),
267
+		__('Fourth', 'geodirectory'),
268
+		__('Last', 'geodirectory')
269 269
 	);
270 270
 }
271 271
 
@@ -284,112 +284,112 @@  discard block
 block discarded – undo
284 284
  *
285 285
  * @return bool If valid returns true. Otherwise false.
286 286
  */
287
-function geodir_is_page( $gdpage = '' ) {
287
+function geodir_is_page($gdpage = '') {
288 288
 
289 289
 	global $wp_query, $post, $wp;
290 290
 	//if(!is_admin()):
291 291
 
292
-	switch ( $gdpage ):
292
+	switch ($gdpage):
293 293
 		case 'add-listing':
294 294
 
295
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
295
+			if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
296 296
 				return true;
297
-			} elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
297
+			} elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
298 298
 				return true;
299 299
 			}
300 300
 
301 301
 			break;
302 302
 		case 'preview':
303
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] )
304
-			     && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() )
303
+			if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
304
+			     && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
305 305
 			) {
306 306
 				return true;
307 307
 			}
308 308
 			break;
309 309
 		case 'listing-success':
310
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
310
+			if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
311 311
 				return true;
312 312
 			}
313 313
 			break;
314 314
 		case 'detail':
315
-			$post_type = get_query_var( 'post_type' );
316
-			if ( is_array( $post_type ) ) {
317
-				$post_type = reset( $post_type );
315
+			$post_type = get_query_var('post_type');
316
+			if (is_array($post_type)) {
317
+				$post_type = reset($post_type);
318 318
 			}
319
-			if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
319
+			if (is_single() && in_array($post_type, geodir_get_posttypes())) {
320 320
 				return true;
321 321
 			}
322 322
 			break;
323 323
 		case 'pt':
324
-			$post_type = get_query_var( 'post_type' );
325
-			if ( is_array( $post_type ) ) {
326
-				$post_type = reset( $post_type );
324
+			$post_type = get_query_var('post_type');
325
+			if (is_array($post_type)) {
326
+				$post_type = reset($post_type);
327 327
 			}
328
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
328
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
329 329
 				return true;
330 330
 			}
331 331
 
332 332
 			break;
333 333
 		case 'listing':
334
-			if ( is_tax() && geodir_get_taxonomy_posttype() ) {
334
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
335 335
 				global $current_term, $taxonomy, $term;
336 336
 
337 337
 				return true;
338 338
 			}
339
-			$post_type = get_query_var( 'post_type' );
340
-			if ( is_array( $post_type ) ) {
341
-				$post_type = reset( $post_type );
339
+			$post_type = get_query_var('post_type');
340
+			if (is_array($post_type)) {
341
+				$post_type = reset($post_type);
342 342
 			}
343
-			if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
343
+			if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
344 344
 				return true;
345 345
 			}
346 346
 
347 347
 			break;
348 348
 		case 'home':
349 349
 
350
-			if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
350
+			if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
351 351
 				return true;
352 352
 			}
353 353
 
354 354
 			break;
355 355
 		case 'location':
356
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
356
+			if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
357 357
 				return true;
358 358
 			}
359 359
 			break;
360 360
 		case 'author':
361
-			if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
361
+			if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
362 362
 				return true;
363 363
 			}
364 364
 
365
-			if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
366
-				if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
365
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
366
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
367 367
 					return true;
368 368
 				}
369 369
 			}
370 370
 			break;
371 371
 		case 'search':
372
-			if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
372
+			if (is_search() && isset($_REQUEST['geodir_search'])) {
373 373
 				return true;
374 374
 			}
375 375
 			break;
376 376
 		case 'info':
377
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
377
+			if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
378 378
 				return true;
379 379
 			}
380 380
 			break;
381 381
 		case 'login':
382
-			if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
382
+			if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
383 383
 				return true;
384 384
 			}
385 385
 			break;
386 386
 		case 'checkout':
387
-			if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
387
+			if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
388 388
 				return true;
389 389
 			}
390 390
 			break;
391 391
 		case 'invoices':
392
-			if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
392
+			if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
393 393
 				return true;
394 394
 			}
395 395
 			break;
@@ -414,28 +414,28 @@  discard block
 block discarded – undo
414 414
  *
415 415
  * @param object $wp WordPress object.
416 416
  */
417
-function geodir_set_is_geodir_page( $wp ) {
418
-	if ( ! is_admin() ) {
417
+function geodir_set_is_geodir_page($wp) {
418
+	if (!is_admin()) {
419 419
 		//$wp->query_vars['gd_is_geodir_page'] = false;
420 420
 		//print_r()
421
-		if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array(
421
+		if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array(
422 422
 				'preview',
423 423
 				'page',
424 424
 				'paged',
425 425
 				'cpage'
426
-			) )
426
+			))
427 427
 		) {
428
-			if ( get_option( 'geodir_set_as_home' ) ) {
428
+			if (get_option('geodir_set_as_home')) {
429 429
 				$wp->query_vars['gd_is_geodir_page'] = true;
430 430
 			}
431
-			if ( geodir_is_page( 'home' ) ) {
431
+			if (geodir_is_page('home')) {
432 432
 				$wp->query_vars['gd_is_geodir_page'] = true;
433 433
 			}
434 434
 
435 435
 
436 436
 		}
437 437
 
438
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
438
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
439 439
 			if (
440 440
 				$wp->query_vars['page_id'] == geodir_add_listing_page_id()
441 441
 				|| $wp->query_vars['page_id'] == geodir_preview_page_id()
@@ -444,26 +444,26 @@  discard block
 block discarded – undo
444 444
 				|| $wp->query_vars['page_id'] == geodir_home_page_id()
445 445
 				|| $wp->query_vars['page_id'] == geodir_info_page_id()
446 446
 				|| $wp->query_vars['page_id'] == geodir_login_page_id()
447
-				|| ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
448
-				|| ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
447
+				|| (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
448
+				|| (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
449 449
 			) {
450 450
 				$wp->query_vars['gd_is_geodir_page'] = true;
451 451
 			}
452 452
 		}
453 453
 
454
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
455
-			$page = get_page_by_path( $wp->query_vars['pagename'] );
454
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
455
+			$page = get_page_by_path($wp->query_vars['pagename']);
456 456
 
457
-			if ( ! empty( $page ) && (
457
+			if (!empty($page) && (
458 458
 					$page->ID == geodir_add_listing_page_id()
459 459
 					|| $page->ID == geodir_preview_page_id()
460 460
 					|| $page->ID == geodir_success_page_id()
461 461
 					|| $page->ID == geodir_location_page_id()
462
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() )
463
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() )
464
-					|| ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() )
465
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() )
466
-					|| ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() )
462
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id())
463
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id())
464
+					|| (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id())
465
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
466
+					|| (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
467 467
 				)
468 468
 			) {
469 469
 				$wp->query_vars['gd_is_geodir_page'] = true;
@@ -471,20 +471,20 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 
473 473
 
474
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
474
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
475 475
 			$requested_post_type = $wp->query_vars['post_type'];
476 476
 			// check if this post type is geodirectory post types
477 477
 			$post_type_array = geodir_get_posttypes();
478
-			if ( in_array( $requested_post_type, $post_type_array ) ) {
478
+			if (in_array($requested_post_type, $post_type_array)) {
479 479
 				$wp->query_vars['gd_is_geodir_page'] = true;
480 480
 			}
481 481
 		}
482 482
 
483
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
484
-			$geodir_taxonomis = geodir_get_taxonomies( '', true );
485
-			if ( ! empty( $geodir_taxonomis ) ) {
486
-				foreach ( $geodir_taxonomis as $taxonomy ) {
487
-					if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
483
+		if (!isset($wp->query_vars['gd_is_geodir_page'])) {
484
+			$geodir_taxonomis = geodir_get_taxonomies('', true);
485
+			if (!empty($geodir_taxonomis)) {
486
+				foreach ($geodir_taxonomis as $taxonomy) {
487
+					if (array_key_exists($taxonomy, $wp->query_vars)) {
488 488
 						$wp->query_vars['gd_is_geodir_page'] = true;
489 489
 						break;
490 490
 					}
@@ -493,20 +493,20 @@  discard block
 block discarded – undo
493 493
 
494 494
 		}
495 495
 
496
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
496
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
497 497
 			$wp->query_vars['gd_is_geodir_page'] = true;
498 498
 		}
499 499
 
500 500
 
501
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
501
+		if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
502 502
 			$wp->query_vars['gd_is_geodir_page'] = true;
503 503
 		}
504 504
 
505 505
 
506 506
 //check if homepage
507
-		if ( ! isset( $wp->query_vars['gd_is_geodir_page'] )
508
-		     && ! isset( $wp->query_vars['page_id'] )
509
-		     && ! isset( $wp->query_vars['pagename'] )
507
+		if (!isset($wp->query_vars['gd_is_geodir_page'])
508
+		     && !isset($wp->query_vars['page_id'])
509
+		     && !isset($wp->query_vars['pagename'])
510 510
 		     && is_page_geodir_home()
511 511
 		) {
512 512
 			$wp->query_vars['gd_is_geodir_page'] = true;
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
  */
531 531
 function geodir_is_geodir_page() {
532 532
 	global $wp;
533
-	if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
533
+	if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
534 534
 		return true;
535 535
 	} else {
536 536
 		return false;
537 537
 	}
538 538
 }
539 539
 
540
-if ( ! function_exists( 'geodir_get_imagesize' ) ) {
540
+if (!function_exists('geodir_get_imagesize')) {
541 541
 	/**
542 542
 	 * Get image size using the size key .
543 543
 	 *
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
 	 *
549 549
 	 * @return array|mixed|void|WP_Error If valid returns image size. Else returns error.
550 550
 	 */
551
-	function geodir_get_imagesize( $size = '' ) {
551
+	function geodir_get_imagesize($size = '') {
552 552
 
553 553
 		$imagesizes = array(
554
-			'list-thumb'   => array( 'w' => 283, 'h' => 188 ),
555
-			'thumbnail'    => array( 'w' => 125, 'h' => 125 ),
556
-			'widget-thumb' => array( 'w' => 50, 'h' => 50 ),
557
-			'slider-thumb' => array( 'w' => 100, 'h' => 100 )
554
+			'list-thumb'   => array('w' => 283, 'h' => 188),
555
+			'thumbnail'    => array('w' => 125, 'h' => 125),
556
+			'widget-thumb' => array('w' => 50, 'h' => 50),
557
+			'slider-thumb' => array('w' => 100, 'h' => 100)
558 558
 		);
559 559
 
560 560
 		/**
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 		 *
565 565
 		 * @param array $imagesizes Image size array.
566 566
 		 */
567
-		$imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes );
567
+		$imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
568 568
 
569
-		if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
569
+		if (!empty($size) && array_key_exists($size, $imagesizes)) {
570 570
 			/**
571 571
 			 * Filters image size of the passed key.
572 572
 			 *
@@ -574,11 +574,11 @@  discard block
 block discarded – undo
574 574
 			 *
575 575
 			 * @param array $imagesizes [$size] Image size array of the passed key.
576 576
 			 */
577
-			return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] );
577
+			return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
578 578
 
579
-		} elseif ( ! empty( $size ) ) {
579
+		} elseif (!empty($size)) {
580 580
 
581
-			return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) );
581
+			return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
582 582
 
583 583
 		}
584 584
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 */
603 603
 
604 604
 
605
-if ( ! function_exists( 'createRandomString' ) ) {
605
+if (!function_exists('createRandomString')) {
606 606
 	/**
607 607
 	 * Creates random string.
608 608
 	 *
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
 	 */
613 613
 	function createRandomString() {
614 614
 		$chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
615
-		srand( (double) microtime() * 1000000 );
615
+		srand((double) microtime() * 1000000);
616 616
 		$i       = 0;
617 617
 		$rstring = '';
618
-		while ( $i <= 25 ) {
618
+		while ($i <= 25) {
619 619
 			$num     = rand() % 33;
620
-			$tmp     = substr( $chars, $num, 1 );
621
-			$rstring = $rstring . $tmp;
622
-			$i ++;
620
+			$tmp     = substr($chars, $num, 1);
621
+			$rstring = $rstring.$tmp;
622
+			$i++;
623 623
 		}
624 624
 
625 625
 		return $rstring;
626 626
 	}
627 627
 }
628 628
 
629
-if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
629
+if (!function_exists('geodir_getDistanceRadius')) {
630 630
 	/**
631 631
 	 * Calculates the distance radius.
632 632
 	 *
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
 	 *
638 638
 	 * @return float The mean radius.
639 639
 	 */
640
-	function geodir_getDistanceRadius( $uom = 'km' ) {
640
+	function geodir_getDistanceRadius($uom = 'km') {
641 641
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
642
-		switch ( geodir_strtolower( $uom ) ):
642
+		switch (geodir_strtolower($uom)):
643 643
 			case 'km'    :
644 644
 				$earthMeanRadius = 6371.009; // km
645 645
 				break;
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 }
672 672
 
673 673
 
674
-if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
674
+if (!function_exists('geodir_calculateDistanceFromLatLong')) {
675 675
 	/**
676 676
 	 * Calculate the great circle distance between two points identified by longitude and latitude.
677 677
 	 *
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 	 *
685 685
 	 * @return float The distance.
686 686
 	 */
687
-	function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
687
+	function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
688 688
 //	Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude
689 689
 
690
-		$earthMeanRadius = geodir_getDistanceRadius( $uom );
690
+		$earthMeanRadius = geodir_getDistanceRadius($uom);
691 691
 
692
-		$deltaLatitude  = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] );
693
-		$deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] );
694
-		$a              = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) +
695
-		                  cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) *
696
-		                  sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 );
697
-		$c              = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
692
+		$deltaLatitude  = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']);
693
+		$deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']);
694
+		$a              = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) +
695
+		                  cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) *
696
+		                  sin($deltaLongitude / 2) * sin($deltaLongitude / 2);
697
+		$c              = 2 * atan2(sqrt($a), sqrt(1 - $a));
698 698
 		$distance       = $earthMeanRadius * $c;
699 699
 
700 700
 		return $distance;
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 }
704 704
 
705 705
 
706
-if ( ! function_exists( 'geodir_sendEmail' ) ) {
706
+if (!function_exists('geodir_sendEmail')) {
707 707
 	/**
708 708
 	 * The main function that send transactional emails using the args provided.
709 709
 	 *
@@ -722,83 +722,83 @@  discard block
 block discarded – undo
722 722
 	 * @param string $post_id       The post ID.
723 723
 	 * @param string $user_id       The user ID.
724 724
 	 */
725
-	function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
725
+	function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
726 726
 		$login_details = '';
727 727
 
728 728
 		// strip slashes from subject & message text
729
-		$to_subject = stripslashes_deep( $to_subject );
730
-		$to_message = stripslashes_deep( $to_message );
731
-
732
-		if ( $message_type == 'send_friend' ) {
733
-			$subject = get_option( 'geodir_email_friend_subject' );
734
-			$message = get_option( 'geodir_email_friend_content' );
735
-		} elseif ( $message_type == 'send_enquiry' ) {
736
-			$subject = get_option( 'geodir_email_enquiry_subject' );
737
-			$message = get_option( 'geodir_email_enquiry_content' );
738
-		} elseif ( $message_type == 'forgot_password' ) {
739
-			$subject       = get_option( 'geodir_forgot_password_subject' );
740
-			$message       = get_option( 'geodir_forgot_password_content' );
729
+		$to_subject = stripslashes_deep($to_subject);
730
+		$to_message = stripslashes_deep($to_message);
731
+
732
+		if ($message_type == 'send_friend') {
733
+			$subject = get_option('geodir_email_friend_subject');
734
+			$message = get_option('geodir_email_friend_content');
735
+		} elseif ($message_type == 'send_enquiry') {
736
+			$subject = get_option('geodir_email_enquiry_subject');
737
+			$message = get_option('geodir_email_enquiry_content');
738
+		} elseif ($message_type == 'forgot_password') {
739
+			$subject       = get_option('geodir_forgot_password_subject');
740
+			$message       = get_option('geodir_forgot_password_content');
741 741
 			$login_details = $to_message;
742
-		} elseif ( $message_type == 'registration' ) {
743
-			$subject       = get_option( 'geodir_registration_success_email_subject' );
744
-			$message       = get_option( 'geodir_registration_success_email_content' );
742
+		} elseif ($message_type == 'registration') {
743
+			$subject       = get_option('geodir_registration_success_email_subject');
744
+			$message       = get_option('geodir_registration_success_email_content');
745 745
 			$login_details = $to_message;
746
-		} elseif ( $message_type == 'post_submit' ) {
747
-			$subject = get_option( 'geodir_post_submited_success_email_subject' );
748
-			$message = get_option( 'geodir_post_submited_success_email_content' );
749
-		} elseif ( $message_type == 'listing_published' ) {
750
-			$subject = get_option( 'geodir_post_published_email_subject' );
751
-			$message = get_option( 'geodir_post_published_email_content' );
752
-		} elseif ( $message_type == 'listing_edited' ) {
753
-			$subject = get_option( 'geodir_post_edited_email_subject_admin' );
754
-			$message = get_option( 'geodir_post_edited_email_content_admin' );
746
+		} elseif ($message_type == 'post_submit') {
747
+			$subject = get_option('geodir_post_submited_success_email_subject');
748
+			$message = get_option('geodir_post_submited_success_email_content');
749
+		} elseif ($message_type == 'listing_published') {
750
+			$subject = get_option('geodir_post_published_email_subject');
751
+			$message = get_option('geodir_post_published_email_content');
752
+		} elseif ($message_type == 'listing_edited') {
753
+			$subject = get_option('geodir_post_edited_email_subject_admin');
754
+			$message = get_option('geodir_post_edited_email_content_admin');
755 755
 		}
756 756
 
757
-		if ( ! empty( $subject ) ) {
758
-			$subject = __( stripslashes_deep( $subject ), 'geodirectory' );
757
+		if (!empty($subject)) {
758
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
759 759
 		}
760 760
 
761
-		if ( ! empty( $message ) ) {
762
-			$message = __( stripslashes_deep( $message ), 'geodirectory' );
761
+		if (!empty($message)) {
762
+			$message = __(stripslashes_deep($message), 'geodirectory');
763 763
 		}
764 764
 
765
-		$to_message        = nl2br( $to_message );
766
-		$sitefromEmail     = get_option( 'site_email' );
765
+		$to_message        = nl2br($to_message);
766
+		$sitefromEmail     = get_option('site_email');
767 767
 		$sitefromEmailName = get_site_emailName();
768
-		$productlink       = get_permalink( $post_id );
768
+		$productlink       = get_permalink($post_id);
769 769
 
770 770
 		$user_login = '';
771
-		if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
771
+		if ($user_id > 0 && $user_info = get_userdata($user_id)) {
772 772
 			$user_login = $user_info->user_login;
773 773
 		}
774 774
 
775 775
 		$posted_date = '';
776 776
 		$listingLink = '';
777 777
 
778
-		$post_info = get_post( $post_id );
778
+		$post_info = get_post($post_id);
779 779
 
780
-		if ( $post_info ) {
780
+		if ($post_info) {
781 781
 			$posted_date = $post_info->post_date;
782
-			$listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
782
+			$listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
783 783
 		}
784 784
 		$siteurl       = home_url();
785
-		$siteurl_link  = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
785
+		$siteurl_link  = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
786 786
 		$loginurl      = geodir_login_url();
787
-		$loginurl_link = '<a href="' . $loginurl . '">login</a>';
787
+		$loginurl_link = '<a href="'.$loginurl.'">login</a>';
788 788
 
789
-		$post_author_id   = ! empty( $post_info ) ? $post_info->post_author : 0;
790
-		$post_author_name = geodir_get_client_name( $post_author_id );
791
-		$current_date     = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) );
789
+		$post_author_id   = !empty($post_info) ? $post_info->post_author : 0;
790
+		$post_author_name = geodir_get_client_name($post_author_id);
791
+		$current_date     = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
792 792
 
793
-		if ( $fromEmail == '' ) {
794
-			$fromEmail = get_option( 'site_email' );
793
+		if ($fromEmail == '') {
794
+			$fromEmail = get_option('site_email');
795 795
 		}
796 796
 
797
-		if ( $fromEmailName == '' ) {
798
-			$fromEmailName = get_option( 'site_email_name' );
797
+		if ($fromEmailName == '') {
798
+			$fromEmailName = get_option('site_email_name');
799 799
 		}
800 800
 
801
-		$search_array  = array(
801
+		$search_array = array(
802 802
 			'[#listing_link#]',
803 803
 			'[#site_name_url#]',
804 804
 			'[#post_id#]',
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 			$post_author_name,
839 839
 			$current_date
840 840
 		);
841
-		$message       = str_replace( $search_array, $replace_array, $message );
841
+		$message       = str_replace($search_array, $replace_array, $message);
842 842
 
843 843
 		$search_array  = array(
844 844
 			'[#listing_link#]',
@@ -874,12 +874,12 @@  discard block
 block discarded – undo
874 874
 			$post_author_name,
875 875
 			$current_date
876 876
 		);
877
-		$subject       = str_replace( $search_array, $replace_array, $subject );
877
+		$subject = str_replace($search_array, $replace_array, $subject);
878 878
 
879
-		$headers = 'MIME-Version: 1.0' . "\r\n";
880
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
881
-		$headers .= "Reply-To: " . $fromEmail . "\r\n";
882
-		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
879
+		$headers = 'MIME-Version: 1.0'."\r\n";
880
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
881
+		$headers .= "Reply-To: ".$fromEmail."\r\n";
882
+		$headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
883 883
 
884 884
 		$to = $toEmail;
885 885
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 		 * @param string $post_id       The post ID.
902 902
 		 * @param string $user_id       The user ID.
903 903
 		 */
904
-		$to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
904
+		$to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
905 905
 		/**
906 906
 		 * Filter the client email subject.
907 907
 		 *
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 		 * @param string $post_id       The post ID.
921 921
 		 * @param string $user_id       The user ID.
922 922
 		 */
923
-		$subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
923
+		$subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
924 924
 		/**
925 925
 		 * Filter the client email message.
926 926
 		 *
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		 * @param string $post_id       The post ID.
940 940
 		 * @param string $user_id       The user ID.
941 941
 		 */
942
-		$message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
942
+		$message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
943 943
 		/**
944 944
 		 * Filter the client email headers.
945 945
 		 *
@@ -958,34 +958,34 @@  discard block
 block discarded – undo
958 958
 		 * @param string $post_id       The post ID.
959 959
 		 * @param string $user_id       The user ID.
960 960
 		 */
961
-		$headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id );
961
+		$headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
962 962
 
963
-		$sent = wp_mail( $to, $subject, $message, $headers );
963
+		$sent = wp_mail($to, $subject, $message, $headers);
964 964
 
965
-		if ( ! $sent ) {
966
-			if ( is_array( $to ) ) {
967
-				$to = implode( ',', $to );
965
+		if (!$sent) {
966
+			if (is_array($to)) {
967
+				$to = implode(',', $to);
968 968
 			}
969 969
 			$log_message = sprintf(
970
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
970
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
971 971
 				$message_type,
972
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
972
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
973 973
 				$to,
974 974
 				$subject
975 975
 			);
976
-			geodir_error_log( $log_message );
976
+			geodir_error_log($log_message);
977 977
 		}
978 978
 
979 979
 		///////// ADMIN BCC EMIALS
980
-		$adminEmail = get_bloginfo( 'admin_email' );
980
+		$adminEmail = get_bloginfo('admin_email');
981 981
 		$to         = $adminEmail;
982 982
 
983 983
 		$admin_bcc = false;
984
-		if ( $message_type == 'post_submit' ) {
985
-			$subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' );
986
-			$message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' );
984
+		if ($message_type == 'post_submit') {
985
+			$subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
986
+			$message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
987 987
 
988
-			$search_array  = array(
988
+			$search_array = array(
989 989
 				'[#listing_link#]',
990 990
 				'[#site_name_url#]',
991 991
 				'[#post_id#]',
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 				$user_login,
1018 1018
 				$user_login
1019 1019
 			);
1020
-			$message       = str_replace( $search_array, $replace_array, $message );
1020
+			$message       = str_replace($search_array, $replace_array, $message);
1021 1021
 
1022 1022
 			$search_array  = array(
1023 1023
 				'[#listing_link#]',
@@ -1045,40 +1045,40 @@  discard block
 block discarded – undo
1045 1045
 				$user_login,
1046 1046
 				$user_login
1047 1047
 			);
1048
-			$subject       = str_replace( $search_array, $replace_array, $subject );
1048
+			$subject = str_replace($search_array, $replace_array, $subject);
1049 1049
 
1050 1050
 			$subject .= ' - ADMIN BCC COPY';
1051 1051
 			$admin_bcc = true;
1052 1052
 
1053
-		} elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
1053
+		} elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
1054 1054
 			$subject .= ' - ADMIN BCC COPY';
1055 1055
 			$admin_bcc = true;
1056
-		} elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
1056
+		} elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
1057 1057
 			$subject .= ' - ADMIN BCC COPY';
1058 1058
 			$admin_bcc = true;
1059
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
1059
+		} elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
1060 1060
 			$subject .= ' - ADMIN BCC COPY';
1061 1061
 			$admin_bcc = true;
1062
-		} elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
1062
+		} elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
1063 1063
 			$subject .= ' - ADMIN BCC COPY';
1064 1064
 			$admin_bcc = true;
1065 1065
 		}
1066 1066
 
1067
-		if ( $admin_bcc === true ) {
1068
-			$sent = wp_mail( $to, $subject, $message, $headers );
1067
+		if ($admin_bcc === true) {
1068
+			$sent = wp_mail($to, $subject, $message, $headers);
1069 1069
 
1070
-			if ( ! $sent ) {
1071
-				if ( is_array( $to ) ) {
1072
-					$to = implode( ',', $to );
1070
+			if (!$sent) {
1071
+				if (is_array($to)) {
1072
+					$to = implode(',', $to);
1073 1073
 				}
1074 1074
 				$log_message = sprintf(
1075
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1075
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1076 1076
 					$message_type,
1077
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1077
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
1078 1078
 					$to,
1079 1079
 					$subject
1080 1080
 				);
1081
-				geodir_error_log( $log_message );
1081
+				geodir_error_log($log_message);
1082 1082
 			}
1083 1083
 		}
1084 1084
 
@@ -1094,27 +1094,27 @@  discard block
 block discarded – undo
1094 1094
  */
1095 1095
 function geodir_taxonomy_breadcrumb() {
1096 1096
 
1097
-	$term   = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
1097
+	$term   = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
1098 1098
 	$parent = $term->parent;
1099 1099
 
1100
-	while ( $parent ):
1100
+	while ($parent):
1101 1101
 		$parents[]  = $parent;
1102
-		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1102
+		$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
1103 1103
 		$parent     = $new_parent->parent;
1104 1104
 	endwhile;
1105 1105
 
1106
-	if ( ! empty( $parents ) ):
1107
-		$parents = array_reverse( $parents );
1106
+	if (!empty($parents)):
1107
+		$parents = array_reverse($parents);
1108 1108
 
1109
-		foreach ( $parents as $parent ):
1110
-			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
1111
-			$url  = get_term_link( $item, get_query_var( 'taxonomy' ) );
1112
-			echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>';
1109
+		foreach ($parents as $parent):
1110
+			$item = get_term_by('id', $parent, get_query_var('taxonomy'));
1111
+			$url  = get_term_link($item, get_query_var('taxonomy'));
1112
+			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
1113 1113
 		endforeach;
1114 1114
 
1115 1115
 	endif;
1116 1116
 
1117
-	echo '<li> > ' . $term->name . '</li>';
1117
+	echo '<li> > '.$term->name.'</li>';
1118 1118
 }
1119 1119
 
1120 1120
 
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
 	 *
1137 1137
 	 * @since 1.0.0
1138 1138
 	 */
1139
-	$separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' );
1139
+	$separator = apply_filters('geodir_breadcrumb_separator', ' > ');
1140 1140
 
1141
-	if ( ! geodir_is_page( 'home' ) ) {
1141
+	if (!geodir_is_page('home')) {
1142 1142
 		$breadcrumb    = '';
1143 1143
 		$url_categoris = '';
1144 1144
 		$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
@@ -1147,162 +1147,162 @@  discard block
 block discarded – undo
1147 1147
 		 *
1148 1148
 		 * @since 1.0.0
1149 1149
 		 */
1150
-		$breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>';
1150
+		$breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
1151 1151
 
1152 1152
 		$gd_post_type   = geodir_get_current_posttype();
1153
-		$post_type_info = get_post_type_object( $gd_post_type );
1153
+		$post_type_info = get_post_type_object($gd_post_type);
1154 1154
 
1155
-		remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' );
1155
+		remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
1156 1156
 
1157
-		$listing_link = get_post_type_archive_link( $gd_post_type );
1157
+		$listing_link = get_post_type_archive_link($gd_post_type);
1158 1158
 
1159
-		add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 );
1160
-		$listing_link = rtrim( $listing_link, '/' );
1159
+		add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
1160
+		$listing_link = rtrim($listing_link, '/');
1161 1161
 		$listing_link .= '/';
1162 1162
 
1163 1163
 		$post_type_for_location_link = $listing_link;
1164
-		$location_terms              = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
1164
+		$location_terms              = geodir_get_current_location_terms('query_vars', $gd_post_type);
1165 1165
 
1166 1166
 		global $wp, $gd_session;
1167 1167
 		$location_link = $post_type_for_location_link;
1168 1168
 
1169
-		if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
1169
+		if (geodir_is_page('detail') || geodir_is_page('listing')) {
1170 1170
 			global $post;
1171
-			$location_manager     = defined( 'POST_LOCATION_TABLE' ) ? true : false;
1172
-			$neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false;
1171
+			$location_manager     = defined('POST_LOCATION_TABLE') ? true : false;
1172
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1173 1173
 
1174
-			if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
1174
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1175 1175
 				$location_terms = array(
1176 1176
 					'gd_country' => $post->country_slug,
1177 1177
 					'gd_region'  => $post->region_slug,
1178 1178
 					'gd_city'    => $post->city_slug
1179 1179
 				);
1180 1180
 
1181
-				if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
1181
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1182 1182
 					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1183 1183
 				}
1184 1184
 			}
1185 1185
 
1186
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
1186
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1187 1187
 
1188 1188
 			$hide_url_part = array();
1189
-			if ( $location_manager ) {
1190
-				$hide_country_part = get_option( 'geodir_location_hide_country_part' );
1191
-				$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
1192
-
1193
-				if ( $hide_region_part && $hide_country_part ) {
1194
-					$hide_url_part = array( 'gd_country', 'gd_region' );
1195
-				} else if ( $hide_region_part && ! $hide_country_part ) {
1196
-					$hide_url_part = array( 'gd_region' );
1197
-				} else if ( ! $hide_region_part && $hide_country_part ) {
1198
-					$hide_url_part = array( 'gd_country' );
1189
+			if ($location_manager) {
1190
+				$hide_country_part = get_option('geodir_location_hide_country_part');
1191
+				$hide_region_part  = get_option('geodir_location_hide_region_part');
1192
+
1193
+				if ($hide_region_part && $hide_country_part) {
1194
+					$hide_url_part = array('gd_country', 'gd_region');
1195
+				} else if ($hide_region_part && !$hide_country_part) {
1196
+					$hide_url_part = array('gd_region');
1197
+				} else if (!$hide_region_part && $hide_country_part) {
1198
+					$hide_url_part = array('gd_country');
1199 1199
 				}
1200 1200
 			}
1201 1201
 
1202 1202
 			$hide_text_part = array();
1203
-			if ( $geodir_show_location_url == 'country_city' ) {
1204
-				$hide_text_part = array( 'gd_region' );
1203
+			if ($geodir_show_location_url == 'country_city') {
1204
+				$hide_text_part = array('gd_region');
1205 1205
 
1206
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1207
-					unset( $location_terms['gd_region'] );
1206
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1207
+					unset($location_terms['gd_region']);
1208 1208
 				}
1209
-			} else if ( $geodir_show_location_url == 'region_city' ) {
1210
-				$hide_text_part = array( 'gd_country' );
1209
+			} else if ($geodir_show_location_url == 'region_city') {
1210
+				$hide_text_part = array('gd_country');
1211 1211
 
1212
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1213
-					unset( $location_terms['gd_country'] );
1212
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1213
+					unset($location_terms['gd_country']);
1214 1214
 				}
1215
-			} else if ( $geodir_show_location_url == 'city' ) {
1216
-				$hide_text_part = array( 'gd_country', 'gd_region' );
1215
+			} else if ($geodir_show_location_url == 'city') {
1216
+				$hide_text_part = array('gd_country', 'gd_region');
1217 1217
 
1218
-				if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
1219
-					unset( $location_terms['gd_country'] );
1218
+				if (isset($location_terms['gd_country']) && !$location_manager) {
1219
+					unset($location_terms['gd_country']);
1220 1220
 				}
1221
-				if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
1222
-					unset( $location_terms['gd_region'] );
1221
+				if (isset($location_terms['gd_region']) && !$location_manager) {
1222
+					unset($location_terms['gd_region']);
1223 1223
 				}
1224 1224
 			}
1225 1225
 
1226 1226
 			$is_location_last = '';
1227 1227
 			$is_taxonomy_last = '';
1228 1228
 			$breadcrumb .= '<li>';
1229
-			if ( get_query_var( $gd_post_type . 'category' ) ) {
1230
-				$gd_taxonomy = $gd_post_type . 'category';
1231
-			} elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
1232
-				$gd_taxonomy = $gd_post_type . '_tags';
1229
+			if (get_query_var($gd_post_type.'category')) {
1230
+				$gd_taxonomy = $gd_post_type.'category';
1231
+			} elseif (get_query_var($gd_post_type.'_tags')) {
1232
+				$gd_taxonomy = $gd_post_type.'_tags';
1233 1233
 			}
1234 1234
 
1235
-			$breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1236
-			if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
1235
+			$breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1236
+			if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
1237 1237
 				$is_location_last = false;
1238 1238
 			} else {
1239 1239
 				$is_location_last = true;
1240 1240
 			}
1241 1241
 
1242
-			if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
1242
+			if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
1243 1243
 				$is_taxonomy_last = true;
1244 1244
 			} else {
1245 1245
 				$is_taxonomy_last = false;
1246 1246
 			}
1247 1247
 
1248
-			if ( ! empty( $location_terms ) ) {
1249
-				$geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false;
1248
+			if (!empty($location_terms)) {
1249
+				$geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
1250 1250
 
1251
-				foreach ( $location_terms as $key => $location_term ) {
1252
-					if ( $location_term != '' ) {
1253
-						if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
1251
+				foreach ($location_terms as $key => $location_term) {
1252
+					if ($location_term != '') {
1253
+						if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
1254 1254
 							continue;
1255 1255
 						}
1256 1256
 
1257
-						$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term );
1258
-						$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
1259
-						$gd_location_link_text = ucfirst( $gd_location_link_text );
1257
+						$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
1258
+						$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
1259
+						$gd_location_link_text = ucfirst($gd_location_link_text);
1260 1260
 
1261 1261
 						$location_term_actual_country = '';
1262 1262
 						$location_term_actual_region  = '';
1263 1263
 						$location_term_actual_city    = '';
1264
-						if ( $geodir_get_locations ) {
1265
-							if ( $key == 'gd_country' ) {
1266
-								$location_term_actual_country = get_actual_location_name( 'country', $location_term, true );
1267
-							} else if ( $key == 'gd_region' ) {
1268
-								$location_term_actual_region = get_actual_location_name( 'region', $location_term, true );
1269
-							} else if ( $key == 'gd_city' ) {
1270
-								$location_term_actual_city = get_actual_location_name( 'city', $location_term, true );
1264
+						if ($geodir_get_locations) {
1265
+							if ($key == 'gd_country') {
1266
+								$location_term_actual_country = get_actual_location_name('country', $location_term, true);
1267
+							} else if ($key == 'gd_region') {
1268
+								$location_term_actual_region = get_actual_location_name('region', $location_term, true);
1269
+							} else if ($key == 'gd_city') {
1270
+								$location_term_actual_city = get_actual_location_name('city', $location_term, true);
1271 1271
 							}
1272 1272
 						} else {
1273 1273
 							$location_info = geodir_get_location();
1274 1274
 
1275
-							if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
1276
-								if ( $key == 'gd_country' ) {
1277
-									$location_term_actual_country = __( $location_info->country, 'geodirectory' );
1278
-								} else if ( $key == 'gd_region' ) {
1279
-									$location_term_actual_region = __( $location_info->region, 'geodirectory' );
1280
-								} else if ( $key == 'gd_city' ) {
1281
-									$location_term_actual_city = __( $location_info->city, 'geodirectory' );
1275
+							if (!empty($location_info) && isset($location_info->location_id)) {
1276
+								if ($key == 'gd_country') {
1277
+									$location_term_actual_country = __($location_info->country, 'geodirectory');
1278
+								} else if ($key == 'gd_region') {
1279
+									$location_term_actual_region = __($location_info->region, 'geodirectory');
1280
+								} else if ($key == 'gd_city') {
1281
+									$location_term_actual_city = __($location_info->city, 'geodirectory');
1282 1282
 								}
1283 1283
 							}
1284 1284
 						}
1285 1285
 
1286
-						if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1287
-							$breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text;
1288
-						} else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
1289
-							$breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text;
1290
-						} else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
1291
-							$breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text;
1292
-						} else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
1293
-							$breadcrumb .= $separator . $gd_location_link_text;
1286
+						if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1287
+							$breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text;
1288
+						} else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
1289
+							$breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text;
1290
+						} else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
1291
+							$breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text;
1292
+						} else if ($is_location_last && $key == 'gd_neighbourhood') {
1293
+							$breadcrumb .= $separator.$gd_location_link_text;
1294 1294
 						} else {
1295
-							if ( get_option( 'permalink_structure' ) != '' ) {
1296
-								$location_link .= $location_term . '/';
1295
+							if (get_option('permalink_structure') != '') {
1296
+								$location_link .= $location_term.'/';
1297 1297
 							} else {
1298
-								$location_link .= "&$key=" . $location_term;
1298
+								$location_link .= "&$key=".$location_term;
1299 1299
 							}
1300 1300
 
1301
-							if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
1301
+							if ($key == 'gd_country' && $location_term_actual_country != '') {
1302 1302
 								$gd_location_link_text = $location_term_actual_country;
1303
-							} else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
1303
+							} else if ($key == 'gd_region' && $location_term_actual_region != '') {
1304 1304
 								$gd_location_link_text = $location_term_actual_region;
1305
-							} else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
1305
+							} else if ($key == 'gd_city' && $location_term_actual_city != '') {
1306 1306
 								$gd_location_link_text = $location_term_actual_city;
1307 1307
 							}
1308 1308
 
@@ -1312,76 +1312,76 @@  discard block
 block discarded – undo
1312 1312
                             }
1313 1313
                             */
1314 1314
 
1315
-							$breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>';
1315
+							$breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>';
1316 1316
 						}
1317 1317
 					}
1318 1318
 				}
1319 1319
 			}
1320 1320
 
1321
-			if ( ! empty( $gd_taxonomy ) ) {
1321
+			if (!empty($gd_taxonomy)) {
1322 1322
 				$term_index = 1;
1323 1323
 
1324 1324
 				//if(get_option('geodir_add_categories_url'))
1325 1325
 				{
1326
-					if ( get_query_var( $gd_post_type . '_tags' ) ) {
1327
-						$cat_link = $listing_link . 'tags/';
1326
+					if (get_query_var($gd_post_type.'_tags')) {
1327
+						$cat_link = $listing_link.'tags/';
1328 1328
 					} else {
1329 1329
 						$cat_link = $listing_link;
1330 1330
 					}
1331 1331
 
1332
-					foreach ( $location_terms as $key => $location_term ) {
1333
-						if ( $location_manager && in_array( $key, $hide_url_part ) ) {
1332
+					foreach ($location_terms as $key => $location_term) {
1333
+						if ($location_manager && in_array($key, $hide_url_part)) {
1334 1334
 							continue;
1335 1335
 						}
1336 1336
 
1337
-						if ( $location_term != '' ) {
1338
-							if ( get_option( 'permalink_structure' ) != '' ) {
1339
-								$cat_link .= $location_term . '/';
1337
+						if ($location_term != '') {
1338
+							if (get_option('permalink_structure') != '') {
1339
+								$cat_link .= $location_term.'/';
1340 1340
 							}
1341 1341
 						}
1342 1342
 					}
1343 1343
 
1344
-					$term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) );
1345
-					foreach ( $term_array as $term ) {
1346
-						$term_link_text = preg_replace( '/-(\d+)$/', '', $term );
1347
-						$term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text );
1344
+					$term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
1345
+					foreach ($term_array as $term) {
1346
+						$term_link_text = preg_replace('/-(\d+)$/', '', $term);
1347
+						$term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
1348 1348
 
1349 1349
 						// get term actual name
1350
-						$term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' );
1351
-						if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
1352
-							$term_link_text = urldecode( $term_info['name'] );
1350
+						$term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
1351
+						if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
1352
+							$term_link_text = urldecode($term_info['name']);
1353 1353
 						} else {
1354 1354
 							continue;
1355 1355
 							//$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text)));
1356 1356
 						}
1357 1357
 
1358
-						if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
1359
-							$breadcrumb .= $separator . $term_link_text;
1358
+						if ($term_index == count($term_array) && $is_taxonomy_last) {
1359
+							$breadcrumb .= $separator.$term_link_text;
1360 1360
 						} else {
1361
-							$cat_link .= $term . '/';
1362
-							$breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1361
+							$cat_link .= $term.'/';
1362
+							$breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>';
1363 1363
 						}
1364
-						$term_index ++;
1364
+						$term_index++;
1365 1365
 					}
1366 1366
 				}
1367 1367
 
1368 1368
 
1369 1369
 			}
1370 1370
 
1371
-			if ( geodir_is_page( 'detail' ) ) {
1372
-				$breadcrumb .= $separator . get_the_title();
1371
+			if (geodir_is_page('detail')) {
1372
+				$breadcrumb .= $separator.get_the_title();
1373 1373
 			}
1374 1374
 
1375 1375
 			$breadcrumb .= '</li>';
1376 1376
 
1377 1377
 
1378
-		} elseif ( geodir_is_page( 'author' ) ) {
1378
+		} elseif (geodir_is_page('author')) {
1379 1379
 			$user_id             = get_current_user_id();
1380
-			$author_link         = get_author_posts_url( $user_id );
1381
-			$default_author_link = geodir_getlink( $author_link, array(
1380
+			$author_link         = get_author_posts_url($user_id);
1381
+			$default_author_link = geodir_getlink($author_link, array(
1382 1382
 				'geodir_dashbord' => 'true',
1383 1383
 				'stype'           => 'gd_place'
1384
-			), false );
1384
+			), false);
1385 1385
 
1386 1386
 			/**
1387 1387
 			 * Filter author page link.
@@ -1391,16 +1391,16 @@  discard block
 block discarded – undo
1391 1391
 			 * @param string $default_author_link Default author link.
1392 1392
 			 * @param int $user_id                Author ID.
1393 1393
 			 */
1394
-			$default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id );
1394
+			$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
1395 1395
 
1396 1396
 			$breadcrumb .= '<li>';
1397
-			$breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>';
1397
+			$breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
1398 1398
 
1399
-			if ( isset( $_REQUEST['list'] ) ) {
1400
-				$author_link = geodir_getlink( $author_link, array(
1399
+			if (isset($_REQUEST['list'])) {
1400
+				$author_link = geodir_getlink($author_link, array(
1401 1401
 					'geodir_dashbord' => 'true',
1402 1402
 					'stype'           => $_REQUEST['stype']
1403
-				), false );
1403
+				), false);
1404 1404
 
1405 1405
 				/**
1406 1406
 				 * Filter author page link.
@@ -1411,61 +1411,61 @@  discard block
 block discarded – undo
1411 1411
 				 * @param int $user_id        Author ID.
1412 1412
 				 * @param string $_REQUEST    ['stype'] Post type.
1413 1413
 				 */
1414
-				$author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] );
1414
+				$author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
1415 1415
 
1416
-				$breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>';
1417
-				$breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] );
1416
+				$breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>';
1417
+				$breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
1418 1418
 			} else {
1419
-				$breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' );
1419
+				$breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory');
1420 1420
 			}
1421 1421
 
1422 1422
 			$breadcrumb .= '</li>';
1423
-		} elseif ( is_category() || is_single() ) {
1423
+		} elseif (is_category() || is_single()) {
1424 1424
 			$category = get_the_category();
1425
-			if ( is_category() ) {
1426
-				$breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>';
1425
+			if (is_category()) {
1426
+				$breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>';
1427 1427
 			}
1428
-			if ( is_single() ) {
1429
-				$breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>';
1430
-				$breadcrumb .= '<li>' . $separator . get_the_title() . '</li>';
1428
+			if (is_single()) {
1429
+				$breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>';
1430
+				$breadcrumb .= '<li>'.$separator.get_the_title().'</li>';
1431 1431
 			}
1432 1432
 			/* End of my version ##################################################### */
1433
-		} else if ( is_page() ) {
1433
+		} else if (is_page()) {
1434 1434
 			$page_title = get_the_title();
1435 1435
 
1436
-			if ( geodir_is_page( 'location' ) ) {
1436
+			if (geodir_is_page('location')) {
1437 1437
 				$location_page_id = geodir_location_page_id();
1438
-				$loc_post         = get_post( $location_page_id );
1438
+				$loc_post         = get_post($location_page_id);
1439 1439
 				$post_name        = $loc_post->post_name;
1440
-				$slug             = ucwords( str_replace( '-', ' ', $post_name ) );
1441
-				$page_title       = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' );
1440
+				$slug             = ucwords(str_replace('-', ' ', $post_name));
1441
+				$page_title       = !empty($slug) ? $slug : __('Location', 'geodirectory');
1442 1442
 			}
1443 1443
 
1444
-			$breadcrumb .= '<li>' . $separator;
1445
-			$breadcrumb .= stripslashes_deep( $page_title );
1444
+			$breadcrumb .= '<li>'.$separator;
1445
+			$breadcrumb .= stripslashes_deep($page_title);
1446 1446
 			$breadcrumb .= '</li>';
1447
-		} else if ( is_tag() ) {
1448
-			$breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>';
1449
-		} else if ( is_day() ) {
1450
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1451
-			the_time( 'F jS, Y' );
1447
+		} else if (is_tag()) {
1448
+			$breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
1449
+		} else if (is_day()) {
1450
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1451
+			the_time('F jS, Y');
1452 1452
 			$breadcrumb .= '</li>';
1453
-		} else if ( is_month() ) {
1454
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1455
-			the_time( 'F, Y' );
1453
+		} else if (is_month()) {
1454
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1455
+			the_time('F, Y');
1456 1456
 			$breadcrumb .= '</li>';
1457
-		} else if ( is_year() ) {
1458
-			$breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " ";
1459
-			the_time( 'Y' );
1457
+		} else if (is_year()) {
1458
+			$breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
1459
+			the_time('Y');
1460 1460
 			$breadcrumb .= '</li>';
1461
-		} else if ( is_author() ) {
1462
-			$breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' );
1461
+		} else if (is_author()) {
1462
+			$breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
1463 1463
 			$breadcrumb .= '</li>';
1464
-		} else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
1465
-			$breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' );
1464
+		} else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
1465
+			$breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
1466 1466
 			$breadcrumb .= '</li>';
1467
-		} else if ( is_search() ) {
1468
-			$breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' );
1467
+		} else if (is_search()) {
1468
+			$breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
1469 1469
 			$breadcrumb .= '</li>';
1470 1470
 		}
1471 1471
 		$breadcrumb .= '</ul></div>';
@@ -1478,13 +1478,13 @@  discard block
 block discarded – undo
1478 1478
 		 * @param string $breadcrumb Breadcrumb HTML.
1479 1479
 		 * @param string $separator  Breadcrumb separator.
1480 1480
 		 */
1481
-		echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator );
1481
+		echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
1482 1482
 	}
1483 1483
 }
1484 1484
 
1485 1485
 
1486
-add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin
1487
-if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
1486
+add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
1487
+if (!function_exists('geodir_allow_wpadmin')) {
1488 1488
 	/**
1489 1489
 	 * Allow only admins to access wp-admin.
1490 1490
 	 *
@@ -1496,12 +1496,12 @@  discard block
 block discarded – undo
1496 1496
 	 */
1497 1497
 	function geodir_allow_wpadmin() {
1498 1498
 		global $wpdb;
1499
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1499
+		if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
1500 1500
 		{
1501
-			if ( current_user_can( 'administrator' ) ) {
1501
+			if (current_user_can('administrator')) {
1502 1502
 			} else {
1503 1503
 
1504
-				wp_redirect( home_url() );
1504
+				wp_redirect(home_url());
1505 1505
 				exit;
1506 1506
 			}
1507 1507
 
@@ -1520,23 +1520,23 @@  discard block
 block discarded – undo
1520 1520
  *
1521 1521
  * @return array|WP_Error The uploaded data as array. When failure returns error.
1522 1522
  */
1523
-function fetch_remote_file( $url ) {
1523
+function fetch_remote_file($url) {
1524 1524
 	// extract the file name and extension from the url
1525
-	require_once( ABSPATH . 'wp-includes/pluggable.php' );
1526
-	$file_name = basename( $url );
1527
-	if ( strpos( $file_name, '?' ) !== false ) {
1528
-		list( $file_name ) = explode( '?', $file_name );
1525
+	require_once(ABSPATH.'wp-includes/pluggable.php');
1526
+	$file_name = basename($url);
1527
+	if (strpos($file_name, '?') !== false) {
1528
+		list($file_name) = explode('?', $file_name);
1529 1529
 	}
1530 1530
 	$dummy        = false;
1531 1531
 	$add_to_cache = false;
1532 1532
 	$key          = null;
1533
-	if ( strpos( $url, '/dummy/' ) !== false ) {
1533
+	if (strpos($url, '/dummy/') !== false) {
1534 1534
 		$dummy = true;
1535
-		$key   = "dummy_" . str_replace( '.', '_', $file_name );
1536
-		$value = get_transient( 'cached_dummy_images' );
1537
-		if ( $value ) {
1538
-			if ( isset( $value[ $key ] ) ) {
1539
-				return $value[ $key ];
1535
+		$key   = "dummy_".str_replace('.', '_', $file_name);
1536
+		$value = get_transient('cached_dummy_images');
1537
+		if ($value) {
1538
+			if (isset($value[$key])) {
1539
+				return $value[$key];
1540 1540
 			} else {
1541 1541
 				$add_to_cache = true;
1542 1542
 			}
@@ -1547,58 +1547,58 @@  discard block
 block discarded – undo
1547 1547
 
1548 1548
 	// get placeholder file in the upload dir with a unique, sanitized filename
1549 1549
 
1550
-	$post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : '';
1550
+	$post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1551 1551
 
1552
-	$upload = wp_upload_bits( $file_name, 0, '', $post_upload_date );
1553
-	if ( $upload['error'] ) {
1554
-		return new WP_Error( 'upload_dir_error', $upload['error'] );
1552
+	$upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1553
+	if ($upload['error']) {
1554
+		return new WP_Error('upload_dir_error', $upload['error']);
1555 1555
 	}
1556 1556
 
1557 1557
 
1558
-	sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay
1558
+	sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay
1559 1559
 
1560 1560
 	// fetch the remote url and write it to the placeholder file
1561
-	$headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) );
1561
+	$headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
1562 1562
 
1563 1563
 	$log_message = '';
1564
-	if ( is_wp_error( $headers ) ) {
1565
-		echo 'file: ' . $url;
1564
+	if (is_wp_error($headers)) {
1565
+		echo 'file: '.$url;
1566 1566
 
1567
-		return new WP_Error( 'import_file_error', $headers->get_error_message() );
1567
+		return new WP_Error('import_file_error', $headers->get_error_message());
1568 1568
 	}
1569 1569
 
1570
-	$filesize = filesize( $upload['file'] );
1570
+	$filesize = filesize($upload['file']);
1571 1571
 	// request failed
1572
-	if ( ! $headers ) {
1573
-		$log_message = __( 'Remote server did not respond', 'geodirectory' );
1572
+	if (!$headers) {
1573
+		$log_message = __('Remote server did not respond', 'geodirectory');
1574 1574
 	} // make sure the fetch was successful
1575
-	elseif ( $headers['response']['code'] != '200' ) {
1576
-		$log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) );
1577
-	} elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
1578
-		$log_message = __( 'Remote file is incorrect size', 'geodirectory' );
1579
-	} elseif ( 0 == $filesize ) {
1580
-		$log_message = __( 'Zero size file downloaded', 'geodirectory' );
1581
-	}
1582
-
1583
-	if ( $log_message ) {
1584
-		$del = unlink( $upload['file'] );
1585
-		if ( ! $del ) {
1586
-			geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) );
1575
+	elseif ($headers['response']['code'] != '200') {
1576
+		$log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1577
+	} elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
1578
+		$log_message = __('Remote file is incorrect size', 'geodirectory');
1579
+	} elseif (0 == $filesize) {
1580
+		$log_message = __('Zero size file downloaded', 'geodirectory');
1581
+	}
1582
+
1583
+	if ($log_message) {
1584
+		$del = unlink($upload['file']);
1585
+		if (!$del) {
1586
+			geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
1587 1587
 		}
1588 1588
 
1589
-		return new WP_Error( 'import_file_error', $log_message );
1589
+		return new WP_Error('import_file_error', $log_message);
1590 1590
 	}
1591 1591
 
1592
-	if ( $dummy && $add_to_cache && is_array( $upload ) ) {
1593
-		$images = get_transient( 'cached_dummy_images' );
1594
-		if ( is_array( $images ) ) {
1595
-			$images[ $key ] = $upload;
1592
+	if ($dummy && $add_to_cache && is_array($upload)) {
1593
+		$images = get_transient('cached_dummy_images');
1594
+		if (is_array($images)) {
1595
+			$images[$key] = $upload;
1596 1596
 		} else {
1597
-			$images = array( $key => $upload );
1597
+			$images = array($key => $upload);
1598 1598
 		}
1599 1599
 
1600 1600
 		//setting the cache using the WP Transient API
1601
-		set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache
1601
+		set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
1602 1602
 	}
1603 1603
 
1604 1604
 	return $upload;
@@ -1612,12 +1612,12 @@  discard block
 block discarded – undo
1612 1612
  * @return string|void Max upload size.
1613 1613
  */
1614 1614
 function geodir_max_upload_size() {
1615
-	$max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 );
1615
+	$max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1616 1616
 
1617
-	if ( $max_filesize > 0 && $max_filesize < 1 ) {
1618
-		$max_filesize = (int) ( $max_filesize * 1024 ) . 'kb';
1617
+	if ($max_filesize > 0 && $max_filesize < 1) {
1618
+		$max_filesize = (int) ($max_filesize * 1024).'kb';
1619 1619
 	} else {
1620
-		$max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1620
+		$max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';
1621 1621
 	}
1622 1622
 
1623 1623
 	/**
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 	 *
1628 1628
 	 * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb.
1629 1629
 	 */
1630
-	return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize );
1630
+	return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
1631 1631
 }
1632 1632
 
1633 1633
 /**
@@ -1640,8 +1640,8 @@  discard block
 block discarded – undo
1640 1640
  * @return bool If dummy folder exists returns true, else false.
1641 1641
  */
1642 1642
 function geodir_dummy_folder_exists() {
1643
-	$path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1644
-	if ( ! is_dir( $path ) ) {
1643
+	$path = geodir_plugin_path().'/geodirectory-admin/dummy/';
1644
+	if (!is_dir($path)) {
1645 1645
 		return false;
1646 1646
 	} else {
1647 1647
 		return true;
@@ -1660,17 +1660,17 @@  discard block
 block discarded – undo
1660 1660
  *
1661 1661
  * @return object Author info.
1662 1662
  */
1663
-function geodir_get_author_info( $aid ) {
1663
+function geodir_get_author_info($aid) {
1664 1664
 	global $wpdb;
1665 1665
 	/*$infosql = "select * from $wpdb->users where ID=$aid";*/
1666
-	$infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) );
1667
-	$info    = $wpdb->get_results( $infosql );
1668
-	if ( $info ) {
1666
+	$infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
1667
+	$info    = $wpdb->get_results($infosql);
1668
+	if ($info) {
1669 1669
 		return $info[0];
1670 1670
 	}
1671 1671
 }
1672 1672
 
1673
-if ( ! function_exists( 'adminEmail' ) ) {
1673
+if (!function_exists('adminEmail')) {
1674 1674
 	/**
1675 1675
 	 * Send emails to client on post submission, renew etc.
1676 1676
 	 *
@@ -1683,67 +1683,67 @@  discard block
 block discarded – undo
1683 1683
 	 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1684 1684
 	 * @param string $custom_1     Custom data to be sent.
1685 1685
 	 */
1686
-	function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
1686
+	function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
1687 1687
 		global $wpdb;
1688
-		if ( $message_type == 'expiration' ) {
1689
-			$subject        = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) );
1690
-			$client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) );
1691
-		} elseif ( $message_type == 'post_submited' ) {
1692
-			$subject        = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' );
1693
-			$client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' );
1694
-		} elseif ( $message_type == 'renew' ) {
1695
-			$subject        = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' );
1696
-			$client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' );
1697
-		} elseif ( $message_type == 'upgrade' ) {
1698
-			$subject        = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' );
1699
-			$client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' );
1700
-		} elseif ( $message_type == 'claim_approved' ) {
1701
-			$subject        = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' );
1702
-			$client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' );
1703
-		} elseif ( $message_type == 'claim_rejected' ) {
1704
-			$subject        = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' );
1705
-			$client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' );
1706
-		} elseif ( $message_type == 'claim_requested' ) {
1707
-			$subject        = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' );
1708
-			$client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' );
1709
-		} elseif ( $message_type == 'auto_claim' ) {
1710
-			$subject        = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' );
1711
-			$client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' );
1712
-		} elseif ( $message_type == 'payment_success' ) {
1713
-			$subject        = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' );
1714
-			$client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' );
1715
-		} elseif ( $message_type == 'payment_fail' ) {
1716
-			$subject        = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' );
1717
-			$client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' );
1688
+		if ($message_type == 'expiration') {
1689
+			$subject        = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1690
+			$client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1691
+		} elseif ($message_type == 'post_submited') {
1692
+			$subject        = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1693
+			$client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1694
+		} elseif ($message_type == 'renew') {
1695
+			$subject        = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1696
+			$client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1697
+		} elseif ($message_type == 'upgrade') {
1698
+			$subject        = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1699
+			$client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1700
+		} elseif ($message_type == 'claim_approved') {
1701
+			$subject        = __(get_option('claim_approved_email_subject'), 'geodirectory');
1702
+			$client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1703
+		} elseif ($message_type == 'claim_rejected') {
1704
+			$subject        = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1705
+			$client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1706
+		} elseif ($message_type == 'claim_requested') {
1707
+			$subject        = __(get_option('claim_email_subject_admin'), 'geodirectory');
1708
+			$client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1709
+		} elseif ($message_type == 'auto_claim') {
1710
+			$subject        = __(get_option('auto_claim_email_subject'), 'geodirectory');
1711
+			$client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1712
+		} elseif ($message_type == 'payment_success') {
1713
+			$subject        = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1714
+			$client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1715
+		} elseif ($message_type == 'payment_fail') {
1716
+			$subject        = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1717
+			$client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1718 1718
 		}
1719 1719
 		$transaction_details = $custom_1;
1720
-		$fromEmail           = get_option( 'site_email' );
1720
+		$fromEmail           = get_option('site_email');
1721 1721
 		$fromEmailName       = get_site_emailName();
1722 1722
 //$alivedays = get_post_meta($page_id,'alive_days',true);
1723
-		$pkg_limit            = get_property_price_info_listing( $page_id );
1723
+		$pkg_limit            = get_property_price_info_listing($page_id);
1724 1724
 		$alivedays            = $pkg_limit['days'];
1725
-		$productlink          = get_permalink( $page_id );
1726
-		$post_info            = get_post( $page_id );
1727
-		$post_date            = date( 'dS F,Y', strtotime( $post_info->post_date ) );
1728
-		$listingLink          = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1725
+		$productlink          = get_permalink($page_id);
1726
+		$post_info            = get_post($page_id);
1727
+		$post_date            = date('dS F,Y', strtotime($post_info->post_date));
1728
+		$listingLink          = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1729 1729
 		$loginurl             = geodir_login_url();
1730
-		$loginurl_link        = '<a href="' . $loginurl . '">login</a>';
1730
+		$loginurl_link        = '<a href="'.$loginurl.'">login</a>';
1731 1731
 		$siteurl              = home_url();
1732
-		$siteurl_link         = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>';
1733
-		$user_info            = get_userdata( $user_id );
1732
+		$siteurl_link         = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>';
1733
+		$user_info            = get_userdata($user_id);
1734 1734
 		$user_email           = $user_info->user_email;
1735
-		$display_name         = geodir_get_client_name( $user_id );
1735
+		$display_name         = geodir_get_client_name($user_id);
1736 1736
 		$user_login           = $user_info->user_login;
1737
-		$number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' );
1738
-		if ( $number_of_grace_days == '' ) {
1737
+		$number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
1738
+		if ($number_of_grace_days == '') {
1739 1739
 			$number_of_grace_days = 1;
1740 1740
 		}
1741
-		if ( $post_info->post_type == 'event' ) {
1741
+		if ($post_info->post_type == 'event') {
1742 1742
 			$post_type = 'event';
1743 1743
 		} else {
1744 1744
 			$post_type = 'listing';
1745 1745
 		}
1746
-		$renew_link     = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>';
1746
+		$renew_link     = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>';
1747 1747
 		$search_array   = array(
1748 1748
 			'[#client_name#]',
1749 1749
 			'[#listing_link#]',
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 			'[#site_name#]',
1760 1760
 			'[#transaction_details#]'
1761 1761
 		);
1762
-		$replace_array  = array(
1762
+		$replace_array = array(
1763 1763
 			$display_name,
1764 1764
 			$listingLink,
1765 1765
 			$post_date,
@@ -1774,11 +1774,11 @@  discard block
 block discarded – undo
1774 1774
 			$fromEmailName,
1775 1775
 			$transaction_details
1776 1776
 		);
1777
-		$client_message = str_replace( $search_array, $replace_array, $client_message );
1778
-		$subject        = str_replace( $search_array, $replace_array, $subject );
1779
-		$headers        = 'MIME-Version: 1.0' . "\r\n";
1780
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1781
-		$headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n";
1777
+		$client_message = str_replace($search_array, $replace_array, $client_message);
1778
+		$subject        = str_replace($search_array, $replace_array, $subject);
1779
+		$headers        = 'MIME-Version: 1.0'."\r\n";
1780
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1781
+		$headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n";
1782 1782
 
1783 1783
 		$to      = $fromEmail;
1784 1784
 		$message = $client_message;
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1797 1797
 		 * @param string $custom_1     Custom data to be sent.
1798 1798
 		 */
1799
-		$to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 );
1799
+		$to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
1800 1800
 		/**
1801 1801
 		 * Filter the admin email subject.
1802 1802
 		 *
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1810 1810
 		 * @param string $custom_1     Custom data to be sent.
1811 1811
 		 */
1812
-		$subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 );
1812
+		$subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
1813 1813
 		/**
1814 1814
 		 * Filter the admin email message.
1815 1815
 		 *
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1823 1823
 		 * @param string $custom_1     Custom data to be sent.
1824 1824
 		 */
1825
-		$message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 );
1825
+		$message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
1826 1826
 		/**
1827 1827
 		 * Filter the admin email headers.
1828 1828
 		 *
@@ -1835,27 +1835,27 @@  discard block
 block discarded – undo
1835 1835
 		 * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'.
1836 1836
 		 * @param string $custom_1     Custom data to be sent.
1837 1837
 		 */
1838
-		$headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 );
1838
+		$headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
1839 1839
 
1840 1840
 
1841
-		$sent = wp_mail( $to, $subject, $message, $headers );
1842
-		if ( ! $sent ) {
1843
-			if ( is_array( $to ) ) {
1844
-				$to = implode( ',', $to );
1841
+		$sent = wp_mail($to, $subject, $message, $headers);
1842
+		if (!$sent) {
1843
+			if (is_array($to)) {
1844
+				$to = implode(',', $to);
1845 1845
 			}
1846 1846
 			$log_message = sprintf(
1847
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1847
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1848 1848
 				$message_type,
1849
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1849
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1850 1850
 				$to,
1851 1851
 				$subject
1852 1852
 			);
1853
-			geodir_error_log( $log_message );
1853
+			geodir_error_log($log_message);
1854 1854
 		}
1855 1855
 	}
1856 1856
 }
1857 1857
 
1858
-if ( ! function_exists( 'sendEmail' ) ) {
1858
+if (!function_exists('sendEmail')) {
1859 1859
 	/**
1860 1860
 	 * @todo    could be a duplicate of geodir_sendEmail.
1861 1861
 	 *
@@ -1873,40 +1873,40 @@  discard block
 block discarded – undo
1873 1873
 	 * @param string $post_id       The post ID.
1874 1874
 	 * @param string $user_id       The user ID.
1875 1875
 	 */
1876
-	function sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
1876
+	function sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
1877 1877
 		$login_details = '';
1878
-		if ( $message_type == 'send_friend' ) {
1879
-			$subject = stripslashes( __( get_option( 'email_friend_subject' ), 'geodirectory' ) );
1880
-			$message = stripslashes( __( get_option( 'email_friend_content' ), 'geodirectory' ) );
1881
-		} elseif ( $message_type == 'send_enquiry' ) {
1882
-			$subject = __( get_option( 'email_enquiry_subject' ), 'geodirectory' );
1883
-			$message = __( get_option( 'email_enquiry_content' ), 'geodirectory' );
1884
-		} elseif ( $message_type == 'forgot_password' ) {
1885
-			$subject       = __( get_option( 'forgot_password_subject' ), 'geodirectory' );
1886
-			$message       = __( get_option( 'forgot_password_content' ), 'geodirectory' );
1878
+		if ($message_type == 'send_friend') {
1879
+			$subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1880
+			$message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1881
+		} elseif ($message_type == 'send_enquiry') {
1882
+			$subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1883
+			$message = __(get_option('email_enquiry_content'), 'geodirectory');
1884
+		} elseif ($message_type == 'forgot_password') {
1885
+			$subject       = __(get_option('forgot_password_subject'), 'geodirectory');
1886
+			$message       = __(get_option('forgot_password_content'), 'geodirectory');
1887 1887
 			$login_details = $to_message;
1888
-		} elseif ( $message_type == 'registration' ) {
1889
-			$subject       = __( get_option( 'registration_success_email_subject' ), 'geodirectory' );
1890
-			$message       = __( get_option( 'registration_success_email_content' ), 'geodirectory' );
1888
+		} elseif ($message_type == 'registration') {
1889
+			$subject       = __(get_option('registration_success_email_subject'), 'geodirectory');
1890
+			$message       = __(get_option('registration_success_email_content'), 'geodirectory');
1891 1891
 			$login_details = $to_message;
1892 1892
 		}
1893
-		$to_message        = nl2br( $to_message );
1894
-		$sitefromEmail     = get_option( 'site_email' );
1893
+		$to_message        = nl2br($to_message);
1894
+		$sitefromEmail     = get_option('site_email');
1895 1895
 		$sitefromEmailName = get_site_emailName();
1896
-		$productlink       = get_permalink( $post_id );
1897
-		$post_info         = get_post( $post_id );
1898
-		$listingLink       = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>';
1896
+		$productlink       = get_permalink($post_id);
1897
+		$post_info         = get_post($post_id);
1898
+		$listingLink       = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>';
1899 1899
 		$siteurl           = home_url();
1900
-		$siteurl_link      = '<a href="' . $siteurl . '">' . $siteurl . '</a>';
1900
+		$siteurl_link      = '<a href="'.$siteurl.'">'.$siteurl.'</a>';
1901 1901
 		$loginurl          = geodir_login_url();
1902
-		$loginurl_link     = '<a href="' . $loginurl . '">login</a>';
1903
-		if ( $fromEmail == '' ) {
1904
-			$fromEmail = get_option( 'site_email' );
1902
+		$loginurl_link     = '<a href="'.$loginurl.'">login</a>';
1903
+		if ($fromEmail == '') {
1904
+			$fromEmail = get_option('site_email');
1905 1905
 		}
1906
-		if ( $fromEmailName == '' ) {
1907
-			$fromEmailName = get_option( 'site_email_name' );
1906
+		if ($fromEmailName == '') {
1907
+			$fromEmailName = get_option('site_email_name');
1908 1908
 		}
1909
-		$search_array  = array(
1909
+		$search_array = array(
1910 1910
 			'[#listing_link#]',
1911 1911
 			'[#site_name_url#]',
1912 1912
 			'[#post_id#]',
@@ -1932,7 +1932,7 @@  discard block
 block discarded – undo
1932 1932
 			$login_details,
1933 1933
 			$toEmailName
1934 1934
 		);
1935
-		$message       = str_replace( $search_array, $replace_array, $message );
1935
+		$message       = str_replace($search_array, $replace_array, $message);
1936 1936
 
1937 1937
 		$search_array  = array(
1938 1938
 			'[#listing_link#]',
@@ -1954,64 +1954,64 @@  discard block
 block discarded – undo
1954 1954
 			$to_subject,
1955 1955
 			$toEmailName
1956 1956
 		);
1957
-		$subject       = str_replace( $search_array, $replace_array, $subject );
1958
-		$headers       = 'MIME-Version: 1.0' . "\r\n";
1959
-		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
1960
-		$headers .= "Reply-To: " . $fromEmail . "\r\n";
1961
-		$headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n";
1957
+		$subject       = str_replace($search_array, $replace_array, $subject);
1958
+		$headers       = 'MIME-Version: 1.0'."\r\n";
1959
+		$headers .= 'Content-type: text/html; charset=UTF-8'."\r\n";
1960
+		$headers .= "Reply-To: ".$fromEmail."\r\n";
1961
+		$headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n";
1962 1962
 
1963 1963
 		$to = $toEmail;
1964 1964
 
1965
-		$sent = wp_mail( $to, $subject, $message, $headers );
1966
-		if ( ! $sent ) {
1967
-			if ( is_array( $to ) ) {
1968
-				$to = implode( ',', $to );
1965
+		$sent = wp_mail($to, $subject, $message, $headers);
1966
+		if (!$sent) {
1967
+			if (is_array($to)) {
1968
+				$to = implode(',', $to);
1969 1969
 			}
1970 1970
 			$log_message = sprintf(
1971
-				__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1971
+				__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1972 1972
 				$message_type,
1973
-				date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1973
+				date_i18n('F j Y H:i:s', current_time('timestamp')),
1974 1974
 				$to,
1975 1975
 				$subject
1976 1976
 			);
1977
-			geodir_error_log( $log_message );
1977
+			geodir_error_log($log_message);
1978 1978
 		}
1979 1979
 
1980 1980
 		///////// ADMIN BCC EMIALS
1981 1981
 		$admin_bcc = false;
1982
-		if ( $message_type == 'registration' ) {
1983
-			$message_raw  = explode( __( "Password:", 'geodirectory' ), $message );
1984
-			$message_raw2 = explode( "</p>", $message_raw[1], 2 );
1985
-			$message      = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1];
1982
+		if ($message_type == 'registration') {
1983
+			$message_raw  = explode(__("Password:", 'geodirectory'), $message);
1984
+			$message_raw2 = explode("</p>", $message_raw[1], 2);
1985
+			$message      = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
1986 1986
 		}
1987
-		$adminEmail = get_bloginfo( 'admin_email' );
1987
+		$adminEmail = get_bloginfo('admin_email');
1988 1988
 		$to         = $adminEmail;
1989 1989
 
1990
-		if ( $message_type == 'registration' && get_option( 'bcc_new_user' ) ) {
1990
+		if ($message_type == 'registration' && get_option('bcc_new_user')) {
1991 1991
 			$subject .= ' - ADMIN BCC COPY';
1992 1992
 			$admin_bcc = true;
1993
-		} elseif ( $message_type == 'send_friend' && get_option( 'bcc_friend' ) ) {
1993
+		} elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1994 1994
 			$subject .= ' - ADMIN BCC COPY';
1995 1995
 			$admin_bcc = true;
1996
-		} elseif ( $message_type == 'send_enquiry' && get_option( 'bcc_enquiry' ) ) {
1996
+		} elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1997 1997
 			$subject .= ' - ADMIN BCC COPY';
1998 1998
 			$admin_bcc = true;
1999 1999
 		}
2000 2000
 
2001
-		if ( $admin_bcc === true ) {
2002
-			$sent = wp_mail( $to, $subject, $message, $headers );
2003
-			if ( ! $sent ) {
2004
-				if ( is_array( $to ) ) {
2005
-					$to = implode( ',', $to );
2001
+		if ($admin_bcc === true) {
2002
+			$sent = wp_mail($to, $subject, $message, $headers);
2003
+			if (!$sent) {
2004
+				if (is_array($to)) {
2005
+					$to = implode(',', $to);
2006 2006
 				}
2007 2007
 				$log_message = sprintf(
2008
-					__( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
2008
+					__("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
2009 2009
 					$message_type,
2010
-					date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
2010
+					date_i18n('F j Y H:i:s', current_time('timestamp')),
2011 2011
 					$to,
2012 2012
 					$subject
2013 2013
 				);
2014
-				geodir_error_log( $log_message );
2014
+				geodir_error_log($log_message);
2015 2015
 			}
2016 2016
 		}
2017 2017
 
@@ -2033,12 +2033,12 @@  discard block
 block discarded – undo
2033 2033
  *
2034 2034
  * @return array Category IDs.
2035 2035
  */
2036
-function gd_lang_object_ids( $ids_array, $type ) {
2037
-	if ( function_exists( 'icl_object_id' ) ) {
2036
+function gd_lang_object_ids($ids_array, $type) {
2037
+	if (function_exists('icl_object_id')) {
2038 2038
 		$res = array();
2039
-		foreach ( $ids_array as $id ) {
2040
-			$xlat = icl_object_id( $id, $type, false );
2041
-			if ( ! is_null( $xlat ) ) {
2039
+		foreach ($ids_array as $id) {
2040
+			$xlat = icl_object_id($id, $type, false);
2041
+			if (!is_null($xlat)) {
2042 2042
 				$res[] = $xlat;
2043 2043
 			}
2044 2044
 		}
@@ -2062,20 +2062,20 @@  discard block
 block discarded – undo
2062 2062
  *
2063 2063
  * @return array Modified Body CSS classes.
2064 2064
  */
2065
-function geodir_custom_posts_body_class( $classes ) {
2065
+function geodir_custom_posts_body_class($classes) {
2066 2066
 	global $wpdb, $wp;
2067
-	$post_types = geodir_get_posttypes( 'object' );
2068
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2067
+	$post_types = geodir_get_posttypes('object');
2068
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2069 2069
 		$classes[] = 'geodir_custom_posts';
2070 2070
 	}
2071 2071
 
2072 2072
 	// fix body class for signup page
2073
-	if ( geodir_is_page( 'login' ) ) {
2073
+	if (geodir_is_page('login')) {
2074 2074
 		$new_classes   = array();
2075 2075
 		$new_classes[] = 'signup page-geodir-signup';
2076
-		if ( ! empty( $classes ) ) {
2077
-			foreach ( $classes as $class ) {
2078
-				if ( $class && $class != 'home' && $class != 'blog' ) {
2076
+		if (!empty($classes)) {
2077
+			foreach ($classes as $class) {
2078
+				if ($class && $class != 'home' && $class != 'blog') {
2079 2079
 					$new_classes[] = $class;
2080 2080
 				}
2081 2081
 			}
@@ -2083,14 +2083,14 @@  discard block
 block discarded – undo
2083 2083
 		$classes = $new_classes;
2084 2084
 	}
2085 2085
 
2086
-	if ( geodir_is_geodir_page() ) {
2086
+	if (geodir_is_geodir_page()) {
2087 2087
 		$classes[] = 'geodir-page';
2088 2088
 	}
2089 2089
 
2090 2090
 	return $classes;
2091 2091
 }
2092 2092
 
2093
-add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search
2093
+add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
2094 2094
 
2095 2095
 
2096 2096
 /**
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 *
2107 2107
 	 * @since 1.0.0
2108 2108
 	 */
2109
-	return apply_filters( 'geodir_map_zoom_level', array(
2109
+	return apply_filters('geodir_map_zoom_level', array(
2110 2110
 		1,
2111 2111
 		2,
2112 2112
 		3,
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
 		17,
2127 2127
 		18,
2128 2128
 		19
2129
-	) );
2129
+	));
2130 2130
 
2131 2131
 }
2132 2132
 
@@ -2139,12 +2139,12 @@  discard block
 block discarded – undo
2139 2139
  *
2140 2140
  * @param string $geodir_option_name Option key.
2141 2141
  */
2142
-function geodir_option_version_backup( $geodir_option_name ) {
2142
+function geodir_option_version_backup($geodir_option_name) {
2143 2143
 	$version_date  = time();
2144
-	$geodir_option = get_option( $geodir_option_name );
2144
+	$geodir_option = get_option($geodir_option_name);
2145 2145
 
2146
-	if ( ! empty( $geodir_option ) ) {
2147
-		add_option( $geodir_option_name . '_' . $version_date, $geodir_option );
2146
+	if (!empty($geodir_option)) {
2147
+		add_option($geodir_option_name.'_'.$version_date, $geodir_option);
2148 2148
 	}
2149 2149
 }
2150 2150
 
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
  *
2159 2159
  * @return int Page ID.
2160 2160
  */
2161
-function get_page_id_geodir_add_listing_page( $page_id ) {
2162
-	if ( geodir_wpml_multilingual_status() ) {
2161
+function get_page_id_geodir_add_listing_page($page_id) {
2162
+	if (geodir_wpml_multilingual_status()) {
2163 2163
 		$post_type = 'post_page';
2164
-		$page_id   = geodir_get_wpml_element_id( $page_id, $post_type );
2164
+		$page_id   = geodir_get_wpml_element_id($page_id, $post_type);
2165 2165
 	}
2166 2166
 
2167 2167
 	return $page_id;
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
  * @return bool Returns true when sitepress multilingual CMS active. else returns false.
2176 2176
  */
2177 2177
 function geodir_wpml_multilingual_status() {
2178
-	if ( function_exists( 'icl_object_id' ) ) {
2178
+	if (function_exists('icl_object_id')) {
2179 2179
 		return true;
2180 2180
 	}
2181 2181
 
@@ -2193,19 +2193,19 @@  discard block
 block discarded – undo
2193 2193
  *
2194 2194
  * @return int Element ID when exists. Else the page id.
2195 2195
  */
2196
-function geodir_get_wpml_element_id( $page_id, $post_type ) {
2196
+function geodir_get_wpml_element_id($page_id, $post_type) {
2197 2197
 	global $sitepress;
2198
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2199
-		$trid = $sitepress->get_element_trid( $page_id, $post_type );
2198
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2199
+		$trid = $sitepress->get_element_trid($page_id, $post_type);
2200 2200
 
2201
-		if ( $trid > 0 ) {
2202
-			$translations = $sitepress->get_element_translations( $trid, $post_type );
2201
+		if ($trid > 0) {
2202
+			$translations = $sitepress->get_element_translations($trid, $post_type);
2203 2203
 
2204 2204
 			$lang = $sitepress->get_current_language();
2205 2205
 			$lang = $lang ? $lang : $sitepress->get_default_language();
2206 2206
 
2207
-			if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
2208
-				$page_id = $translations[ $lang ]->element_id;
2207
+			if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
2208
+				$page_id = $translations[$lang]->element_id;
2209 2209
 			}
2210 2210
 		}
2211 2211
 	}
@@ -2222,15 +2222,15 @@  discard block
 block discarded – undo
2222 2222
  */
2223 2223
 function geodir_wpml_check_element_id() {
2224 2224
 	global $sitepress;
2225
-	if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
2225
+	if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
2226 2226
 		$el_type      = 'post_page';
2227
-		$el_id        = get_option( 'geodir_add_listing_page' );
2227
+		$el_id        = get_option('geodir_add_listing_page');
2228 2228
 		$default_lang = $sitepress->get_default_language();
2229
-		$el_details   = $sitepress->get_element_language_details( $el_id, $el_type );
2229
+		$el_details   = $sitepress->get_element_language_details($el_id, $el_type);
2230 2230
 
2231
-		if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
2232
-			if ( ! $el_details->source_language_code ) {
2233
-				$sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang );
2231
+		if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
2232
+			if (!$el_details->source_language_code) {
2233
+				$sitepress->set_element_language_details($el_id, $el_type, '', $default_lang);
2234 2234
 				$sitepress->icl_translations_cache->clear();
2235 2235
 			}
2236 2236
 		}
@@ -2249,41 +2249,41 @@  discard block
 block discarded – undo
2249 2249
  *
2250 2250
  * @return string Orderby SQL.
2251 2251
  */
2252
-function geodir_widget_listings_get_order( $query_args ) {
2252
+function geodir_widget_listings_get_order($query_args) {
2253 2253
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2254 2254
 
2255 2255
 	$query_args = $gd_query_args_widgets;
2256
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2257
-		return $wpdb->posts . ".post_date DESC, ";
2256
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2257
+		return $wpdb->posts.".post_date DESC, ";
2258 2258
 	}
2259 2259
 
2260
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2261
-	$table     = $plugin_prefix . $post_type . '_detail';
2260
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2261
+	$table     = $plugin_prefix.$post_type.'_detail';
2262 2262
 
2263
-	$sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : '';
2263
+	$sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : '';
2264 2264
 
2265
-	switch ( $sort_by ) {
2265
+	switch ($sort_by) {
2266 2266
 		case 'latest':
2267 2267
 		case 'newest':
2268
-			$orderby = $wpdb->posts . ".post_date DESC, ";
2268
+			$orderby = $wpdb->posts.".post_date DESC, ";
2269 2269
 			break;
2270 2270
 		case 'featured':
2271
-			$orderby = $table . ".is_featured ASC, ";
2271
+			$orderby = $table.".is_featured ASC, ";
2272 2272
 			break;
2273 2273
 		case 'az':
2274
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2274
+			$orderby = $wpdb->posts.".post_title ASC, ";
2275 2275
 			break;
2276 2276
 		case 'high_review':
2277
-			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
2277
+			$orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
2278 2278
 			break;
2279 2279
 		case 'high_rating':
2280
-			$orderby = "( " . $table . ".overall_rating  ) DESC, ";
2280
+			$orderby = "( ".$table.".overall_rating  ) DESC, ";
2281 2281
 			break;
2282 2282
 		case 'random':
2283 2283
 			$orderby = "RAND(), ";
2284 2284
 			break;
2285 2285
 		default:
2286
-			$orderby = $wpdb->posts . ".post_title ASC, ";
2286
+			$orderby = $wpdb->posts.".post_title ASC, ";
2287 2287
 			break;
2288 2288
 	}
2289 2289
 
@@ -2305,15 +2305,15 @@  discard block
 block discarded – undo
2305 2305
  *
2306 2306
  * @return mixed Result object.
2307 2307
  */
2308
-function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
2308
+function geodir_get_widget_listings($query_args = array(), $count_only = false) {
2309 2309
 	global $wpdb, $plugin_prefix, $table_prefix;
2310 2310
 	$GLOBALS['gd_query_args_widgets'] = $query_args;
2311 2311
 	$gd_query_args_widgets            = $query_args;
2312 2312
 
2313
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2314
-	$table     = $plugin_prefix . $post_type . '_detail';
2313
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2314
+	$table     = $plugin_prefix.$post_type.'_detail';
2315 2315
 
2316
-	$fields = $wpdb->posts . ".*, " . $table . ".*";
2316
+	$fields = $wpdb->posts.".*, ".$table.".*";
2317 2317
 	/**
2318 2318
 	 * Filter widget listing fields string part that is being used for query.
2319 2319
 	 *
@@ -2323,17 +2323,17 @@  discard block
 block discarded – undo
2323 2323
 	 * @param string $table     Table name.
2324 2324
 	 * @param string $post_type Post type.
2325 2325
 	 */
2326
-	$fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type );
2326
+	$fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
2327 2327
 
2328
-	$join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
2328
+	$join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
2329 2329
 
2330 2330
 	########### WPML ###########
2331 2331
 
2332
-	if ( function_exists( 'icl_object_id' ) ) {
2332
+	if (function_exists('icl_object_id')) {
2333 2333
 		global $sitepress;
2334 2334
 		$lang_code = ICL_LANGUAGE_CODE;
2335
-		if ( $lang_code ) {
2336
-			$join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
2335
+		if ($lang_code) {
2336
+			$join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
2337 2337
 		}
2338 2338
 	}
2339 2339
 
@@ -2347,15 +2347,15 @@  discard block
 block discarded – undo
2347 2347
 	 * @param string $join      Join clause string.
2348 2348
 	 * @param string $post_type Post type.
2349 2349
 	 */
2350
-	$join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type );
2350
+	$join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
2351 2351
 
2352
-	$post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : '';
2352
+	$post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : '';
2353 2353
 
2354
-	$where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'";
2354
+	$where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'";
2355 2355
 
2356 2356
 	########### WPML ###########
2357
-	if ( function_exists( 'icl_object_id' ) ) {
2358
-		if ( $lang_code ) {
2357
+	if (function_exists('icl_object_id')) {
2358
+		if ($lang_code) {
2359 2359
 			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' ";
2360 2360
 		}
2361 2361
 	}
@@ -2368,8 +2368,8 @@  discard block
 block discarded – undo
2368 2368
 	 * @param string $where     Where clause string.
2369 2369
 	 * @param string $post_type Post type.
2370 2370
 	 */
2371
-	$where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type );
2372
-	$where = $where != '' ? " WHERE 1=1 " . $where : '';
2371
+	$where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
2372
+	$where = $where != '' ? " WHERE 1=1 ".$where : '';
2373 2373
 
2374 2374
 	$groupby = " GROUP BY $wpdb->posts.ID ";
2375 2375
 	/**
@@ -2380,15 +2380,15 @@  discard block
 block discarded – undo
2380 2380
 	 * @param string $groupby   Group by clause string.
2381 2381
 	 * @param string $post_type Post type.
2382 2382
 	 */
2383
-	$groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type );
2383
+	$groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
2384 2384
 
2385
-	if ( $count_only ) {
2386
-		$sql  = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
2387
-			" . $join . "
2385
+	if ($count_only) {
2386
+		$sql  = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
2387
+			" . $join."
2388 2388
 			" . $where;
2389
-		$rows = (int) $wpdb->get_var( $sql );
2389
+		$rows = (int) $wpdb->get_var($sql);
2390 2390
 	} else {
2391
-		$orderby = geodir_widget_listings_get_order( $query_args );
2391
+		$orderby = geodir_widget_listings_get_order($query_args);
2392 2392
 		/**
2393 2393
 		 * Filter widget listing orderby clause string part that is being used for query.
2394 2394
 		 *
@@ -2398,11 +2398,11 @@  discard block
 block discarded – undo
2398 2398
 		 * @param string $table     Table name.
2399 2399
 		 * @param string $post_type Post type.
2400 2400
 		 */
2401
-		$orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type );
2402
-		$orderby .= $wpdb->posts . ".post_title ASC";
2403
-		$orderby = $orderby != '' ? " ORDER BY " . $orderby : '';
2401
+		$orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
2402
+		$orderby .= $wpdb->posts.".post_title ASC";
2403
+		$orderby = $orderby != '' ? " ORDER BY ".$orderby : '';
2404 2404
 
2405
-		$limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5;
2405
+		$limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5;
2406 2406
 		/**
2407 2407
 		 * Filter widget listing limit that is being used for query.
2408 2408
 		 *
@@ -2411,26 +2411,26 @@  discard block
 block discarded – undo
2411 2411
 		 * @param int $limit        Query results limit.
2412 2412
 		 * @param string $post_type Post type.
2413 2413
 		 */
2414
-		$limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type );
2414
+		$limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
2415 2415
 
2416
-		$page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1;
2417
-		if ( ! $page ) {
2416
+		$page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
2417
+		if (!$page) {
2418 2418
 			$page = 1;
2419 2419
 		}
2420 2420
 
2421
-		$limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : "";
2421
+		$limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : "";
2422 2422
 
2423
-		$sql  = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
2424
-			" . $join . "
2425
-			" . $where . "
2426
-			" . $groupby . "
2427
-			" . $orderby . "
2423
+		$sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts."
2424
+			" . $join."
2425
+			" . $where."
2426
+			" . $groupby."
2427
+			" . $orderby."
2428 2428
 			" . $limit;
2429
-		$rows = $wpdb->get_results( $sql );
2429
+		$rows = $wpdb->get_results($sql);
2430 2430
 	}
2431 2431
 
2432
-	unset( $GLOBALS['gd_query_args_widgets'] );
2433
-	unset( $gd_query_args_widgets );
2432
+	unset($GLOBALS['gd_query_args_widgets']);
2433
+	unset($gd_query_args_widgets);
2434 2434
 
2435 2435
 	return $rows;
2436 2436
 }
@@ -2447,11 +2447,11 @@  discard block
 block discarded – undo
2447 2447
  *
2448 2448
  * @return string Modified fields SQL.
2449 2449
  */
2450
-function geodir_function_widget_listings_fields( $fields ) {
2450
+function geodir_function_widget_listings_fields($fields) {
2451 2451
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2452 2452
 
2453 2453
 	$query_args = $gd_query_args_widgets;
2454
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2454
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2455 2455
 		return $fields;
2456 2456
 	}
2457 2457
 
@@ -2470,24 +2470,24 @@  discard block
 block discarded – undo
2470 2470
  *
2471 2471
  * @return string Modified join clause SQL.
2472 2472
  */
2473
-function geodir_function_widget_listings_join( $join ) {
2473
+function geodir_function_widget_listings_join($join) {
2474 2474
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2475 2475
 
2476 2476
 	$query_args = $gd_query_args_widgets;
2477
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2477
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2478 2478
 		return $join;
2479 2479
 	}
2480 2480
 
2481
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2482
-	$table     = $plugin_prefix . $post_type . '_detail';
2481
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2482
+	$table     = $plugin_prefix.$post_type.'_detail';
2483 2483
 
2484
-	if ( ! empty( $query_args['with_pics_only'] ) ) {
2485
-		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
2484
+	if (!empty($query_args['with_pics_only'])) {
2485
+		$join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
2486 2486
 	}
2487 2487
 
2488
-	if ( ! empty( $query_args['tax_query'] ) ) {
2489
-		$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2490
-		if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2488
+	if (!empty($query_args['tax_query'])) {
2489
+		$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2490
+		if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2491 2491
 			$join .= $tax_queries['join'];
2492 2492
 		}
2493 2493
 	}
@@ -2507,49 +2507,49 @@  discard block
 block discarded – undo
2507 2507
  *
2508 2508
  * @return string Modified where clause SQL.
2509 2509
  */
2510
-function geodir_function_widget_listings_where( $where ) {
2510
+function geodir_function_widget_listings_where($where) {
2511 2511
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2512 2512
 
2513 2513
 	$query_args = $gd_query_args_widgets;
2514
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2514
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2515 2515
 		return $where;
2516 2516
 	}
2517
-	$post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type'];
2518
-	$table     = $plugin_prefix . $post_type . '_detail';
2517
+	$post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type'];
2518
+	$table     = $plugin_prefix.$post_type.'_detail';
2519 2519
 
2520
-	if ( ! empty( $query_args ) ) {
2521
-		if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
2522
-			$where = geodir_default_location_where( $where, $table );
2520
+	if (!empty($query_args)) {
2521
+		if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
2522
+			$where = geodir_default_location_where($where, $table);
2523 2523
 		}
2524 2524
 
2525
-		if ( ! empty( $query_args['post_author'] ) ) {
2526
-			$where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author'];
2525
+		if (!empty($query_args['post_author'])) {
2526
+			$where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author'];
2527 2527
 		}
2528 2528
 
2529
-		if ( ! empty( $query_args['show_featured_only'] ) ) {
2530
-			$where .= " AND " . $table . ".is_featured = '1'";
2529
+		if (!empty($query_args['show_featured_only'])) {
2530
+			$where .= " AND ".$table.".is_featured = '1'";
2531 2531
 		}
2532 2532
 
2533
-		if ( ! empty( $query_args['show_special_only'] ) ) {
2534
-			$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
2533
+		if (!empty($query_args['show_special_only'])) {
2534
+			$where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
2535 2535
 		}
2536 2536
 
2537
-		if ( ! empty( $query_args['with_pics_only'] ) ) {
2538
-			$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL ";
2537
+		if (!empty($query_args['with_pics_only'])) {
2538
+			$where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL ";
2539 2539
 		}
2540 2540
 
2541
-		if ( ! empty( $query_args['featured_image_only'] ) ) {
2542
-			$where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' ";
2541
+		if (!empty($query_args['featured_image_only'])) {
2542
+			$where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' ";
2543 2543
 		}
2544 2544
 
2545
-		if ( ! empty( $query_args['with_videos_only'] ) ) {
2546
-			$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
2545
+		if (!empty($query_args['with_videos_only'])) {
2546
+			$where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
2547 2547
 		}
2548 2548
 
2549
-		if ( ! empty( $query_args['tax_query'] ) ) {
2550
-			$tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' );
2549
+		if (!empty($query_args['tax_query'])) {
2550
+			$tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID');
2551 2551
 
2552
-			if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
2552
+			if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
2553 2553
 				$where .= $tax_queries['where'];
2554 2554
 			}
2555 2555
 		}
@@ -2570,11 +2570,11 @@  discard block
 block discarded – undo
2570 2570
  *
2571 2571
  * @return string Modified orderby clause SQL.
2572 2572
  */
2573
-function geodir_function_widget_listings_orderby( $orderby ) {
2573
+function geodir_function_widget_listings_orderby($orderby) {
2574 2574
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2575 2575
 
2576 2576
 	$query_args = $gd_query_args_widgets;
2577
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2577
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2578 2578
 		return $orderby;
2579 2579
 	}
2580 2580
 
@@ -2593,15 +2593,15 @@  discard block
 block discarded – undo
2593 2593
  *
2594 2594
  * @return int Query limit.
2595 2595
  */
2596
-function geodir_function_widget_listings_limit( $limit ) {
2596
+function geodir_function_widget_listings_limit($limit) {
2597 2597
 	global $wpdb, $plugin_prefix, $gd_query_args_widgets;
2598 2598
 
2599 2599
 	$query_args = $gd_query_args_widgets;
2600
-	if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
2600
+	if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
2601 2601
 		return $limit;
2602 2602
 	}
2603 2603
 
2604
-	if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
2604
+	if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2605 2605
 		$limit = (int) $query_args['posts_per_page'];
2606 2606
 	}
2607 2607
 
@@ -2619,12 +2619,12 @@  discard block
 block discarded – undo
2619 2619
  *
2620 2620
  * @return int Large size width.
2621 2621
  */
2622
-function geodir_media_image_large_width( $default = 800, $params = '' ) {
2623
-	$large_size_w = get_option( 'large_size_w' );
2622
+function geodir_media_image_large_width($default = 800, $params = '') {
2623
+	$large_size_w = get_option('large_size_w');
2624 2624
 	$large_size_w = $large_size_w > 0 ? $large_size_w : $default;
2625
-	$large_size_w = absint( $large_size_w );
2625
+	$large_size_w = absint($large_size_w);
2626 2626
 
2627
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2627
+	if (!get_option('geodir_use_wp_media_large_size')) {
2628 2628
 		$large_size_w = 800;
2629 2629
 	}
2630 2630
 
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 	 * @param int $default         Default width.
2638 2638
 	 * @param string|array $params Image parameters.
2639 2639
 	 */
2640
-	$large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params );
2640
+	$large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
2641 2641
 
2642 2642
 	return $large_size_w;
2643 2643
 }
@@ -2653,12 +2653,12 @@  discard block
 block discarded – undo
2653 2653
  *
2654 2654
  * @return int Large size height.
2655 2655
  */
2656
-function geodir_media_image_large_height( $default = 800, $params = '' ) {
2657
-	$large_size_h = get_option( 'large_size_h' );
2656
+function geodir_media_image_large_height($default = 800, $params = '') {
2657
+	$large_size_h = get_option('large_size_h');
2658 2658
 	$large_size_h = $large_size_h > 0 ? $large_size_h : $default;
2659
-	$large_size_h = absint( $large_size_h );
2659
+	$large_size_h = absint($large_size_h);
2660 2660
 
2661
-	if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
2661
+	if (!get_option('geodir_use_wp_media_large_size')) {
2662 2662
 		$large_size_h = 800;
2663 2663
 	}
2664 2664
 
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 	 * @param int $default         Default height.
2672 2672
 	 * @param string|array $params Image parameters.
2673 2673
 	 */
2674
-	$large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params );
2674
+	$large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
2675 2675
 
2676 2676
 	return $large_size_h;
2677 2677
 }
@@ -2688,8 +2688,8 @@  discard block
 block discarded – undo
2688 2688
  *
2689 2689
  * @return string Sanitized name.
2690 2690
  */
2691
-function geodir_sanitize_location_name( $type, $name, $translate = true ) {
2692
-	if ( $name == '' ) {
2691
+function geodir_sanitize_location_name($type, $name, $translate = true) {
2692
+	if ($name == '') {
2693 2693
 		return null;
2694 2694
 	}
2695 2695
 
@@ -2698,13 +2698,13 @@  discard block
 block discarded – undo
2698 2698
 	$type = $type == 'gd_city' ? 'city' : $type;
2699 2699
 
2700 2700
 	$return = $name;
2701
-	if ( function_exists( 'get_actual_location_name' ) ) {
2702
-		$return = get_actual_location_name( $type, $name, $translate );
2701
+	if (function_exists('get_actual_location_name')) {
2702
+		$return = get_actual_location_name($type, $name, $translate);
2703 2703
 	} else {
2704
-		$return = preg_replace( '/-(\d+)$/', '', $return );
2705
-		$return = preg_replace( '/[_-]/', ' ', $return );
2706
-		$return = geodir_ucwords( $return );
2707
-		$return = $translate ? __( $return, 'geodirectory' ) : $return;
2704
+		$return = preg_replace('/-(\d+)$/', '', $return);
2705
+		$return = preg_replace('/[_-]/', ' ', $return);
2706
+		$return = geodir_ucwords($return);
2707
+		$return = $translate ? __($return, 'geodirectory') : $return;
2708 2708
 	}
2709 2709
 
2710 2710
 	return $return;
@@ -2719,14 +2719,14 @@  discard block
 block discarded – undo
2719 2719
  *
2720 2720
  * @param int $number Comments number.
2721 2721
  */
2722
-function geodir_comments_number( $number ) {
2722
+function geodir_comments_number($number) {
2723 2723
 
2724
-	if ( $number > 1 ) {
2725
-		$output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) );
2726
-	} elseif ( $number == 0 || $number == '' ) {
2727
-		$output = __( 'No Reviews', 'geodirectory' );
2724
+	if ($number > 1) {
2725
+		$output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
2726
+	} elseif ($number == 0 || $number == '') {
2727
+		$output = __('No Reviews', 'geodirectory');
2728 2728
 	} else { // must be one
2729
-		$output = __( '1 Review', 'geodirectory' );
2729
+		$output = __('1 Review', 'geodirectory');
2730 2730
 	}
2731 2731
 	echo $output;
2732 2732
 }
@@ -2741,18 +2741,18 @@  discard block
 block discarded – undo
2741 2741
  */
2742 2742
 function is_page_geodir_home() {
2743 2743
 	global $wpdb;
2744
-	$cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() );
2745
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2746
-		remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 );
2744
+	$cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
2745
+	if (function_exists('geodir_location_geo_home_link')) {
2746
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
2747 2747
 	}
2748
-	$home_url = home_url( '', 'http' );
2749
-	if ( function_exists( 'geodir_location_geo_home_link' ) ) {
2750
-		add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 );
2748
+	$home_url = home_url('', 'http');
2749
+	if (function_exists('geodir_location_geo_home_link')) {
2750
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2751 2751
 	}
2752
-	$home_url = str_replace( "www.", "", $home_url );
2753
-	if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
2752
+	$home_url = str_replace("www.", "", $home_url);
2753
+	if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
2754 2754
 		return true;
2755
-	} elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
2755
+	} elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
2756 2756
 		return true;
2757 2757
 	} else {
2758 2758
 		return false;
@@ -2772,18 +2772,18 @@  discard block
 block discarded – undo
2772 2772
  *
2773 2773
  * @return string The canonical URL.
2774 2774
  */
2775
-function geodir_wpseo_homepage_canonical( $url ) {
2775
+function geodir_wpseo_homepage_canonical($url) {
2776 2776
 	global $post;
2777 2777
 
2778
-	if ( is_page_geodir_home() ) {
2778
+	if (is_page_geodir_home()) {
2779 2779
 		return home_url();
2780 2780
 	}
2781 2781
 
2782 2782
 	return $url;
2783 2783
 }
2784 2784
 
2785
-add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 );
2786
-add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 );
2785
+add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
2786
+add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
2787 2787
 
2788 2788
 /**
2789 2789
  * Add extra fields to google maps script call.
@@ -2796,20 +2796,20 @@  discard block
 block discarded – undo
2796 2796
  *
2797 2797
  * @return string Modified extra string.
2798 2798
  */
2799
-function geodir_googlemap_script_extra_details_page( $extra ) {
2799
+function geodir_googlemap_script_extra_details_page($extra) {
2800 2800
 	global $post;
2801 2801
 	$add_google_places_api = false;
2802
-	if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
2802
+	if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
2803 2803
 		$add_google_places_api = true;
2804 2804
 	}
2805
-	if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
2805
+	if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
2806 2806
 		$extra .= "&amp;libraries=places";
2807 2807
 	}
2808 2808
 
2809 2809
 	return $extra;
2810 2810
 }
2811 2811
 
2812
-add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 );
2812
+add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
2813 2813
 
2814 2814
 
2815 2815
 /**
@@ -2826,93 +2826,93 @@  discard block
 block discarded – undo
2826 2826
  *                                          after_widget.
2827 2827
  * @param array|string $instance            The settings for the particular instance of the widget.
2828 2828
  */
2829
-function geodir_popular_post_category_output( $args = '', $instance = '' ) {
2829
+function geodir_popular_post_category_output($args = '', $instance = '') {
2830 2830
 	// prints the widget
2831 2831
 	global $wpdb, $plugin_prefix, $geodir_post_category_str;
2832
-	extract( $args, EXTR_SKIP );
2832
+	extract($args, EXTR_SKIP);
2833 2833
 
2834 2834
 	echo $before_widget;
2835 2835
 
2836 2836
 	/** This filter is documented in geodirectory_widgets.php */
2837
-	$title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2837
+	$title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2838 2838
 
2839 2839
 	$gd_post_type = geodir_get_current_posttype();
2840 2840
 
2841
-	$category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2842
-	if ( ! empty( $gd_post_type ) ) {
2841
+	$category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2842
+	if (!empty($gd_post_type)) {
2843 2843
 		$default_post_type = $gd_post_type;
2844
-	} elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
2844
+	} elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
2845 2845
 		$default_post_type = $instance['default_post_type'];
2846 2846
 	} else {
2847 2847
 		$all_gd_post_type  = geodir_get_posttypes();
2848
-		$default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : '';
2848
+		$default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : '';
2849 2849
 	}
2850 2850
 
2851 2851
 	$taxonomy = array();
2852
-	if ( ! empty( $gd_post_type ) ) {
2853
-		$taxonomy[] = $gd_post_type . "category";
2852
+	if (!empty($gd_post_type)) {
2853
+		$taxonomy[] = $gd_post_type."category";
2854 2854
 	} else {
2855
-		$taxonomy = geodir_get_taxonomies( $gd_post_type );
2855
+		$taxonomy = geodir_get_taxonomies($gd_post_type);
2856 2856
 	}
2857 2857
 
2858
-	$terms   = get_terms( $taxonomy );
2858
+	$terms   = get_terms($taxonomy);
2859 2859
 	$a_terms = array();
2860 2860
 	$b_terms = array();
2861 2861
 
2862
-	foreach ( $terms as $term ) {
2863
-		if ( $term->count > 0 ) {
2864
-			$a_terms[ $term->taxonomy ][] = $term;
2862
+	foreach ($terms as $term) {
2863
+		if ($term->count > 0) {
2864
+			$a_terms[$term->taxonomy][] = $term;
2865 2865
 		}
2866 2866
 	}
2867 2867
 
2868
-	if ( ! empty( $a_terms ) ) {
2869
-		foreach ( $a_terms as $b_key => $b_val ) {
2870
-			$b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' );
2868
+	if (!empty($a_terms)) {
2869
+		foreach ($a_terms as $b_key => $b_val) {
2870
+			$b_terms[$b_key] = geodir_sort_terms($b_val, 'count');
2871 2871
 		}
2872 2872
 
2873
-		$default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : '';
2873
+		$default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : '';
2874 2874
 
2875 2875
 		$tax_change_output = '';
2876
-		if ( count( $b_terms ) > 1 ) {
2876
+		if (count($b_terms) > 1) {
2877 2877
 			$tax_change_output .= "<select data-limit='$category_limit' class='geodir-cat-list-tax'  onchange='geodir_get_post_term(this);'>";
2878
-			foreach ( $b_terms as $key => $val ) {
2879
-				$ptype    = get_post_type_object( str_replace( "category", "", $key ) );
2880
-				$cpt_name = __( $ptype->labels->singular_name, 'geodirectory' );
2881
-				$tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>";
2878
+			foreach ($b_terms as $key => $val) {
2879
+				$ptype    = get_post_type_object(str_replace("category", "", $key));
2880
+				$cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2881
+				$tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
2882 2882
 			}
2883 2883
 			$tax_change_output .= "</select>";
2884 2884
 		}
2885 2885
 
2886
-		if ( ! empty( $b_terms ) ) {
2887
-			$terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array
2888
-			global $cat_count;//make global so we can change via function
2886
+		if (!empty($b_terms)) {
2887
+			$terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2888
+			global $cat_count; //make global so we can change via function
2889 2889
 			$cat_count = 0;
2890 2890
 			?>
2891 2891
 			<div class="geodir-category-list-in clearfix">
2892 2892
 				<div class="geodir-cat-list clearfix">
2893 2893
 					<?php
2894
-					echo $before_title . __( $title ) . $after_title;
2894
+					echo $before_title.__($title).$after_title;
2895 2895
 
2896 2896
 					echo $tax_change_output;
2897 2897
 
2898 2898
 					echo '<ul class="geodir-popular-cat-list">';
2899 2899
 
2900
-					geodir_helper_cat_list_output( $terms, $category_limit );
2900
+					geodir_helper_cat_list_output($terms, $category_limit);
2901 2901
 
2902 2902
 					echo '</ul>';
2903 2903
 					?>
2904 2904
 				</div>
2905 2905
 				<?php
2906 2906
 				$hide = '';
2907
-				if ( $cat_count < $category_limit ) {
2907
+				if ($cat_count < $category_limit) {
2908 2908
 					$hide = 'style="display:none;"';
2909 2909
 				}
2910 2910
 				echo "<div class='geodir-cat-list-more' $hide >";
2911
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>';
2912
-				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>';
2911
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
2912
+				echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
2913 2913
 				echo "</div>";
2914 2914
 				/* add scripts */
2915
-				add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 );
2915
+				add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
2916 2916
 				?>
2917 2917
 			</div>
2918 2918
 			<?php
@@ -2931,25 +2931,25 @@  discard block
 block discarded – undo
2931 2931
  * @param array $terms                      An array of term objects.
2932 2932
  * @param int $category_limit               Number of categories to display by default.
2933 2933
  */
2934
-function geodir_helper_cat_list_output( $terms, $category_limit ) {
2934
+function geodir_helper_cat_list_output($terms, $category_limit) {
2935 2935
 	global $geodir_post_category_str, $cat_count;
2936 2936
 	$term_icons = geodir_get_term_icon();
2937 2937
 
2938 2938
 	$geodir_post_category_str = array();
2939 2939
 
2940 2940
 
2941
-	foreach ( $terms as $cat ) {
2942
-		$post_type     = str_replace( "category", "", $cat->taxonomy );
2943
-		$term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : '';
2941
+	foreach ($terms as $cat) {
2942
+		$post_type     = str_replace("category", "", $cat->taxonomy);
2943
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : '';
2944 2944
 
2945
-		$cat_count ++;
2945
+		$cat_count++;
2946 2946
 
2947
-		$geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id );
2947
+		$geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
2948 2948
 
2949 2949
 		$class_row  = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2950 2950
 		$total_post = $cat->count;
2951 2951
 
2952
-		$term_link = get_term_link( $cat, $cat->taxonomy );
2952
+		$term_link = get_term_link($cat, $cat->taxonomy);
2953 2953
 		/**
2954 2954
 		 * Filer the category term link.
2955 2955
 		 *
@@ -2959,11 +2959,11 @@  discard block
 block discarded – undo
2959 2959
 		 * @param int $cat          ->term_id The term id.
2960 2960
 		 * @param string $post_type Wordpress post type.
2961 2961
 		 */
2962
-		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2962
+		$term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2963 2963
 
2964
-		echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2965
-		echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">';
2966
-		echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
2964
+		echo '<li class="'.$class_row.'"><a href="'.$term_link.'">';
2965
+		echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">';
2966
+		echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
2967 2967
 		echo '</a></li>';
2968 2968
 	}
2969 2969
 }
@@ -2978,14 +2978,14 @@  discard block
 block discarded – undo
2978 2978
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
2979 2979
  * @param array|string $instance The settings for the particular instance of the widget.
2980 2980
  */
2981
-function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
2981
+function geodir_listing_slider_widget_output($args = '', $instance = '') {
2982 2982
 	// prints the widget
2983
-	extract( $args, EXTR_SKIP );
2983
+	extract($args, EXTR_SKIP);
2984 2984
 
2985 2985
 	echo $before_widget;
2986 2986
 
2987 2987
 	/** This filter is documented in geodirectory_widgets.php */
2988
-	$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
2988
+	$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
2989 2989
 	/**
2990 2990
 	 * Filter the widget post type.
2991 2991
 	 *
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
 	 *
2994 2994
 	 * @param string $instance ['post_type'] Post type of listing.
2995 2995
 	 */
2996
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
2996
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
2997 2997
 	/**
2998 2998
 	 * Filter the widget's term.
2999 2999
 	 *
@@ -3001,7 +3001,7 @@  discard block
 block discarded – undo
3001 3001
 	 *
3002 3002
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3003 3003
 	 */
3004
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3004
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3005 3005
 	/**
3006 3006
 	 * Filter the widget listings limit.
3007 3007
 	 *
@@ -3009,7 +3009,7 @@  discard block
 block discarded – undo
3009 3009
 	 *
3010 3010
 	 * @param string $instance ['post_number'] Number of listings to display.
3011 3011
 	 */
3012
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3012
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3013 3013
 	/**
3014 3014
 	 * Filter the widget listings limit shown at one time.
3015 3015
 	 *
@@ -3017,7 +3017,7 @@  discard block
 block discarded – undo
3017 3017
 	 *
3018 3018
 	 * @param string $instance ['max_show'] Number of listings to display on screen.
3019 3019
 	 */
3020
-	$max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] );
3020
+	$max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
3021 3021
 	/**
3022 3022
 	 * Filter the widget slide width.
3023 3023
 	 *
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
 	 *
3026 3026
 	 * @param string $instance ['slide_width'] Width of the slides shown.
3027 3027
 	 */
3028
-	$slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] );
3028
+	$slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
3029 3029
 	/**
3030 3030
 	 * Filter widget's "show title" value.
3031 3031
 	 *
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
 	 *
3034 3034
 	 * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0.
3035 3035
 	 */
3036
-	$show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] );
3036
+	$show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
3037 3037
 	/**
3038 3038
 	 * Filter widget's "slideshow" value.
3039 3039
 	 *
@@ -3041,7 +3041,7 @@  discard block
 block discarded – undo
3041 3041
 	 *
3042 3042
 	 * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically.
3043 3043
 	 */
3044
-	$slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] );
3044
+	$slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
3045 3045
 	/**
3046 3046
 	 * Filter widget's "animationLoop" value.
3047 3047
 	 *
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
 	 *
3050 3050
 	 * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop.
3051 3051
 	 */
3052
-	$animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] );
3052
+	$animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
3053 3053
 	/**
3054 3054
 	 * Filter widget's "directionNav" value.
3055 3055
 	 *
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
 	 *
3058 3058
 	 * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0.
3059 3059
 	 */
3060
-	$directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] );
3060
+	$directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
3061 3061
 	/**
3062 3062
 	 * Filter widget's "slideshowSpeed" value.
3063 3063
 	 *
@@ -3065,7 +3065,7 @@  discard block
 block discarded – undo
3065 3065
 	 *
3066 3066
 	 * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds.
3067 3067
 	 */
3068
-	$slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] );
3068
+	$slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
3069 3069
 	/**
3070 3070
 	 * Filter widget's "animationSpeed" value.
3071 3071
 	 *
@@ -3073,7 +3073,7 @@  discard block
 block discarded – undo
3073 3073
 	 *
3074 3074
 	 * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds.
3075 3075
 	 */
3076
-	$animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] );
3076
+	$animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
3077 3077
 	/**
3078 3078
 	 * Filter widget's "animation" value.
3079 3079
 	 *
@@ -3081,7 +3081,7 @@  discard block
 block discarded – undo
3081 3081
 	 *
3082 3082
 	 * @param string $instance ['animation'] Controls the animation type, "fade" or "slide".
3083 3083
 	 */
3084
-	$animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] );
3084
+	$animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
3085 3085
 	/**
3086 3086
 	 * Filter widget's "list_sort" type.
3087 3087
 	 *
@@ -3089,10 +3089,10 @@  discard block
 block discarded – undo
3089 3089
 	 *
3090 3090
 	 * @param string $instance ['list_sort'] Listing sort by type.
3091 3091
 	 */
3092
-	$list_sort          = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3093
-	$show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null;
3092
+	$list_sort          = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3093
+	$show_featured_only = !empty($instance['show_featured_only']) ? 1 : null;
3094 3094
 
3095
-	wp_enqueue_script( 'geodirectory-jquery-flexslider-js' );
3095
+	wp_enqueue_script('geodirectory-jquery-flexslider-js');
3096 3096
 	?>
3097 3097
 	<script type="text/javascript">
3098 3098
 		jQuery(window).load(function () {
@@ -3107,23 +3107,23 @@  discard block
 block discarded – undo
3107 3107
 				itemWidth: 75,
3108 3108
 				itemMargin: 5,
3109 3109
 				asNavFor: '#geodir_widget_slider',
3110
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3110
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3111 3111
 			});
3112 3112
 
3113 3113
 			jQuery('#geodir_widget_slider').flexslider({
3114
-				animation: "<?php echo $animation;?>",
3114
+				animation: "<?php echo $animation; ?>",
3115 3115
 				selector: ".geodir-slides > li",
3116 3116
 				namespace: "geodir-",
3117 3117
 				controlNav: true,
3118
-				animationLoop: <?php echo $animationLoop;?>,
3119
-				slideshow: <?php echo $slideshow;?>,
3120
-				slideshowSpeed: <?php echo $slideshowSpeed;?>,
3121
-				animationSpeed: <?php echo $animationSpeed;?>,
3122
-				directionNav: <?php echo $directionNav;?>,
3123
-				maxItems: <?php echo $max_show;?>,
3118
+				animationLoop: <?php echo $animationLoop; ?>,
3119
+				slideshow: <?php echo $slideshow; ?>,
3120
+				slideshowSpeed: <?php echo $slideshowSpeed; ?>,
3121
+				animationSpeed: <?php echo $animationSpeed; ?>,
3122
+				directionNav: <?php echo $directionNav; ?>,
3123
+				maxItems: <?php echo $max_show; ?>,
3124 3124
 				move: 1,
3125
-				<?php if ( $slide_width ) {
3126
-				echo "itemWidth: " . $slide_width . ",";
3125
+				<?php if ($slide_width) {
3126
+				echo "itemWidth: ".$slide_width.",";
3127 3127
 			}?>
3128 3128
 				sync: "#geodir_widget_carousel",
3129 3129
 				start: function (slider) {
@@ -3131,7 +3131,7 @@  discard block
 block discarded – undo
3131 3131
 					jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
3132 3132
 					jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
3133 3133
 				},
3134
-				rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
3134
+				rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
3135 3135
 			});
3136 3136
 		});
3137 3137
 	</script>
@@ -3142,62 +3142,62 @@  discard block
 block discarded – undo
3142 3142
 		'post_type'      => $post_type,
3143 3143
 		'order_by'       => $list_sort
3144 3144
 	);
3145
-	if ( $show_featured_only ) {
3145
+	if ($show_featured_only) {
3146 3146
 		$query_args['show_featured_only'] = 1;
3147 3147
 	}
3148 3148
 
3149
-	if ( $category != 0 || $category != '' ) {
3150
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3149
+	if ($category != 0 || $category != '') {
3150
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3151 3151
 		$tax_query         = array(
3152 3152
 			'taxonomy' => $category_taxonomy[0],
3153 3153
 			'field'    => 'id',
3154 3154
 			'terms'    => $category
3155 3155
 		);
3156 3156
 
3157
-		$query_args['tax_query'] = array( $tax_query );
3157
+		$query_args['tax_query'] = array($tax_query);
3158 3158
 	}
3159 3159
 
3160 3160
 	// we want listings with featured image only
3161 3161
 	$query_args['featured_image_only'] = 1;
3162 3162
 
3163
-	if ( $post_type == 'gd_event' ) {
3163
+	if ($post_type == 'gd_event') {
3164 3164
 		$query_args['gedir_event_listing_filter'] = 'upcoming';
3165 3165
 	}// show only upcoming events
3166 3166
 
3167
-	$widget_listings = geodir_get_widget_listings( $query_args );
3168
-	if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
3169
-		if ( $title ) {
3170
-			echo $before_title . $title . $after_title;
3167
+	$widget_listings = geodir_get_widget_listings($query_args);
3168
+	if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
3169
+		if ($title) {
3170
+			echo $before_title.$title.$after_title;
3171 3171
 		}
3172 3172
 
3173 3173
 		global $post;
3174 3174
 
3175
-		$current_post = $post;// keep current post info
3175
+		$current_post = $post; // keep current post info
3176 3176
 
3177 3177
 		$widget_main_slides = '';
3178 3178
 		$nav_slides         = '';
3179 3179
 		$widget_slides      = 0;
3180 3180
 
3181
-		foreach ( $widget_listings as $widget_listing ) {
3181
+		foreach ($widget_listings as $widget_listing) {
3182 3182
 			global $gd_widget_listing_type;
3183 3183
 			$post         = $widget_listing;
3184
-			$widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) );
3184
+			$widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
3185 3185
 
3186
-			if ( ! empty( $widget_image ) ) {
3187
-				if ( $widget_image->height >= 200 ) {
3186
+			if (!empty($widget_image)) {
3187
+				if ($widget_image->height >= 200) {
3188 3188
 					$widget_spacer_height = 0;
3189 3189
 				} else {
3190
-					$widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 );
3190
+					$widget_spacer_height = ((200 - $widget_image->height) / 2);
3191 3191
 				}
3192 3192
 
3193
-				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />';
3193
+				$widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />';
3194 3194
 
3195 3195
 				$title = '';
3196
-				if ( $show_title ) {
3197
-					$title_html     = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>';
3196
+				if ($show_title) {
3197
+					$title_html     = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>';
3198 3198
 					$post_id        = $post->ID;
3199
-					$post_permalink = get_permalink( $post->ID );
3200
-					$post_title     = get_the_title( $post->ID );
3199
+					$post_permalink = get_permalink($post->ID);
3200
+					$post_title     = get_the_title($post->ID);
3201 3201
 					/**
3202 3202
 					 * Filter the listing slider widget title.
3203 3203
 					 *
@@ -3208,12 +3208,12 @@  discard block
 block discarded – undo
3208 3208
 					 * @param string $post_permalink The post permalink url.
3209 3209
 					 * @param string $post_title     The post title text.
3210 3210
 					 */
3211
-					$title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title );
3211
+					$title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
3212 3212
 				}
3213 3213
 
3214
-				$widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>';
3215
-				$nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
3216
-				$widget_slides ++;
3214
+				$widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>';
3215
+				$nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
3216
+				$widget_slides++;
3217 3217
 			}
3218 3218
 		}
3219 3219
 		?>
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
 			<div id="geodir_widget_slider" class="geodir_flexslider">
3223 3223
 				<ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul>
3224 3224
 			</div>
3225
-			<?php if ( $widget_slides > 1 ) { ?>
3225
+			<?php if ($widget_slides > 1) { ?>
3226 3226
 				<div id="geodir_widget_carousel" class="geodir_flexslider">
3227 3227
 					<ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul>
3228 3228
 				</div>
@@ -3230,7 +3230,7 @@  discard block
 block discarded – undo
3230 3230
 		</div>
3231 3231
 		<?php
3232 3232
 		$GLOBALS['post'] = $current_post;
3233
-		setup_postdata( $current_post );
3233
+		setup_postdata($current_post);
3234 3234
 	}
3235 3235
 	echo $after_widget;
3236 3236
 }
@@ -3246,46 +3246,46 @@  discard block
 block discarded – undo
3246 3246
  * @param array|string $args     Display arguments including before_title, after_title, before_widget, and after_widget.
3247 3247
  * @param array|string $instance The settings for the particular instance of the widget.
3248 3248
  */
3249
-function geodir_loginwidget_output( $args = '', $instance = '' ) {
3249
+function geodir_loginwidget_output($args = '', $instance = '') {
3250 3250
 	//print_r($args);
3251 3251
 	//print_r($instance);
3252 3252
 	// prints the widget
3253
-	extract( $args, EXTR_SKIP );
3253
+	extract($args, EXTR_SKIP);
3254 3254
 
3255 3255
 	/** This filter is documented in geodirectory_widgets.php */
3256
-	$title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3256
+	$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3257 3257
 
3258 3258
 	echo $before_widget;
3259
-	echo $before_title . $title . $after_title;
3259
+	echo $before_title.$title.$after_title;
3260 3260
 
3261
-	if ( is_user_logged_in() ) {
3261
+	if (is_user_logged_in()) {
3262 3262
 		global $current_user;
3263 3263
 
3264
-		$author_link = get_author_posts_url( $current_user->data->ID );
3265
-		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
3264
+		$author_link = get_author_posts_url($current_user->data->ID);
3265
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
3266 3266
 
3267 3267
 		echo '<ul class="geodir-loginbox-list">';
3268 3268
 		ob_start();
3269 3269
 		?>
3270 3270
 		<li><a class="signin"
3271
-		       href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li>
3271
+		       href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
3272 3272
 		<?php
3273
-		$post_types                           = geodir_get_posttypes( 'object' );
3274
-		$show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' );
3275
-		$geodir_allow_posttype_frontend       = get_option( 'geodir_allow_posttype_frontend' );
3273
+		$post_types                           = geodir_get_posttypes('object');
3274
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
3275
+		$geodir_allow_posttype_frontend       = get_option('geodir_allow_posttype_frontend');
3276 3276
 
3277
-		if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
3277
+		if (!empty($show_add_listing_post_types_main_nav)) {
3278 3278
 			$addlisting_links = '';
3279
-			foreach ( $post_types as $key => $postobj ) {
3279
+			foreach ($post_types as $key => $postobj) {
3280 3280
 
3281
-				if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
3281
+				if (in_array($key, $show_add_listing_post_types_main_nav)) {
3282 3282
 
3283
-					if ( $add_link = geodir_get_addlisting_link( $key ) ) {
3283
+					if ($add_link = geodir_get_addlisting_link($key)) {
3284 3284
 
3285 3285
 						$name = $postobj->labels->name;
3286 3286
 
3287 3287
 						$selected = '';
3288
-						if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
3288
+						if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
3289 3289
 							$selected = 'selected="selected"';
3290 3290
 						}
3291 3291
 
@@ -3298,22 +3298,22 @@  discard block
 block discarded – undo
3298 3298
 						 * @param string $key       Add listing array key.
3299 3299
 						 * @param int $current_user ->ID Current user ID.
3300 3300
 						 */
3301
-						$add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID );
3301
+						$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
3302 3302
 
3303
-						$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3303
+						$addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3304 3304
 
3305 3305
 					}
3306 3306
 				}
3307 3307
 
3308 3308
 			}
3309 3309
 
3310
-			if ( $addlisting_links != '' ) { ?>
3310
+			if ($addlisting_links != '') { ?>
3311 3311
 
3312 3312
 				<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
3313 3313
 				            option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
3314
-				            data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>">
3314
+				            data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
3315 3315
 						<option value="" disabled="disabled" selected="selected"
3316
-						        style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option>
3316
+						        style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
3317 3317
 						<?php echo $addlisting_links; ?>
3318 3318
 					</select></li> <?php
3319 3319
 
@@ -3321,23 +3321,23 @@  discard block
 block discarded – undo
3321 3321
 
3322 3322
 		}
3323 3323
 		// My Favourites in Dashboard
3324
-		$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
3324
+		$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
3325 3325
 		$user_favourite                    = geodir_user_favourite_listing_count();
3326 3326
 
3327
-		if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
3327
+		if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
3328 3328
 			$favourite_links = '';
3329 3329
 
3330
-			foreach ( $post_types as $key => $postobj ) {
3331
-				if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
3330
+			foreach ($post_types as $key => $postobj) {
3331
+				if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
3332 3332
 					$name           = $postobj->labels->name;
3333
-					$post_type_link = geodir_getlink( $author_link, array(
3333
+					$post_type_link = geodir_getlink($author_link, array(
3334 3334
 						'stype' => $key,
3335 3335
 						'list'  => 'favourite'
3336
-					), false );
3336
+					), false);
3337 3337
 
3338 3338
 					$selected = '';
3339 3339
 
3340
-					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
3340
+					if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
3341 3341
 						$selected = 'selected="selected"';
3342 3342
 					}
3343 3343
 					/**
@@ -3349,20 +3349,20 @@  discard block
 block discarded – undo
3349 3349
 					 * @param string $key            Favorite listing array key.
3350 3350
 					 * @param int $current_user      ->ID Current user ID.
3351 3351
 					 */
3352
-					$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID );
3352
+					$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
3353 3353
 
3354
-					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3354
+					$favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3355 3355
 				}
3356 3356
 			}
3357 3357
 
3358
-			if ( $favourite_links != '' ) {
3358
+			if ($favourite_links != '') {
3359 3359
 				?>
3360 3360
 				<li>
3361 3361
 					<select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
3362 3362
 					        option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
3363
-					        data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>">
3363
+					        data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
3364 3364
 						<option value="" disabled="disabled" selected="selected"
3365
-						        style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option>
3365
+						        style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
3366 3366
 						<?php echo $favourite_links; ?>
3367 3367
 					</select>
3368 3368
 				</li>
@@ -3371,19 +3371,19 @@  discard block
 block discarded – undo
3371 3371
 		}
3372 3372
 
3373 3373
 
3374
-		$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
3374
+		$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
3375 3375
 		$user_listing                     = geodir_user_post_listing_count();
3376 3376
 
3377
-		if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
3377
+		if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
3378 3378
 			$listing_links = '';
3379 3379
 
3380
-			foreach ( $post_types as $key => $postobj ) {
3381
-				if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
3380
+			foreach ($post_types as $key => $postobj) {
3381
+				if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
3382 3382
 					$name         = $postobj->labels->name;
3383
-					$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
3383
+					$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
3384 3384
 
3385 3385
 					$selected = '';
3386
-					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
3386
+					if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
3387 3387
 						$selected = 'selected="selected"';
3388 3388
 					}
3389 3389
 
@@ -3396,20 +3396,20 @@  discard block
 block discarded – undo
3396 3396
 					 * @param string $key          My listing array key.
3397 3397
 					 * @param int $current_user    ->ID Current user ID.
3398 3398
 					 */
3399
-					$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID );
3399
+					$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
3400 3400
 
3401
-					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>';
3401
+					$listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>';
3402 3402
 				}
3403 3403
 			}
3404 3404
 
3405
-			if ( $listing_links != '' ) {
3405
+			if ($listing_links != '') {
3406 3406
 				?>
3407 3407
 				<li>
3408 3408
 					<select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
3409 3409
 					        option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
3410
-					        data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>">
3410
+					        data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
3411 3411
 						<option value="" disabled="disabled" selected="selected"
3412
-						        style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option>
3412
+						        style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
3413 3413
 						<?php echo $listing_links; ?>
3414 3414
 					</select>
3415 3415
 				</li>
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 		 *
3426 3426
 		 * @param string $dashboard_link Dashboard links HTML.
3427 3427
 		 */
3428
-		echo apply_filters( 'geodir_dashboard_links', $dashboard_link );
3428
+		echo apply_filters('geodir_dashboard_links', $dashboard_link);
3429 3429
 		echo '</ul>';
3430 3430
 
3431 3431
 		/**
@@ -3433,7 +3433,7 @@  discard block
 block discarded – undo
3433 3433
 		 *
3434 3434
 		 * @since 1.6.6
3435 3435
 		 */
3436
-		do_action( 'geodir_after_loginwidget_form_logged_in' );
3436
+		do_action('geodir_after_loginwidget_form_logged_in');
3437 3437
 
3438 3438
 
3439 3439
 	} else {
@@ -3448,18 +3448,18 @@  discard block
 block discarded – undo
3448 3448
 		<form name="loginform" class="loginform1"
3449 3449
 		      action="<?php echo geodir_login_url(); ?>"
3450 3450
 		      method="post">
3451
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log"
3451
+			<div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
3452 3452
 			                                    type="text" class="textfield user_login1"/> <span
3453 3453
 					class="user_loginInfo"></span></div>
3454
-			<div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>"
3454
+			<div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
3455 3455
 			                                    name="pwd" type="password"
3456 3456
 			                                    class="textfield user_pass1 input-text"/><span
3457 3457
 					class="user_passInfo"></span></div>
3458 3458
 
3459
-			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/>
3459
+			<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/>
3460 3460
 			<input type="hidden" name="testcookie" value="1"/>
3461 3461
 
3462
-				<?php do_action( 'login_form' ); ?>
3462
+				<?php do_action('login_form'); ?>
3463 3463
 
3464 3464
 			<div class="geodir_form_row clearfix"><input type="submit" name="submit"
3465 3465
 			                                             value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/>
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 					 * @since 1.0.0
3473 3473
 					 */
3474 3474
 					?>
3475
-					<a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>"
3475
+					<a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
3476 3476
 					   class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a>
3477 3477
 
3478 3478
 					<?php
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
 					 * @since 1.0.0
3483 3483
 					 */
3484 3484
 					?>
3485
-					<a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>"
3485
+					<a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
3486 3486
 					   class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div>
3487 3487
 		</form>
3488 3488
 		<?php
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
 		 *
3492 3492
 		 * @since 1.6.6
3493 3493
 		 */
3494
-		do_action( 'geodir_after_loginwidget_form_logged_out' );
3494
+		do_action('geodir_after_loginwidget_form_logged_out');
3495 3495
 	}
3496 3496
 
3497 3497
 	echo $after_widget;
@@ -3513,16 +3513,16 @@  discard block
 block discarded – undo
3513 3513
  *                                         after_widget.
3514 3514
  * @param array|string $instance           The settings for the particular instance of the widget.
3515 3515
  */
3516
-function geodir_popular_postview_output( $args = '', $instance = '' ) {
3516
+function geodir_popular_postview_output($args = '', $instance = '') {
3517 3517
 	global $gd_session;
3518 3518
 
3519 3519
 	// prints the widget
3520
-	extract( $args, EXTR_SKIP );
3520
+	extract($args, EXTR_SKIP);
3521 3521
 
3522 3522
 	echo $before_widget;
3523 3523
 
3524 3524
 	/** This filter is documented in geodirectory_widgets.php */
3525
-	$title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) );
3525
+	$title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
3526 3526
 	/**
3527 3527
 	 * Filter the widget post type.
3528 3528
 	 *
@@ -3530,7 +3530,7 @@  discard block
 block discarded – undo
3530 3530
 	 *
3531 3531
 	 * @param string $instance ['post_type'] Post type of listing.
3532 3532
 	 */
3533
-	$post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] );
3533
+	$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
3534 3534
 	/**
3535 3535
 	 * Filter the widget's term.
3536 3536
 	 *
@@ -3538,7 +3538,7 @@  discard block
 block discarded – undo
3538 3538
 	 *
3539 3539
 	 * @param string $instance ['category'] Filter by term. Can be any valid term.
3540 3540
 	 */
3541
-	$category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] );
3541
+	$category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
3542 3542
 	/**
3543 3543
 	 * Filter the widget listings limit.
3544 3544
 	 *
@@ -3546,7 +3546,7 @@  discard block
 block discarded – undo
3546 3546
 	 *
3547 3547
 	 * @param string $instance ['post_number'] Number of listings to display.
3548 3548
 	 */
3549
-	$post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] );
3549
+	$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
3550 3550
 	/**
3551 3551
 	 * Filter widget's "layout" type.
3552 3552
 	 *
@@ -3554,7 +3554,7 @@  discard block
 block discarded – undo
3554 3554
 	 *
3555 3555
 	 * @param string $instance ['layout'] Widget layout type.
3556 3556
 	 */
3557
-	$layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] );
3557
+	$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
3558 3558
 	/**
3559 3559
 	 * Filter widget's "add_location_filter" value.
3560 3560
 	 *
@@ -3562,7 +3562,7 @@  discard block
 block discarded – undo
3562 3562
 	 *
3563 3563
 	 * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0.
3564 3564
 	 */
3565
-	$add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] );
3565
+	$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
3566 3566
 	/**
3567 3567
 	 * Filter widget's listing width.
3568 3568
 	 *
@@ -3570,7 +3570,7 @@  discard block
 block discarded – undo
3570 3570
 	 *
3571 3571
 	 * @param string $instance ['listing_width'] Listing width.
3572 3572
 	 */
3573
-	$listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] );
3573
+	$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
3574 3574
 	/**
3575 3575
 	 * Filter widget's "list_sort" type.
3576 3576
 	 *
@@ -3578,25 +3578,25 @@  discard block
 block discarded – undo
3578 3578
 	 *
3579 3579
 	 * @param string $instance ['list_sort'] Listing sort by type.
3580 3580
 	 */
3581
-	$list_sort             = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] );
3582
-	$use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false;
3581
+	$list_sort             = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
3582
+	$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
3583 3583
 
3584 3584
 	// set post type to current viewing post type
3585
-	if ( $use_viewing_post_type ) {
3585
+	if ($use_viewing_post_type) {
3586 3586
 		$current_post_type = geodir_get_current_posttype();
3587
-		if ( $current_post_type != '' && $current_post_type != $post_type ) {
3587
+		if ($current_post_type != '' && $current_post_type != $post_type) {
3588 3588
 			$post_type = $current_post_type;
3589 3589
 			$category  = array(); // old post type category will not work for current changed post type
3590 3590
 		}
3591 3591
 	}
3592 3592
 	// replace widget title dynamically
3593
-	$posttype_plural_label   = __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3594
-	$posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' );
3593
+	$posttype_plural_label   = __(get_post_type_plural_label($post_type), 'geodirectory');
3594
+	$posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory');
3595 3595
 
3596
-	$title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title );
3597
-	$title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title );
3596
+	$title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
3597
+	$title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
3598 3598
 
3599
-	if ( isset( $instance['character_count'] ) ) {
3599
+	if (isset($instance['character_count'])) {
3600 3600
 		/**
3601 3601
 		 * Filter the widget's excerpt character count.
3602 3602
 		 *
@@ -3604,37 +3604,37 @@  discard block
 block discarded – undo
3604 3604
 		 *
3605 3605
 		 * @param int $instance ['character_count'] Excerpt character count.
3606 3606
 		 */
3607
-		$character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] );
3607
+		$character_count = apply_filters('widget_list_character_count', $instance['character_count']);
3608 3608
 	} else {
3609 3609
 		$character_count = '';
3610 3610
 	}
3611 3611
 
3612
-	if ( empty( $title ) || $title == 'All' ) {
3613
-		$title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' );
3612
+	if (empty($title) || $title == 'All') {
3613
+		$title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory');
3614 3614
 	}
3615 3615
 
3616 3616
 	$location_url = array();
3617
-	$city         = get_query_var( 'gd_city' );
3618
-	if ( ! empty( $city ) ) {
3619
-		$country = get_query_var( 'gd_country' );
3620
-		$region  = get_query_var( 'gd_region' );
3617
+	$city         = get_query_var('gd_city');
3618
+	if (!empty($city)) {
3619
+		$country = get_query_var('gd_country');
3620
+		$region  = get_query_var('gd_region');
3621 3621
 
3622
-		$geodir_show_location_url = get_option( 'geodir_show_location_url' );
3622
+		$geodir_show_location_url = get_option('geodir_show_location_url');
3623 3623
 
3624
-		if ( $geodir_show_location_url == 'all' ) {
3625
-			if ( $country != '' ) {
3624
+		if ($geodir_show_location_url == 'all') {
3625
+			if ($country != '') {
3626 3626
 				$location_url[] = $country;
3627 3627
 			}
3628 3628
 
3629
-			if ( $region != '' ) {
3629
+			if ($region != '') {
3630 3630
 				$location_url[] = $region;
3631 3631
 			}
3632
-		} else if ( $geodir_show_location_url == 'country_city' ) {
3633
-			if ( $country != '' ) {
3632
+		} else if ($geodir_show_location_url == 'country_city') {
3633
+			if ($country != '') {
3634 3634
 				$location_url[] = $country;
3635 3635
 			}
3636
-		} else if ( $geodir_show_location_url == 'region_city' ) {
3637
-			if ( $region != '' ) {
3636
+		} else if ($geodir_show_location_url == 'region_city') {
3637
+			if ($region != '') {
3638 3638
 				$location_url[] = $region;
3639 3639
 			}
3640 3640
 		}
@@ -3642,37 +3642,37 @@  discard block
 block discarded – undo
3642 3642
 		$location_url[] = $city;
3643 3643
 	}
3644 3644
 
3645
-	$location_url  = implode( '/', $location_url );
3645
+	$location_url  = implode('/', $location_url);
3646 3646
 	$skip_location = false;
3647
-	if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
3647
+	if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
3648 3648
 		$skip_location = true;
3649
-		$gd_session->un_set( 'gd_multi_location' );
3649
+		$gd_session->un_set('gd_multi_location');
3650 3650
 	}
3651 3651
 
3652
-	if ( get_option( 'permalink_structure' ) ) {
3653
-		$viewall_url = get_post_type_archive_link( $post_type );
3652
+	if (get_option('permalink_structure')) {
3653
+		$viewall_url = get_post_type_archive_link($post_type);
3654 3654
 	} else {
3655
-		$viewall_url = get_post_type_archive_link( $post_type );
3655
+		$viewall_url = get_post_type_archive_link($post_type);
3656 3656
 	}
3657 3657
 
3658
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3658
+	if (!empty($category) && $category[0] != '0') {
3659 3659
 		global $geodir_add_location_url;
3660 3660
 
3661 3661
 		$geodir_add_location_url = '0';
3662 3662
 
3663
-		if ( $add_location_filter != '0' ) {
3663
+		if ($add_location_filter != '0') {
3664 3664
 			$geodir_add_location_url = '1';
3665 3665
 		}
3666 3666
 
3667
-		$viewall_url = get_term_link( (int) $category[0], $post_type . 'category' );
3667
+		$viewall_url = get_term_link((int) $category[0], $post_type.'category');
3668 3668
 
3669 3669
 		$geodir_add_location_url = null;
3670 3670
 	}
3671
-	if ( $skip_location ) {
3672
-		$gd_session->set( 'gd_multi_location', 1 );
3671
+	if ($skip_location) {
3672
+		$gd_session->set('gd_multi_location', 1);
3673 3673
 	}
3674 3674
 
3675
-	if ( is_wp_error( $viewall_url ) ) {
3675
+	if (is_wp_error($viewall_url)) {
3676 3676
 		$viewall_url = '';
3677 3677
 	}
3678 3678
 
@@ -3684,34 +3684,34 @@  discard block
 block discarded – undo
3684 3684
 		'order_by'       => $list_sort
3685 3685
 	);
3686 3686
 
3687
-	if ( $character_count ) {
3687
+	if ($character_count) {
3688 3688
 		$query_args['excerpt_length'] = $character_count;
3689 3689
 	}
3690 3690
 
3691
-	if ( ! empty( $instance['show_featured_only'] ) ) {
3691
+	if (!empty($instance['show_featured_only'])) {
3692 3692
 		$query_args['show_featured_only'] = 1;
3693 3693
 	}
3694 3694
 
3695
-	if ( ! empty( $instance['show_special_only'] ) ) {
3695
+	if (!empty($instance['show_special_only'])) {
3696 3696
 		$query_args['show_special_only'] = 1;
3697 3697
 	}
3698 3698
 
3699
-	if ( ! empty( $instance['with_pics_only'] ) ) {
3699
+	if (!empty($instance['with_pics_only'])) {
3700 3700
 		$query_args['with_pics_only']      = 0;
3701 3701
 		$query_args['featured_image_only'] = 1;
3702 3702
 	}
3703 3703
 
3704
-	if ( ! empty( $instance['with_videos_only'] ) ) {
3704
+	if (!empty($instance['with_videos_only'])) {
3705 3705
 		$query_args['with_videos_only'] = 1;
3706 3706
 	}
3707
-	$with_no_results = ! empty( $instance['without_no_results'] ) ? false : true;
3707
+	$with_no_results = !empty($instance['without_no_results']) ? false : true;
3708 3708
 
3709
-	if ( ! empty( $category ) && $category[0] != '0' ) {
3710
-		$category_taxonomy = geodir_get_taxonomies( $post_type );
3709
+	if (!empty($category) && $category[0] != '0') {
3710
+		$category_taxonomy = geodir_get_taxonomies($post_type);
3711 3711
 
3712 3712
 		######### WPML #########
3713
-		if ( function_exists( 'icl_object_id' ) ) {
3714
-			$category = gd_lang_object_ids( $category, $category_taxonomy[0] );
3713
+		if (function_exists('icl_object_id')) {
3714
+			$category = gd_lang_object_ids($category, $category_taxonomy[0]);
3715 3715
 		}
3716 3716
 		######### WPML #########
3717 3717
 
@@ -3721,14 +3721,14 @@  discard block
 block discarded – undo
3721 3721
 			'terms'    => $category
3722 3722
 		);
3723 3723
 
3724
-		$query_args['tax_query'] = array( $tax_query );
3724
+		$query_args['tax_query'] = array($tax_query);
3725 3725
 	}
3726 3726
 
3727 3727
 	global $gridview_columns_widget, $geodir_is_widget_listing;
3728 3728
 
3729
-	$widget_listings = geodir_get_widget_listings( $query_args );
3729
+	$widget_listings = geodir_get_widget_listings($query_args);
3730 3730
 
3731
-	if ( ! empty( $widget_listings ) || $with_no_results ) {
3731
+	if (!empty($widget_listings) || $with_no_results) {
3732 3732
 		?>
3733 3733
 		<div class="geodir_locations geodir_location_listing">
3734 3734
 
@@ -3738,11 +3738,11 @@  discard block
 block discarded – undo
3738 3738
 			 *
3739 3739
 			 * @since 1.0.0
3740 3740
 			 */
3741
-			do_action( 'geodir_before_view_all_link_in_widget' ); ?>
3741
+			do_action('geodir_before_view_all_link_in_widget'); ?>
3742 3742
 			<div class="geodir_list_heading clearfix">
3743
-				<?php echo $before_title . $title . $after_title; ?>
3743
+				<?php echo $before_title.$title.$after_title; ?>
3744 3744
 				<a href="<?php echo $viewall_url; ?>"
3745
-				   class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a>
3745
+				   class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
3746 3746
 			</div>
3747 3747
 			<?php
3748 3748
 			/**
@@ -3750,10 +3750,10 @@  discard block
 block discarded – undo
3750 3750
 			 *
3751 3751
 			 * @since 1.0.0
3752 3752
 			 */
3753
-			do_action( 'geodir_after_view_all_link_in_widget' ); ?>
3753
+			do_action('geodir_after_view_all_link_in_widget'); ?>
3754 3754
 			<?php
3755
-			if ( strstr( $layout, 'gridview' ) ) {
3756
-				$listing_view_exp        = explode( '_', $layout );
3755
+			if (strstr($layout, 'gridview')) {
3756
+				$listing_view_exp        = explode('_', $layout);
3757 3757
 				$gridview_columns_widget = $layout;
3758 3758
 				$layout                  = $listing_view_exp[0];
3759 3759
 			} else {
@@ -3765,8 +3765,8 @@  discard block
 block discarded – undo
3765 3765
 			 *
3766 3766
 			 * @since 1.0.0
3767 3767
 			 */
3768
-			$template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) );
3769
-			if ( ! isset( $character_count ) ) {
3768
+			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
3769
+			if (!isset($character_count)) {
3770 3770
 				/**
3771 3771
 				 * Filter the widget's excerpt character count.
3772 3772
 				 *
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
 				 *
3775 3775
 				 * @param int $instance ['character_count'] Excerpt character count.
3776 3776
 				 */
3777
-				$character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count );
3777
+				$character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
3778 3778
 			}
3779 3779
 
3780 3780
 			global $post, $map_jason, $map_canvas_arr;
@@ -3789,13 +3789,13 @@  discard block
 block discarded – undo
3789 3789
 			 *
3790 3790
 			 * @since 1.0.0
3791 3791
 			 */
3792
-			include( $template );
3792
+			include($template);
3793 3793
 
3794 3794
 			$geodir_is_widget_listing = false;
3795 3795
 
3796 3796
 			$GLOBALS['post'] = $current_post;
3797
-			if ( ! empty( $current_post ) ) {
3798
-				setup_postdata( $current_post );
3797
+			if (!empty($current_post)) {
3798
+				setup_postdata($current_post);
3799 3799
 			}
3800 3800
 			$map_jason      = $current_map_jason;
3801 3801
 			$map_canvas_arr = $current_map_canvas_arr;
@@ -3826,12 +3826,12 @@  discard block
 block discarded – undo
3826 3826
  *
3827 3827
  * @return int Reviews count.
3828 3828
  */
3829
-function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
3829
+function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
3830 3830
 	global $wpdb, $plugin_prefix;
3831 3831
 
3832
-	$detail_table = $plugin_prefix . $post_type . '_detail';
3832
+	$detail_table = $plugin_prefix.$post_type.'_detail';
3833 3833
 
3834
-	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
3834
+	$sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
3835 3835
 
3836 3836
 	/**
3837 3837
 	 * Filter count review sql query.
@@ -3843,9 +3843,9 @@  discard block
 block discarded – undo
3843 3843
 	 * @param int $taxonomy     The taxonomy Id.
3844 3844
 	 * @param string $post_type The post type.
3845 3845
 	 */
3846
-	$sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type );
3846
+	$sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
3847 3847
 
3848
-	$count = $wpdb->get_var( $sql );
3848
+	$count = $wpdb->get_var($sql);
3849 3849
 
3850 3850
 	return $count;
3851 3851
 }
@@ -3863,7 +3863,7 @@  discard block
 block discarded – undo
3863 3863
  *
3864 3864
  * @return array Term array data.
3865 3865
  */
3866
-function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
3866
+function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
3867 3867
 	/**
3868 3868
 	 * Filter review count option data.
3869 3869
 	 *
@@ -3873,78 +3873,78 @@  discard block
 block discarded – undo
3873 3873
 	 * @param bool $force_update Force update option value?. Default.false.
3874 3874
 	 * @param int $post_ID       The post id to update if any.
3875 3875
 	 */
3876
-	$option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID );
3877
-	if ( ! empty( $option_data ) ) {
3876
+	$option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
3877
+	if (!empty($option_data)) {
3878 3878
 		return $option_data;
3879 3879
 	}
3880 3880
 
3881
-	$option_data = get_option( 'geodir_global_review_count' );
3881
+	$option_data = get_option('geodir_global_review_count');
3882 3882
 
3883
-	if ( ! $option_data || $force_update ) {
3884
-		if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
3883
+	if (!$option_data || $force_update) {
3884
+		if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
3885 3885
 			global $gd_session;
3886 3886
 			$term_array = (array) $option_data;
3887
-			$post_type  = get_post_type( $post_ID );
3888
-			$taxonomy   = $post_type . 'category';
3889
-			$terms      = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
3890
-
3891
-			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
3892
-				foreach ( $terms as $term_id ) {
3893
-					$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3894
-					$children               = get_term_children( $term_id, $taxonomy );
3895
-					$term_array[ $term_id ] = $count;
3887
+			$post_type  = get_post_type($post_ID);
3888
+			$taxonomy   = $post_type.'category';
3889
+			$terms      = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
3890
+
3891
+			if (!empty($terms) && !is_wp_error($terms)) {
3892
+				foreach ($terms as $term_id) {
3893
+					$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3894
+					$children               = get_term_children($term_id, $taxonomy);
3895
+					$term_array[$term_id] = $count;
3896 3896
 				}
3897 3897
 			}
3898 3898
 
3899
-			$session_listing = $gd_session->get( 'listing' );
3899
+			$session_listing = $gd_session->get('listing');
3900 3900
 
3901 3901
 			$terms = array();
3902
-			if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
3903
-				$terms = (array) $_POST['post_category'][ $taxonomy ];
3904
-			} else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
3905
-				$terms = (array) $session_listing['post_category'][ $taxonomy ];
3902
+			if (isset($_POST['post_category'][$taxonomy])) {
3903
+				$terms = (array) $_POST['post_category'][$taxonomy];
3904
+			} else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
3905
+				$terms = (array) $session_listing['post_category'][$taxonomy];
3906 3906
 			}
3907 3907
 
3908
-			if ( ! empty( $terms ) ) {
3909
-				foreach ( $terms as $term_id ) {
3910
-					if ( $term_id > 0 ) {
3911
-						$count                  = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type );
3912
-						$children               = get_term_children( $term_id, $taxonomy );
3913
-						$term_array[ $term_id ] = $count;
3908
+			if (!empty($terms)) {
3909
+				foreach ($terms as $term_id) {
3910
+					if ($term_id > 0) {
3911
+						$count                  = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type);
3912
+						$children               = get_term_children($term_id, $taxonomy);
3913
+						$term_array[$term_id] = $count;
3914 3914
 					}
3915 3915
 				}
3916 3916
 			}
3917 3917
 		} else { // Update reviews count for all post categories.
3918 3918
 			$term_array = array();
3919 3919
 			$post_types = geodir_get_posttypes();
3920
-			foreach ( $post_types as $post_type ) {
3920
+			foreach ($post_types as $post_type) {
3921 3921
 
3922
-				$taxonomy = geodir_get_taxonomies( $post_type );
3922
+				$taxonomy = geodir_get_taxonomies($post_type);
3923 3923
 				$taxonomy = $taxonomy[0];
3924 3924
 
3925 3925
 				$args = array(
3926 3926
 					'hide_empty' => false
3927 3927
 				);
3928 3928
 
3929
-				$terms = get_terms( $taxonomy, $args );
3929
+				$terms = get_terms($taxonomy, $args);
3930 3930
 
3931
-				foreach ( $terms as $term ) {
3932
-					$count    = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type );
3933
-					$children = get_term_children( $term->term_id, $taxonomy );
3931
+				foreach ($terms as $term) {
3932
+					$count    = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type);
3933
+					$children = get_term_children($term->term_id, $taxonomy);
3934 3934
 					/*if ( is_array( $children ) ) {
3935 3935
                         foreach ( $children as $child_id ) {
3936 3936
                             $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type);
3937 3937
                             $count = $count + $child_count;
3938 3938
                         }
3939 3939
                     }*/
3940
-					$term_array[ $term->term_id ] = $count;
3940
+					$term_array[$term->term_id] = $count;
3941 3941
 				}
3942 3942
 			}
3943 3943
 		}
3944 3944
 
3945
-		update_option( 'geodir_global_review_count', $term_array );
3945
+		update_option('geodir_global_review_count', $term_array);
3946 3946
 		//clear cache
3947
-		wp_cache_delete( 'geodir_global_review_count' );
3947
+		wp_cache_delete('geodir_global_review_count');
3948 3948
 
3949 3949
 		return $term_array;
3950 3950
 	} else {
@@ -3960,39 +3960,39 @@  discard block
 block discarded – undo
3960 3960
  * @package GeoDirectory
3961 3961
  * @return bool
3962 3962
  */
3963
-function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
3964
-	if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
3963
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
3964
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
3965 3965
 		return; // do not run if importing listings
3966 3966
 	}
3967 3967
 
3968
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
3968
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
3969 3969
 		return;
3970 3970
 	}
3971 3971
 
3972 3972
 	$post_ID = 0;
3973
-	if ( ! empty( $post ) ) {
3974
-		if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
3973
+	if (!empty($post)) {
3974
+		if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
3975 3975
 			return;
3976 3976
 		}
3977 3977
 
3978
-		if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
3978
+		if ($new_status == 'auto-draft' && $old_status == 'new') {
3979 3979
 			return;
3980 3980
 		}
3981 3981
 
3982
-		if ( ! empty( $post->ID ) ) {
3982
+		if (!empty($post->ID)) {
3983 3983
 			$post_ID = $post->ID;
3984 3984
 		}
3985 3985
 	}
3986 3986
 
3987
-	if ( $new_status != $old_status ) {
3988
-		geodir_count_reviews_by_terms( true, $post_ID );
3987
+	if ($new_status != $old_status) {
3988
+		geodir_count_reviews_by_terms(true, $post_ID);
3989 3989
 	}
3990 3990
 
3991 3991
 	return true;
3992 3992
 }
3993 3993
 
3994
-function geodir_term_review_count_force_update_single_post( $post_id ) {
3995
-	geodir_count_reviews_by_terms( true, $post_id );
3994
+function geodir_term_review_count_force_update_single_post($post_id) {
3995
+	geodir_count_reviews_by_terms(true, $post_id);
3996 3996
 }
3997 3997
 
3998 3998
 /*-----------------------------------------------------------------------------------*/
@@ -4009,11 +4009,11 @@  discard block
 block discarded – undo
4009 4009
  *
4010 4010
  * @return int Post count.
4011 4011
  */
4012
-function geodir_count_posts_by_term( $data, $term ) {
4012
+function geodir_count_posts_by_term($data, $term) {
4013 4013
 
4014
-	if ( $data ) {
4015
-		if ( isset( $data[ $term->term_id ] ) ) {
4016
-			return $data[ $term->term_id ];
4014
+	if ($data) {
4015
+		if (isset($data[$term->term_id])) {
4016
+			return $data[$term->term_id];
4017 4017
 		} else {
4018 4018
 			return 0;
4019 4019
 		}
@@ -4030,8 +4030,8 @@  discard block
 block discarded – undo
4030 4030
  * param array $terms An array of term objects.
4031 4031
  * @return array Sorted terms array.
4032 4032
  */
4033
-function geodir_sort_terms_by_count( $terms ) {
4034
-	usort( $terms, "geodir_sort_by_count_obj" );
4033
+function geodir_sort_terms_by_count($terms) {
4034
+	usort($terms, "geodir_sort_by_count_obj");
4035 4035
 
4036 4036
 	return $terms;
4037 4037
 }
@@ -4046,8 +4046,8 @@  discard block
 block discarded – undo
4046 4046
  *
4047 4047
  * @return array Sorted terms array.
4048 4048
  */
4049
-function geodir_sort_terms_by_review_count( $terms ) {
4050
-	usort( $terms, "geodir_sort_by_review_count_obj" );
4049
+function geodir_sort_terms_by_review_count($terms) {
4050
+	usort($terms, "geodir_sort_by_review_count_obj");
4051 4051
 
4052 4052
 	return $terms;
4053 4053
 }
@@ -4063,12 +4063,12 @@  discard block
 block discarded – undo
4063 4063
  *
4064 4064
  * @return array Sorted terms array.
4065 4065
  */
4066
-function geodir_sort_terms( $terms, $sort = 'count' ) {
4067
-	if ( $sort == 'count' ) {
4068
-		return geodir_sort_terms_by_count( $terms );
4066
+function geodir_sort_terms($terms, $sort = 'count') {
4067
+	if ($sort == 'count') {
4068
+		return geodir_sort_terms_by_count($terms);
4069 4069
 	}
4070
-	if ( $sort == 'review_count' ) {
4071
-		return geodir_sort_terms_by_review_count( $terms );
4070
+	if ($sort == 'review_count') {
4071
+		return geodir_sort_terms_by_review_count($terms);
4072 4072
 	}
4073 4073
 }
4074 4074
 
@@ -4086,7 +4086,7 @@  discard block
 block discarded – undo
4086 4086
  *
4087 4087
  * @return bool
4088 4088
  */
4089
-function geodir_sort_by_count( $a, $b ) {
4089
+function geodir_sort_by_count($a, $b) {
4090 4090
 	return $a['count'] < $b['count'];
4091 4091
 }
4092 4092
 
@@ -4101,7 +4101,7 @@  discard block
 block discarded – undo
4101 4101
  *
4102 4102
  * @return bool
4103 4103
  */
4104
-function geodir_sort_by_count_obj( $a, $b ) {
4104
+function geodir_sort_by_count_obj($a, $b) {
4105 4105
 	return $a->count < $b->count;
4106 4106
 }
4107 4107
 
@@ -4116,7 +4116,7 @@  discard block
 block discarded – undo
4116 4116
  *
4117 4117
  * @return bool
4118 4118
  */
4119
-function geodir_sort_by_review_count_obj( $a, $b ) {
4119
+function geodir_sort_by_review_count_obj($a, $b) {
4120 4120
 	return $a->review_count < $b->review_count;
4121 4121
 }
4122 4122
 
@@ -4133,35 +4133,35 @@  discard block
 block discarded – undo
4133 4133
 	 * @since   1.4.2
4134 4134
 	 * @package GeoDirectory
4135 4135
 	 */
4136
-	$locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' );
4136
+	$locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
4137 4137
 
4138
-	load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' );
4139
-	load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' );
4138
+	load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
4139
+	load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
4140 4140
 
4141 4141
 	/**
4142 4142
 	 * Define language constants.
4143 4143
 	 *
4144 4144
 	 * @since 1.0.0
4145 4145
 	 */
4146
-	require_once( geodir_plugin_path() . '/language.php' );
4146
+	require_once(geodir_plugin_path().'/language.php');
4147 4147
 
4148
-	$language_file = geodir_plugin_path() . '/db-language.php';
4148
+	$language_file = geodir_plugin_path().'/db-language.php';
4149 4149
 
4150 4150
 	// Load language string file if not created yet
4151
-	if ( ! file_exists( $language_file ) ) {
4151
+	if (!file_exists($language_file)) {
4152 4152
 		geodirectory_load_db_language();
4153 4153
 	}
4154 4154
 
4155
-	if ( file_exists( $language_file ) ) {
4155
+	if (file_exists($language_file)) {
4156 4156
 		/**
4157 4157
 		 * Language strings from database.
4158 4158
 		 *
4159 4159
 		 * @since 1.4.2
4160 4160
 		 */
4161 4161
 		try {
4162
-			require_once( $language_file );
4163
-		} catch ( Exception $e ) {
4164
-			error_log( 'Language Error: ' . $e->getMessage() );
4162
+			require_once($language_file);
4163
+		} catch (Exception $e) {
4164
+			error_log('Language Error: '.$e->getMessage());
4165 4165
 		}
4166 4166
 	}
4167 4167
 }
@@ -4178,19 +4178,19 @@  discard block
 block discarded – undo
4178 4178
  */
4179 4179
 function geodirectory_load_db_language() {
4180 4180
 	global $wp_filesystem;
4181
-	if ( empty( $wp_filesystem ) ) {
4182
-		require_once( ABSPATH . '/wp-admin/includes/file.php' );
4181
+	if (empty($wp_filesystem)) {
4182
+		require_once(ABSPATH.'/wp-admin/includes/file.php');
4183 4183
 		WP_Filesystem();
4184 4184
 		global $wp_filesystem;
4185 4185
 	}
4186 4186
 
4187
-	$language_file = geodir_plugin_path() . '/db-language.php';
4187
+	$language_file = geodir_plugin_path().'/db-language.php';
4188 4188
 
4189
-	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
4189
+	if (is_file($language_file) && !is_writable($language_file)) {
4190 4190
 		return false;
4191 4191
 	} // Not possible to create.
4192 4192
 
4193
-	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
4193
+	if (!is_file($language_file) && !is_writable(dirname($language_file))) {
4194 4194
 		return false;
4195 4195
 	} // Not possible to create.
4196 4196
 
@@ -4203,9 +4203,9 @@  discard block
 block discarded – undo
4203 4203
 	 *
4204 4204
 	 * @param array $contents_strings Array of strings.
4205 4205
 	 */
4206
-	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );
4206
+	$contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
4207 4207
 
4208
-	$contents_strings = array_unique( $contents_strings );
4208
+	$contents_strings = array_unique($contents_strings);
4209 4209
 
4210 4210
 	$contents_head   = array();
4211 4211
 	$contents_head[] = "<?php";
@@ -4222,20 +4222,20 @@  discard block
 block discarded – undo
4222 4222
 	$contents_foot[] = "";
4223 4223
 	$contents_foot[] = "";
4224 4224
 
4225
-	$contents = implode( PHP_EOL, $contents_head );
4225
+	$contents = implode(PHP_EOL, $contents_head);
4226 4226
 
4227
-	if ( ! empty( $contents_strings ) ) {
4228
-		foreach ( $contents_strings as $string ) {
4229
-			if ( is_scalar( $string ) && $string != '' ) {
4230
-				$string = str_replace( "'", "\'", $string );
4231
-				$contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
4227
+	if (!empty($contents_strings)) {
4228
+		foreach ($contents_strings as $string) {
4229
+			if (is_scalar($string) && $string != '') {
4230
+				$string = str_replace("'", "\'", $string);
4231
+				$contents .= PHP_EOL."__('".$string."', 'geodirectory');";
4232 4232
 			}
4233 4233
 		}
4234 4234
 	}
4235 4235
 
4236
-	$contents .= implode( PHP_EOL, $contents_foot );
4236
+	$contents .= implode(PHP_EOL, $contents_foot);
4237 4237
 
4238
-	if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
4238
+	if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
4239 4239
 		return false;
4240 4240
 	} // Failure; could not write file.
4241 4241
 
@@ -4255,45 +4255,45 @@  discard block
 block discarded – undo
4255 4255
  *
4256 4256
  * @return array Translation texts.
4257 4257
  */
4258
-function geodir_load_custom_field_translation( $translation_texts = array() ) {
4258
+function geodir_load_custom_field_translation($translation_texts = array()) {
4259 4259
 	global $wpdb;
4260 4260
 
4261 4261
 	// Custom fields table
4262
-	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE;
4263
-	$rows = $wpdb->get_results( $sql );
4262
+	$sql  = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE;
4263
+	$rows = $wpdb->get_results($sql);
4264 4264
 
4265
-	if ( ! empty( $rows ) ) {
4266
-		foreach ( $rows as $row ) {
4267
-			if ( ! empty( $row->admin_title ) ) {
4268
-				$translation_texts[] = stripslashes_deep( $row->admin_title );
4265
+	if (!empty($rows)) {
4266
+		foreach ($rows as $row) {
4267
+			if (!empty($row->admin_title)) {
4268
+				$translation_texts[] = stripslashes_deep($row->admin_title);
4269 4269
 			}
4270 4270
 
4271
-			if ( ! empty( $row->admin_desc ) ) {
4272
-				$translation_texts[] = stripslashes_deep( $row->admin_desc );
4271
+			if (!empty($row->admin_desc)) {
4272
+				$translation_texts[] = stripslashes_deep($row->admin_desc);
4273 4273
 			}
4274 4274
 
4275
-			if ( ! empty( $row->site_title ) ) {
4276
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4275
+			if (!empty($row->site_title)) {
4276
+				$translation_texts[] = stripslashes_deep($row->site_title);
4277 4277
 			}
4278 4278
 
4279
-			if ( ! empty( $row->clabels ) ) {
4280
-				$translation_texts[] = stripslashes_deep( $row->clabels );
4279
+			if (!empty($row->clabels)) {
4280
+				$translation_texts[] = stripslashes_deep($row->clabels);
4281 4281
 			}
4282 4282
 
4283
-			if ( ! empty( $row->required_msg ) ) {
4284
-				$translation_texts[] = stripslashes_deep( $row->required_msg );
4283
+			if (!empty($row->required_msg)) {
4284
+				$translation_texts[] = stripslashes_deep($row->required_msg);
4285 4285
 			}
4286 4286
 
4287
-			if ( ! empty( $row->default_value ) ) {
4288
-				$translation_texts[] = stripslashes_deep( $row->default_value );
4287
+			if (!empty($row->default_value)) {
4288
+				$translation_texts[] = stripslashes_deep($row->default_value);
4289 4289
 			}
4290 4290
 
4291
-			if ( ! empty( $row->option_values ) ) {
4292
-				$option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) );
4291
+			if (!empty($row->option_values)) {
4292
+				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
4293 4293
 
4294
-				if ( ! empty( $option_values ) ) {
4295
-					foreach ( $option_values as $option_value ) {
4296
-						if ( ! empty( $option_value['label'] ) ) {
4294
+				if (!empty($option_values)) {
4295
+					foreach ($option_values as $option_value) {
4296
+						if (!empty($option_value['label'])) {
4297 4297
 							$translation_texts[] = $option_value['label'];
4298 4298
 						}
4299 4299
 					}
@@ -4303,48 +4303,48 @@  discard block
 block discarded – undo
4303 4303
 	}
4304 4304
 
4305 4305
 	// Custom sorting fields table
4306
-	$sql  = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4307
-	$rows = $wpdb->get_results( $sql );
4306
+	$sql  = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE;
4307
+	$rows = $wpdb->get_results($sql);
4308 4308
 
4309
-	if ( ! empty( $rows ) ) {
4310
-		foreach ( $rows as $row ) {
4311
-			if ( ! empty( $row->site_title ) ) {
4312
-				$translation_texts[] = stripslashes_deep( $row->site_title );
4309
+	if (!empty($rows)) {
4310
+		foreach ($rows as $row) {
4311
+			if (!empty($row->site_title)) {
4312
+				$translation_texts[] = stripslashes_deep($row->site_title);
4313 4313
 			}
4314 4314
 
4315
-			if ( ! empty( $row->asc_title ) ) {
4316
-				$translation_texts[] = stripslashes_deep( $row->asc_title );
4315
+			if (!empty($row->asc_title)) {
4316
+				$translation_texts[] = stripslashes_deep($row->asc_title);
4317 4317
 			}
4318 4318
 
4319
-			if ( ! empty( $row->desc_title ) ) {
4320
-				$translation_texts[] = stripslashes_deep( $row->desc_title );
4319
+			if (!empty($row->desc_title)) {
4320
+				$translation_texts[] = stripslashes_deep($row->desc_title);
4321 4321
 			}
4322 4322
 		}
4323 4323
 	}
4324 4324
 
4325 4325
 	// Advance search filter fields table
4326
-	if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
4327
-		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
4328
-		$rows = $wpdb->get_results( $sql );
4329
-
4330
-		if ( ! empty( $rows ) ) {
4331
-			foreach ( $rows as $row ) {
4332
-				if ( ! empty( $row->field_site_name ) ) {
4333
-					$translation_texts[] = stripslashes_deep( $row->field_site_name );
4326
+	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
4327
+		$sql  = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE;
4328
+		$rows = $wpdb->get_results($sql);
4329
+
4330
+		if (!empty($rows)) {
4331
+			foreach ($rows as $row) {
4332
+				if (!empty($row->field_site_name)) {
4333
+					$translation_texts[] = stripslashes_deep($row->field_site_name);
4334 4334
 				}
4335 4335
 
4336
-				if ( ! empty( $row->front_search_title ) ) {
4337
-					$translation_texts[] = stripslashes_deep( $row->front_search_title );
4336
+				if (!empty($row->front_search_title)) {
4337
+					$translation_texts[] = stripslashes_deep($row->front_search_title);
4338 4338
 				}
4339 4339
 
4340
-				if ( ! empty( $row->field_desc ) ) {
4341
-					$translation_texts[] = stripslashes_deep( $row->field_desc );
4340
+				if (!empty($row->field_desc)) {
4341
+					$translation_texts[] = stripslashes_deep($row->field_desc);
4342 4342
 				}
4343 4343
 			}
4344 4344
 		}
4345 4345
 	}
4346 4346
 
4347
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
4347
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
4348 4348
 
4349 4349
 	return $translation_texts;
4350 4350
 }
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
 	 *
4367 4367
 	 * @param array $geodir_allowed_mime_types and file extensions.
4368 4368
 	 */
4369
-	return apply_filters( 'geodir_allowed_mime_types', array(
4369
+	return apply_filters('geodir_allowed_mime_types', array(
4370 4370
 			'Image'       => array( // Image formats.
4371 4371
 				'jpg'  => 'image/jpeg',
4372 4372
 				'jpe'  => 'image/jpeg',
@@ -4434,18 +4434,18 @@  discard block
 block discarded – undo
4434 4434
  *
4435 4435
  * @return string User display name.
4436 4436
  */
4437
-function geodir_get_client_name( $user_id ) {
4437
+function geodir_get_client_name($user_id) {
4438 4438
 	$client_name = '';
4439 4439
 
4440
-	$user_data = get_userdata( $user_id );
4440
+	$user_data = get_userdata($user_id);
4441 4441
 
4442
-	if ( ! empty( $user_data ) ) {
4443
-		if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
4444
-			$client_name = trim( $user_data->display_name );
4445
-		} else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
4446
-			$client_name = trim( $user_data->user_nicename );
4442
+	if (!empty($user_data)) {
4443
+		if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
4444
+			$client_name = trim($user_data->display_name);
4445
+		} else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
4446
+			$client_name = trim($user_data->user_nicename);
4447 4447
 		} else {
4448
-			$client_name = trim( $user_data->user_login );
4448
+			$client_name = trim($user_data->user_login);
4449 4449
 		}
4450 4450
 	}
4451 4451
 
@@ -4453,19 +4453,19 @@  discard block
 block discarded – undo
4453 4453
 }
4454 4454
 
4455 4455
 
4456
-add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 );
4456
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
4457 4457
 /*
4458 4458
  * Add location variables to wpseo replacements.
4459 4459
  *
4460 4460
  * @since 1.5.4
4461 4461
  */
4462
-function geodir_wpseo_replacements( $vars ) {
4462
+function geodir_wpseo_replacements($vars) {
4463 4463
 
4464 4464
 	global $wp;
4465 4465
 	$title = '';
4466 4466
 	// location variables
4467 4467
 	$gd_post_type   = geodir_get_current_posttype();
4468
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4468
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4469 4469
 	/**
4470 4470
 	 * Filter the title variables location variables array
4471 4471
 	 *
@@ -4475,105 +4475,105 @@  discard block
 block discarded – undo
4475 4475
 	 * @param array $location_array The array of location variables.
4476 4476
 	 * @param array $vars           The page title variables.
4477 4477
 	 */
4478
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars );
4478
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
4479 4479
 	$location_titles = array();
4480
-	if ( get_query_var( 'gd_country_full' ) ) {
4481
-		if ( get_query_var( 'gd_country_full' ) ) {
4482
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4480
+	if (get_query_var('gd_country_full')) {
4481
+		if (get_query_var('gd_country_full')) {
4482
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4483 4483
 		}
4484
-		if ( get_query_var( 'gd_region_full' ) ) {
4485
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4484
+		if (get_query_var('gd_region_full')) {
4485
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4486 4486
 		}
4487
-		if ( get_query_var( 'gd_city_full' ) ) {
4488
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4487
+		if (get_query_var('gd_city_full')) {
4488
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4489 4489
 		}
4490 4490
 	}
4491 4491
 	$location_single = '';
4492
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4493
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4494
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4492
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4493
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4494
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4495 4495
 
4496 4496
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4497 4497
 
4498
-	if ( function_exists( 'get_actual_location_name' ) ) {
4499
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4500
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4501
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4498
+	if (function_exists('get_actual_location_name')) {
4499
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4500
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4501
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4502 4502
 	}
4503 4503
 
4504
-	if ( $gd_city != '' ) {
4505
-		if ( $gd_city_actual != '' ) {
4504
+	if ($gd_city != '') {
4505
+		if ($gd_city_actual != '') {
4506 4506
 			$gd_city = $gd_city_actual;
4507 4507
 		} else {
4508
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4509
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4510
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4508
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4509
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4510
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4511 4511
 		}
4512 4512
 		$location_single = $gd_city;
4513 4513
 
4514
-	} else if ( $gd_region != '' ) {
4515
-		if ( $gd_region_actual != '' ) {
4514
+	} else if ($gd_region != '') {
4515
+		if ($gd_region_actual != '') {
4516 4516
 			$gd_region = $gd_region_actual;
4517 4517
 		} else {
4518
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4519
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4520
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4518
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4519
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4520
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4521 4521
 		}
4522 4522
 
4523 4523
 		$location_single = $gd_region;
4524
-	} else if ( $gd_country != '' ) {
4525
-		if ( $gd_country_actual != '' ) {
4524
+	} else if ($gd_country != '') {
4525
+		if ($gd_country_actual != '') {
4526 4526
 			$gd_country = $gd_country_actual;
4527 4527
 		} else {
4528
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4529
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4530
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4528
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4529
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4530
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4531 4531
 		}
4532 4532
 
4533 4533
 		$location_single = $gd_country;
4534 4534
 	}
4535 4535
 
4536
-	if ( ! empty( $location_array ) ) {
4536
+	if (!empty($location_array)) {
4537 4537
 
4538
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4539
-		$location_array       = array_reverse( $location_array );
4538
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4539
+		$location_array       = array_reverse($location_array);
4540 4540
 
4541
-		foreach ( $location_array as $location_type => $location ) {
4542
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4543
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4541
+		foreach ($location_array as $location_type => $location) {
4542
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4543
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4544 4544
 
4545
-			$location_name = geodir_ucwords( $gd_location_link_text );
4546
-			$location_name = __( $location_name, 'geodirectory' );
4545
+			$location_name = geodir_ucwords($gd_location_link_text);
4546
+			$location_name = __($location_name, 'geodirectory');
4547 4547
 
4548
-			if ( $actual_location_name ) {
4549
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4550
-				$location_name = get_actual_location_name( $location_type, $location, true );
4548
+			if ($actual_location_name) {
4549
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4550
+				$location_name = get_actual_location_name($location_type, $location, true);
4551 4551
 			}
4552 4552
 
4553 4553
 			$location_titles[] = $location_name;
4554 4554
 		}
4555
-		if ( ! empty( $location_titles ) ) {
4556
-			$location_titles = array_unique( $location_titles );
4555
+		if (!empty($location_titles)) {
4556
+			$location_titles = array_unique($location_titles);
4557 4557
 		}
4558 4558
 	}
4559 4559
 
4560 4560
 
4561
-	if ( ! empty( $location_titles ) ) {
4562
-		$vars['%%location%%'] = implode( ", ", $location_titles );
4561
+	if (!empty($location_titles)) {
4562
+		$vars['%%location%%'] = implode(", ", $location_titles);
4563 4563
 	}
4564 4564
 
4565 4565
 
4566
-	if ( ! empty( $location_titles ) ) {
4567
-		$vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4566
+	if (!empty($location_titles)) {
4567
+		$vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
4568 4568
 	}
4569 4569
 
4570 4570
 
4571
-	if ( $location_single ) {
4572
-		$vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4571
+	if ($location_single) {
4572
+		$vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
4573 4573
 	}
4574 4574
 
4575 4575
 
4576
-	if ( $location_single ) {
4576
+	if ($location_single) {
4577 4577
 		$vars['%%location_single%%'] = $location_single;
4578 4578
 	}
4579 4579
 
@@ -4586,13 +4586,13 @@  discard block
 block discarded – undo
4586 4586
 	 * @param string $vars          The title with variables.
4587 4587
 	 * @param array $location_array The array of location variables.
4588 4588
 	 */
4589
-	return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array );
4589
+	return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
4590 4590
 }
4591 4591
 
4592 4592
 
4593
-add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 );
4594
-add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 );
4595
-add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 );
4593
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
4594
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
4595
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
4596 4596
 
4597 4597
 /**
4598 4598
  * Filter the title variables.
@@ -4634,14 +4634,14 @@  discard block
 block discarded – undo
4634 4634
  *
4635 4635
  * @return string Title after filtered variables.
4636 4636
  */
4637
-function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
4637
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
4638 4638
 	global $wp, $post;
4639 4639
 
4640
-	if ( ! $gd_page || ! $title ) {
4640
+	if (!$gd_page || !$title) {
4641 4641
 		return $title; // if no a GD page then bail.
4642 4642
 	}
4643 4643
 
4644
-	if ( $sep == '' ) {
4644
+	if ($sep == '') {
4645 4645
 		/**
4646 4646
 		 * Filter the page title separator.
4647 4647
 		 *
@@ -4650,100 +4650,100 @@  discard block
 block discarded – undo
4650 4650
 		 *
4651 4651
 		 * @param string $sep The separator, default: `|`.
4652 4652
 		 */
4653
-		$sep = apply_filters( 'geodir_page_title_separator', '|' );
4653
+		$sep = apply_filters('geodir_page_title_separator', '|');
4654 4654
 	}
4655 4655
 
4656
-	if ( strpos( $title, '%%title%%' ) !== false ) {
4657
-		$title = str_replace( "%%title%%", $post->post_title, $title );
4656
+	if (strpos($title, '%%title%%') !== false) {
4657
+		$title = str_replace("%%title%%", $post->post_title, $title);
4658 4658
 	}
4659 4659
 
4660
-	if ( strpos( $title, '%%sitename%%' ) !== false ) {
4661
-		$title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title );
4660
+	if (strpos($title, '%%sitename%%') !== false) {
4661
+		$title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
4662 4662
 	}
4663 4663
 
4664
-	if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
4665
-		$title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title );
4664
+	if (strpos($title, '%%sitedesc%%') !== false) {
4665
+		$title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
4666 4666
 	}
4667 4667
 
4668
-	if ( strpos( $title, '%%excerpt%%' ) !== false ) {
4669
-		$title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title );
4668
+	if (strpos($title, '%%excerpt%%') !== false) {
4669
+		$title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
4670 4670
 	}
4671 4671
 
4672
-	if ( $gd_page == 'search' || $gd_page == 'author' ) {
4673
-		$post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : '';
4674
-	} else if ( $gd_page == 'add-listing' ) {
4675
-		$post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : '';
4676
-		$post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type;
4677
-	} else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
4672
+	if ($gd_page == 'search' || $gd_page == 'author') {
4673
+		$post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : '';
4674
+	} else if ($gd_page == 'add-listing') {
4675
+		$post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : '';
4676
+		$post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type;
4677
+	} else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
4678 4678
 		$post_type = $post->post_type;
4679 4679
 	} else {
4680
-		$post_type = get_query_var( 'post_type' );
4680
+		$post_type = get_query_var('post_type');
4681 4681
 	}
4682 4682
 
4683
-	if ( strpos( $title, '%%pt_single%%' ) !== false ) {
4683
+	if (strpos($title, '%%pt_single%%') !== false) {
4684 4684
 		$singular_name = '';
4685
-		if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
4686
-			$singular_name = __( $singular_name, 'geodirectory' );
4685
+		if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
4686
+			$singular_name = __($singular_name, 'geodirectory');
4687 4687
 		}
4688 4688
 
4689
-		$title = str_replace( "%%pt_single%%", $singular_name, $title );
4689
+		$title = str_replace("%%pt_single%%", $singular_name, $title);
4690 4690
 	}
4691 4691
 
4692
-	if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
4692
+	if (strpos($title, '%%pt_plural%%') !== false) {
4693 4693
 		$plural_name = '';
4694
-		if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
4695
-			$plural_name = __( $plural_name, 'geodirectory' );
4694
+		if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
4695
+			$plural_name = __($plural_name, 'geodirectory');
4696 4696
 		}
4697 4697
 
4698
-		$title = str_replace( "%%pt_plural%%", $plural_name, $title );
4698
+		$title = str_replace("%%pt_plural%%", $plural_name, $title);
4699 4699
 	}
4700 4700
 
4701
-	if ( strpos( $title, '%%category%%' ) !== false ) {
4701
+	if (strpos($title, '%%category%%') !== false) {
4702 4702
 		$cat_name = '';
4703 4703
 
4704
-		if ( $gd_page == 'detail' ) {
4705
-			if ( $post->default_category ) {
4706
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4707
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4704
+		if ($gd_page == 'detail') {
4705
+			if ($post->default_category) {
4706
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4707
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4708 4708
 			}
4709
-		} else if ( $gd_page == 'listing' ) {
4709
+		} else if ($gd_page == 'listing') {
4710 4710
 			$queried_object = get_queried_object();
4711
-			if ( isset( $queried_object->name ) ) {
4711
+			if (isset($queried_object->name)) {
4712 4712
 				$cat_name = $queried_object->name;
4713 4713
 			}
4714 4714
 		}
4715
-		$title = str_replace( "%%category%%", $cat_name, $title );
4715
+		$title = str_replace("%%category%%", $cat_name, $title);
4716 4716
 	}
4717 4717
 
4718
-	if ( strpos( $title, '%%tag%%' ) !== false ) {
4718
+	if (strpos($title, '%%tag%%') !== false) {
4719 4719
 		$cat_name = '';
4720 4720
 
4721
-		if ( $gd_page == 'detail' ) {
4722
-			if ( $post->default_category ) {
4723
-				$cat      = get_term( $post->default_category, $post->post_type . 'category' );
4724
-				$cat_name = ( isset( $cat->name ) ) ? $cat->name : '';
4721
+		if ($gd_page == 'detail') {
4722
+			if ($post->default_category) {
4723
+				$cat      = get_term($post->default_category, $post->post_type.'category');
4724
+				$cat_name = (isset($cat->name)) ? $cat->name : '';
4725 4725
 			}
4726
-		} else if ( $gd_page == 'listing' ) {
4726
+		} else if ($gd_page == 'listing') {
4727 4727
 			$queried_object = get_queried_object();
4728
-			if ( isset( $queried_object->name ) ) {
4728
+			if (isset($queried_object->name)) {
4729 4729
 				$cat_name = $queried_object->name;
4730 4730
 			}
4731 4731
 		}
4732
-		$title = str_replace( "%%tag%%", $cat_name, $title );
4732
+		$title = str_replace("%%tag%%", $cat_name, $title);
4733 4733
 	}
4734 4734
 
4735
-	if ( strpos( $title, '%%id%%' ) !== false ) {
4736
-		$ID    = ( isset( $post->ID ) ) ? $post->ID : '';
4737
-		$title = str_replace( "%%id%%", $ID, $title );
4735
+	if (strpos($title, '%%id%%') !== false) {
4736
+		$ID    = (isset($post->ID)) ? $post->ID : '';
4737
+		$title = str_replace("%%id%%", $ID, $title);
4738 4738
 	}
4739 4739
 
4740
-	if ( strpos( $title, '%%sep%%' ) !== false ) {
4741
-		$title = str_replace( "%%sep%%", $sep, $title );
4740
+	if (strpos($title, '%%sep%%') !== false) {
4741
+		$title = str_replace("%%sep%%", $sep, $title);
4742 4742
 	}
4743 4743
 
4744 4744
 	// location variables
4745 4745
 	$gd_post_type   = geodir_get_current_posttype();
4746
-	$location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type );
4746
+	$location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
4747 4747
 	/**
4748 4748
 	 * Filter the title variables location variables array
4749 4749
 	 *
@@ -4755,166 +4755,166 @@  discard block
 block discarded – undo
4755 4755
 	 * @param string $gd_page       The page being filtered.
4756 4756
 	 * @param string $sep           The separator, default: `|`.
4757 4757
 	 */
4758
-	$location_array  = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep );
4758
+	$location_array  = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4759 4759
 	$location_titles = array();
4760
-	if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
4761
-		if ( get_query_var( 'gd_country_full' ) ) {
4762
-			$location_array['gd_country'] = get_query_var( 'gd_country_full' );
4760
+	if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4761
+		if (get_query_var('gd_country_full')) {
4762
+			$location_array['gd_country'] = get_query_var('gd_country_full');
4763 4763
 		}
4764
-		if ( get_query_var( 'gd_region_full' ) ) {
4765
-			$location_array['gd_region'] = get_query_var( 'gd_region_full' );
4764
+		if (get_query_var('gd_region_full')) {
4765
+			$location_array['gd_region'] = get_query_var('gd_region_full');
4766 4766
 		}
4767
-		if ( get_query_var( 'gd_city_full' ) ) {
4768
-			$location_array['gd_city'] = get_query_var( 'gd_city_full' );
4767
+		if (get_query_var('gd_city_full')) {
4768
+			$location_array['gd_city'] = get_query_var('gd_city_full');
4769 4769
 		}
4770 4770
 	}
4771 4771
 	$location_single = '';
4772
-	$gd_country      = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : '';
4773
-	$gd_region       = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : '';
4774
-	$gd_city         = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : '';
4772
+	$gd_country      = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
4773
+	$gd_region       = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
4774
+	$gd_city         = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
4775 4775
 
4776 4776
 	$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
4777 4777
 
4778
-	if ( function_exists( 'get_actual_location_name' ) ) {
4779
-		$gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country;
4780
-		$gd_region_actual  = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region;
4781
-		$gd_city_actual    = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city;
4778
+	if (function_exists('get_actual_location_name')) {
4779
+		$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
4780
+		$gd_region_actual  = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
4781
+		$gd_city_actual    = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
4782 4782
 	}
4783 4783
 
4784
-	if ( $gd_city != '' ) {
4785
-		if ( $gd_city_actual != '' ) {
4784
+	if ($gd_city != '') {
4785
+		if ($gd_city_actual != '') {
4786 4786
 			$gd_city = $gd_city_actual;
4787 4787
 		} else {
4788
-			$gd_city = preg_replace( '/-(\d+)$/', '', $gd_city );
4789
-			$gd_city = preg_replace( '/[_-]/', ' ', $gd_city );
4790
-			$gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' );
4788
+			$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
4789
+			$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
4790
+			$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
4791 4791
 		}
4792 4792
 		$location_single = $gd_city;
4793 4793
 
4794
-	} else if ( $gd_region != '' ) {
4795
-		if ( $gd_region_actual != '' ) {
4794
+	} else if ($gd_region != '') {
4795
+		if ($gd_region_actual != '') {
4796 4796
 			$gd_region = $gd_region_actual;
4797 4797
 		} else {
4798
-			$gd_region = preg_replace( '/-(\d+)$/', '', $gd_region );
4799
-			$gd_region = preg_replace( '/[_-]/', ' ', $gd_region );
4800
-			$gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' );
4798
+			$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
4799
+			$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
4800
+			$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
4801 4801
 		}
4802 4802
 
4803 4803
 		$location_single = $gd_region;
4804
-	} else if ( $gd_country != '' ) {
4805
-		if ( $gd_country_actual != '' ) {
4804
+	} else if ($gd_country != '') {
4805
+		if ($gd_country_actual != '') {
4806 4806
 			$gd_country = $gd_country_actual;
4807 4807
 		} else {
4808
-			$gd_country = preg_replace( '/-(\d+)$/', '', $gd_country );
4809
-			$gd_country = preg_replace( '/[_-]/', ' ', $gd_country );
4810
-			$gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' );
4808
+			$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
4809
+			$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
4810
+			$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
4811 4811
 		}
4812 4812
 
4813 4813
 		$location_single = $gd_country;
4814 4814
 	}
4815 4815
 
4816
-	if ( ! empty( $location_array ) ) {
4816
+	if (!empty($location_array)) {
4817 4817
 
4818
-		$actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false;
4819
-		$location_array       = array_reverse( $location_array );
4818
+		$actual_location_name = function_exists('get_actual_location_name') ? true : false;
4819
+		$location_array       = array_reverse($location_array);
4820 4820
 
4821
-		foreach ( $location_array as $location_type => $location ) {
4822
-			$gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location );
4823
-			$gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text );
4821
+		foreach ($location_array as $location_type => $location) {
4822
+			$gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4823
+			$gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4824 4824
 
4825
-			$location_name = geodir_ucwords( $gd_location_link_text );
4826
-			$location_name = __( $location_name, 'geodirectory' );
4825
+			$location_name = geodir_ucwords($gd_location_link_text);
4826
+			$location_name = __($location_name, 'geodirectory');
4827 4827
 
4828
-			if ( $actual_location_name ) {
4829
-				$location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type;
4830
-				$location_name = get_actual_location_name( $location_type, $location, true );
4828
+			if ($actual_location_name) {
4829
+				$location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4830
+				$location_name = get_actual_location_name($location_type, $location, true);
4831 4831
 			}
4832 4832
 
4833 4833
 			$location_titles[] = $location_name;
4834 4834
 		}
4835
-		if ( ! empty( $location_titles ) ) {
4836
-			$location_titles = array_unique( $location_titles );
4835
+		if (!empty($location_titles)) {
4836
+			$location_titles = array_unique($location_titles);
4837 4837
 		}
4838 4838
 	}
4839 4839
 
4840 4840
 
4841
-	if ( strpos( $title, '%%location%%' ) !== false ) {
4841
+	if (strpos($title, '%%location%%') !== false) {
4842 4842
 		$location = '';
4843
-		if ( $location_titles ) {
4844
-			$location = implode( ", ", $location_titles );
4843
+		if ($location_titles) {
4844
+			$location = implode(", ", $location_titles);
4845 4845
 		}
4846
-		$title = str_replace( "%%location%%", $location, $title );
4846
+		$title = str_replace("%%location%%", $location, $title);
4847 4847
 	}
4848 4848
 
4849
-	if ( strpos( $title, '%%in_location%%' ) !== false ) {
4849
+	if (strpos($title, '%%in_location%%') !== false) {
4850 4850
 		$location = '';
4851
-		if ( $location_titles ) {
4852
-			$location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles );
4851
+		if ($location_titles) {
4852
+			$location = __('in ', 'geodirectory').implode(", ", $location_titles);
4853 4853
 		}
4854
-		$title = str_replace( "%%in_location%%", $location, $title );
4854
+		$title = str_replace("%%in_location%%", $location, $title);
4855 4855
 	}
4856 4856
 
4857
-	if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
4858
-		if ( $location_single ) {
4859
-			$location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single;
4857
+	if (strpos($title, '%%in_location_single%%') !== false) {
4858
+		if ($location_single) {
4859
+			$location_single = __('in', 'geodirectory').' '.$location_single;
4860 4860
 		}
4861
-		$title = str_replace( "%%in_location_single%%", $location_single, $title );
4861
+		$title = str_replace("%%in_location_single%%", $location_single, $title);
4862 4862
 	}
4863 4863
 
4864
-	if ( strpos( $title, '%%location_single%%' ) !== false ) {
4865
-		$title = str_replace( "%%location_single%%", $location_single, $title );
4864
+	if (strpos($title, '%%location_single%%') !== false) {
4865
+		$title = str_replace("%%location_single%%", $location_single, $title);
4866 4866
 	}
4867 4867
 
4868 4868
 
4869
-	if ( strpos( $title, '%%search_term%%' ) !== false ) {
4869
+	if (strpos($title, '%%search_term%%') !== false) {
4870 4870
 		$search_term = '';
4871
-		if ( isset( $_REQUEST['s'] ) ) {
4872
-			$search_term = esc_attr( $_REQUEST['s'] );
4871
+		if (isset($_REQUEST['s'])) {
4872
+			$search_term = esc_attr($_REQUEST['s']);
4873 4873
 		}
4874
-		$title = str_replace( "%%search_term%%", $search_term, $title );
4874
+		$title = str_replace("%%search_term%%", $search_term, $title);
4875 4875
 	}
4876 4876
 
4877
-	if ( strpos( $title, '%%search_near%%' ) !== false ) {
4877
+	if (strpos($title, '%%search_near%%') !== false) {
4878 4878
 		$search_term = '';
4879
-		if ( isset( $_REQUEST['snear'] ) ) {
4880
-			$search_term = esc_attr( $_REQUEST['snear'] );
4879
+		if (isset($_REQUEST['snear'])) {
4880
+			$search_term = esc_attr($_REQUEST['snear']);
4881 4881
 		}
4882
-		$title = str_replace( "%%search_near%%", $search_term, $title );
4882
+		$title = str_replace("%%search_near%%", $search_term, $title);
4883 4883
 	}
4884 4884
 
4885
-	if ( strpos( $title, '%%name%%' ) !== false ) {
4886
-		if ( is_author() ) {
4887
-			$curauth     = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
4885
+	if (strpos($title, '%%name%%') !== false) {
4886
+		if (is_author()) {
4887
+			$curauth     = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
4888 4888
 			$author_name = $curauth->display_name;
4889 4889
 		} else {
4890 4890
 			$author_name = get_the_author();
4891 4891
 		}
4892
-		if ( ! $author_name || $author_name === '' ) {
4892
+		if (!$author_name || $author_name === '') {
4893 4893
 			$queried_object = get_queried_object();
4894 4894
 
4895
-			if ( isset( $queried_object->data->user_nicename ) ) {
4895
+			if (isset($queried_object->data->user_nicename)) {
4896 4896
 				$author_name = $queried_object->data->display_name;
4897 4897
 			}
4898 4898
 		}
4899
-		$title = str_replace( "%%name%%", $author_name, $title );
4899
+		$title = str_replace("%%name%%", $author_name, $title);
4900 4900
 	}
4901 4901
 
4902
-	if ( strpos( $title, '%%page%%' ) !== false ) {
4903
-		$page  = geodir_title_meta_page( $sep );
4904
-		$title = str_replace( "%%page%%", $page, $title );
4902
+	if (strpos($title, '%%page%%') !== false) {
4903
+		$page  = geodir_title_meta_page($sep);
4904
+		$title = str_replace("%%page%%", $page, $title);
4905 4905
 	}
4906
-	if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
4906
+	if (strpos($title, '%%pagenumber%%') !== false) {
4907 4907
 		$pagenumber = geodir_title_meta_pagenumber();
4908
-		$title      = str_replace( "%%pagenumber%%", $pagenumber, $title );
4908
+		$title      = str_replace("%%pagenumber%%", $pagenumber, $title);
4909 4909
 	}
4910
-	if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
4910
+	if (strpos($title, '%%pagetotal%%') !== false) {
4911 4911
 		$pagetotal = geodir_title_meta_pagetotal();
4912
-		$title     = str_replace( "%%pagetotal%%", $pagetotal, $title );
4912
+		$title     = str_replace("%%pagetotal%%", $pagetotal, $title);
4913 4913
 	}
4914 4914
 
4915
-	$title = wptexturize( $title );
4916
-	$title = convert_chars( $title );
4917
-	$title = esc_html( $title );
4915
+	$title = wptexturize($title);
4916
+	$title = convert_chars($title);
4917
+	$title = esc_html($title);
4918 4918
 
4919 4919
 	/**
4920 4920
 	 * Filter the title variables after standard ones have been filtered.
@@ -4928,7 +4928,7 @@  discard block
 block discarded – undo
4928 4928
 	 * @param string $sep           The separator, default: `|`.
4929 4929
 	 */
4930 4930
 
4931
-	return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep );
4931
+	return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4932 4932
 }
4933 4933
 
4934 4934
 /**
@@ -4941,82 +4941,82 @@  discard block
 block discarded – undo
4941 4941
  *
4942 4942
  * @return array Translation texts.
4943 4943
  */
4944
-function geodir_load_cpt_text_translation( $translation_texts = array() ) {
4945
-	$gd_post_types = geodir_get_posttypes( 'array' );
4944
+function geodir_load_cpt_text_translation($translation_texts = array()) {
4945
+	$gd_post_types = geodir_get_posttypes('array');
4946 4946
 
4947
-	if ( ! empty( $gd_post_types ) ) {
4948
-		foreach ( $gd_post_types as $post_type => $cpt_info ) {
4949
-			$labels      = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : '';
4950
-			$description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : '';
4951
-			$seo         = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : '';
4947
+	if (!empty($gd_post_types)) {
4948
+		foreach ($gd_post_types as $post_type => $cpt_info) {
4949
+			$labels      = isset($cpt_info['labels']) ? $cpt_info['labels'] : '';
4950
+			$description = isset($cpt_info['description']) ? $cpt_info['description'] : '';
4951
+			$seo         = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4952 4952
 
4953
-			if ( ! empty( $labels ) ) {
4954
-				if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
4953
+			if (!empty($labels)) {
4954
+				if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4955 4955
 					$translation_texts[] = $labels['name'];
4956 4956
 				}
4957
-				if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
4957
+				if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4958 4958
 					$translation_texts[] = $labels['singular_name'];
4959 4959
 				}
4960
-				if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
4960
+				if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4961 4961
 					$translation_texts[] = $labels['add_new'];
4962 4962
 				}
4963
-				if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
4963
+				if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4964 4964
 					$translation_texts[] = $labels['add_new_item'];
4965 4965
 				}
4966
-				if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
4966
+				if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4967 4967
 					$translation_texts[] = $labels['edit_item'];
4968 4968
 				}
4969
-				if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
4969
+				if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4970 4970
 					$translation_texts[] = $labels['new_item'];
4971 4971
 				}
4972
-				if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
4972
+				if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4973 4973
 					$translation_texts[] = $labels['view_item'];
4974 4974
 				}
4975
-				if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
4975
+				if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4976 4976
 					$translation_texts[] = $labels['search_items'];
4977 4977
 				}
4978
-				if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
4978
+				if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4979 4979
 					$translation_texts[] = $labels['not_found'];
4980 4980
 				}
4981
-				if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
4981
+				if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4982 4982
 					$translation_texts[] = $labels['not_found_in_trash'];
4983 4983
 				}
4984
-				if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
4984
+				if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4985 4985
 					$translation_texts[] = $labels['label_post_profile'];
4986 4986
 				}
4987
-				if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
4987
+				if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4988 4988
 					$translation_texts[] = $labels['label_post_info'];
4989 4989
 				}
4990
-				if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
4990
+				if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4991 4991
 					$translation_texts[] = $labels['label_post_images'];
4992 4992
 				}
4993
-				if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
4993
+				if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4994 4994
 					$translation_texts[] = $labels['label_post_map'];
4995 4995
 				}
4996
-				if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
4996
+				if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4997 4997
 					$translation_texts[] = $labels['label_reviews'];
4998 4998
 				}
4999
-				if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
4999
+				if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
5000 5000
 					$translation_texts[] = $labels['label_related_listing'];
5001 5001
 				}
5002 5002
 			}
5003 5003
 
5004
-			if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
5005
-				$translation_texts[] = normalize_whitespace( $description );
5004
+			if ($description != '' && !in_array($description, $translation_texts)) {
5005
+				$translation_texts[] = normalize_whitespace($description);
5006 5006
 			}
5007 5007
 
5008
-			if ( ! empty( $seo ) ) {
5009
-				if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
5010
-					$translation_texts[] = normalize_whitespace( $seo['meta_keyword'] );
5008
+			if (!empty($seo)) {
5009
+				if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
5010
+					$translation_texts[] = normalize_whitespace($seo['meta_keyword']);
5011 5011
 				}
5012 5012
 
5013
-				if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
5014
-					$translation_texts[] = normalize_whitespace( $seo['meta_description'] );
5013
+				if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
5014
+					$translation_texts[] = normalize_whitespace($seo['meta_description']);
5015 5015
 				}
5016 5016
 			}
5017 5017
 		}
5018 5018
 	}
5019
-	$translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts;
5019
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
5020 5020
 
5021 5021
 	return $translation_texts;
5022 5022
 }
@@ -5031,27 +5031,27 @@  discard block
 block discarded – undo
5031 5031
  *
5032 5032
  * @return array Location terms.
5033 5033
  */
5034
-function geodir_remove_location_terms( $location_terms = array() ) {
5035
-	$location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false;
5034
+function geodir_remove_location_terms($location_terms = array()) {
5035
+	$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
5036 5036
 
5037
-	if ( ! empty( $location_terms ) && $location_manager ) {
5038
-		$hide_country_part = get_option( 'geodir_location_hide_country_part' );
5039
-		$hide_region_part  = get_option( 'geodir_location_hide_region_part' );
5037
+	if (!empty($location_terms) && $location_manager) {
5038
+		$hide_country_part = get_option('geodir_location_hide_country_part');
5039
+		$hide_region_part  = get_option('geodir_location_hide_region_part');
5040 5040
 
5041
-		if ( $hide_region_part && $hide_country_part ) {
5042
-			if ( isset( $location_terms['gd_country'] ) ) {
5043
-				unset( $location_terms['gd_country'] );
5041
+		if ($hide_region_part && $hide_country_part) {
5042
+			if (isset($location_terms['gd_country'])) {
5043
+				unset($location_terms['gd_country']);
5044 5044
 			}
5045
-			if ( isset( $location_terms['gd_region'] ) ) {
5046
-				unset( $location_terms['gd_region'] );
5045
+			if (isset($location_terms['gd_region'])) {
5046
+				unset($location_terms['gd_region']);
5047 5047
 			}
5048
-		} else if ( $hide_region_part && ! $hide_country_part ) {
5049
-			if ( isset( $location_terms['gd_region'] ) ) {
5050
-				unset( $location_terms['gd_region'] );
5048
+		} else if ($hide_region_part && !$hide_country_part) {
5049
+			if (isset($location_terms['gd_region'])) {
5050
+				unset($location_terms['gd_region']);
5051 5051
 			}
5052
-		} else if ( ! $hide_region_part && $hide_country_part ) {
5053
-			if ( isset( $location_terms['gd_country'] ) ) {
5054
-				unset( $location_terms['gd_country'] );
5052
+		} else if (!$hide_region_part && $hide_country_part) {
5053
+			if (isset($location_terms['gd_country'])) {
5054
+				unset($location_terms['gd_country']);
5055 5055
 			}
5056 5056
 		}
5057 5057
 	}
@@ -5069,33 +5069,33 @@  discard block
 block discarded – undo
5069 5069
  * @param WP_Post $post Post object.
5070 5070
  * @param bool $update  Whether this is an existing listing being updated or not.
5071 5071
  */
5072
-function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
5073
-	if ( ! $update ) {
5072
+function geodir_on_wp_insert_post($post_ID, $post, $update) {
5073
+	if (!$update) {
5074 5074
 		return;
5075 5075
 	}
5076 5076
 
5077
-	$action      = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
5078
-	$is_admin    = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false;
5077
+	$action      = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
5078
+	$is_admin    = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
5079 5079
 	$inline_save = $action == 'inline-save' ? true : false;
5080 5080
 
5081
-	if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
5081
+	if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
5082 5082
 		return;
5083 5083
 	}
5084 5084
 
5085
-	if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
5085
+	if ($action != '' && in_array($action, array('geodir_import_export'))) {
5086 5086
 		return;
5087 5087
 	}
5088 5088
 
5089 5089
 	$user_id = (int) get_current_user_id();
5090 5090
 
5091
-	if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
5092
-		$author_id = ! empty( $post->post_author ) ? $post->post_author : 0;
5091
+	if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
5092
+		$author_id = !empty($post->post_author) ? $post->post_author : 0;
5093 5093
 
5094
-		if ( $user_id == $author_id && ! is_super_admin() ) {
5095
-			$from_email   = get_option( 'site_email' );
5094
+		if ($user_id == $author_id && !is_super_admin()) {
5095
+			$from_email   = get_option('site_email');
5096 5096
 			$from_name    = get_site_emailName();
5097
-			$to_email     = get_option( 'admin_email' );
5098
-			$to_name      = get_option( 'name' );
5097
+			$to_email     = get_option('admin_email');
5098
+			$to_name      = get_option('name');
5099 5099
 			$message_type = 'listing_edited';
5100 5100
 
5101 5101
 			$notify_edited = true;
@@ -5107,9 +5107,9 @@  discard block
 block discarded – undo
5107 5107
 			 * @param bool $notify_edited Notify on listing edited by author?
5108 5108
 			 * @param object $post        The current post object.
5109 5109
 			 */
5110
-			$notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post );
5110
+			$notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
5111 5111
 
5112
-			geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID );
5112
+			geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
5113 5113
 		}
5114 5114
 	}
5115 5115
 }
@@ -5124,14 +5124,14 @@  discard block
 block discarded – undo
5124 5124
  *
5125 5125
  * @return string|null The current page start & end numbering.
5126 5126
  */
5127
-function geodir_title_meta_page( $sep ) {
5127
+function geodir_title_meta_page($sep) {
5128 5128
 	$replacement = null;
5129 5129
 
5130
-	$max = geodir_title_meta_pagenumbering( 'max' );
5131
-	$nr  = geodir_title_meta_pagenumbering( 'nr' );
5130
+	$max = geodir_title_meta_pagenumbering('max');
5131
+	$nr  = geodir_title_meta_pagenumbering('nr');
5132 5132
 
5133
-	if ( $max > 1 && $nr > 1 ) {
5134
-		$replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max );
5133
+	if ($max > 1 && $nr > 1) {
5134
+		$replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
5135 5135
 	}
5136 5136
 
5137 5137
 	return $replacement;
@@ -5148,8 +5148,8 @@  discard block
 block discarded – undo
5148 5148
 function geodir_title_meta_pagenumber() {
5149 5149
 	$replacement = null;
5150 5150
 
5151
-	$nr = geodir_title_meta_pagenumbering( 'nr' );
5152
-	if ( isset( $nr ) && $nr > 0 ) {
5151
+	$nr = geodir_title_meta_pagenumbering('nr');
5152
+	if (isset($nr) && $nr > 0) {
5153 5153
 		$replacement = (string) $nr;
5154 5154
 	}
5155 5155
 
@@ -5167,8 +5167,8 @@  discard block
 block discarded – undo
5167 5167
 function geodir_title_meta_pagetotal() {
5168 5168
 	$replacement = null;
5169 5169
 
5170
-	$max = geodir_title_meta_pagenumbering( 'max' );
5171
-	if ( isset( $max ) && $max > 0 ) {
5170
+	$max = geodir_title_meta_pagenumbering('max');
5171
+	if (isset($max) && $max > 0) {
5172 5172
 		$replacement = (string) $max;
5173 5173
 	}
5174 5174
 
@@ -5188,36 +5188,36 @@  discard block
 block discarded – undo
5188 5188
  *
5189 5189
  * @return int|null The current page numbering.
5190 5190
  */
5191
-function geodir_title_meta_pagenumbering( $request = 'nr' ) {
5191
+function geodir_title_meta_pagenumbering($request = 'nr') {
5192 5192
 	global $wp_query, $post;
5193 5193
 	$max_num_pages = null;
5194 5194
 	$page_number   = null;
5195 5195
 
5196 5196
 	$max_num_pages = 1;
5197 5197
 
5198
-	if ( ! is_singular() ) {
5199
-		$page_number = get_query_var( 'paged' );
5200
-		if ( $page_number === 0 || $page_number === '' ) {
5198
+	if (!is_singular()) {
5199
+		$page_number = get_query_var('paged');
5200
+		if ($page_number === 0 || $page_number === '') {
5201 5201
 			$page_number = 1;
5202 5202
 		}
5203 5203
 
5204
-		if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
5204
+		if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
5205 5205
 			$max_num_pages = $wp_query->max_num_pages;
5206 5206
 		}
5207 5207
 	} else {
5208
-		$page_number = get_query_var( 'page' );
5209
-		if ( $page_number === 0 || $page_number === '' ) {
5208
+		$page_number = get_query_var('page');
5209
+		if ($page_number === 0 || $page_number === '') {
5210 5210
 			$page_number = 1;
5211 5211
 		}
5212 5212
 
5213
-		if ( isset( $post->post_content ) ) {
5214
-			$max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 );
5213
+		if (isset($post->post_content)) {
5214
+			$max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1);
5215 5215
 		}
5216 5216
 	}
5217 5217
 
5218 5218
 	$return = null;
5219 5219
 
5220
-	switch ( $request ) {
5220
+	switch ($request) {
5221 5221
 		case 'nr':
5222 5222
 			$return = $page_number;
5223 5223
 			break;
@@ -5238,14 +5238,14 @@  discard block
 block discarded – undo
5238 5238
  *
5239 5239
  * @return array Terms.
5240 5240
  */
5241
-function geodir_filter_empty_terms( $terms ) {
5242
-	if ( empty( $terms ) ) {
5241
+function geodir_filter_empty_terms($terms) {
5242
+	if (empty($terms)) {
5243 5243
 		return $terms;
5244 5244
 	}
5245 5245
 
5246 5246
 	$return = array();
5247
-	foreach ( $terms as $term ) {
5248
-		if ( isset( $term->count ) && $term->count > 0 ) {
5247
+	foreach ($terms as $term) {
5248
+		if (isset($term->count) && $term->count > 0) {
5249 5249
 			$return[] = $term;
5250 5250
 		} else {
5251 5251
 			/**
@@ -5256,7 +5256,7 @@  discard block
 block discarded – undo
5256 5256
 			 * @param array $return The array of terms to return.
5257 5257
 			 * @param object $term  The term object.
5258 5258
 			 */
5259
-			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5259
+			$return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
5260 5260
 		}
5261 5261
 	}
5262 5262
 
@@ -5273,12 +5273,12 @@  discard block
 block discarded – undo
5273 5273
  *
5274 5274
  * @return array
5275 5275
  */
5276
-function geodir_remove_hentry( $class ) {
5277
-	if ( geodir_is_page( 'detail' ) ) {
5278
-		$class = array_diff( $class, array( 'hentry' ) );
5276
+function geodir_remove_hentry($class) {
5277
+	if (geodir_is_page('detail')) {
5278
+		$class = array_diff($class, array('hentry'));
5279 5279
 	}
5280 5280
 
5281 5281
 	return $class;
5282 5282
 }
5283 5283
 
5284
-add_filter( 'post_class', 'geodir_remove_hentry' );
5285 5284
\ No newline at end of file
5285
+add_filter('post_class', 'geodir_remove_hentry');
5286 5286
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,10 @@  discard block
 block discarded – undo
29 29
 
30 30
 	if ( is_ssl() ) :
31 31
 		return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
32
-	else :
33
-		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
32
+	else {
33
+		:
34
+		return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) );
35
+	}
34 36
 	endif;
35 37
 }
36 38
 
@@ -1496,12 +1498,14 @@  discard block
 block discarded – undo
1496 1498
 	 */
1497 1499
 	function geodir_allow_wpadmin() {
1498 1500
 		global $wpdb;
1499
-		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through
1501
+		if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) {
1502
+			// checking action in request to allow ajax request go through
1500 1503
 		{
1501 1504
 			if ( current_user_can( 'administrator' ) ) {
1502 1505
 			} else {
1503 1506
 
1504
-				wp_redirect( home_url() );
1507
+				wp_redirect( home_url() );
1508
+		}
1505 1509
 				exit;
1506 1510
 			}
1507 1511
 
Please login to merge, or discard this patch.
upgrade.php 3 patches
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $wpdb;
11 11
 
12
-if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
12
+if (get_option('geodirectory'.'_db_version') != GEODIRECTORY_VERSION) {
13 13
     /**
14 14
      * Include custom database table related functions.
15 15
      *
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
 
54
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
54
+    add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions
55 55
 
56
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
56
+    update_option('geodirectory'.'_db_version', GEODIRECTORY_VERSION);
57 57
 
58 58
 }
59 59
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
  * @since 1.0.0
89 89
  * @package GeoDirectory
90 90
  */
91
-function geodir_upgrade_146(){
91
+function geodir_upgrade_146() {
92 92
     gd_convert_virtual_pages();
93 93
 }
94 94
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.0
99 99
  * @package GeoDirectory
100 100
  */
101
-function geodir_upgrade_150(){
101
+function geodir_upgrade_150() {
102 102
     gd_fix_cpt_rewrite_slug();
103 103
 }
104 104
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
  * @since 1.4.8
111 111
  * @package GeoDirectory
112 112
  */
113
-function geodir_upgrade_148(){
113
+function geodir_upgrade_148() {
114 114
     /*
115 115
      * Blank the users google password if present as we now use oAuth 2.0
116 116
      */
117
-    update_option('geodir_ga_pass','');
118
-    update_option('geodir_ga_user','');
117
+    update_option('geodir_ga_pass', '');
118
+    update_option('geodir_ga_user', '');
119 119
 
120 120
 }
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
  * @since 1.5.3
127 127
  * @package GeoDirectory
128 128
  */
129
-function geodir_upgrade_153(){
129
+function geodir_upgrade_153() {
130 130
     geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
131 131
     geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
132 132
 }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
  * @since 1.5.3
138 138
  * @package GeoDirectory
139 139
  */
140
-function geodir_upgrade_154(){
140
+function geodir_upgrade_154() {
141 141
     geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
142 142
 }
143 143
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
  * @since 1.5.2
148 148
  * @package GeoDirectory
149 149
  */
150
-function geodir_upgrade_152(){
150
+function geodir_upgrade_152() {
151 151
     gd_fix_address_detail_table_limit();
152 152
 }
153 153
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  * @since 1.6.6
158 158
  * @package GeoDirectory
159 159
  */
160
-function geodir_upgrade_166(){
160
+function geodir_upgrade_166() {
161 161
     gd_convert_custom_field_display();
162 162
 }
163 163
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 function geodir_fix_review_date()
192 192
 {
193 193
     global $wpdb;
194
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
194
+    $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
195 195
 }
196 196
 
197 197
 /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 function geodir_fix_review_post_status()
205 205
 {
206 206
     global $wpdb;
207
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
207
+    $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
208 208
 }
209 209
 
210 210
 /**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 function geodir_fix_review_content()
219 219
 {
220 220
     global $wpdb;
221
-    if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
221
+    if ($wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
222 222
         return true;
223 223
     } else {
224 224
         return false;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         foreach ($all_postypes as $key) {
244 244
             // update each GD CTP
245 245
 
246
-            $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
246
+            $wpdb->query("UPDATE ".GEODIR_REVIEW_TABLE." gdr JOIN ".$wpdb->prefix."geodir_".$key."_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
247 247
 
248 248
         }
249 249
         return true;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     if (!empty($all_postypes)) {
268 268
         foreach ($all_postypes as $key) {
269 269
             // update each GD CTP
270
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
270
+            $reviews = $wpdb->get_results("SELECT post_id FROM ".$wpdb->prefix."geodir_".$key."_detail d");
271 271
 
272 272
             if (!empty($reviews)) {
273 273
                 foreach ($reviews as $post_id) {
@@ -282,49 +282,49 @@  discard block
 block discarded – undo
282 282
 }
283 283
 
284 284
 
285
-function gd_convert_custom_field_display(){
285
+function gd_convert_custom_field_display() {
286 286
     global $wpdb;
287 287
 
288
-    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
288
+    $field_info = $wpdb->get_results("select * from ".GEODIR_CUSTOM_FIELDS_TABLE);
289 289
 
290 290
     $has_run = get_option('gd_convert_custom_field_display');
291
-    if($has_run){return;}
291
+    if ($has_run) {return; }
292 292
 
293 293
 
294 294
 
295
-    if(is_array( $field_info)){
295
+    if (is_array($field_info)) {
296 296
 
297
-        foreach( $field_info as $cf){
297
+        foreach ($field_info as $cf) {
298 298
 
299 299
             $id = $cf->id;
300 300
 
301
-            if(!property_exists($cf,'show_in') || !$id){return;}
301
+            if (!property_exists($cf, 'show_in') || !$id) {return; }
302 302
 
303 303
             $show_in_arr = array();
304 304
 
305
-            if($cf->is_default){
305
+            if ($cf->is_default) {
306 306
                 $show_in_arr[] = "[detail]";
307 307
             }
308 308
 
309
-            if($cf->show_on_detail){
309
+            if ($cf->show_on_detail) {
310 310
                 $show_in_arr[] = "[moreinfo]";
311 311
             }
312 312
 
313
-            if($cf->show_on_listing){
313
+            if ($cf->show_on_listing) {
314 314
                 $show_in_arr[] = "[listing]";
315 315
             }
316 316
 
317
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
317
+            if ($cf->show_as_tab || $cf->htmlvar_name == 'geodir_video' || $cf->htmlvar_name == 'geodir_special_offers') {
318 318
                 $show_in_arr[] = "[owntab]";
319 319
             }
320 320
 
321
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
321
+            if ($cf->htmlvar_name == 'post' || $cf->htmlvar_name == 'geodir_contact' || $cf->htmlvar_name == 'geodir_timing') {
322 322
                 $show_in_arr[] = "[mapbubble]";
323 323
             }
324 324
 
325
-            if(!empty($show_in_arr )){
326
-                $show_in_arr = implode(',',$show_in_arr);
327
-            }else{
325
+            if (!empty($show_in_arr)) {
326
+                $show_in_arr = implode(',', $show_in_arr);
327
+            } else {
328 328
                 $show_in_arr = '';
329 329
             }
330 330
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
         }
334 334
 
335
-        update_option('gd_convert_custom_field_display',1);
335
+        update_option('gd_convert_custom_field_display', 1);
336 336
     }
337 337
 }
338 338
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
     update_option('gd_theme_compats', $theme_compat);
711 711
 
712
-    gd_set_theme_compat();// set the compat pack if avail
712
+    gd_set_theme_compat(); // set the compat pack if avail
713 713
 }
714 714
 
715 715
 
@@ -720,61 +720,61 @@  discard block
 block discarded – undo
720 720
  * @package GeoDirectory
721 721
  * @global object $wpdb WordPress Database object.
722 722
  */
723
-function gd_convert_virtual_pages(){
723
+function gd_convert_virtual_pages() {
724 724
     global $wpdb;
725 725
 
726 726
     // Update the add listing page settings
727 727
     $add_listing_page = $wpdb->get_var(
728 728
         $wpdb->prepare(
729
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
729
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
730 730
             array('add-listing')
731 731
         )
732 732
     );
733 733
 
734
-    if($add_listing_page){
735
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
736
-        update_option( 'geodir_add_listing_page', $add_listing_page);
734
+    if ($add_listing_page) {
735
+        wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish'));
736
+        update_option('geodir_add_listing_page', $add_listing_page);
737 737
     }
738 738
 
739 739
     // Update the listing preview page settings
740 740
     $listing_preview_page = $wpdb->get_var(
741 741
         $wpdb->prepare(
742
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
742
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
743 743
             array('listing-preview')
744 744
         )
745 745
     );
746 746
 
747
-    if($listing_preview_page){
748
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
749
-        update_option( 'geodir_preview_page', $listing_preview_page);
747
+    if ($listing_preview_page) {
748
+        wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish'));
749
+        update_option('geodir_preview_page', $listing_preview_page);
750 750
     }
751 751
 
752 752
     // Update the listing success page settings
753 753
     $listing_success_page = $wpdb->get_var(
754 754
         $wpdb->prepare(
755
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
755
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
756 756
             array('listing-success')
757 757
         )
758 758
     );
759 759
 
760
-    if($listing_success_page){
761
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
762
-        update_option( 'geodir_success_page', $listing_success_page);
760
+    if ($listing_success_page) {
761
+        wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish'));
762
+        update_option('geodir_success_page', $listing_success_page);
763 763
     }
764 764
 
765 765
     // Update the listing success page settings
766 766
     $location_page = $wpdb->get_var(
767 767
         $wpdb->prepare(
768
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
768
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
769 769
             array('location')
770 770
         )
771 771
     );
772 772
 
773
-    if($location_page){
773
+    if ($location_page) {
774 774
         $location_slug = get_option('geodir_location_prefix');
775
-        if(!$location_slug ){$location_slug  = 'location';}
776
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
777
-        update_option( 'geodir_location_page', $location_page);
775
+        if (!$location_slug) {$location_slug = 'location'; }
776
+        wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug));
777
+        update_option('geodir_location_page', $location_page);
778 778
     }
779 779
 
780 780
 }
@@ -793,13 +793,13 @@  discard block
 block discarded – undo
793 793
     $post_types = get_option('geodir_post_types');
794 794
 
795 795
 
796
-    if (is_array($post_types)){
796
+    if (is_array($post_types)) {
797 797
 
798 798
         foreach ($post_types as $post_type => $args) {
799 799
 
800 800
 
801
-            if(isset($args['rewrite']['slug'])){
802
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
801
+            if (isset($args['rewrite']['slug'])) {
802
+                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']);
803 803
             }
804 804
 
805 805
                 $alt_post_types[$post_type] = $args;
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
         }
808 808
     }
809 809
 
810
-    if(!empty($alt_post_types)) {
811
-        update_option('geodir_post_types',$alt_post_types);
810
+    if (!empty($alt_post_types)) {
811
+        update_option('geodir_post_types', $alt_post_types);
812 812
         }
813 813
 
814 814
 
@@ -834,9 +834,9 @@  discard block
 block discarded – undo
834 834
         foreach ($all_postypes as $key) {
835 835
             // update each GD CTP
836 836
             try {
837
-                $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
838
-            } catch(Exception $e) {
839
-                error_log( 'Error: ' . $e->getMessage() );
837
+                $wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_".$key."_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
838
+            } catch (Exception $e) {
839
+                error_log('Error: '.$e->getMessage());
840 840
             }
841 841
         }
842 842
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@
 block discarded – undo
324 324
 
325 325
             if(!empty($show_in_arr )){
326 326
                 $show_in_arr = implode(',',$show_in_arr);
327
-            }else{
327
+            } else{
328 328
                 $show_in_arr = '';
329 329
             }
330 330
 
Please login to merge, or discard this patch.
Indentation   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -10,50 +10,50 @@  discard block
 block discarded – undo
10 10
 global $wpdb;
11 11
 
12 12
 if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
13
-    /**
14
-     * Include custom database table related functions.
15
-     *
16
-     * @since 1.0.0
17
-     * @package GeoDirectory
18
-     */
19
-    include_once('geodirectory-admin/admin_db_install.php');
20
-    add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
21
-    if (GEODIRECTORY_VERSION <= '1.3.6') {
22
-        add_action('plugins_loaded', 'geodir_upgrade_136', 11);
23
-    }
13
+	/**
14
+	 * Include custom database table related functions.
15
+	 *
16
+	 * @since 1.0.0
17
+	 * @package GeoDirectory
18
+	 */
19
+	include_once('geodirectory-admin/admin_db_install.php');
20
+	add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
21
+	if (GEODIRECTORY_VERSION <= '1.3.6') {
22
+		add_action('plugins_loaded', 'geodir_upgrade_136', 11);
23
+	}
24 24
 
25
-    if (GEODIRECTORY_VERSION <= '1.4.6') {
26
-        add_action('init', 'geodir_upgrade_146', 11);
27
-    }
25
+	if (GEODIRECTORY_VERSION <= '1.4.6') {
26
+		add_action('init', 'geodir_upgrade_146', 11);
27
+	}
28 28
 
29
-    if (GEODIRECTORY_VERSION <= '1.4.8') {
30
-        add_action('init', 'geodir_upgrade_148', 11);
31
-    }
29
+	if (GEODIRECTORY_VERSION <= '1.4.8') {
30
+		add_action('init', 'geodir_upgrade_148', 11);
31
+	}
32 32
 
33
-    if (GEODIRECTORY_VERSION <= '1.5.0') {
34
-        add_action('init', 'geodir_upgrade_150', 11);
35
-    }
33
+	if (GEODIRECTORY_VERSION <= '1.5.0') {
34
+		add_action('init', 'geodir_upgrade_150', 11);
35
+	}
36 36
 
37
-    if (GEODIRECTORY_VERSION <= '1.5.2') {
38
-        add_action('init', 'geodir_upgrade_152', 11);
39
-    }
37
+	if (GEODIRECTORY_VERSION <= '1.5.2') {
38
+		add_action('init', 'geodir_upgrade_152', 11);
39
+	}
40 40
 
41
-    if (GEODIRECTORY_VERSION <= '1.5.3') {
42
-        add_action('init', 'geodir_upgrade_153', 11);
43
-    }
41
+	if (GEODIRECTORY_VERSION <= '1.5.3') {
42
+		add_action('init', 'geodir_upgrade_153', 11);
43
+	}
44 44
 
45
-    if (GEODIRECTORY_VERSION <= '1.5.4') {
46
-        add_action('init', 'geodir_upgrade_154', 11);
47
-    }
45
+	if (GEODIRECTORY_VERSION <= '1.5.4') {
46
+		add_action('init', 'geodir_upgrade_154', 11);
47
+	}
48 48
 
49
-    if (GEODIRECTORY_VERSION <= '1.6.6') {
50
-        add_action('init', 'geodir_upgrade_166', 11);
51
-    }
49
+	if (GEODIRECTORY_VERSION <= '1.6.6') {
50
+		add_action('init', 'geodir_upgrade_166', 11);
51
+	}
52 52
 
53 53
 
54
-    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
54
+	add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
55 55
 
56
-    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
56
+	update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
57 57
 
58 58
 }
59 59
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
  */
67 67
 function geodirectory_upgrade_all()
68 68
 {
69
-    geodir_create_tables();
70
-    geodir_update_review_db();
71
-    gd_install_theme_compat();
69
+	geodir_create_tables();
70
+	geodir_update_review_db();
71
+	gd_install_theme_compat();
72 72
 }
73 73
 
74 74
 /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
  */
80 80
 function geodir_upgrade_136()
81 81
 {
82
-    geodir_fix_review_overall_rating();
82
+	geodir_fix_review_overall_rating();
83 83
 }
84 84
 
85 85
 /**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  * @package GeoDirectory
90 90
  */
91 91
 function geodir_upgrade_146(){
92
-    gd_convert_virtual_pages();
92
+	gd_convert_virtual_pages();
93 93
 }
94 94
 
95 95
 /**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  * @package GeoDirectory
100 100
  */
101 101
 function geodir_upgrade_150(){
102
-    gd_fix_cpt_rewrite_slug();
102
+	gd_fix_cpt_rewrite_slug();
103 103
 }
104 104
 
105 105
 
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
  * @package GeoDirectory
112 112
  */
113 113
 function geodir_upgrade_148(){
114
-    /*
114
+	/*
115 115
      * Blank the users google password if present as we now use oAuth 2.0
116 116
      */
117
-    update_option('geodir_ga_pass','');
118
-    update_option('geodir_ga_user','');
117
+	update_option('geodir_ga_pass','');
118
+	update_option('geodir_ga_user','');
119 119
 
120 120
 }
121 121
 
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
  * @package GeoDirectory
128 128
  */
129 129
 function geodir_upgrade_153(){
130
-    geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
131
-    geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
130
+	geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
131
+	geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
132 132
 }
133 133
 
134 134
 /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
  * @package GeoDirectory
139 139
  */
140 140
 function geodir_upgrade_154(){
141
-    geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
141
+	geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
142 142
 }
143 143
 
144 144
 /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
  * @package GeoDirectory
149 149
  */
150 150
 function geodir_upgrade_152(){
151
-    gd_fix_address_detail_table_limit();
151
+	gd_fix_address_detail_table_limit();
152 152
 }
153 153
 
154 154
 /**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
  * @package GeoDirectory
159 159
  */
160 160
 function geodir_upgrade_166(){
161
-    gd_convert_custom_field_display();
161
+	gd_convert_custom_field_display();
162 162
 }
163 163
 
164 164
 
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
  */
173 173
 function geodir_update_review_db()
174 174
 {
175
-    global $wpdb, $plugin_prefix;
175
+	global $wpdb, $plugin_prefix;
176 176
 
177
-    geodir_fix_review_date();
178
-    geodir_fix_review_post_status();
179
-    geodir_fix_review_content();
180
-    geodir_fix_review_location();
177
+	geodir_fix_review_date();
178
+	geodir_fix_review_post_status();
179
+	geodir_fix_review_content();
180
+	geodir_fix_review_location();
181 181
 
182 182
 }
183 183
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function geodir_fix_review_date()
192 192
 {
193
-    global $wpdb;
194
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
193
+	global $wpdb;
194
+	$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
195 195
 }
196 196
 
197 197
 /**
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
  */
204 204
 function geodir_fix_review_post_status()
205 205
 {
206
-    global $wpdb;
207
-    $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
206
+	global $wpdb;
207
+	$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
208 208
 }
209 209
 
210 210
 /**
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
  */
218 218
 function geodir_fix_review_content()
219 219
 {
220
-    global $wpdb;
221
-    if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
222
-        return true;
223
-    } else {
224
-        return false;
225
-    }
220
+	global $wpdb;
221
+	if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
222
+		return true;
223
+	} else {
224
+		return false;
225
+	}
226 226
 }
227 227
 
228 228
 /**
@@ -235,20 +235,20 @@  discard block
 block discarded – undo
235 235
  */
236 236
 function geodir_fix_review_location()
237 237
 {
238
-    global $wpdb;
238
+	global $wpdb;
239 239
 
240
-    $all_postypes = geodir_get_posttypes();
240
+	$all_postypes = geodir_get_posttypes();
241 241
 
242
-    if (!empty($all_postypes)) {
243
-        foreach ($all_postypes as $key) {
244
-            // update each GD CTP
242
+	if (!empty($all_postypes)) {
243
+		foreach ($all_postypes as $key) {
244
+			// update each GD CTP
245 245
 
246
-            $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
246
+			$wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city,  gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
247 247
 
248
-        }
249
-        return true;
250
-    }
251
-    return false;
248
+		}
249
+		return true;
250
+	}
251
+	return false;
252 252
 }
253 253
 
254 254
 /**
@@ -260,82 +260,82 @@  discard block
 block discarded – undo
260 260
  */
261 261
 function geodir_fix_review_overall_rating()
262 262
 {
263
-    global $wpdb;
263
+	global $wpdb;
264 264
 
265
-    $all_postypes = geodir_get_posttypes();
265
+	$all_postypes = geodir_get_posttypes();
266 266
 
267
-    if (!empty($all_postypes)) {
268
-        foreach ($all_postypes as $key) {
269
-            // update each GD CTP
270
-            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
267
+	if (!empty($all_postypes)) {
268
+		foreach ($all_postypes as $key) {
269
+			// update each GD CTP
270
+			$reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
271 271
 
272
-            if (!empty($reviews)) {
273
-                foreach ($reviews as $post_id) {
274
-                    geodir_update_postrating($post_id->post_id, $key);
275
-                }
272
+			if (!empty($reviews)) {
273
+				foreach ($reviews as $post_id) {
274
+					geodir_update_postrating($post_id->post_id, $key);
275
+				}
276 276
 
277
-            }
277
+			}
278 278
 
279
-        }
279
+		}
280 280
 
281
-    }
281
+	}
282 282
 }
283 283
 
284 284
 
285 285
 function gd_convert_custom_field_display(){
286
-    global $wpdb;
286
+	global $wpdb;
287 287
 
288
-    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
288
+	$field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
289 289
 
290
-    $has_run = get_option('gd_convert_custom_field_display');
291
-    if($has_run){return;}
290
+	$has_run = get_option('gd_convert_custom_field_display');
291
+	if($has_run){return;}
292 292
 
293
-    // set the field_type_key for standard fields
294
-    $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
293
+	// set the field_type_key for standard fields
294
+	$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
295 295
 
296 296
 
297
-    if(is_array( $field_info)){
297
+	if(is_array( $field_info)){
298 298
 
299
-        foreach( $field_info as $cf){
299
+		foreach( $field_info as $cf){
300 300
 
301
-            $id = $cf->id;
301
+			$id = $cf->id;
302 302
 
303
-            if(!property_exists($cf,'show_in') || !$id){return;}
303
+			if(!property_exists($cf,'show_in') || !$id){return;}
304 304
 
305
-            $show_in_arr = array();
305
+			$show_in_arr = array();
306 306
 
307
-            if($cf->is_default){
308
-                $show_in_arr[] = "[detail]";
309
-            }
307
+			if($cf->is_default){
308
+				$show_in_arr[] = "[detail]";
309
+			}
310 310
 
311
-            if($cf->show_on_detail){
312
-                $show_in_arr[] = "[moreinfo]";
313
-            }
311
+			if($cf->show_on_detail){
312
+				$show_in_arr[] = "[moreinfo]";
313
+			}
314 314
 
315
-            if($cf->show_on_listing){
316
-                $show_in_arr[] = "[listing]";
317
-            }
315
+			if($cf->show_on_listing){
316
+				$show_in_arr[] = "[listing]";
317
+			}
318 318
 
319
-            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
320
-                $show_in_arr[] = "[owntab]";
321
-            }
319
+			if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
320
+				$show_in_arr[] = "[owntab]";
321
+			}
322 322
 
323
-            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
324
-                $show_in_arr[] = "[mapbubble]";
325
-            }
323
+			if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
324
+				$show_in_arr[] = "[mapbubble]";
325
+			}
326 326
 
327
-            if(!empty($show_in_arr )){
328
-                $show_in_arr = implode(',',$show_in_arr);
329
-            }else{
330
-                $show_in_arr = '';
331
-            }
327
+			if(!empty($show_in_arr )){
328
+				$show_in_arr = implode(',',$show_in_arr);
329
+			}else{
330
+				$show_in_arr = '';
331
+			}
332 332
 
333
-            $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
333
+			$wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
334 334
 
335
-        }
335
+		}
336 336
 
337
-        update_option('gd_convert_custom_field_display',1);
338
-    }
337
+		update_option('gd_convert_custom_field_display',1);
338
+	}
339 339
 }
340 340
 
341 341
 ############################################
@@ -351,367 +351,367 @@  discard block
 block discarded – undo
351 351
  */
352 352
 function gd_install_theme_compat()
353 353
 {
354
-    global $wpdb;
354
+	global $wpdb;
355 355
 
356
-    $theme_compat = array();
357
-    $theme_compat = get_option('gd_theme_compats');
356
+	$theme_compat = array();
357
+	$theme_compat = get_option('gd_theme_compats');
358 358
 //GDF
359
-    $theme_compat['GeoDirectory_Framework'] = array(
360
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
361
-        'geodir_wrapper_open_class' => '',
362
-        'geodir_wrapper_open_replace' => '',
363
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
364
-        'geodir_wrapper_content_open_id' => 'geodir_content',
365
-        'geodir_wrapper_content_open_class' => '',
366
-        'geodir_wrapper_content_open_replace' => '',
367
-        'geodir_wrapper_content_close_replace' => '',
368
-        'geodir_article_open_id' => '',
369
-        'geodir_article_open_class' => '',
370
-        'geodir_article_open_replace' => '',
371
-        'geodir_article_close_replace' => '',
372
-        'geodir_sidebar_right_open_id' => '',
373
-        'geodir_sidebar_right_open_class' => '',
374
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
375
-        'geodir_sidebar_right_close_replace' => '',
376
-        'geodir_sidebar_left_open_id' => '',
377
-        'geodir_sidebar_left_open_class' => '',
378
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
379
-        'geodir_sidebar_left_close_replace' => '',
380
-        'geodir_main_content_open_id' => '',
381
-        'geodir_main_content_open_class' => '',
382
-        'geodir_main_content_open_replace' => '<!-- removed -->',
383
-        'geodir_main_content_close_replace' => '<!-- removed -->',
384
-        'geodir_top_content_add' => '',
385
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
386
-        'geodir_before_widget_filter' => '',
387
-        'geodir_after_widget_filter' => '',
388
-        'geodir_theme_compat_css' => '',
389
-        'geodir_theme_compat_js' => '',
390
-        'geodir_theme_compat_default_options' => '',
391
-        'geodir_theme_compat_code' => ''
392
-    );
359
+	$theme_compat['GeoDirectory_Framework'] = array(
360
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
361
+		'geodir_wrapper_open_class' => '',
362
+		'geodir_wrapper_open_replace' => '',
363
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
364
+		'geodir_wrapper_content_open_id' => 'geodir_content',
365
+		'geodir_wrapper_content_open_class' => '',
366
+		'geodir_wrapper_content_open_replace' => '',
367
+		'geodir_wrapper_content_close_replace' => '',
368
+		'geodir_article_open_id' => '',
369
+		'geodir_article_open_class' => '',
370
+		'geodir_article_open_replace' => '',
371
+		'geodir_article_close_replace' => '',
372
+		'geodir_sidebar_right_open_id' => '',
373
+		'geodir_sidebar_right_open_class' => '',
374
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
375
+		'geodir_sidebar_right_close_replace' => '',
376
+		'geodir_sidebar_left_open_id' => '',
377
+		'geodir_sidebar_left_open_class' => '',
378
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
379
+		'geodir_sidebar_left_close_replace' => '',
380
+		'geodir_main_content_open_id' => '',
381
+		'geodir_main_content_open_class' => '',
382
+		'geodir_main_content_open_replace' => '<!-- removed -->',
383
+		'geodir_main_content_close_replace' => '<!-- removed -->',
384
+		'geodir_top_content_add' => '',
385
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
386
+		'geodir_before_widget_filter' => '',
387
+		'geodir_after_widget_filter' => '',
388
+		'geodir_theme_compat_css' => '',
389
+		'geodir_theme_compat_js' => '',
390
+		'geodir_theme_compat_default_options' => '',
391
+		'geodir_theme_compat_code' => ''
392
+	);
393 393
 
394 394
 //Directory Theme
395
-    $theme_compat['Directory_Starter'] = array(
396
-        'geodir_wrapper_open_id' => 'geodir_wrapper',
397
-        'geodir_wrapper_open_class' => '',
398
-        'geodir_wrapper_open_replace' => '',
399
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
400
-        'geodir_wrapper_content_open_id' => 'geodir_content',
401
-        'geodir_wrapper_content_open_class' => '',
402
-        'geodir_wrapper_content_open_replace' => '',
403
-        'geodir_wrapper_content_close_replace' => '',
404
-        'geodir_article_open_id' => '',
405
-        'geodir_article_open_class' => '',
406
-        'geodir_article_open_replace' => '',
407
-        'geodir_article_close_replace' => '',
408
-        'geodir_sidebar_right_open_id' => '',
409
-        'geodir_sidebar_right_open_class' => '',
410
-        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
411
-        'geodir_sidebar_right_close_replace' => '',
412
-        'geodir_sidebar_left_open_id' => '',
413
-        'geodir_sidebar_left_open_class' => '',
414
-        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
415
-        'geodir_sidebar_left_close_replace' => '',
416
-        'geodir_main_content_open_id' => '',
417
-        'geodir_main_content_open_class' => '',
418
-        'geodir_main_content_open_replace' => '<!-- removed -->',
419
-        'geodir_main_content_close_replace' => '<!-- removed -->',
420
-        'geodir_top_content_add' => '',
421
-        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
422
-        'geodir_before_widget_filter' => '',
423
-        'geodir_after_widget_filter' => '',
424
-        'geodir_theme_compat_css' => '',
425
-        'geodir_theme_compat_js' => '',
426
-        'geodir_theme_compat_default_options' => '',
427
-        'geodir_theme_compat_code' => ''
428
-    );
395
+	$theme_compat['Directory_Starter'] = array(
396
+		'geodir_wrapper_open_id' => 'geodir_wrapper',
397
+		'geodir_wrapper_open_class' => '',
398
+		'geodir_wrapper_open_replace' => '',
399
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
400
+		'geodir_wrapper_content_open_id' => 'geodir_content',
401
+		'geodir_wrapper_content_open_class' => '',
402
+		'geodir_wrapper_content_open_replace' => '',
403
+		'geodir_wrapper_content_close_replace' => '',
404
+		'geodir_article_open_id' => '',
405
+		'geodir_article_open_class' => '',
406
+		'geodir_article_open_replace' => '',
407
+		'geodir_article_close_replace' => '',
408
+		'geodir_sidebar_right_open_id' => '',
409
+		'geodir_sidebar_right_open_class' => '',
410
+		'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
411
+		'geodir_sidebar_right_close_replace' => '',
412
+		'geodir_sidebar_left_open_id' => '',
413
+		'geodir_sidebar_left_open_class' => '',
414
+		'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
415
+		'geodir_sidebar_left_close_replace' => '',
416
+		'geodir_main_content_open_id' => '',
417
+		'geodir_main_content_open_class' => '',
418
+		'geodir_main_content_open_replace' => '<!-- removed -->',
419
+		'geodir_main_content_close_replace' => '<!-- removed -->',
420
+		'geodir_top_content_add' => '',
421
+		'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
422
+		'geodir_before_widget_filter' => '',
423
+		'geodir_after_widget_filter' => '',
424
+		'geodir_theme_compat_css' => '',
425
+		'geodir_theme_compat_js' => '',
426
+		'geodir_theme_compat_default_options' => '',
427
+		'geodir_theme_compat_code' => ''
428
+	);
429 429
 
430 430
 //Jobby
431
-    $theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
431
+	$theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
432 432
 
433 433
 //GeoProperty
434
-    $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
434
+	$theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
435 435
 
436 436
 //Avada
437
-    $theme_compat['Avada'] = array(
438
-        'geodir_wrapper_open_id' => '',
439
-        'geodir_wrapper_open_class' => '',
440
-        'geodir_wrapper_open_replace' => '<!-- removed -->',
441
-        'geodir_wrapper_close_replace' => '<!-- removed -->',
442
-        'geodir_wrapper_content_open_id' => 'content',
443
-        'geodir_wrapper_content_open_class' => '',
444
-        'geodir_wrapper_content_open_replace' => '',
445
-        'geodir_wrapper_content_close_replace' => '',
446
-        'geodir_article_open_id' => '',
447
-        'geodir_article_open_class' => '',
448
-        'geodir_article_open_replace' => '',
449
-        'geodir_article_close_replace' => '',
450
-        'geodir_sidebar_right_open_id' => '',
451
-        'geodir_sidebar_right_open_class' => '',
452
-        'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
453
-        'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
454
-        'geodir_sidebar_left_open_id' => '',
455
-        'geodir_sidebar_left_open_class' => '',
456
-        'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
457
-        'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
458
-        'geodir_main_content_open_id' => '',
459
-        'geodir_main_content_open_class' => '',
460
-        'geodir_main_content_open_replace' => '<!-- removed -->',
461
-        'geodir_main_content_close_replace' => '<!-- removed -->',
462
-        'geodir_top_content_add' => '',
463
-        'geodir_before_main_content_add' => '',
464
-        'geodir_before_widget_filter' => '',
465
-        'geodir_after_widget_filter' => '',
466
-        'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
467
-        'geodir_theme_compat_js' => '',
468
-        'geodir_theme_compat_default_options' => '',
469
-        'geodir_theme_compat_code' => 'Avada'
470
-    );
437
+	$theme_compat['Avada'] = array(
438
+		'geodir_wrapper_open_id' => '',
439
+		'geodir_wrapper_open_class' => '',
440
+		'geodir_wrapper_open_replace' => '<!-- removed -->',
441
+		'geodir_wrapper_close_replace' => '<!-- removed -->',
442
+		'geodir_wrapper_content_open_id' => 'content',
443
+		'geodir_wrapper_content_open_class' => '',
444
+		'geodir_wrapper_content_open_replace' => '',
445
+		'geodir_wrapper_content_close_replace' => '',
446
+		'geodir_article_open_id' => '',
447
+		'geodir_article_open_class' => '',
448
+		'geodir_article_open_replace' => '',
449
+		'geodir_article_close_replace' => '',
450
+		'geodir_sidebar_right_open_id' => '',
451
+		'geodir_sidebar_right_open_class' => '',
452
+		'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
453
+		'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
454
+		'geodir_sidebar_left_open_id' => '',
455
+		'geodir_sidebar_left_open_class' => '',
456
+		'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
457
+		'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
458
+		'geodir_main_content_open_id' => '',
459
+		'geodir_main_content_open_class' => '',
460
+		'geodir_main_content_open_replace' => '<!-- removed -->',
461
+		'geodir_main_content_close_replace' => '<!-- removed -->',
462
+		'geodir_top_content_add' => '',
463
+		'geodir_before_main_content_add' => '',
464
+		'geodir_before_widget_filter' => '',
465
+		'geodir_after_widget_filter' => '',
466
+		'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
467
+		'geodir_theme_compat_js' => '',
468
+		'geodir_theme_compat_default_options' => '',
469
+		'geodir_theme_compat_code' => 'Avada'
470
+	);
471 471
 
472 472
 //Enfold
473
-    $theme_compat['Enfold'] = array(
474
-        'geodir_wrapper_open_id' => '',
475
-        'geodir_wrapper_open_class' => '',
476
-        'geodir_wrapper_open_replace' => '',
477
-        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
478
-        'geodir_wrapper_content_open_id' => '',
479
-        'geodir_wrapper_content_open_class' => '',
480
-        'geodir_wrapper_content_open_replace' => '',
481
-        'geodir_wrapper_content_close_replace' => '</div></main>',
482
-        'geodir_article_open_id' => '',
483
-        'geodir_article_open_class' => '',
484
-        'geodir_article_open_replace' => '',
485
-        'geodir_article_close_replace' => '',
486
-        'geodir_sidebar_right_open_id' => '',
487
-        'geodir_sidebar_right_open_class' => '',
488
-        'geodir_sidebar_right_open_replace' => '',
489
-        'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
490
-        'geodir_sidebar_left_open_id' => '',
491
-        'geodir_sidebar_left_open_class' => '',
492
-        'geodir_sidebar_left_open_replace' => '',
493
-        'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
494
-        'geodir_main_content_open_id' => '',
495
-        'geodir_main_content_open_class' => '',
496
-        'geodir_main_content_open_replace' => '',
497
-        'geodir_main_content_close_replace' => '',
498
-        'geodir_top_content_add' => '',
499
-        'geodir_before_main_content_add' => '',
500
-        'geodir_before_widget_filter' => '',
501
-        'geodir_after_widget_filter' => '',
502
-        'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
503
-        'geodir_theme_compat_js' => '',
504
-        'geodir_theme_compat_default_options' => '',
505
-        'geodir_theme_compat_code' => 'Enfold'
506
-    );
473
+	$theme_compat['Enfold'] = array(
474
+		'geodir_wrapper_open_id' => '',
475
+		'geodir_wrapper_open_class' => '',
476
+		'geodir_wrapper_open_replace' => '',
477
+		'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
478
+		'geodir_wrapper_content_open_id' => '',
479
+		'geodir_wrapper_content_open_class' => '',
480
+		'geodir_wrapper_content_open_replace' => '',
481
+		'geodir_wrapper_content_close_replace' => '</div></main>',
482
+		'geodir_article_open_id' => '',
483
+		'geodir_article_open_class' => '',
484
+		'geodir_article_open_replace' => '',
485
+		'geodir_article_close_replace' => '',
486
+		'geodir_sidebar_right_open_id' => '',
487
+		'geodir_sidebar_right_open_class' => '',
488
+		'geodir_sidebar_right_open_replace' => '',
489
+		'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
490
+		'geodir_sidebar_left_open_id' => '',
491
+		'geodir_sidebar_left_open_class' => '',
492
+		'geodir_sidebar_left_open_replace' => '',
493
+		'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
494
+		'geodir_main_content_open_id' => '',
495
+		'geodir_main_content_open_class' => '',
496
+		'geodir_main_content_open_replace' => '',
497
+		'geodir_main_content_close_replace' => '',
498
+		'geodir_top_content_add' => '',
499
+		'geodir_before_main_content_add' => '',
500
+		'geodir_before_widget_filter' => '',
501
+		'geodir_after_widget_filter' => '',
502
+		'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
503
+		'geodir_theme_compat_js' => '',
504
+		'geodir_theme_compat_default_options' => '',
505
+		'geodir_theme_compat_code' => 'Enfold'
506
+	);
507 507
 
508 508
 // X
509
-    $theme_compat['X'] = array(
510
-        'geodir_wrapper_open_id' => '',
511
-        'geodir_wrapper_open_class' => '',
512
-        'geodir_wrapper_open_replace' => '',
513
-        'geodir_wrapper_close_replace' => '',
514
-        'geodir_wrapper_content_open_id' => '',
515
-        'geodir_wrapper_content_open_class' => '',
516
-        'geodir_wrapper_content_open_replace' => '',
517
-        'geodir_wrapper_content_close_replace' => '',
518
-        'geodir_article_open_id' => '',
519
-        'geodir_article_open_class' => '',
520
-        'geodir_article_open_replace' => '',
521
-        'geodir_article_close_replace' => '',
522
-        'geodir_sidebar_right_open_id' => '',
523
-        'geodir_sidebar_right_open_class' => '',
524
-        'geodir_sidebar_right_open_replace' => '',
525
-        'geodir_sidebar_right_close_replace' => '',
526
-        'geodir_sidebar_left_open_id' => '',
527
-        'geodir_sidebar_left_open_class' => '',
528
-        'geodir_sidebar_left_open_replace' => '',
529
-        'geodir_sidebar_left_close_replace' => '',
530
-        'geodir_main_content_open_id' => '',
531
-        'geodir_main_content_open_class' => '',
532
-        'geodir_main_content_open_replace' => '',
533
-        'geodir_main_content_close_replace' => '',
534
-        'geodir_top_content_add' => '',
535
-        'geodir_before_main_content_add' => '',
536
-        'geodir_before_widget_filter' => '',
537
-        'geodir_after_widget_filter' => '',
538
-        'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
539
-        'geodir_theme_compat_js' => '',
540
-        'geodir_theme_compat_default_options' => '',
541
-        'geodir_theme_compat_code' => 'X'
542
-    );
509
+	$theme_compat['X'] = array(
510
+		'geodir_wrapper_open_id' => '',
511
+		'geodir_wrapper_open_class' => '',
512
+		'geodir_wrapper_open_replace' => '',
513
+		'geodir_wrapper_close_replace' => '',
514
+		'geodir_wrapper_content_open_id' => '',
515
+		'geodir_wrapper_content_open_class' => '',
516
+		'geodir_wrapper_content_open_replace' => '',
517
+		'geodir_wrapper_content_close_replace' => '',
518
+		'geodir_article_open_id' => '',
519
+		'geodir_article_open_class' => '',
520
+		'geodir_article_open_replace' => '',
521
+		'geodir_article_close_replace' => '',
522
+		'geodir_sidebar_right_open_id' => '',
523
+		'geodir_sidebar_right_open_class' => '',
524
+		'geodir_sidebar_right_open_replace' => '',
525
+		'geodir_sidebar_right_close_replace' => '',
526
+		'geodir_sidebar_left_open_id' => '',
527
+		'geodir_sidebar_left_open_class' => '',
528
+		'geodir_sidebar_left_open_replace' => '',
529
+		'geodir_sidebar_left_close_replace' => '',
530
+		'geodir_main_content_open_id' => '',
531
+		'geodir_main_content_open_class' => '',
532
+		'geodir_main_content_open_replace' => '',
533
+		'geodir_main_content_close_replace' => '',
534
+		'geodir_top_content_add' => '',
535
+		'geodir_before_main_content_add' => '',
536
+		'geodir_before_widget_filter' => '',
537
+		'geodir_after_widget_filter' => '',
538
+		'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
539
+		'geodir_theme_compat_js' => '',
540
+		'geodir_theme_compat_default_options' => '',
541
+		'geodir_theme_compat_code' => 'X'
542
+	);
543 543
 
544 544
 // Divi
545
-    $theme_compat['Divi'] = array(
546
-        'geodir_wrapper_open_id' => 'main-content',
547
-        'geodir_wrapper_open_class' => '',
548
-        'geodir_wrapper_open_replace' => '',
549
-        'geodir_wrapper_close_replace' => '',
550
-        'geodir_wrapper_content_open_id' => 'left-area',
551
-        'geodir_wrapper_content_open_class' => '',
552
-        'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
553
-        'geodir_wrapper_content_close_replace' => '',
554
-        'geodir_article_open_id' => '',
555
-        'geodir_article_open_class' => '',
556
-        'geodir_article_open_replace' => '',
557
-        'geodir_article_close_replace' => '',
558
-        'geodir_sidebar_right_open_id' => 'sidebar',
559
-        'geodir_sidebar_right_open_class' => '',
560
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
561
-        'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
562
-        'geodir_sidebar_left_open_id' => 'sidebar',
563
-        'geodir_sidebar_left_open_class' => '',
564
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
565
-        'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
566
-        'geodir_main_content_open_id' => '',
567
-        'geodir_main_content_open_class' => '',
568
-        'geodir_main_content_open_replace' => '',
569
-        'geodir_main_content_close_replace' => '',
570
-        'geodir_top_content_add' => '',
571
-        'geodir_before_main_content_add' => '',
572
-        'geodir_before_widget_filter' => '',
573
-        'geodir_after_widget_filter' => '',
574
-        'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
575
-        'geodir_theme_compat_js' => '',
576
-        'geodir_theme_compat_default_options' => '',
577
-        'geodir_theme_compat_code' => 'Divi'
578
-    );
545
+	$theme_compat['Divi'] = array(
546
+		'geodir_wrapper_open_id' => 'main-content',
547
+		'geodir_wrapper_open_class' => '',
548
+		'geodir_wrapper_open_replace' => '',
549
+		'geodir_wrapper_close_replace' => '',
550
+		'geodir_wrapper_content_open_id' => 'left-area',
551
+		'geodir_wrapper_content_open_class' => '',
552
+		'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
553
+		'geodir_wrapper_content_close_replace' => '',
554
+		'geodir_article_open_id' => '',
555
+		'geodir_article_open_class' => '',
556
+		'geodir_article_open_replace' => '',
557
+		'geodir_article_close_replace' => '',
558
+		'geodir_sidebar_right_open_id' => 'sidebar',
559
+		'geodir_sidebar_right_open_class' => '',
560
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
561
+		'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
562
+		'geodir_sidebar_left_open_id' => 'sidebar',
563
+		'geodir_sidebar_left_open_class' => '',
564
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
565
+		'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
566
+		'geodir_main_content_open_id' => '',
567
+		'geodir_main_content_open_class' => '',
568
+		'geodir_main_content_open_replace' => '',
569
+		'geodir_main_content_close_replace' => '',
570
+		'geodir_top_content_add' => '',
571
+		'geodir_before_main_content_add' => '',
572
+		'geodir_before_widget_filter' => '',
573
+		'geodir_after_widget_filter' => '',
574
+		'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
575
+		'geodir_theme_compat_js' => '',
576
+		'geodir_theme_compat_default_options' => '',
577
+		'geodir_theme_compat_code' => 'Divi'
578
+	);
579 579
 
580 580
 // Genesis
581
-    $theme_compat['Genesis'] = array(
582
-        'geodir_wrapper_open_id' => '',
583
-        'geodir_wrapper_open_class' => 'content-sidebar-wrap',
584
-        'geodir_wrapper_open_replace' => '',
585
-        'geodir_wrapper_close_replace' => '',
586
-        'geodir_wrapper_content_open_id' => '',
587
-        'geodir_wrapper_content_open_class' => 'content',
588
-        'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
589
-        'geodir_wrapper_content_close_replace' => '',
590
-        'geodir_article_open_id' => '',
591
-        'geodir_article_open_class' => '',
592
-        'geodir_article_open_replace' => '',
593
-        'geodir_article_close_replace' => '',
594
-        'geodir_sidebar_right_open_id' => '',
595
-        'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
596
-        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
597
-        'geodir_sidebar_right_close_replace' => '',
598
-        'geodir_sidebar_left_open_id' => '',
599
-        'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
600
-        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
601
-        'geodir_sidebar_left_close_replace' => '',
602
-        'geodir_main_content_open_id' => '',
603
-        'geodir_main_content_open_class' => '',
604
-        'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
605
-        'geodir_main_content_close_replace' => '',
606
-        'geodir_top_content_add' => '',
607
-        'geodir_before_main_content_add' => '',
608
-        'geodir_before_widget_filter' => '',
609
-        'geodir_after_widget_filter' => '',
610
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
611
-        'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
612
-        'geodir_theme_compat_js' => '',
613
-        'geodir_theme_compat_default_options' => '',
614
-        'geodir_theme_compat_code' => 'Genesis'
615
-    );
581
+	$theme_compat['Genesis'] = array(
582
+		'geodir_wrapper_open_id' => '',
583
+		'geodir_wrapper_open_class' => 'content-sidebar-wrap',
584
+		'geodir_wrapper_open_replace' => '',
585
+		'geodir_wrapper_close_replace' => '',
586
+		'geodir_wrapper_content_open_id' => '',
587
+		'geodir_wrapper_content_open_class' => 'content',
588
+		'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
589
+		'geodir_wrapper_content_close_replace' => '',
590
+		'geodir_article_open_id' => '',
591
+		'geodir_article_open_class' => '',
592
+		'geodir_article_open_replace' => '',
593
+		'geodir_article_close_replace' => '',
594
+		'geodir_sidebar_right_open_id' => '',
595
+		'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
596
+		'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
597
+		'geodir_sidebar_right_close_replace' => '',
598
+		'geodir_sidebar_left_open_id' => '',
599
+		'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
600
+		'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
601
+		'geodir_sidebar_left_close_replace' => '',
602
+		'geodir_main_content_open_id' => '',
603
+		'geodir_main_content_open_class' => '',
604
+		'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
605
+		'geodir_main_content_close_replace' => '',
606
+		'geodir_top_content_add' => '',
607
+		'geodir_before_main_content_add' => '',
608
+		'geodir_before_widget_filter' => '',
609
+		'geodir_after_widget_filter' => '',
610
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
611
+		'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
612
+		'geodir_theme_compat_js' => '',
613
+		'geodir_theme_compat_default_options' => '',
614
+		'geodir_theme_compat_code' => 'Genesis'
615
+	);
616 616
 
617 617
 // Jupiter
618
-    $theme_compat['Jupiter'] = array(
619
-        'geodir_wrapper_open_id' => '',
620
-        'geodir_wrapper_open_class' => '',
621
-        'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div  class="theme-page-wrapper mk-main-wrapper  mk-grid vc_row-fluid">',
622
-        'geodir_wrapper_close_replace' => '</div></div></div>',
623
-        'geodir_wrapper_content_open_id' => '',
624
-        'geodir_wrapper_content_open_class' => '',
625
-        'geodir_wrapper_content_open_replace' => '',
626
-        'geodir_wrapper_content_close_replace' => '',
627
-        'geodir_article_open_id' => '',
628
-        'geodir_article_open_class' => '',
629
-        'geodir_article_open_replace' => '',
630
-        'geodir_article_close_replace' => '',
631
-        'geodir_sidebar_right_open_id' => 'mk-sidebar',
632
-        'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
633
-        'geodir_sidebar_right_open_replace' => '',
634
-        'geodir_sidebar_right_close_replace' => '',
635
-        'geodir_sidebar_left_open_id' => 'mk-sidebar',
636
-        'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
637
-        'geodir_sidebar_left_open_replace' => '',
638
-        'geodir_sidebar_left_close_replace' => '',
639
-        'geodir_main_content_open_id' => '',
640
-        'geodir_main_content_open_class' => '',
641
-        'geodir_main_content_open_replace' => '',
642
-        'geodir_main_content_close_replace' => '',
643
-        'geodir_top_content_add' => '',
644
-        'geodir_before_main_content_add' => '',
645
-        'geodir_before_widget_filter' => '',
646
-        'geodir_after_widget_filter' => '',
647
-        'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
648
-        'geodir_after_title_filter' => '',
649
-        'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
650
-        'geodir_sub_menu_ul_class_filter' => '',
651
-        'geodir_sub_menu_li_class_filter' => '',
652
-        'geodir_menu_a_class_filter' => 'menu-item-link',
653
-        'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
654
-        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu',
655
-        'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
656
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
657
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
658
-        'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
659
-        'geodir_theme_compat_js' => '',
660
-        'geodir_theme_compat_default_options' => '',
661
-        'geodir_theme_compat_code' => 'Jupiter'
662
-    );
618
+	$theme_compat['Jupiter'] = array(
619
+		'geodir_wrapper_open_id' => '',
620
+		'geodir_wrapper_open_class' => '',
621
+		'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div  class="theme-page-wrapper mk-main-wrapper  mk-grid vc_row-fluid">',
622
+		'geodir_wrapper_close_replace' => '</div></div></div>',
623
+		'geodir_wrapper_content_open_id' => '',
624
+		'geodir_wrapper_content_open_class' => '',
625
+		'geodir_wrapper_content_open_replace' => '',
626
+		'geodir_wrapper_content_close_replace' => '',
627
+		'geodir_article_open_id' => '',
628
+		'geodir_article_open_class' => '',
629
+		'geodir_article_open_replace' => '',
630
+		'geodir_article_close_replace' => '',
631
+		'geodir_sidebar_right_open_id' => 'mk-sidebar',
632
+		'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
633
+		'geodir_sidebar_right_open_replace' => '',
634
+		'geodir_sidebar_right_close_replace' => '',
635
+		'geodir_sidebar_left_open_id' => 'mk-sidebar',
636
+		'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
637
+		'geodir_sidebar_left_open_replace' => '',
638
+		'geodir_sidebar_left_close_replace' => '',
639
+		'geodir_main_content_open_id' => '',
640
+		'geodir_main_content_open_class' => '',
641
+		'geodir_main_content_open_replace' => '',
642
+		'geodir_main_content_close_replace' => '',
643
+		'geodir_top_content_add' => '',
644
+		'geodir_before_main_content_add' => '',
645
+		'geodir_before_widget_filter' => '',
646
+		'geodir_after_widget_filter' => '',
647
+		'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
648
+		'geodir_after_title_filter' => '',
649
+		'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
650
+		'geodir_sub_menu_ul_class_filter' => '',
651
+		'geodir_sub_menu_li_class_filter' => '',
652
+		'geodir_menu_a_class_filter' => 'menu-item-link',
653
+		'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
654
+		'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu',
655
+		'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
656
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
657
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
658
+		'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
659
+		'geodir_theme_compat_js' => '',
660
+		'geodir_theme_compat_default_options' => '',
661
+		'geodir_theme_compat_code' => 'Jupiter'
662
+	);
663 663
 
664 664
 // Multi News
665
-    $theme_compat['Multi_News'] = array(
666
-        'geodir_wrapper_open_id' => '',
667
-        'geodir_wrapper_open_class' => 'main-container clearfix',
668
-        'geodir_wrapper_open_replace' => '',
669
-        'geodir_wrapper_close_replace' => '',
670
-        'geodir_wrapper_content_open_id' => '',
671
-        'geodir_wrapper_content_open_class' => '',
672
-        'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
673
-        'geodir_wrapper_content_close_replace' => '</div></div></div>',
674
-        'geodir_article_open_id' => '',
675
-        'geodir_article_open_class' => '',
676
-        'geodir_article_open_replace' => '',
677
-        'geodir_article_close_replace' => '',
678
-        'geodir_sidebar_right_open_id' => '',
679
-        'geodir_sidebar_right_open_class' => '',
680
-        'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
681
-        'geodir_sidebar_right_close_replace' => '',
682
-        'geodir_sidebar_left_open_id' => '',
683
-        'geodir_sidebar_left_open_class' => '',
684
-        'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
685
-        'geodir_sidebar_left_close_replace' => '',
686
-        'geodir_main_content_open_id' => '',
687
-        'geodir_main_content_open_class' => '',
688
-        'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
689
-        'geodir_main_content_close_replace' => '</div>',
690
-        'geodir_top_content_add' => '',
691
-        'geodir_before_main_content_add' => '',
692
-        'geodir_full_page_class_filter' => 'section full-width-section',
693
-        'geodir_before_widget_filter' => '',
694
-        'geodir_after_widget_filter' => '',
695
-        'geodir_before_title_filter' => '<div class="widget-title"><h2>',
696
-        'geodir_after_title_filter' => '</h2></div>',
697
-        'geodir_menu_li_class_filter' => '',
698
-        'geodir_sub_menu_ul_class_filter' => '',
699
-        'geodir_sub_menu_li_class_filter' => '',
700
-        'geodir_menu_a_class_filter' => '',
701
-        'geodir_sub_menu_a_class_filter' => '',
702
-        'geodir_location_switcher_menu_li_class_filter' => '',
703
-        'geodir_location_switcher_menu_a_class_filter' => '',
704
-        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
705
-        'geodir_location_switcher_menu_sub_li_class_filter' => '',
706
-        'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
707
-        'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
708
-        'geodir_theme_compat_default_options' => '',
709
-        'geodir_theme_compat_code' => 'Multi_News'
710
-    );
711
-
712
-    update_option('gd_theme_compats', $theme_compat);
713
-
714
-    gd_set_theme_compat();// set the compat pack if avail
665
+	$theme_compat['Multi_News'] = array(
666
+		'geodir_wrapper_open_id' => '',
667
+		'geodir_wrapper_open_class' => 'main-container clearfix',
668
+		'geodir_wrapper_open_replace' => '',
669
+		'geodir_wrapper_close_replace' => '',
670
+		'geodir_wrapper_content_open_id' => '',
671
+		'geodir_wrapper_content_open_class' => '',
672
+		'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
673
+		'geodir_wrapper_content_close_replace' => '</div></div></div>',
674
+		'geodir_article_open_id' => '',
675
+		'geodir_article_open_class' => '',
676
+		'geodir_article_open_replace' => '',
677
+		'geodir_article_close_replace' => '',
678
+		'geodir_sidebar_right_open_id' => '',
679
+		'geodir_sidebar_right_open_class' => '',
680
+		'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
681
+		'geodir_sidebar_right_close_replace' => '',
682
+		'geodir_sidebar_left_open_id' => '',
683
+		'geodir_sidebar_left_open_class' => '',
684
+		'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
685
+		'geodir_sidebar_left_close_replace' => '',
686
+		'geodir_main_content_open_id' => '',
687
+		'geodir_main_content_open_class' => '',
688
+		'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
689
+		'geodir_main_content_close_replace' => '</div>',
690
+		'geodir_top_content_add' => '',
691
+		'geodir_before_main_content_add' => '',
692
+		'geodir_full_page_class_filter' => 'section full-width-section',
693
+		'geodir_before_widget_filter' => '',
694
+		'geodir_after_widget_filter' => '',
695
+		'geodir_before_title_filter' => '<div class="widget-title"><h2>',
696
+		'geodir_after_title_filter' => '</h2></div>',
697
+		'geodir_menu_li_class_filter' => '',
698
+		'geodir_sub_menu_ul_class_filter' => '',
699
+		'geodir_sub_menu_li_class_filter' => '',
700
+		'geodir_menu_a_class_filter' => '',
701
+		'geodir_sub_menu_a_class_filter' => '',
702
+		'geodir_location_switcher_menu_li_class_filter' => '',
703
+		'geodir_location_switcher_menu_a_class_filter' => '',
704
+		'geodir_location_switcher_menu_sub_ul_class_filter' => '',
705
+		'geodir_location_switcher_menu_sub_li_class_filter' => '',
706
+		'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
707
+		'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
708
+		'geodir_theme_compat_default_options' => '',
709
+		'geodir_theme_compat_code' => 'Multi_News'
710
+	);
711
+
712
+	update_option('gd_theme_compats', $theme_compat);
713
+
714
+	gd_set_theme_compat();// set the compat pack if avail
715 715
 }
716 716
 
717 717
 
@@ -723,61 +723,61 @@  discard block
 block discarded – undo
723 723
  * @global object $wpdb WordPress Database object.
724 724
  */
725 725
 function gd_convert_virtual_pages(){
726
-    global $wpdb;
727
-
728
-    // Update the add listing page settings
729
-    $add_listing_page = $wpdb->get_var(
730
-        $wpdb->prepare(
731
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
732
-            array('add-listing')
733
-        )
734
-    );
735
-
736
-    if($add_listing_page){
737
-        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
738
-        update_option( 'geodir_add_listing_page', $add_listing_page);
739
-    }
740
-
741
-    // Update the listing preview page settings
742
-    $listing_preview_page = $wpdb->get_var(
743
-        $wpdb->prepare(
744
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
745
-            array('listing-preview')
746
-        )
747
-    );
748
-
749
-    if($listing_preview_page){
750
-        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
751
-        update_option( 'geodir_preview_page', $listing_preview_page);
752
-    }
753
-
754
-    // Update the listing success page settings
755
-    $listing_success_page = $wpdb->get_var(
756
-        $wpdb->prepare(
757
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
758
-            array('listing-success')
759
-        )
760
-    );
761
-
762
-    if($listing_success_page){
763
-        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
764
-        update_option( 'geodir_success_page', $listing_success_page);
765
-    }
766
-
767
-    // Update the listing success page settings
768
-    $location_page = $wpdb->get_var(
769
-        $wpdb->prepare(
770
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
771
-            array('location')
772
-        )
773
-    );
774
-
775
-    if($location_page){
776
-        $location_slug = get_option('geodir_location_prefix');
777
-        if(!$location_slug ){$location_slug  = 'location';}
778
-        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
779
-        update_option( 'geodir_location_page', $location_page);
780
-    }
726
+	global $wpdb;
727
+
728
+	// Update the add listing page settings
729
+	$add_listing_page = $wpdb->get_var(
730
+		$wpdb->prepare(
731
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
732
+			array('add-listing')
733
+		)
734
+	);
735
+
736
+	if($add_listing_page){
737
+		wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
738
+		update_option( 'geodir_add_listing_page', $add_listing_page);
739
+	}
740
+
741
+	// Update the listing preview page settings
742
+	$listing_preview_page = $wpdb->get_var(
743
+		$wpdb->prepare(
744
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
745
+			array('listing-preview')
746
+		)
747
+	);
748
+
749
+	if($listing_preview_page){
750
+		wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
751
+		update_option( 'geodir_preview_page', $listing_preview_page);
752
+	}
753
+
754
+	// Update the listing success page settings
755
+	$listing_success_page = $wpdb->get_var(
756
+		$wpdb->prepare(
757
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
758
+			array('listing-success')
759
+		)
760
+	);
761
+
762
+	if($listing_success_page){
763
+		wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
764
+		update_option( 'geodir_success_page', $listing_success_page);
765
+	}
766
+
767
+	// Update the listing success page settings
768
+	$location_page = $wpdb->get_var(
769
+		$wpdb->prepare(
770
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
771
+			array('location')
772
+		)
773
+	);
774
+
775
+	if($location_page){
776
+		$location_slug = get_option('geodir_location_prefix');
777
+		if(!$location_slug ){$location_slug  = 'location';}
778
+		wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
779
+		update_option( 'geodir_location_page', $location_page);
780
+	}
781 781
 
782 782
 }
783 783
 
@@ -791,31 +791,31 @@  discard block
 block discarded – undo
791 791
 function gd_fix_cpt_rewrite_slug()
792 792
 {
793 793
 
794
-    $alt_post_types = array();
795
-    $post_types = get_option('geodir_post_types');
794
+	$alt_post_types = array();
795
+	$post_types = get_option('geodir_post_types');
796 796
 
797 797
 
798
-    if (is_array($post_types)){
798
+	if (is_array($post_types)){
799 799
 
800
-        foreach ($post_types as $post_type => $args) {
800
+		foreach ($post_types as $post_type => $args) {
801 801
 
802 802
 
803
-            if(isset($args['rewrite']['slug'])){
804
-                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
805
-            }
803
+			if(isset($args['rewrite']['slug'])){
804
+				$args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
805
+			}
806 806
 
807
-                $alt_post_types[$post_type] = $args;
807
+				$alt_post_types[$post_type] = $args;
808 808
 
809
-        }
810
-    }
809
+		}
810
+	}
811 811
 
812
-    if(!empty($alt_post_types)) {
813
-        update_option('geodir_post_types',$alt_post_types);
814
-        }
812
+	if(!empty($alt_post_types)) {
813
+		update_option('geodir_post_types',$alt_post_types);
814
+		}
815 815
 
816 816
 
817
-    // flush the rewrite rules
818
-    flush_rewrite_rules();
817
+	// flush the rewrite rules
818
+	flush_rewrite_rules();
819 819
 }
820 820
 
821 821
 
@@ -828,18 +828,18 @@  discard block
 block discarded – undo
828 828
  */
829 829
 function gd_fix_address_detail_table_limit()
830 830
 {
831
-    global $wpdb;
832
-
833
-    $all_postypes = geodir_get_posttypes();
834
-
835
-    if (!empty($all_postypes)) {
836
-        foreach ($all_postypes as $key) {
837
-            // update each GD CTP
838
-            try {
839
-                $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
840
-            } catch(Exception $e) {
841
-                error_log( 'Error: ' . $e->getMessage() );
842
-            }
843
-        }
844
-    }
831
+	global $wpdb;
832
+
833
+	$all_postypes = geodir_get_posttypes();
834
+
835
+	if (!empty($all_postypes)) {
836
+		foreach ($all_postypes as $key) {
837
+			// update each GD CTP
838
+			try {
839
+				$wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
840
+			} catch(Exception $e) {
841
+				error_log( 'Error: ' . $e->getMessage() );
842
+			}
843
+		}
844
+	}
845 845
 }
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 3 patches
Indentation   +1513 added lines, -1513 removed lines patch added patch discarded remove patch
@@ -21,83 +21,83 @@  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_{$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_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_{$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_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_{$location}_{$html_var}")){
62
-        /**
63
-         * Filter the checkbox html by location and individual custom field.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param array $cf The custom field array.
67
-         * @since 1.6.6
68
-         */
69
-        $html = apply_filters("geodir_custom_field_output_checkbox_{$location}_{$html_var}",$html,$cf);
70
-    }
71
-
72
-    // If not html then we run the standard output.
73
-    if(empty($html)){
74
-
75
-        if ( (int) $post->{$html_var} == 1 ):
76
-
77
-            if ( $post->{$html_var} == '1' ):
78
-                $html_val = __( 'Yes', 'geodirectory' );
79
-            else:
80
-                $html_val = __( 'No', 'geodirectory' );
81
-            endif;
82
-
83
-            $field_icon = geodir_field_icon_proccess($cf);
84
-            if (strpos($field_icon, 'http') !== false) {
85
-                $field_icon_af = '';
86
-            } elseif ($field_icon == '') {
87
-                $field_icon_af = '';
88
-            } else {
89
-                $field_icon_af = $field_icon;
90
-                $field_icon = '';
91
-            }
92
-
93
-            $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;
94
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
95
-            $html .= '</span>' . $html_val . '</div>';
96
-        endif;
97
-
98
-    }
99
-
100
-    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_{$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_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_{$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_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_{$location}_{$html_var}")){
62
+		/**
63
+		 * Filter the checkbox html by location and individual custom field.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param array $cf The custom field array.
67
+		 * @since 1.6.6
68
+		 */
69
+		$html = apply_filters("geodir_custom_field_output_checkbox_{$location}_{$html_var}",$html,$cf);
70
+	}
71
+
72
+	// If not html then we run the standard output.
73
+	if(empty($html)){
74
+
75
+		if ( (int) $post->{$html_var} == 1 ):
76
+
77
+			if ( $post->{$html_var} == '1' ):
78
+				$html_val = __( 'Yes', 'geodirectory' );
79
+			else:
80
+				$html_val = __( 'No', 'geodirectory' );
81
+			endif;
82
+
83
+			$field_icon = geodir_field_icon_proccess($cf);
84
+			if (strpos($field_icon, 'http') !== false) {
85
+				$field_icon_af = '';
86
+			} elseif ($field_icon == '') {
87
+				$field_icon_af = '';
88
+			} else {
89
+				$field_icon_af = $field_icon;
90
+				$field_icon = '';
91
+			}
92
+
93
+			$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;
94
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
95
+			$html .= '</span>' . $html_val . '</div>';
96
+		endif;
97
+
98
+	}
99
+
100
+	return $html;
101 101
 }
102 102
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103 103
 
@@ -114,70 +114,70 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
116 116
 
117
-    // check we have the post value
118
-    if(is_int($p)){$post = geodir_get_post_info($p);}
119
-    else{ global $post;}
120
-
121
-    if(!is_array($cf) && $cf!=''){
122
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
123
-        if(!$cf){return NULL;}
124
-    }
125
-
126
-    $html_var = $cf['htmlvar_name'];
127
-
128
-    // Check if there is a location specific filter.
129
-    if(has_filter("geodir_custom_field_output_fieldset_{$location}")){
130
-        /**
131
-         * Filter the fieldset html by location.
132
-         *
133
-         * @param string $html The html to filter.
134
-         * @param array $cf The custom field array.
135
-         * @since 1.6.6
136
-         */
137
-        $html = apply_filters("geodir_custom_field_output_fieldset_{$location}",$html,$cf);
138
-    }
139
-
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_output_fieldset_{$html_var}")){
142
-        /**
143
-         * Filter the fieldset html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param string $location The location to output the html.
147
-         * @param array $cf The custom field array.
148
-         * @since 1.6.6
149
-         */
150
-        $html = apply_filters("geodir_custom_field_output_fieldset_{$html_var}",$html,$location,$cf);
151
-    }
152
-
153
-    // Check if there is a custom field specific filter.
154
-    if(has_filter("geodir_custom_field_output_fieldset_{$location}_{$html_var}")){
155
-        /**
156
-         * Filter the fieldset html by location and individual custom field.
157
-         *
158
-         * @param string $html The html to filter.
159
-         * @param array $cf The custom field array.
160
-         * @since 1.6.6
161
-         */
162
-        $html = apply_filters("geodir_custom_field_output_fieldset_{$location}_{$html_var}",$html,$cf);
163
-    }
164
-
165
-    // If not html then we run the standard output.
166
-    if(empty($html)){
167
-
168
-        global $field_set_start;
169
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
170
-
171
-        if ($field_set_start == 1) {
172
-            echo '</div><div class="geodir-company_info field-group ' . $cf['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
173
-        } else {
174
-            echo '<h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
175
-            $field_set_start = 1;
176
-        }
177
-
178
-    }
179
-
180
-    return $html;
117
+	// check we have the post value
118
+	if(is_int($p)){$post = geodir_get_post_info($p);}
119
+	else{ global $post;}
120
+
121
+	if(!is_array($cf) && $cf!=''){
122
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
123
+		if(!$cf){return NULL;}
124
+	}
125
+
126
+	$html_var = $cf['htmlvar_name'];
127
+
128
+	// Check if there is a location specific filter.
129
+	if(has_filter("geodir_custom_field_output_fieldset_{$location}")){
130
+		/**
131
+		 * Filter the fieldset html by location.
132
+		 *
133
+		 * @param string $html The html to filter.
134
+		 * @param array $cf The custom field array.
135
+		 * @since 1.6.6
136
+		 */
137
+		$html = apply_filters("geodir_custom_field_output_fieldset_{$location}",$html,$cf);
138
+	}
139
+
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_output_fieldset_{$html_var}")){
142
+		/**
143
+		 * Filter the fieldset html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param string $location The location to output the html.
147
+		 * @param array $cf The custom field array.
148
+		 * @since 1.6.6
149
+		 */
150
+		$html = apply_filters("geodir_custom_field_output_fieldset_{$html_var}",$html,$location,$cf);
151
+	}
152
+
153
+	// Check if there is a custom field specific filter.
154
+	if(has_filter("geodir_custom_field_output_fieldset_{$location}_{$html_var}")){
155
+		/**
156
+		 * Filter the fieldset html by location and individual custom field.
157
+		 *
158
+		 * @param string $html The html to filter.
159
+		 * @param array $cf The custom field array.
160
+		 * @since 1.6.6
161
+		 */
162
+		$html = apply_filters("geodir_custom_field_output_fieldset_{$location}_{$html_var}",$html,$cf);
163
+	}
164
+
165
+	// If not html then we run the standard output.
166
+	if(empty($html)){
167
+
168
+		global $field_set_start;
169
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
170
+
171
+		if ($field_set_start == 1) {
172
+			echo '</div><div class="geodir-company_info field-group ' . $cf['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
173
+		} else {
174
+			echo '<h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
175
+			$field_set_start = 1;
176
+		}
177
+
178
+	}
179
+
180
+	return $html;
181 181
 }
182 182
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
183 183
 
@@ -194,105 +194,105 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function geodir_cf_url($html,$location,$cf,$p=''){
196 196
 
197
-    // check we have the post value
198
-    if(is_int($p)){$post = geodir_get_post_info($p);}
199
-    else{ global $post;}
200
-
201
-    if(!is_array($cf) && $cf!=''){
202
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
203
-        if(!$cf){return NULL;}
204
-    }
205
-
206
-    $html_var = $cf['htmlvar_name'];
207
-
208
-    // Check if there is a location specific filter.
209
-    if(has_filter("geodir_custom_field_output_url_{$location}")){
210
-        /**
211
-         * Filter the url html by location.
212
-         *
213
-         * @param string $html The html to filter.
214
-         * @param array $cf The custom field array.
215
-         * @since 1.6.6
216
-         */
217
-        $html = apply_filters("geodir_custom_field_output_url_{$location}",$html,$cf);
218
-    }
219
-
220
-    // Check if there is a custom field specific filter.
221
-    if(has_filter("geodir_custom_field_output_url_{$html_var}")){
222
-        /**
223
-         * Filter the url html by individual custom field.
224
-         *
225
-         * @param string $html The html to filter.
226
-         * @param string $location The location to output the html.
227
-         * @param array $cf The custom field array.
228
-         * @since 1.6.6
229
-         */
230
-        $html = apply_filters("geodir_custom_field_output_url_{$html_var}",$html,$location,$cf);
231
-    }
232
-
233
-    // Check if there is a custom field specific filter.
234
-    if(has_filter("geodir_custom_field_output_url_{$location}_{$html_var}")){
235
-        /**
236
-         * Filter the url html by location and individual custom field.
237
-         *
238
-         * @param string $html The html to filter.
239
-         * @param array $cf The custom field array.
240
-         * @since 1.6.6
241
-         */
242
-        $html = apply_filters("geodir_custom_field_output_url_{$location}_{$html_var}",$html,$cf);
243
-    }
244
-
245
-    // If not html then we run the standard output.
246
-    if(empty($html)){
247
-
248
-        if ($post->{$cf['htmlvar_name']}):
249
-
250
-            $field_icon = geodir_field_icon_proccess($cf);
251
-            if (strpos($field_icon, 'http') !== false) {
252
-                $field_icon_af = '';
253
-            } elseif ($field_icon == '') {
254
-
255
-                if ($cf['name'] == 'geodir_facebook') {
256
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
257
-                } elseif ($cf['name'] == 'geodir_twitter') {
258
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
259
-                } else {
260
-                    $field_icon_af = '<i class="fa fa-link"></i>';
261
-                }
262
-
263
-            } else {
264
-                $field_icon_af = $field_icon;
265
-                $field_icon = '';
266
-            }
267
-
268
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
269
-
270
-
271
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
272
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
273
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
274
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
275
-
276
-
277
-
278
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
279
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
280
-            /**
281
-             * Filter custom field website name.
282
-             *
283
-             * @since 1.0.0
284
-             *
285
-             * @param string $title Website Title.
286
-             * @param string $website Website URL.
287
-             * @param int $post->ID Post ID.
288
-             */
289
-            $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>';
290
-
291
-        endif;
292
-
293
-    }
294
-
295
-    return $html;
197
+	// check we have the post value
198
+	if(is_int($p)){$post = geodir_get_post_info($p);}
199
+	else{ global $post;}
200
+
201
+	if(!is_array($cf) && $cf!=''){
202
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
203
+		if(!$cf){return NULL;}
204
+	}
205
+
206
+	$html_var = $cf['htmlvar_name'];
207
+
208
+	// Check if there is a location specific filter.
209
+	if(has_filter("geodir_custom_field_output_url_{$location}")){
210
+		/**
211
+		 * Filter the url html by location.
212
+		 *
213
+		 * @param string $html The html to filter.
214
+		 * @param array $cf The custom field array.
215
+		 * @since 1.6.6
216
+		 */
217
+		$html = apply_filters("geodir_custom_field_output_url_{$location}",$html,$cf);
218
+	}
219
+
220
+	// Check if there is a custom field specific filter.
221
+	if(has_filter("geodir_custom_field_output_url_{$html_var}")){
222
+		/**
223
+		 * Filter the url html by individual custom field.
224
+		 *
225
+		 * @param string $html The html to filter.
226
+		 * @param string $location The location to output the html.
227
+		 * @param array $cf The custom field array.
228
+		 * @since 1.6.6
229
+		 */
230
+		$html = apply_filters("geodir_custom_field_output_url_{$html_var}",$html,$location,$cf);
231
+	}
232
+
233
+	// Check if there is a custom field specific filter.
234
+	if(has_filter("geodir_custom_field_output_url_{$location}_{$html_var}")){
235
+		/**
236
+		 * Filter the url html by location and individual custom field.
237
+		 *
238
+		 * @param string $html The html to filter.
239
+		 * @param array $cf The custom field array.
240
+		 * @since 1.6.6
241
+		 */
242
+		$html = apply_filters("geodir_custom_field_output_url_{$location}_{$html_var}",$html,$cf);
243
+	}
244
+
245
+	// If not html then we run the standard output.
246
+	if(empty($html)){
247
+
248
+		if ($post->{$cf['htmlvar_name']}):
249
+
250
+			$field_icon = geodir_field_icon_proccess($cf);
251
+			if (strpos($field_icon, 'http') !== false) {
252
+				$field_icon_af = '';
253
+			} elseif ($field_icon == '') {
254
+
255
+				if ($cf['name'] == 'geodir_facebook') {
256
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
257
+				} elseif ($cf['name'] == 'geodir_twitter') {
258
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
259
+				} else {
260
+					$field_icon_af = '<i class="fa fa-link"></i>';
261
+				}
262
+
263
+			} else {
264
+				$field_icon_af = $field_icon;
265
+				$field_icon = '';
266
+			}
267
+
268
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
269
+
270
+
271
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
272
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
273
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
274
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
275
+
276
+
277
+
278
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
279
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
280
+			/**
281
+			 * Filter custom field website name.
282
+			 *
283
+			 * @since 1.0.0
284
+			 *
285
+			 * @param string $title Website Title.
286
+			 * @param string $website Website URL.
287
+			 * @param int $post->ID Post ID.
288
+			 */
289
+			$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>';
290
+
291
+		endif;
292
+
293
+	}
294
+
295
+	return $html;
296 296
 }
297 297
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
298 298
 
@@ -309,79 +309,79 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_cf_phone($html,$location,$cf,$p=''){
311 311
 
312
-    // check we have the post value
313
-    if(is_int($p)){$post = geodir_get_post_info($p);}
314
-    else{ global $post;}
315
-
316
-    if(!is_array($cf) && $cf!=''){
317
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
318
-        if(!$cf){return NULL;}
319
-    }
320
-
321
-    $html_var = $cf['htmlvar_name'];
322
-
323
-    // Check if there is a location specific filter.
324
-    if(has_filter("geodir_custom_field_output_phone_{$location}")){
325
-        /**
326
-         * Filter the phone html by location.
327
-         *
328
-         * @param string $html The html to filter.
329
-         * @param array $cf The custom field array.
330
-         * @since 1.6.6
331
-         */
332
-        $html = apply_filters("geodir_custom_field_output_phone_{$location}",$html,$cf);
333
-    }
334
-
335
-    // Check if there is a custom field specific filter.
336
-    if(has_filter("geodir_custom_field_output_phone_{$html_var}")){
337
-        /**
338
-         * Filter the phone html by individual custom field.
339
-         *
340
-         * @param string $html The html to filter.
341
-         * @param string $location The location to output the html.
342
-         * @param array $cf The custom field array.
343
-         * @since 1.6.6
344
-         */
345
-        $html = apply_filters("geodir_custom_field_output_phone_{$html_var}",$html,$location,$cf);
346
-    }
347
-
348
-    // Check if there is a custom field specific filter.
349
-    if(has_filter("geodir_custom_field_output_phone_{$location}_{$html_var}")){
350
-        /**
351
-         * Filter the phone html by location and individual custom field.
352
-         *
353
-         * @param string $html The html to filter.
354
-         * @param array $cf The custom field array.
355
-         * @since 1.6.6
356
-         */
357
-        $html = apply_filters("geodir_custom_field_output_phone_{$location}_{$html_var}",$html,$cf);
358
-    }
359
-
360
-    // If not html then we run the standard output.
361
-    if(empty($html)){
362
-
363
-        if ($post->{$cf['htmlvar_name']}):
364
-
365
-            $field_icon = geodir_field_icon_proccess($cf);
366
-            if (strpos($field_icon, 'http') !== false) {
367
-                $field_icon_af = '';
368
-            } elseif ($field_icon == '') {
369
-                $field_icon_af = '<i class="fa fa-phone"></i>';
370
-            } else {
371
-                $field_icon_af = $field_icon;
372
-                $field_icon = '';
373
-            }
374
-
375
-
376
-            $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 .
377
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
378
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
379
-
380
-        endif;
381
-
382
-    }
383
-
384
-    return $html;
312
+	// check we have the post value
313
+	if(is_int($p)){$post = geodir_get_post_info($p);}
314
+	else{ global $post;}
315
+
316
+	if(!is_array($cf) && $cf!=''){
317
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
318
+		if(!$cf){return NULL;}
319
+	}
320
+
321
+	$html_var = $cf['htmlvar_name'];
322
+
323
+	// Check if there is a location specific filter.
324
+	if(has_filter("geodir_custom_field_output_phone_{$location}")){
325
+		/**
326
+		 * Filter the phone html by location.
327
+		 *
328
+		 * @param string $html The html to filter.
329
+		 * @param array $cf The custom field array.
330
+		 * @since 1.6.6
331
+		 */
332
+		$html = apply_filters("geodir_custom_field_output_phone_{$location}",$html,$cf);
333
+	}
334
+
335
+	// Check if there is a custom field specific filter.
336
+	if(has_filter("geodir_custom_field_output_phone_{$html_var}")){
337
+		/**
338
+		 * Filter the phone html by individual custom field.
339
+		 *
340
+		 * @param string $html The html to filter.
341
+		 * @param string $location The location to output the html.
342
+		 * @param array $cf The custom field array.
343
+		 * @since 1.6.6
344
+		 */
345
+		$html = apply_filters("geodir_custom_field_output_phone_{$html_var}",$html,$location,$cf);
346
+	}
347
+
348
+	// Check if there is a custom field specific filter.
349
+	if(has_filter("geodir_custom_field_output_phone_{$location}_{$html_var}")){
350
+		/**
351
+		 * Filter the phone html by location and individual custom field.
352
+		 *
353
+		 * @param string $html The html to filter.
354
+		 * @param array $cf The custom field array.
355
+		 * @since 1.6.6
356
+		 */
357
+		$html = apply_filters("geodir_custom_field_output_phone_{$location}_{$html_var}",$html,$cf);
358
+	}
359
+
360
+	// If not html then we run the standard output.
361
+	if(empty($html)){
362
+
363
+		if ($post->{$cf['htmlvar_name']}):
364
+
365
+			$field_icon = geodir_field_icon_proccess($cf);
366
+			if (strpos($field_icon, 'http') !== false) {
367
+				$field_icon_af = '';
368
+			} elseif ($field_icon == '') {
369
+				$field_icon_af = '<i class="fa fa-phone"></i>';
370
+			} else {
371
+				$field_icon_af = $field_icon;
372
+				$field_icon = '';
373
+			}
374
+
375
+
376
+			$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 .
377
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
378
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
379
+
380
+		endif;
381
+
382
+	}
383
+
384
+	return $html;
385 385
 }
386 386
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
387 387
 
@@ -398,84 +398,84 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function geodir_cf_time($html,$location,$cf,$p=''){
400 400
 
401
-    // check we have the post value
402
-    if(is_int($p)){$post = geodir_get_post_info($p);}
403
-    else{ global $post;}
404
-
405
-    if(!is_array($cf) && $cf!=''){
406
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
407
-        if(!$cf){return NULL;}
408
-    }
409
-
410
-    $html_var = $cf['htmlvar_name'];
411
-
412
-    // Check if there is a location specific filter.
413
-    if(has_filter("geodir_custom_field_output_time_{$location}")){
414
-        /**
415
-         * Filter the time html by location.
416
-         *
417
-         * @param string $html The html to filter.
418
-         * @param array $cf The custom field array.
419
-         * @since 1.6.6
420
-         */
421
-        $html = apply_filters("geodir_custom_field_output_time_{$location}",$html,$cf);
422
-    }
423
-
424
-    // Check if there is a custom field specific filter.
425
-    if(has_filter("geodir_custom_field_output_time_{$html_var}")){
426
-        /**
427
-         * Filter the time html by individual custom field.
428
-         *
429
-         * @param string $html The html to filter.
430
-         * @param string $location The location to output the html.
431
-         * @param array $cf The custom field array.
432
-         * @since 1.6.6
433
-         */
434
-        $html = apply_filters("geodir_custom_field_output_time_{$html_var}",$html,$location,$cf);
435
-    }
436
-
437
-    // Check if there is a custom field specific filter.
438
-    if(has_filter("geodir_custom_field_output_time_{$location}_{$html_var}")){
439
-        /**
440
-         * Filter the time html by location and individual custom field.
441
-         *
442
-         * @param string $html The html to filter.
443
-         * @param array $cf The custom field array.
444
-         * @since 1.6.6
445
-         */
446
-        $html = apply_filters("geodir_custom_field_output_time_{$location}_{$html_var}",$html,$cf);
447
-    }
448
-
449
-    // If not html then we run the standard output.
450
-    if(empty($html)){
451
-
452
-        if ($post->{$cf['htmlvar_name']}):
453
-
454
-            $value = '';
455
-            if ($post->{$cf['htmlvar_name']} != '')
456
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
458
-
459
-            $field_icon = geodir_field_icon_proccess($cf);
460
-            if (strpos($field_icon, 'http') !== false) {
461
-                $field_icon_af = '';
462
-            } elseif ($field_icon == '') {
463
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
464
-            } else {
465
-                $field_icon_af = $field_icon;
466
-                $field_icon = '';
467
-            }
468
-
469
-
470
-            $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;
471
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
472
-            $html .= '</span>' . $value . '</div>';
473
-
474
-        endif;
475
-
476
-    }
477
-
478
-    return $html;
401
+	// check we have the post value
402
+	if(is_int($p)){$post = geodir_get_post_info($p);}
403
+	else{ global $post;}
404
+
405
+	if(!is_array($cf) && $cf!=''){
406
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
407
+		if(!$cf){return NULL;}
408
+	}
409
+
410
+	$html_var = $cf['htmlvar_name'];
411
+
412
+	// Check if there is a location specific filter.
413
+	if(has_filter("geodir_custom_field_output_time_{$location}")){
414
+		/**
415
+		 * Filter the time html by location.
416
+		 *
417
+		 * @param string $html The html to filter.
418
+		 * @param array $cf The custom field array.
419
+		 * @since 1.6.6
420
+		 */
421
+		$html = apply_filters("geodir_custom_field_output_time_{$location}",$html,$cf);
422
+	}
423
+
424
+	// Check if there is a custom field specific filter.
425
+	if(has_filter("geodir_custom_field_output_time_{$html_var}")){
426
+		/**
427
+		 * Filter the time html by individual custom field.
428
+		 *
429
+		 * @param string $html The html to filter.
430
+		 * @param string $location The location to output the html.
431
+		 * @param array $cf The custom field array.
432
+		 * @since 1.6.6
433
+		 */
434
+		$html = apply_filters("geodir_custom_field_output_time_{$html_var}",$html,$location,$cf);
435
+	}
436
+
437
+	// Check if there is a custom field specific filter.
438
+	if(has_filter("geodir_custom_field_output_time_{$location}_{$html_var}")){
439
+		/**
440
+		 * Filter the time html by location and individual custom field.
441
+		 *
442
+		 * @param string $html The html to filter.
443
+		 * @param array $cf The custom field array.
444
+		 * @since 1.6.6
445
+		 */
446
+		$html = apply_filters("geodir_custom_field_output_time_{$location}_{$html_var}",$html,$cf);
447
+	}
448
+
449
+	// If not html then we run the standard output.
450
+	if(empty($html)){
451
+
452
+		if ($post->{$cf['htmlvar_name']}):
453
+
454
+			$value = '';
455
+			if ($post->{$cf['htmlvar_name']} != '')
456
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
458
+
459
+			$field_icon = geodir_field_icon_proccess($cf);
460
+			if (strpos($field_icon, 'http') !== false) {
461
+				$field_icon_af = '';
462
+			} elseif ($field_icon == '') {
463
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
464
+			} else {
465
+				$field_icon_af = $field_icon;
466
+				$field_icon = '';
467
+			}
468
+
469
+
470
+			$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;
471
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
472
+			$html .= '</span>' . $value . '</div>';
473
+
474
+		endif;
475
+
476
+	}
477
+
478
+	return $html;
479 479
 }
480 480
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
481 481
 
@@ -492,106 +492,106 @@  discard block
 block discarded – undo
492 492
  */
493 493
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
494 494
 
495
-    // check we have the post value
496
-    if(is_int($p)){$post = geodir_get_post_info($p);}
497
-    else{ global $post;}
498
-
499
-    if(!is_array($cf) && $cf!=''){
500
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
501
-        if(!$cf){return NULL;}
502
-    }
503
-
504
-    $html_var = $cf['htmlvar_name'];
505
-
506
-    // Check if there is a location specific filter.
507
-    if(has_filter("geodir_custom_field_output_datepicker_{$location}")){
508
-        /**
509
-         * Filter the datepicker html by location.
510
-         *
511
-         * @param string $html The html to filter.
512
-         * @param array $cf The custom field array.
513
-         * @since 1.6.6
514
-         */
515
-        $html = apply_filters("geodir_custom_field_output_datepicker_{$location}",$html,$cf);
516
-    }
517
-
518
-    // Check if there is a custom field specific filter.
519
-    if(has_filter("geodir_custom_field_output_datepicker_{$html_var}")){
520
-        /**
521
-         * Filter the datepicker html by individual custom field.
522
-         *
523
-         * @param string $html The html to filter.
524
-         * @param string $location The location to output the html.
525
-         * @param array $cf The custom field array.
526
-         * @since 1.6.6
527
-         */
528
-        $html = apply_filters("geodir_custom_field_output_datepicker_{$html_var}",$html,$location,$cf);
529
-    }
530
-
531
-    // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_output_datepicker_{$location}_{$html_var}")){
533
-        /**
534
-         * Filter the datepicker html by location and individual custom field.
535
-         *
536
-         * @param string $html The html to filter.
537
-         * @param array $cf The custom field array.
538
-         * @since 1.6.6
539
-         */
540
-        $html = apply_filters("geodir_custom_field_output_datepicker_{$location}_{$html_var}",$html,$cf);
541
-    }
542
-
543
-    // If not html then we run the standard output.
544
-    if(empty($html)){
545
-
546
-        if ($post->{$cf['htmlvar_name']}):
547
-
548
-            $date_format = geodir_default_date_format();
549
-            if ($cf['extra_fields'] != '') {
550
-                $date_format = unserialize($cf['extra_fields']);
551
-                $date_format = $date_format['date_format'];
552
-            }
553
-            // check if we need to change the format or not
554
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
555
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
556
-
557
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
558
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
559
-
560
-                $date_format = str_replace($search, $replace, $date_format);
561
-
562
-                $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
563
-            }else{
564
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
565
-            }
566
-
567
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
568
-                $value = date_i18n($date_format, strtotime($post_htmlvar_value));
569
-            }else{
570
-                return '';
571
-            }
572
-
573
-            $field_icon = geodir_field_icon_proccess($cf);
574
-
575
-            if (strpos($field_icon, 'http') !== false) {
576
-                $field_icon_af = '';
577
-            } elseif ($field_icon == '') {
578
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
579
-            } else {
580
-                $field_icon_af = $field_icon;
581
-                $field_icon = '';
582
-            }
583
-
584
-
585
-
586
-            $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;
587
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
588
-            $html .= '</span>' . $value . '</div>';
589
-
590
-        endif;
591
-
592
-    }
593
-
594
-    return $html;
495
+	// check we have the post value
496
+	if(is_int($p)){$post = geodir_get_post_info($p);}
497
+	else{ global $post;}
498
+
499
+	if(!is_array($cf) && $cf!=''){
500
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
501
+		if(!$cf){return NULL;}
502
+	}
503
+
504
+	$html_var = $cf['htmlvar_name'];
505
+
506
+	// Check if there is a location specific filter.
507
+	if(has_filter("geodir_custom_field_output_datepicker_{$location}")){
508
+		/**
509
+		 * Filter the datepicker html by location.
510
+		 *
511
+		 * @param string $html The html to filter.
512
+		 * @param array $cf The custom field array.
513
+		 * @since 1.6.6
514
+		 */
515
+		$html = apply_filters("geodir_custom_field_output_datepicker_{$location}",$html,$cf);
516
+	}
517
+
518
+	// Check if there is a custom field specific filter.
519
+	if(has_filter("geodir_custom_field_output_datepicker_{$html_var}")){
520
+		/**
521
+		 * Filter the datepicker html by individual custom field.
522
+		 *
523
+		 * @param string $html The html to filter.
524
+		 * @param string $location The location to output the html.
525
+		 * @param array $cf The custom field array.
526
+		 * @since 1.6.6
527
+		 */
528
+		$html = apply_filters("geodir_custom_field_output_datepicker_{$html_var}",$html,$location,$cf);
529
+	}
530
+
531
+	// Check if there is a custom field specific filter.
532
+	if(has_filter("geodir_custom_field_output_datepicker_{$location}_{$html_var}")){
533
+		/**
534
+		 * Filter the datepicker html by location and individual custom field.
535
+		 *
536
+		 * @param string $html The html to filter.
537
+		 * @param array $cf The custom field array.
538
+		 * @since 1.6.6
539
+		 */
540
+		$html = apply_filters("geodir_custom_field_output_datepicker_{$location}_{$html_var}",$html,$cf);
541
+	}
542
+
543
+	// If not html then we run the standard output.
544
+	if(empty($html)){
545
+
546
+		if ($post->{$cf['htmlvar_name']}):
547
+
548
+			$date_format = geodir_default_date_format();
549
+			if ($cf['extra_fields'] != '') {
550
+				$date_format = unserialize($cf['extra_fields']);
551
+				$date_format = $date_format['date_format'];
552
+			}
553
+			// check if we need to change the format or not
554
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
555
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
556
+
557
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
558
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
559
+
560
+				$date_format = str_replace($search, $replace, $date_format);
561
+
562
+				$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
563
+			}else{
564
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
565
+			}
566
+
567
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
568
+				$value = date_i18n($date_format, strtotime($post_htmlvar_value));
569
+			}else{
570
+				return '';
571
+			}
572
+
573
+			$field_icon = geodir_field_icon_proccess($cf);
574
+
575
+			if (strpos($field_icon, 'http') !== false) {
576
+				$field_icon_af = '';
577
+			} elseif ($field_icon == '') {
578
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
579
+			} else {
580
+				$field_icon_af = $field_icon;
581
+				$field_icon = '';
582
+			}
583
+
584
+
585
+
586
+			$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;
587
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
588
+			$html .= '</span>' . $value . '</div>';
589
+
590
+		endif;
591
+
592
+	}
593
+
594
+	return $html;
595 595
 }
596 596
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
597 597
 
@@ -608,81 +608,81 @@  discard block
 block discarded – undo
608 608
  */
609 609
 function geodir_cf_text($html,$location,$cf,$p=''){
610 610
 
611
-    // check we have the post value
612
-    if(is_int($p)){$post = geodir_get_post_info($p);}
613
-    else{ global $post;}
614
-
615
-    if(!is_array($cf) && $cf!=''){
616
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
617
-        if(!$cf){return NULL;}
618
-    }
619
-
620
-    $html_var = $cf['htmlvar_name'];
621
-
622
-    // Check if there is a location specific filter.
623
-    if(has_filter("geodir_custom_field_output_text_{$location}")){
624
-        /**
625
-         * Filter the text html by location.
626
-         *
627
-         * @param string $html The html to filter.
628
-         * @param array $cf The custom field array.
629
-         * @since 1.6.6
630
-         */
631
-        $html = apply_filters("geodir_custom_field_output_text_{$location}",$html,$cf);
632
-    }
633
-
634
-    // Check if there is a custom field specific filter.
635
-    if(has_filter("geodir_custom_field_output_text_{$html_var}")){
636
-        /**
637
-         * Filter the text html by individual custom field.
638
-         *
639
-         * @param string $html The html to filter.
640
-         * @param string $location The location to output the html.
641
-         * @param array $cf The custom field array.
642
-         * @since 1.6.6
643
-         */
644
-        $html = apply_filters("geodir_custom_field_output_text_{$html_var}",$html,$location,$cf);
645
-    }
646
-
647
-    // Check if there is a custom field specific filter.
648
-    if(has_filter("geodir_custom_field_output_text_{$location}_{$html_var}")){
649
-        /**
650
-         * Filter the text html by location and individual custom field.
651
-         *
652
-         * @param string $html The html to filter.
653
-         * @param array $cf The custom field array.
654
-         * @since 1.6.6
655
-         */
656
-        $html = apply_filters("geodir_custom_field_output_text_{$location}_{$html_var}",$html,$cf);
657
-    }
658
-
659
-    // If not html then we run the standard output.
660
-    if(empty($html)){
661
-
662
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
663
-
664
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
665
-
666
-            $field_icon = geodir_field_icon_proccess($cf);
667
-            if (strpos($field_icon, 'http') !== false) {
668
-                $field_icon_af = '';
669
-            } elseif ($field_icon == '') {
670
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
671
-            } else {
672
-                $field_icon_af = $field_icon;
673
-                $field_icon = '';
674
-            }
675
-
676
-
677
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
678
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
679
-            $html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
680
-
681
-        endif;
682
-
683
-    }
684
-
685
-    return $html;
611
+	// check we have the post value
612
+	if(is_int($p)){$post = geodir_get_post_info($p);}
613
+	else{ global $post;}
614
+
615
+	if(!is_array($cf) && $cf!=''){
616
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
617
+		if(!$cf){return NULL;}
618
+	}
619
+
620
+	$html_var = $cf['htmlvar_name'];
621
+
622
+	// Check if there is a location specific filter.
623
+	if(has_filter("geodir_custom_field_output_text_{$location}")){
624
+		/**
625
+		 * Filter the text html by location.
626
+		 *
627
+		 * @param string $html The html to filter.
628
+		 * @param array $cf The custom field array.
629
+		 * @since 1.6.6
630
+		 */
631
+		$html = apply_filters("geodir_custom_field_output_text_{$location}",$html,$cf);
632
+	}
633
+
634
+	// Check if there is a custom field specific filter.
635
+	if(has_filter("geodir_custom_field_output_text_{$html_var}")){
636
+		/**
637
+		 * Filter the text html by individual custom field.
638
+		 *
639
+		 * @param string $html The html to filter.
640
+		 * @param string $location The location to output the html.
641
+		 * @param array $cf The custom field array.
642
+		 * @since 1.6.6
643
+		 */
644
+		$html = apply_filters("geodir_custom_field_output_text_{$html_var}",$html,$location,$cf);
645
+	}
646
+
647
+	// Check if there is a custom field specific filter.
648
+	if(has_filter("geodir_custom_field_output_text_{$location}_{$html_var}")){
649
+		/**
650
+		 * Filter the text html by location and individual custom field.
651
+		 *
652
+		 * @param string $html The html to filter.
653
+		 * @param array $cf The custom field array.
654
+		 * @since 1.6.6
655
+		 */
656
+		$html = apply_filters("geodir_custom_field_output_text_{$location}_{$html_var}",$html,$cf);
657
+	}
658
+
659
+	// If not html then we run the standard output.
660
+	if(empty($html)){
661
+
662
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
663
+
664
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
665
+
666
+			$field_icon = geodir_field_icon_proccess($cf);
667
+			if (strpos($field_icon, 'http') !== false) {
668
+				$field_icon_af = '';
669
+			} elseif ($field_icon == '') {
670
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
671
+			} else {
672
+				$field_icon_af = $field_icon;
673
+				$field_icon = '';
674
+			}
675
+
676
+
677
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
678
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
679
+			$html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
680
+
681
+		endif;
682
+
683
+	}
684
+
685
+	return $html;
686 686
 }
687 687
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
688 688
 
@@ -699,97 +699,97 @@  discard block
 block discarded – undo
699 699
  */
700 700
 function geodir_cf_radio($html,$location,$cf,$p=''){
701 701
 
702
-    // check we have the post value
703
-    if(is_int($p)){$post = geodir_get_post_info($p);}
704
-    else{ global $post;}
705
-
706
-    if(!is_array($cf) && $cf!=''){
707
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
708
-        if(!$cf){return NULL;}
709
-    }
710
-
711
-    $html_var = $cf['htmlvar_name'];
712
-
713
-    // Check if there is a location specific filter.
714
-    if(has_filter("geodir_custom_field_output_radio_{$location}")){
715
-        /**
716
-         * Filter the radio html by location.
717
-         *
718
-         * @param string $html The html to filter.
719
-         * @param array $cf The custom field array.
720
-         * @since 1.6.6
721
-         */
722
-        $html = apply_filters("geodir_custom_field_output_radio_{$location}",$html,$cf);
723
-    }
724
-
725
-    // Check if there is a custom field specific filter.
726
-    if(has_filter("geodir_custom_field_output_radio_{$html_var}")){
727
-        /**
728
-         * Filter the radio html by individual custom field.
729
-         *
730
-         * @param string $html The html to filter.
731
-         * @param string $location The location to output the html.
732
-         * @param array $cf The custom field array.
733
-         * @since 1.6.6
734
-         */
735
-        $html = apply_filters("geodir_custom_field_output_radio_{$html_var}",$html,$location,$cf);
736
-    }
737
-
738
-    // Check if there is a custom field specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_{$location}_{$html_var}")){
740
-        /**
741
-         * Filter the radio html by location and individual custom field.
742
-         *
743
-         * @param string $html The html to filter.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_{$location}_{$html_var}",$html,$cf);
748
-    }
749
-
750
-    // If not html then we run the standard output.
751
-    if(empty($html)){
752
-
753
-        $html_val = __($post->{$cf['htmlvar_name']}, 'geodirectory');
754
-        if ($post->{$cf['htmlvar_name']} != ''):
755
-
756
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
757
-                $html_val = __('No', 'geodirectory');
758
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
759
-                $html_val = __('Yes', 'geodirectory');
760
-            } else {
761
-                if (!empty($cf['option_values'])) {
762
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
763
-
764
-                    if (!empty($cf_option_values)) {
765
-                        foreach ($cf_option_values as $cf_option_value) {
766
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
767
-                                $html_val = $cf_option_value['label'];
768
-                            }
769
-                        }
770
-                    }
771
-                }
772
-            }
773
-
774
-            $field_icon = geodir_field_icon_proccess($cf);
775
-            if (strpos($field_icon, 'http') !== false) {
776
-                $field_icon_af = '';
777
-            } elseif ($field_icon == '') {
778
-                $field_icon_af = '';
779
-            } else {
780
-                $field_icon_af = $field_icon;
781
-                $field_icon = '';
782
-            }
783
-
784
-
785
-            $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;
786
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
787
-            $html .= '</span>' . $html_val . '</div>';
788
-        endif;
789
-
790
-    }
791
-
792
-    return $html;
702
+	// check we have the post value
703
+	if(is_int($p)){$post = geodir_get_post_info($p);}
704
+	else{ global $post;}
705
+
706
+	if(!is_array($cf) && $cf!=''){
707
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
708
+		if(!$cf){return NULL;}
709
+	}
710
+
711
+	$html_var = $cf['htmlvar_name'];
712
+
713
+	// Check if there is a location specific filter.
714
+	if(has_filter("geodir_custom_field_output_radio_{$location}")){
715
+		/**
716
+		 * Filter the radio html by location.
717
+		 *
718
+		 * @param string $html The html to filter.
719
+		 * @param array $cf The custom field array.
720
+		 * @since 1.6.6
721
+		 */
722
+		$html = apply_filters("geodir_custom_field_output_radio_{$location}",$html,$cf);
723
+	}
724
+
725
+	// Check if there is a custom field specific filter.
726
+	if(has_filter("geodir_custom_field_output_radio_{$html_var}")){
727
+		/**
728
+		 * Filter the radio html by individual custom field.
729
+		 *
730
+		 * @param string $html The html to filter.
731
+		 * @param string $location The location to output the html.
732
+		 * @param array $cf The custom field array.
733
+		 * @since 1.6.6
734
+		 */
735
+		$html = apply_filters("geodir_custom_field_output_radio_{$html_var}",$html,$location,$cf);
736
+	}
737
+
738
+	// Check if there is a custom field specific filter.
739
+	if(has_filter("geodir_custom_field_output_radio_{$location}_{$html_var}")){
740
+		/**
741
+		 * Filter the radio html by location and individual custom field.
742
+		 *
743
+		 * @param string $html The html to filter.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_{$location}_{$html_var}",$html,$cf);
748
+	}
749
+
750
+	// If not html then we run the standard output.
751
+	if(empty($html)){
752
+
753
+		$html_val = __($post->{$cf['htmlvar_name']}, 'geodirectory');
754
+		if ($post->{$cf['htmlvar_name']} != ''):
755
+
756
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
757
+				$html_val = __('No', 'geodirectory');
758
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
759
+				$html_val = __('Yes', 'geodirectory');
760
+			} else {
761
+				if (!empty($cf['option_values'])) {
762
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
763
+
764
+					if (!empty($cf_option_values)) {
765
+						foreach ($cf_option_values as $cf_option_value) {
766
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
767
+								$html_val = $cf_option_value['label'];
768
+							}
769
+						}
770
+					}
771
+				}
772
+			}
773
+
774
+			$field_icon = geodir_field_icon_proccess($cf);
775
+			if (strpos($field_icon, 'http') !== false) {
776
+				$field_icon_af = '';
777
+			} elseif ($field_icon == '') {
778
+				$field_icon_af = '';
779
+			} else {
780
+				$field_icon_af = $field_icon;
781
+				$field_icon = '';
782
+			}
783
+
784
+
785
+			$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;
786
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
787
+			$html .= '</span>' . $html_val . '</div>';
788
+		endif;
789
+
790
+	}
791
+
792
+	return $html;
793 793
 }
794 794
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
795 795
 
@@ -806,91 +806,91 @@  discard block
 block discarded – undo
806 806
  */
807 807
 function geodir_cf_select($html,$location,$cf,$p=''){
808 808
 
809
-    // check we have the post value
810
-    if(is_int($p)){$post = geodir_get_post_info($p);}
811
-    else{ global $post;}
812
-
813
-    if(!is_array($cf) && $cf!=''){
814
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
815
-        if(!$cf){return NULL;}
816
-    }
817
-
818
-    $html_var = $cf['htmlvar_name'];
819
-
820
-    // Check if there is a location specific filter.
821
-    if(has_filter("geodir_custom_field_output_select_{$location}")){
822
-        /**
823
-         * Filter the select html by location.
824
-         *
825
-         * @param string $html The html to filter.
826
-         * @param array $cf The custom field array.
827
-         * @since 1.6.6
828
-         */
829
-        $html = apply_filters("geodir_custom_field_output_select_{$location}",$html,$cf);
830
-    }
831
-
832
-    // Check if there is a custom field specific filter.
833
-    if(has_filter("geodir_custom_field_output_select_{$html_var}")){
834
-        /**
835
-         * Filter the select html by individual custom field.
836
-         *
837
-         * @param string $html The html to filter.
838
-         * @param string $location The location to output the html.
839
-         * @param array $cf The custom field array.
840
-         * @since 1.6.6
841
-         */
842
-        $html = apply_filters("geodir_custom_field_output_select_{$html_var}",$html,$location,$cf);
843
-    }
844
-
845
-    // Check if there is a custom field specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_{$location}_{$html_var}")){
847
-        /**
848
-         * Filter the select html by location and individual custom field.
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_{$location}_{$html_var}",$html,$cf);
855
-    }
856
-
857
-    // If not html then we run the standard output.
858
-    if(empty($html)){
859
-
860
-        if ($post->{$cf['htmlvar_name']}):
861
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
862
-
863
-            if (!empty($cf['option_values'])) {
864
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
865
-
866
-                if (!empty($cf_option_values)) {
867
-                    foreach ($cf_option_values as $cf_option_value) {
868
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
869
-                            //$field_value = $cf_option_value['label']; // no longer needed here.
870
-                        }
871
-                    }
872
-                }
873
-            }
874
-
875
-            $field_icon = geodir_field_icon_proccess($cf);
876
-            if (strpos($field_icon, 'http') !== false) {
877
-                $field_icon_af = '';
878
-            } elseif ($field_icon == '') {
879
-                $field_icon_af = '';
880
-            } else {
881
-                $field_icon_af = $field_icon;
882
-                $field_icon = '';
883
-            }
884
-
885
-
886
-            $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;
887
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
888
-            $html .= '</span>' . $field_value . '</div>';
889
-        endif;
890
-
891
-    }
892
-
893
-    return $html;
809
+	// check we have the post value
810
+	if(is_int($p)){$post = geodir_get_post_info($p);}
811
+	else{ global $post;}
812
+
813
+	if(!is_array($cf) && $cf!=''){
814
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
815
+		if(!$cf){return NULL;}
816
+	}
817
+
818
+	$html_var = $cf['htmlvar_name'];
819
+
820
+	// Check if there is a location specific filter.
821
+	if(has_filter("geodir_custom_field_output_select_{$location}")){
822
+		/**
823
+		 * Filter the select html by location.
824
+		 *
825
+		 * @param string $html The html to filter.
826
+		 * @param array $cf The custom field array.
827
+		 * @since 1.6.6
828
+		 */
829
+		$html = apply_filters("geodir_custom_field_output_select_{$location}",$html,$cf);
830
+	}
831
+
832
+	// Check if there is a custom field specific filter.
833
+	if(has_filter("geodir_custom_field_output_select_{$html_var}")){
834
+		/**
835
+		 * Filter the select html by individual custom field.
836
+		 *
837
+		 * @param string $html The html to filter.
838
+		 * @param string $location The location to output the html.
839
+		 * @param array $cf The custom field array.
840
+		 * @since 1.6.6
841
+		 */
842
+		$html = apply_filters("geodir_custom_field_output_select_{$html_var}",$html,$location,$cf);
843
+	}
844
+
845
+	// Check if there is a custom field specific filter.
846
+	if(has_filter("geodir_custom_field_output_select_{$location}_{$html_var}")){
847
+		/**
848
+		 * Filter the select html by location and individual custom field.
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_{$location}_{$html_var}",$html,$cf);
855
+	}
856
+
857
+	// If not html then we run the standard output.
858
+	if(empty($html)){
859
+
860
+		if ($post->{$cf['htmlvar_name']}):
861
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
862
+
863
+			if (!empty($cf['option_values'])) {
864
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
865
+
866
+				if (!empty($cf_option_values)) {
867
+					foreach ($cf_option_values as $cf_option_value) {
868
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
869
+							//$field_value = $cf_option_value['label']; // no longer needed here.
870
+						}
871
+					}
872
+				}
873
+			}
874
+
875
+			$field_icon = geodir_field_icon_proccess($cf);
876
+			if (strpos($field_icon, 'http') !== false) {
877
+				$field_icon_af = '';
878
+			} elseif ($field_icon == '') {
879
+				$field_icon_af = '';
880
+			} else {
881
+				$field_icon_af = $field_icon;
882
+				$field_icon = '';
883
+			}
884
+
885
+
886
+			$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;
887
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
888
+			$html .= '</span>' . $field_value . '</div>';
889
+		endif;
890
+
891
+	}
892
+
893
+	return $html;
894 894
 }
895 895
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
896 896
 
@@ -907,112 +907,112 @@  discard block
 block discarded – undo
907 907
  */
908 908
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
909 909
 
910
-    // check we have the post value
911
-    if(is_int($p)){$post = geodir_get_post_info($p);}
912
-    else{ global $post;}
913
-
914
-    if(!is_array($cf) && $cf!=''){
915
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
916
-        if(!$cf){return NULL;}
917
-    }
918
-
919
-    $html_var = $cf['htmlvar_name'];
920
-
921
-    // Check if there is a location specific filter.
922
-    if(has_filter("geodir_custom_field_output_multiselect_{$location}")){
923
-        /**
924
-         * Filter the multiselect html by location.
925
-         *
926
-         * @param string $html The html to filter.
927
-         * @param array $cf The custom field array.
928
-         * @since 1.6.6
929
-         */
930
-        $html = apply_filters("geodir_custom_field_output_multiselect_{$location}",$html,$cf);
931
-    }
932
-
933
-    // Check if there is a custom field specific filter.
934
-    if(has_filter("geodir_custom_field_output_multiselect_{$html_var}")){
935
-        /**
936
-         * Filter the multiselect html by individual custom field.
937
-         *
938
-         * @param string $html The html to filter.
939
-         * @param string $location The location to output the html.
940
-         * @param array $cf The custom field array.
941
-         * @since 1.6.6
942
-         */
943
-        $html = apply_filters("geodir_custom_field_output_multiselect_{$html_var}",$html,$location,$cf);
944
-    }
945
-
946
-    // Check if there is a custom field specific filter.
947
-    if(has_filter("geodir_custom_field_output_multiselect_{$location}_{$html_var}")){
948
-        /**
949
-         * Filter the multiselect html by location and individual custom field.
950
-         *
951
-         * @param string $html The html to filter.
952
-         * @param array $cf The custom field array.
953
-         * @since 1.6.6
954
-         */
955
-        $html = apply_filters("geodir_custom_field_output_multiselect_{$location}_{$html_var}",$html,$cf);
956
-    }
957
-
958
-    // If not html then we run the standard output.
959
-    if(empty($html)){
960
-
961
-
962
-        if (!empty($post->{$cf['htmlvar_name']})):
963
-
964
-            if (is_array($post->{$cf['htmlvar_name']})) {
965
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
966
-            }
967
-
968
-            $field_icon = geodir_field_icon_proccess($cf);
969
-            if (strpos($field_icon, 'http') !== false) {
970
-                $field_icon_af = '';
971
-            } elseif ($field_icon == '') {
972
-                $field_icon_af = '';
973
-            } else {
974
-                $field_icon_af = $field_icon;
975
-                $field_icon = '';
976
-            }
977
-
978
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
979
-
980
-            $option_values = array();
981
-            if (!empty($cf['option_values'])) {
982
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
983
-
984
-                if (!empty($cf_option_values)) {
985
-                    foreach ($cf_option_values as $cf_option_value) {
986
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
987
-                            $option_values[] = $cf_option_value['label'];
988
-                        }
989
-                    }
990
-                }
991
-            }
992
-
993
-
994
-            $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;
995
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
996
-            $html .= '</span>';
997
-
998
-            if (count($option_values) > 1) {
999
-                $html .= '<ul>';
1000
-
1001
-                foreach ($option_values as $val) {
1002
-                    $html .= '<li>' . $val . '</li>';
1003
-                }
1004
-
1005
-                $html .= '</ul>';
1006
-            } else {
1007
-                $html .= $post->{$cf['htmlvar_name']};
1008
-            }
1009
-
1010
-            $html .= '</div>';
1011
-        endif;
1012
-
1013
-    }
1014
-
1015
-    return $html;
910
+	// check we have the post value
911
+	if(is_int($p)){$post = geodir_get_post_info($p);}
912
+	else{ global $post;}
913
+
914
+	if(!is_array($cf) && $cf!=''){
915
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
916
+		if(!$cf){return NULL;}
917
+	}
918
+
919
+	$html_var = $cf['htmlvar_name'];
920
+
921
+	// Check if there is a location specific filter.
922
+	if(has_filter("geodir_custom_field_output_multiselect_{$location}")){
923
+		/**
924
+		 * Filter the multiselect html by location.
925
+		 *
926
+		 * @param string $html The html to filter.
927
+		 * @param array $cf The custom field array.
928
+		 * @since 1.6.6
929
+		 */
930
+		$html = apply_filters("geodir_custom_field_output_multiselect_{$location}",$html,$cf);
931
+	}
932
+
933
+	// Check if there is a custom field specific filter.
934
+	if(has_filter("geodir_custom_field_output_multiselect_{$html_var}")){
935
+		/**
936
+		 * Filter the multiselect html by individual custom field.
937
+		 *
938
+		 * @param string $html The html to filter.
939
+		 * @param string $location The location to output the html.
940
+		 * @param array $cf The custom field array.
941
+		 * @since 1.6.6
942
+		 */
943
+		$html = apply_filters("geodir_custom_field_output_multiselect_{$html_var}",$html,$location,$cf);
944
+	}
945
+
946
+	// Check if there is a custom field specific filter.
947
+	if(has_filter("geodir_custom_field_output_multiselect_{$location}_{$html_var}")){
948
+		/**
949
+		 * Filter the multiselect html by location and individual custom field.
950
+		 *
951
+		 * @param string $html The html to filter.
952
+		 * @param array $cf The custom field array.
953
+		 * @since 1.6.6
954
+		 */
955
+		$html = apply_filters("geodir_custom_field_output_multiselect_{$location}_{$html_var}",$html,$cf);
956
+	}
957
+
958
+	// If not html then we run the standard output.
959
+	if(empty($html)){
960
+
961
+
962
+		if (!empty($post->{$cf['htmlvar_name']})):
963
+
964
+			if (is_array($post->{$cf['htmlvar_name']})) {
965
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
966
+			}
967
+
968
+			$field_icon = geodir_field_icon_proccess($cf);
969
+			if (strpos($field_icon, 'http') !== false) {
970
+				$field_icon_af = '';
971
+			} elseif ($field_icon == '') {
972
+				$field_icon_af = '';
973
+			} else {
974
+				$field_icon_af = $field_icon;
975
+				$field_icon = '';
976
+			}
977
+
978
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
979
+
980
+			$option_values = array();
981
+			if (!empty($cf['option_values'])) {
982
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
983
+
984
+				if (!empty($cf_option_values)) {
985
+					foreach ($cf_option_values as $cf_option_value) {
986
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
987
+							$option_values[] = $cf_option_value['label'];
988
+						}
989
+					}
990
+				}
991
+			}
992
+
993
+
994
+			$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;
995
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
996
+			$html .= '</span>';
997
+
998
+			if (count($option_values) > 1) {
999
+				$html .= '<ul>';
1000
+
1001
+				foreach ($option_values as $val) {
1002
+					$html .= '<li>' . $val . '</li>';
1003
+				}
1004
+
1005
+				$html .= '</ul>';
1006
+			} else {
1007
+				$html .= $post->{$cf['htmlvar_name']};
1008
+			}
1009
+
1010
+			$html .= '</div>';
1011
+		endif;
1012
+
1013
+	}
1014
+
1015
+	return $html;
1016 1016
 }
1017 1017
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1018 1018
 
@@ -1029,150 +1029,150 @@  discard block
 block discarded – undo
1029 1029
  */
1030 1030
 function geodir_cf_email($html,$location,$cf,$p=''){
1031 1031
 
1032
-    // check we have the post value
1033
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1034
-    else{ global $post;}
1035
-
1036
-    if(!is_array($cf) && $cf!=''){
1037
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1038
-        if(!$cf){return NULL;}
1039
-    }
1040
-
1041
-    $html_var = $cf['htmlvar_name'];
1042
-
1043
-    // Check if there is a location specific filter.
1044
-    if(has_filter("geodir_custom_field_output_email_{$location}")){
1045
-        /**
1046
-         * Filter the email html by location.
1047
-         *
1048
-         * @param string $html The html to filter.
1049
-         * @param array $cf The custom field array.
1050
-         * @since 1.6.6
1051
-         */
1052
-        $html = apply_filters("geodir_custom_field_output_email_{$location}",$html,$cf);
1053
-    }
1054
-
1055
-    // Check if there is a custom field specific filter.
1056
-    if(has_filter("geodir_custom_field_output_email_{$html_var}")){
1057
-        /**
1058
-         * Filter the email html by individual custom field.
1059
-         *
1060
-         * @param string $html The html to filter.
1061
-         * @param string $location The location to output the html.
1062
-         * @param array $cf The custom field array.
1063
-         * @since 1.6.6
1064
-         */
1065
-        $html = apply_filters("geodir_custom_field_output_email_{$html_var}",$html,$location,$cf);
1066
-    }
1067
-
1068
-    // Check if there is a custom field specific filter.
1069
-    if(has_filter("geodir_custom_field_output_email_{$location}_{$html_var}")){
1070
-        /**
1071
-         * Filter the email html by location and individual custom field.
1072
-         *
1073
-         * @param string $html The html to filter.
1074
-         * @param array $cf The custom field array.
1075
-         * @since 1.6.6
1076
-         */
1077
-        $html = apply_filters("geodir_custom_field_output_email_{$location}_{$html_var}",$html,$cf);
1078
-    }
1079
-
1080
-    // If not html then we run the standard output.
1081
-    if(empty($html)){
1082
-
1083
-        global $preview;
1084
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1085
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1086
-        }
1087
-
1088
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$cf['htmlvar_name']})) {
1089
-            $send_to_friend = true;
1090
-            $b_send_inquiry = '';
1091
-            $b_sendtofriend = '';
1092
-
1093
-            $html = '';
1094
-            if (!$preview) {
1095
-                $b_send_inquiry = 'b_send_inquiry';
1096
-                $b_sendtofriend = 'b_sendtofriend';
1097
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1098
-            }
1099
-
1100
-            $field_icon = geodir_field_icon_proccess($cf);
1101
-            if (strpos($field_icon, 'http') !== false) {
1102
-                $field_icon_af = '';
1103
-            } elseif ($field_icon == '') {
1104
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1105
-            } else {
1106
-                $field_icon_af = $field_icon;
1107
-                $field_icon = '';
1108
-            }
1109
-
1110
-
1111
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1112
-            $seperator = '';
1113
-            if ($post->{$cf['htmlvar_name']}) {
1114
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1115
-                $seperator = ' | ';
1116
-            }
1117
-
1118
-            if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
1119
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1120
-            }
1121
-
1122
-            $html .= '</span></div>';
1123
-
1124
-
1125
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1126
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1127
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1128
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1129
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1130
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1131
-            }
1132
-
1133
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1134
-
1135
-        } else {
1136
-
1137
-            if ($post->{$cf['htmlvar_name']}) {
1138
-
1139
-                $field_icon = geodir_field_icon_proccess($cf);
1140
-                if (strpos($field_icon, 'http') !== false) {
1141
-                    $field_icon_af = '';
1142
-                } elseif ($field_icon == '') {
1143
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1144
-                } else {
1145
-                    $field_icon_af = $field_icon;
1146
-                    $field_icon = '';
1147
-                }
1148
-
1149
-
1150
-                $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;
1151
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1152
-                $html .= '</span><span class="geodir-email-address-output">';
1153
-                $email = $post->{$cf['htmlvar_name']} ;
1154
-                if($e_split = explode('@',$email)){
1155
-                    /**
1156
-                     * Filter email custom field name output.
1157
-                     *
1158
-                     * @since 1.5.3
1159
-                     *
1160
-                     * @param string $email The email string being output.
1161
-                     * @param array $cf Custom field variables array.
1162
-                     */
1163
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1164
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1165
-                }else{
1166
-                    $html .=  $email;
1167
-                }
1168
-                $html .= '</span></div>';
1169
-            }
1170
-
1171
-        }
1172
-
1173
-    }
1174
-
1175
-    return $html;
1032
+	// check we have the post value
1033
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1034
+	else{ global $post;}
1035
+
1036
+	if(!is_array($cf) && $cf!=''){
1037
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1038
+		if(!$cf){return NULL;}
1039
+	}
1040
+
1041
+	$html_var = $cf['htmlvar_name'];
1042
+
1043
+	// Check if there is a location specific filter.
1044
+	if(has_filter("geodir_custom_field_output_email_{$location}")){
1045
+		/**
1046
+		 * Filter the email html by location.
1047
+		 *
1048
+		 * @param string $html The html to filter.
1049
+		 * @param array $cf The custom field array.
1050
+		 * @since 1.6.6
1051
+		 */
1052
+		$html = apply_filters("geodir_custom_field_output_email_{$location}",$html,$cf);
1053
+	}
1054
+
1055
+	// Check if there is a custom field specific filter.
1056
+	if(has_filter("geodir_custom_field_output_email_{$html_var}")){
1057
+		/**
1058
+		 * Filter the email html by individual custom field.
1059
+		 *
1060
+		 * @param string $html The html to filter.
1061
+		 * @param string $location The location to output the html.
1062
+		 * @param array $cf The custom field array.
1063
+		 * @since 1.6.6
1064
+		 */
1065
+		$html = apply_filters("geodir_custom_field_output_email_{$html_var}",$html,$location,$cf);
1066
+	}
1067
+
1068
+	// Check if there is a custom field specific filter.
1069
+	if(has_filter("geodir_custom_field_output_email_{$location}_{$html_var}")){
1070
+		/**
1071
+		 * Filter the email html by location and individual custom field.
1072
+		 *
1073
+		 * @param string $html The html to filter.
1074
+		 * @param array $cf The custom field array.
1075
+		 * @since 1.6.6
1076
+		 */
1077
+		$html = apply_filters("geodir_custom_field_output_email_{$location}_{$html_var}",$html,$cf);
1078
+	}
1079
+
1080
+	// If not html then we run the standard output.
1081
+	if(empty($html)){
1082
+
1083
+		global $preview;
1084
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1085
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1086
+		}
1087
+
1088
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$cf['htmlvar_name']})) {
1089
+			$send_to_friend = true;
1090
+			$b_send_inquiry = '';
1091
+			$b_sendtofriend = '';
1092
+
1093
+			$html = '';
1094
+			if (!$preview) {
1095
+				$b_send_inquiry = 'b_send_inquiry';
1096
+				$b_sendtofriend = 'b_sendtofriend';
1097
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1098
+			}
1099
+
1100
+			$field_icon = geodir_field_icon_proccess($cf);
1101
+			if (strpos($field_icon, 'http') !== false) {
1102
+				$field_icon_af = '';
1103
+			} elseif ($field_icon == '') {
1104
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1105
+			} else {
1106
+				$field_icon_af = $field_icon;
1107
+				$field_icon = '';
1108
+			}
1109
+
1110
+
1111
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1112
+			$seperator = '';
1113
+			if ($post->{$cf['htmlvar_name']}) {
1114
+				$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1115
+				$seperator = ' | ';
1116
+			}
1117
+
1118
+			if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
1119
+				$html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1120
+			}
1121
+
1122
+			$html .= '</span></div>';
1123
+
1124
+
1125
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1126
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1127
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1128
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1129
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1130
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1131
+			}
1132
+
1133
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1134
+
1135
+		} else {
1136
+
1137
+			if ($post->{$cf['htmlvar_name']}) {
1138
+
1139
+				$field_icon = geodir_field_icon_proccess($cf);
1140
+				if (strpos($field_icon, 'http') !== false) {
1141
+					$field_icon_af = '';
1142
+				} elseif ($field_icon == '') {
1143
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1144
+				} else {
1145
+					$field_icon_af = $field_icon;
1146
+					$field_icon = '';
1147
+				}
1148
+
1149
+
1150
+				$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;
1151
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1152
+				$html .= '</span><span class="geodir-email-address-output">';
1153
+				$email = $post->{$cf['htmlvar_name']} ;
1154
+				if($e_split = explode('@',$email)){
1155
+					/**
1156
+					 * Filter email custom field name output.
1157
+					 *
1158
+					 * @since 1.5.3
1159
+					 *
1160
+					 * @param string $email The email string being output.
1161
+					 * @param array $cf Custom field variables array.
1162
+					 */
1163
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1164
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1165
+				}else{
1166
+					$html .=  $email;
1167
+				}
1168
+				$html .= '</span></div>';
1169
+			}
1170
+
1171
+		}
1172
+
1173
+	}
1174
+
1175
+	return $html;
1176 1176
 }
1177 1177
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1178 1178
 
@@ -1189,129 +1189,129 @@  discard block
 block discarded – undo
1189 1189
  */
1190 1190
 function geodir_cf_file($html,$location,$cf,$p=''){
1191 1191
 
1192
-    // check we have the post value
1193
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1194
-    else{ global $post;}
1195
-
1196
-    if(!is_array($cf) && $cf!=''){
1197
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1198
-        if(!$cf){return NULL;}
1199
-    }
1200
-
1201
-    $html_var = $cf['htmlvar_name'];
1202
-
1203
-    // Check if there is a location specific filter.
1204
-    if(has_filter("geodir_custom_field_output_file_{$location}")){
1205
-        /**
1206
-         * Filter the file html by location.
1207
-         *
1208
-         * @param string $html The html to filter.
1209
-         * @param array $cf The custom field array.
1210
-         * @since 1.6.6
1211
-         */
1212
-        $html = apply_filters("geodir_custom_field_output_file_{$location}",$html,$cf);
1213
-    }
1214
-
1215
-    // Check if there is a custom field specific filter.
1216
-    if(has_filter("geodir_custom_field_output_file_{$html_var}")){
1217
-        /**
1218
-         * Filter the file html by individual custom field.
1219
-         *
1220
-         * @param string $html The html to filter.
1221
-         * @param string $location The location to output the html.
1222
-         * @param array $cf The custom field array.
1223
-         * @since 1.6.6
1224
-         */
1225
-        $html = apply_filters("geodir_custom_field_output_file_{$html_var}",$html,$location,$cf);
1226
-    }
1227
-
1228
-    // Check if there is a custom field specific filter.
1229
-    if(has_filter("geodir_custom_field_output_file_{$location}_{$html_var}")){
1230
-        /**
1231
-         * Filter the file html by location and individual custom field.
1232
-         *
1233
-         * @param string $html The html to filter.
1234
-         * @param array $cf The custom field array.
1235
-         * @since 1.6.6
1236
-         */
1237
-        $html = apply_filters("geodir_custom_field_output_file_{$location}_{$html_var}",$html,$cf);
1238
-    }
1239
-
1240
-    // If not html then we run the standard output.
1241
-    if(empty($html)){
1242
-
1243
-        if (!empty($post->{$cf['htmlvar_name']})):
1244
-
1245
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1246
-            if (!empty($files)):
1247
-
1248
-                $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1249
-                $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'] : '';
1250
-
1251
-                $file_paths = '';
1252
-                foreach ($files as $file) {
1253
-                    if (!empty($file)) {
1254
-
1255
-                        // $filetype = wp_check_filetype($file);
1256
-
1257
-                        $image_name_arr = explode('/', $file);
1258
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1259
-                        $filename = end($image_name_arr);
1260
-                        $img_name_arr = explode('.', $filename);
1261
-
1262
-                        $arr_file_type = wp_check_filetype($filename);
1263
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1264
-                            continue;
1265
-                        }
1266
-
1267
-                        $uploaded_file_type = $arr_file_type['type'];
1268
-                        $uploaded_file_ext = $arr_file_type['ext'];
1269
-
1270
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1271
-                            continue; // Invalid file type.
1272
-                        }
1273
-
1274
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1275
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1276
-
1277
-                        // If the uploaded file is image
1278
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1279
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1280
-                            $file_paths .= '<a href="'.$file.'">';
1281
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1282
-                            $file_paths .= '</a>';
1283
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1284
-                            $file_paths .= '</div>';
1285
-                        } else {
1286
-                            $ext_path = '_' . $html_var . '_';
1287
-                            $filename = explode($ext_path, $filename);
1288
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1289
-                        }
1290
-                    }
1291
-                }
1292
-
1293
-                $field_icon = geodir_field_icon_proccess($cf);
1294
-                if (strpos($field_icon, 'http') !== false) {
1295
-                    $field_icon_af = '';
1296
-                } elseif ($field_icon == '') {
1297
-                    $field_icon_af = '';
1298
-                } else {
1299
-                    $field_icon_af = $field_icon;
1300
-                    $field_icon = '';
1301
-                }
1302
-
1303
-                $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;
1304
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1305
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1306
-                $html .= '</span>';
1307
-                $html .= $file_paths . '</div></div>';
1308
-
1309
-            endif;
1310
-        endif;
1311
-
1312
-    }
1313
-
1314
-    return $html;
1192
+	// check we have the post value
1193
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1194
+	else{ global $post;}
1195
+
1196
+	if(!is_array($cf) && $cf!=''){
1197
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1198
+		if(!$cf){return NULL;}
1199
+	}
1200
+
1201
+	$html_var = $cf['htmlvar_name'];
1202
+
1203
+	// Check if there is a location specific filter.
1204
+	if(has_filter("geodir_custom_field_output_file_{$location}")){
1205
+		/**
1206
+		 * Filter the file html by location.
1207
+		 *
1208
+		 * @param string $html The html to filter.
1209
+		 * @param array $cf The custom field array.
1210
+		 * @since 1.6.6
1211
+		 */
1212
+		$html = apply_filters("geodir_custom_field_output_file_{$location}",$html,$cf);
1213
+	}
1214
+
1215
+	// Check if there is a custom field specific filter.
1216
+	if(has_filter("geodir_custom_field_output_file_{$html_var}")){
1217
+		/**
1218
+		 * Filter the file html by individual custom field.
1219
+		 *
1220
+		 * @param string $html The html to filter.
1221
+		 * @param string $location The location to output the html.
1222
+		 * @param array $cf The custom field array.
1223
+		 * @since 1.6.6
1224
+		 */
1225
+		$html = apply_filters("geodir_custom_field_output_file_{$html_var}",$html,$location,$cf);
1226
+	}
1227
+
1228
+	// Check if there is a custom field specific filter.
1229
+	if(has_filter("geodir_custom_field_output_file_{$location}_{$html_var}")){
1230
+		/**
1231
+		 * Filter the file html by location and individual custom field.
1232
+		 *
1233
+		 * @param string $html The html to filter.
1234
+		 * @param array $cf The custom field array.
1235
+		 * @since 1.6.6
1236
+		 */
1237
+		$html = apply_filters("geodir_custom_field_output_file_{$location}_{$html_var}",$html,$cf);
1238
+	}
1239
+
1240
+	// If not html then we run the standard output.
1241
+	if(empty($html)){
1242
+
1243
+		if (!empty($post->{$cf['htmlvar_name']})):
1244
+
1245
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1246
+			if (!empty($files)):
1247
+
1248
+				$extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1249
+				$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'] : '';
1250
+
1251
+				$file_paths = '';
1252
+				foreach ($files as $file) {
1253
+					if (!empty($file)) {
1254
+
1255
+						// $filetype = wp_check_filetype($file);
1256
+
1257
+						$image_name_arr = explode('/', $file);
1258
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1259
+						$filename = end($image_name_arr);
1260
+						$img_name_arr = explode('.', $filename);
1261
+
1262
+						$arr_file_type = wp_check_filetype($filename);
1263
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1264
+							continue;
1265
+						}
1266
+
1267
+						$uploaded_file_type = $arr_file_type['type'];
1268
+						$uploaded_file_ext = $arr_file_type['ext'];
1269
+
1270
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1271
+							continue; // Invalid file type.
1272
+						}
1273
+
1274
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1275
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1276
+
1277
+						// If the uploaded file is image
1278
+						if (in_array($uploaded_file_type, $image_file_types)) {
1279
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1280
+							$file_paths .= '<a href="'.$file.'">';
1281
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1282
+							$file_paths .= '</a>';
1283
+							//$file_paths .= '<img src="'.$file.'"  />';	
1284
+							$file_paths .= '</div>';
1285
+						} else {
1286
+							$ext_path = '_' . $html_var . '_';
1287
+							$filename = explode($ext_path, $filename);
1288
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1289
+						}
1290
+					}
1291
+				}
1292
+
1293
+				$field_icon = geodir_field_icon_proccess($cf);
1294
+				if (strpos($field_icon, 'http') !== false) {
1295
+					$field_icon_af = '';
1296
+				} elseif ($field_icon == '') {
1297
+					$field_icon_af = '';
1298
+				} else {
1299
+					$field_icon_af = $field_icon;
1300
+					$field_icon = '';
1301
+				}
1302
+
1303
+				$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;
1304
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1305
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1306
+				$html .= '</span>';
1307
+				$html .= $file_paths . '</div></div>';
1308
+
1309
+			endif;
1310
+		endif;
1311
+
1312
+	}
1313
+
1314
+	return $html;
1315 1315
 }
1316 1316
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1317 1317
 
@@ -1329,79 +1329,79 @@  discard block
 block discarded – undo
1329 1329
  */
1330 1330
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1331 1331
 
1332
-    // check we have the post value
1333
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1334
-    else{ global $post;}
1335
-
1336
-    if(!is_array($cf) && $cf!=''){
1337
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1338
-        if(!$cf){return NULL;}
1339
-    }
1340
-
1341
-    $html_var = $cf['htmlvar_name'];
1342
-
1343
-    // Check if there is a location specific filter.
1344
-    if(has_filter("geodir_custom_field_output_textarea_{$location}")){
1345
-        /**
1346
-         * Filter the textarea html by location.
1347
-         *
1348
-         * @param string $html The html to filter.
1349
-         * @param array $cf The custom field array.
1350
-         * @since 1.6.6
1351
-         */
1352
-        $html = apply_filters("geodir_custom_field_output_textarea_{$location}",$html,$cf);
1353
-    }
1354
-
1355
-    // Check if there is a custom field specific filter.
1356
-    if(has_filter("geodir_custom_field_output_textarea_{$html_var}")){
1357
-        /**
1358
-         * Filter the textarea html by individual custom field.
1359
-         *
1360
-         * @param string $html The html to filter.
1361
-         * @param string $location The location to output the html.
1362
-         * @param array $cf The custom field array.
1363
-         * @since 1.6.6
1364
-         */
1365
-        $html = apply_filters("geodir_custom_field_output_textarea_{$html_var}",$html,$location,$cf);
1366
-    }
1367
-
1368
-    // Check if there is a custom field specific filter.
1369
-    if(has_filter("geodir_custom_field_output_textarea_{$location}_{$html_var}")){
1370
-        /**
1371
-         * Filter the textarea html by location and individual custom field.
1372
-         *
1373
-         * @param string $html The html to filter.
1374
-         * @param array $cf The custom field array.
1375
-         * @since 1.6.6
1376
-         */
1377
-        $html = apply_filters("geodir_custom_field_output_textarea_{$location}_{$html_var}",$html,$cf);
1378
-    }
1379
-
1380
-    // If not html then we run the standard output.
1381
-    if(empty($html)){
1382
-
1383
-        if (!empty($post->{$cf['htmlvar_name']})) {
1384
-
1385
-            $field_icon = geodir_field_icon_proccess($cf);
1386
-            if (strpos($field_icon, 'http') !== false) {
1387
-                $field_icon_af = '';
1388
-            } elseif ($field_icon == '') {
1389
-                $field_icon_af = '';
1390
-            } else {
1391
-                $field_icon_af = $field_icon;
1392
-                $field_icon = '';
1393
-            }
1394
-
1395
-
1396
-            $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;
1397
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1398
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1399
-
1400
-        }
1401
-
1402
-    }
1403
-
1404
-    return $html;
1332
+	// check we have the post value
1333
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1334
+	else{ global $post;}
1335
+
1336
+	if(!is_array($cf) && $cf!=''){
1337
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1338
+		if(!$cf){return NULL;}
1339
+	}
1340
+
1341
+	$html_var = $cf['htmlvar_name'];
1342
+
1343
+	// Check if there is a location specific filter.
1344
+	if(has_filter("geodir_custom_field_output_textarea_{$location}")){
1345
+		/**
1346
+		 * Filter the textarea html by location.
1347
+		 *
1348
+		 * @param string $html The html to filter.
1349
+		 * @param array $cf The custom field array.
1350
+		 * @since 1.6.6
1351
+		 */
1352
+		$html = apply_filters("geodir_custom_field_output_textarea_{$location}",$html,$cf);
1353
+	}
1354
+
1355
+	// Check if there is a custom field specific filter.
1356
+	if(has_filter("geodir_custom_field_output_textarea_{$html_var}")){
1357
+		/**
1358
+		 * Filter the textarea html by individual custom field.
1359
+		 *
1360
+		 * @param string $html The html to filter.
1361
+		 * @param string $location The location to output the html.
1362
+		 * @param array $cf The custom field array.
1363
+		 * @since 1.6.6
1364
+		 */
1365
+		$html = apply_filters("geodir_custom_field_output_textarea_{$html_var}",$html,$location,$cf);
1366
+	}
1367
+
1368
+	// Check if there is a custom field specific filter.
1369
+	if(has_filter("geodir_custom_field_output_textarea_{$location}_{$html_var}")){
1370
+		/**
1371
+		 * Filter the textarea html by location and individual custom field.
1372
+		 *
1373
+		 * @param string $html The html to filter.
1374
+		 * @param array $cf The custom field array.
1375
+		 * @since 1.6.6
1376
+		 */
1377
+		$html = apply_filters("geodir_custom_field_output_textarea_{$location}_{$html_var}",$html,$cf);
1378
+	}
1379
+
1380
+	// If not html then we run the standard output.
1381
+	if(empty($html)){
1382
+
1383
+		if (!empty($post->{$cf['htmlvar_name']})) {
1384
+
1385
+			$field_icon = geodir_field_icon_proccess($cf);
1386
+			if (strpos($field_icon, 'http') !== false) {
1387
+				$field_icon_af = '';
1388
+			} elseif ($field_icon == '') {
1389
+				$field_icon_af = '';
1390
+			} else {
1391
+				$field_icon_af = $field_icon;
1392
+				$field_icon = '';
1393
+			}
1394
+
1395
+
1396
+			$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;
1397
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1398
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1399
+
1400
+		}
1401
+
1402
+	}
1403
+
1404
+	return $html;
1405 1405
 }
1406 1406
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1407 1407
 
@@ -1419,78 +1419,78 @@  discard block
 block discarded – undo
1419 1419
  */
1420 1420
 function geodir_cf_html($html,$location,$cf,$p=''){
1421 1421
 
1422
-    // check we have the post value
1423
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1424
-    else{ global $post;}
1425
-
1426
-    if(!is_array($cf) && $cf!=''){
1427
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1428
-        if(!$cf){return NULL;}
1429
-    }
1430
-
1431
-    $html_var = $cf['htmlvar_name'];
1432
-
1433
-    // Check if there is a location specific filter.
1434
-    if(has_filter("geodir_custom_field_output_html_{$location}")){
1435
-        /**
1436
-         * Filter the html html by location.
1437
-         *
1438
-         * @param string $html The html to filter.
1439
-         * @param array $cf The custom field array.
1440
-         * @since 1.6.6
1441
-         */
1442
-        $html = apply_filters("geodir_custom_field_output_html_{$location}",$html,$cf);
1443
-    }
1444
-
1445
-    // Check if there is a custom field specific filter.
1446
-    if(has_filter("geodir_custom_field_output_html_{$html_var}")){
1447
-        /**
1448
-         * Filter the html html by individual custom field.
1449
-         *
1450
-         * @param string $html The html to filter.
1451
-         * @param string $location The location to output the html.
1452
-         * @param array $cf The custom field array.
1453
-         * @since 1.6.6
1454
-         */
1455
-        $html = apply_filters("geodir_custom_field_output_html_{$html_var}",$html,$location,$cf);
1456
-    }
1457
-
1458
-    // Check if there is a custom field specific filter.
1459
-    if(has_filter("geodir_custom_field_output_html_{$location}_{$html_var}")){
1460
-        /**
1461
-         * Filter the html html by location and individual custom field.
1462
-         *
1463
-         * @param string $html The html to filter.
1464
-         * @param array $cf The custom field array.
1465
-         * @since 1.6.6
1466
-         */
1467
-        $html = apply_filters("geodir_custom_field_output_html_{$location}_{$html_var}",$html,$cf);
1468
-    }
1469
-
1470
-    // If not html then we run the standard output.
1471
-    if(empty($html)){
1472
-
1473
-        if (!empty($post->{$cf['htmlvar_name']})) {
1474
-
1475
-            $field_icon = geodir_field_icon_proccess($cf);
1476
-            if (strpos($field_icon, 'http') !== false) {
1477
-                $field_icon_af = '';
1478
-            } elseif ($field_icon == '') {
1479
-                $field_icon_af = '';
1480
-            } else {
1481
-                $field_icon_af = $field_icon;
1482
-                $field_icon = '';
1483
-            }
1484
-
1485
-            $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;
1486
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1487
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1488
-
1489
-        }
1490
-
1491
-    }
1492
-
1493
-    return $html;
1422
+	// check we have the post value
1423
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1424
+	else{ global $post;}
1425
+
1426
+	if(!is_array($cf) && $cf!=''){
1427
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1428
+		if(!$cf){return NULL;}
1429
+	}
1430
+
1431
+	$html_var = $cf['htmlvar_name'];
1432
+
1433
+	// Check if there is a location specific filter.
1434
+	if(has_filter("geodir_custom_field_output_html_{$location}")){
1435
+		/**
1436
+		 * Filter the html html by location.
1437
+		 *
1438
+		 * @param string $html The html to filter.
1439
+		 * @param array $cf The custom field array.
1440
+		 * @since 1.6.6
1441
+		 */
1442
+		$html = apply_filters("geodir_custom_field_output_html_{$location}",$html,$cf);
1443
+	}
1444
+
1445
+	// Check if there is a custom field specific filter.
1446
+	if(has_filter("geodir_custom_field_output_html_{$html_var}")){
1447
+		/**
1448
+		 * Filter the html html by individual custom field.
1449
+		 *
1450
+		 * @param string $html The html to filter.
1451
+		 * @param string $location The location to output the html.
1452
+		 * @param array $cf The custom field array.
1453
+		 * @since 1.6.6
1454
+		 */
1455
+		$html = apply_filters("geodir_custom_field_output_html_{$html_var}",$html,$location,$cf);
1456
+	}
1457
+
1458
+	// Check if there is a custom field specific filter.
1459
+	if(has_filter("geodir_custom_field_output_html_{$location}_{$html_var}")){
1460
+		/**
1461
+		 * Filter the html html by location and individual custom field.
1462
+		 *
1463
+		 * @param string $html The html to filter.
1464
+		 * @param array $cf The custom field array.
1465
+		 * @since 1.6.6
1466
+		 */
1467
+		$html = apply_filters("geodir_custom_field_output_html_{$location}_{$html_var}",$html,$cf);
1468
+	}
1469
+
1470
+	// If not html then we run the standard output.
1471
+	if(empty($html)){
1472
+
1473
+		if (!empty($post->{$cf['htmlvar_name']})) {
1474
+
1475
+			$field_icon = geodir_field_icon_proccess($cf);
1476
+			if (strpos($field_icon, 'http') !== false) {
1477
+				$field_icon_af = '';
1478
+			} elseif ($field_icon == '') {
1479
+				$field_icon_af = '';
1480
+			} else {
1481
+				$field_icon_af = $field_icon;
1482
+				$field_icon = '';
1483
+			}
1484
+
1485
+			$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;
1486
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1487
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1488
+
1489
+		}
1490
+
1491
+	}
1492
+
1493
+	return $html;
1494 1494
 }
1495 1495
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1496 1496
 
@@ -1508,112 +1508,112 @@  discard block
 block discarded – undo
1508 1508
  */
1509 1509
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1510 1510
 
1511
-    // check we have the post value
1512
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1513
-    else{ global $post;}
1514
-
1515
-    if(!is_array($cf) && $cf!=''){
1516
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1517
-        if(!$cf){return NULL;}
1518
-    }
1519
-
1520
-    $html_var = $cf['htmlvar_name'];
1521
-
1522
-    // Check if there is a location specific filter.
1523
-    if(has_filter("geodir_custom_field_output_taxonomy_{$location}")){
1524
-        /**
1525
-         * Filter the taxonomy html by location.
1526
-         *
1527
-         * @param string $html The html to filter.
1528
-         * @param array $cf The custom field array.
1529
-         * @since 1.6.6
1530
-         */
1531
-        $html = apply_filters("geodir_custom_field_output_taxonomy_{$location}",$html,$cf);
1532
-    }
1533
-
1534
-    // Check if there is a custom field specific filter.
1535
-    if(has_filter("geodir_custom_field_output_taxonomy_{$html_var}")){
1536
-        /**
1537
-         * Filter the taxonomy html by individual custom field.
1538
-         *
1539
-         * @param string $html The html to filter.
1540
-         * @param string $location The location to output the html.
1541
-         * @param array $cf The custom field array.
1542
-         * @since 1.6.6
1543
-         */
1544
-        $html = apply_filters("geodir_custom_field_output_taxonomy_{$html_var}",$html,$location,$cf);
1545
-    }
1546
-
1547
-    // Check if there is a custom field specific filter.
1548
-    if(has_filter("geodir_custom_field_output_taxonomy_{$location}_{$html_var}")){
1549
-        /**
1550
-         * Filter the taxonomy html by location and individual custom field.
1551
-         *
1552
-         * @param string $html The html to filter.
1553
-         * @param array $cf The custom field array.
1554
-         * @since 1.6.6
1555
-         */
1556
-        $html = apply_filters("geodir_custom_field_output_taxonomy_{$location}_{$html_var}",$html,$cf);
1557
-    }
1558
-
1559
-    // If not html then we run the standard output.
1560
-    if(empty($html)){
1561
-
1562
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1563
-            $post_taxonomy = $post->post_type . 'category';
1564
-            $field_value = $post->{$html_var};
1565
-            $links = array();
1566
-            $terms = array();
1567
-            $termsOrdered = array();
1568
-            if (!is_array($field_value)) {
1569
-                $field_value = explode(",", trim($field_value, ","));
1570
-            }
1571
-
1572
-            $field_value = array_unique($field_value);
1573
-
1574
-            if (!empty($field_value)) {
1575
-                foreach ($field_value as $term) {
1576
-                    $term = trim($term);
1577
-
1578
-                    if ($term != '') {
1579
-                        $term = get_term_by('id', $term, $html_var);
1580
-                        if (is_object($term)) {
1581
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1582
-                            $terms[] = $term;
1583
-                        }
1584
-                    }
1585
-                }
1586
-                if (!empty($links)) {
1587
-                    // order alphabetically
1588
-                    asort($links);
1589
-                    foreach (array_keys($links) as $key) {
1590
-                        $termsOrdered[$key] = $terms[$key];
1591
-                    }
1592
-                    $terms = $termsOrdered;
1593
-                }
1594
-            }
1595
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1596
-
1597
-            if ($html_value != '') {
1598
-                $field_icon = geodir_field_icon_proccess($cf);
1599
-                if (strpos($field_icon, 'http') !== false) {
1600
-                    $field_icon_af = '';
1601
-                } else if ($field_icon == '') {
1602
-                    $field_icon_af = '';
1603
-                } else {
1604
-                    $field_icon_af = $field_icon;
1605
-                    $field_icon = '';
1606
-                }
1607
-
1608
-                $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;
1609
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1610
-                $html .= '</span> ' . $html_value . '</div>';
1611
-            }
1612
-        }
1613
-
1614
-    }
1615
-
1616
-    return $html;
1511
+	// check we have the post value
1512
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1513
+	else{ global $post;}
1514
+
1515
+	if(!is_array($cf) && $cf!=''){
1516
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1517
+		if(!$cf){return NULL;}
1518
+	}
1519
+
1520
+	$html_var = $cf['htmlvar_name'];
1521
+
1522
+	// Check if there is a location specific filter.
1523
+	if(has_filter("geodir_custom_field_output_taxonomy_{$location}")){
1524
+		/**
1525
+		 * Filter the taxonomy html by location.
1526
+		 *
1527
+		 * @param string $html The html to filter.
1528
+		 * @param array $cf The custom field array.
1529
+		 * @since 1.6.6
1530
+		 */
1531
+		$html = apply_filters("geodir_custom_field_output_taxonomy_{$location}",$html,$cf);
1532
+	}
1533
+
1534
+	// Check if there is a custom field specific filter.
1535
+	if(has_filter("geodir_custom_field_output_taxonomy_{$html_var}")){
1536
+		/**
1537
+		 * Filter the taxonomy html by individual custom field.
1538
+		 *
1539
+		 * @param string $html The html to filter.
1540
+		 * @param string $location The location to output the html.
1541
+		 * @param array $cf The custom field array.
1542
+		 * @since 1.6.6
1543
+		 */
1544
+		$html = apply_filters("geodir_custom_field_output_taxonomy_{$html_var}",$html,$location,$cf);
1545
+	}
1546
+
1547
+	// Check if there is a custom field specific filter.
1548
+	if(has_filter("geodir_custom_field_output_taxonomy_{$location}_{$html_var}")){
1549
+		/**
1550
+		 * Filter the taxonomy html by location and individual custom field.
1551
+		 *
1552
+		 * @param string $html The html to filter.
1553
+		 * @param array $cf The custom field array.
1554
+		 * @since 1.6.6
1555
+		 */
1556
+		$html = apply_filters("geodir_custom_field_output_taxonomy_{$location}_{$html_var}",$html,$cf);
1557
+	}
1558
+
1559
+	// If not html then we run the standard output.
1560
+	if(empty($html)){
1561
+
1562
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1563
+			$post_taxonomy = $post->post_type . 'category';
1564
+			$field_value = $post->{$html_var};
1565
+			$links = array();
1566
+			$terms = array();
1567
+			$termsOrdered = array();
1568
+			if (!is_array($field_value)) {
1569
+				$field_value = explode(",", trim($field_value, ","));
1570
+			}
1571
+
1572
+			$field_value = array_unique($field_value);
1573
+
1574
+			if (!empty($field_value)) {
1575
+				foreach ($field_value as $term) {
1576
+					$term = trim($term);
1577
+
1578
+					if ($term != '') {
1579
+						$term = get_term_by('id', $term, $html_var);
1580
+						if (is_object($term)) {
1581
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1582
+							$terms[] = $term;
1583
+						}
1584
+					}
1585
+				}
1586
+				if (!empty($links)) {
1587
+					// order alphabetically
1588
+					asort($links);
1589
+					foreach (array_keys($links) as $key) {
1590
+						$termsOrdered[$key] = $terms[$key];
1591
+					}
1592
+					$terms = $termsOrdered;
1593
+				}
1594
+			}
1595
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1596
+
1597
+			if ($html_value != '') {
1598
+				$field_icon = geodir_field_icon_proccess($cf);
1599
+				if (strpos($field_icon, 'http') !== false) {
1600
+					$field_icon_af = '';
1601
+				} else if ($field_icon == '') {
1602
+					$field_icon_af = '';
1603
+				} else {
1604
+					$field_icon_af = $field_icon;
1605
+					$field_icon = '';
1606
+				}
1607
+
1608
+				$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;
1609
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1610
+				$html .= '</span> ' . $html_value . '</div>';
1611
+			}
1612
+		}
1613
+
1614
+	}
1615
+
1616
+	return $html;
1617 1617
 }
1618 1618
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1619 1619
 
@@ -1630,161 +1630,161 @@  discard block
 block discarded – undo
1630 1630
  */
1631 1631
 function geodir_cf_address($html,$location,$cf,$p=''){
1632 1632
 
1633
-    // check we have the post value
1634
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1635
-    else{ global $post;}
1636
-
1637
-    if(!is_array($cf) && $cf!=''){
1638
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1639
-        if(!$cf){return NULL;}
1640
-    }
1641
-
1642
-    $html_var = $cf['htmlvar_name'];
1643
-
1644
-    // Check if there is a location specific filter.
1645
-    if(has_filter("geodir_custom_field_output_address_{$location}")){
1646
-        /**
1647
-         * Filter the address html by location.
1648
-         *
1649
-         * @param string $html The html to filter.
1650
-         * @param array $cf The custom field array.
1651
-         * @since 1.6.6
1652
-         */
1653
-        $html = apply_filters("geodir_custom_field_output_address_{$location}",$html,$cf);
1654
-    }
1655
-
1656
-    // Check if there is a custom field specific filter.
1657
-    if(has_filter("geodir_custom_field_output_address_{$html_var}")){
1658
-        /**
1659
-         * Filter the address html by individual custom field.
1660
-         *
1661
-         * @param string $html The html to filter.
1662
-         * @param string $location The location to output the html.
1663
-         * @param array $cf The custom field array.
1664
-         * @since 1.6.6
1665
-         */
1666
-        $html = apply_filters("geodir_custom_field_output_address_{$html_var}",$html,$location,$cf);
1667
-    }
1668
-
1669
-    // Check if there is a custom field specific filter.
1670
-    if(has_filter("geodir_custom_field_output_address_{$location}_{$html_var}")){
1671
-        /**
1672
-         * Filter the address html by location and individual custom field.
1673
-         *
1674
-         * @param string $html The html to filter.
1675
-         * @param array $cf The custom field array.
1676
-         * @since 1.6.6
1677
-         */
1678
-        $html = apply_filters("geodir_custom_field_output_address_{$location}_{$html_var}",$html,$cf);
1679
-    }
1680
-
1681
-    // If not html then we run the standard output.
1682
-    if(empty($html)){
1683
-
1684
-        global $preview;
1685
-        $html_var = $cf['htmlvar_name'] . '_address';
1686
-
1687
-        if ($cf['extra_fields']) {
1688
-
1689
-            $extra_fields = unserialize($cf['extra_fields']);
1690
-
1691
-            $addition_fields = '';
1692
-
1693
-            if (!empty($extra_fields)) {
1694
-
1695
-                $show_city_in_address = false;
1696
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1697
-                    $show_city_in_address = true;
1698
-                }
1699
-                /**
1700
-                 * Filter "show city in address" value.
1701
-                 *
1702
-                 * @since 1.0.0
1703
-                 */
1704
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1705
-
1706
-
1707
-                $show_region_in_address = false;
1708
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1709
-                    $show_region_in_address = true;
1710
-                }
1711
-                /**
1712
-                 * Filter "show region in address" value.
1713
-                 *
1714
-                 * @since 1.6.6
1715
-                 */
1716
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1717
-
1718
-                $show_country_in_address = false;
1719
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1720
-                    $show_country_in_address = true;
1721
-                }
1722
-                /**
1723
-                 * Filter "show country in address" value.
1724
-                 *
1725
-                 * @since 1.6.6
1726
-                 */
1727
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1728
-
1729
-                $show_zip_in_address = false;
1730
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1731
-                    $show_zip_in_address = true;
1732
-                }
1733
-                /**
1734
-                 * Filter "show zip in address" value.
1735
-                 *
1736
-                 * @since 1.6.6
1737
-                 */
1738
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1739
-
1740
-
1741
-            }
1742
-
1743
-        }
1744
-
1745
-
1746
-        if ($post->{$html_var}) {
1747
-
1748
-            $field_icon = geodir_field_icon_proccess( $cf );
1749
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1750
-                $field_icon_af = '';
1751
-            } elseif ( $field_icon == '' ) {
1752
-                $field_icon_af = '<i class="fa fa-home"></i>';
1753
-            } else {
1754
-                $field_icon_af = $field_icon;
1755
-                $field_icon    = '';
1756
-            }
1633
+	// check we have the post value
1634
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1635
+	else{ global $post;}
1636
+
1637
+	if(!is_array($cf) && $cf!=''){
1638
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1639
+		if(!$cf){return NULL;}
1640
+	}
1641
+
1642
+	$html_var = $cf['htmlvar_name'];
1643
+
1644
+	// Check if there is a location specific filter.
1645
+	if(has_filter("geodir_custom_field_output_address_{$location}")){
1646
+		/**
1647
+		 * Filter the address html by location.
1648
+		 *
1649
+		 * @param string $html The html to filter.
1650
+		 * @param array $cf The custom field array.
1651
+		 * @since 1.6.6
1652
+		 */
1653
+		$html = apply_filters("geodir_custom_field_output_address_{$location}",$html,$cf);
1654
+	}
1655
+
1656
+	// Check if there is a custom field specific filter.
1657
+	if(has_filter("geodir_custom_field_output_address_{$html_var}")){
1658
+		/**
1659
+		 * Filter the address html by individual custom field.
1660
+		 *
1661
+		 * @param string $html The html to filter.
1662
+		 * @param string $location The location to output the html.
1663
+		 * @param array $cf The custom field array.
1664
+		 * @since 1.6.6
1665
+		 */
1666
+		$html = apply_filters("geodir_custom_field_output_address_{$html_var}",$html,$location,$cf);
1667
+	}
1668
+
1669
+	// Check if there is a custom field specific filter.
1670
+	if(has_filter("geodir_custom_field_output_address_{$location}_{$html_var}")){
1671
+		/**
1672
+		 * Filter the address html by location and individual custom field.
1673
+		 *
1674
+		 * @param string $html The html to filter.
1675
+		 * @param array $cf The custom field array.
1676
+		 * @since 1.6.6
1677
+		 */
1678
+		$html = apply_filters("geodir_custom_field_output_address_{$location}_{$html_var}",$html,$cf);
1679
+	}
1680
+
1681
+	// If not html then we run the standard output.
1682
+	if(empty($html)){
1683
+
1684
+		global $preview;
1685
+		$html_var = $cf['htmlvar_name'] . '_address';
1686
+
1687
+		if ($cf['extra_fields']) {
1688
+
1689
+			$extra_fields = unserialize($cf['extra_fields']);
1690
+
1691
+			$addition_fields = '';
1692
+
1693
+			if (!empty($extra_fields)) {
1694
+
1695
+				$show_city_in_address = false;
1696
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1697
+					$show_city_in_address = true;
1698
+				}
1699
+				/**
1700
+				 * Filter "show city in address" value.
1701
+				 *
1702
+				 * @since 1.0.0
1703
+				 */
1704
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1705
+
1706
+
1707
+				$show_region_in_address = false;
1708
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1709
+					$show_region_in_address = true;
1710
+				}
1711
+				/**
1712
+				 * Filter "show region in address" value.
1713
+				 *
1714
+				 * @since 1.6.6
1715
+				 */
1716
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1717
+
1718
+				$show_country_in_address = false;
1719
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1720
+					$show_country_in_address = true;
1721
+				}
1722
+				/**
1723
+				 * Filter "show country in address" value.
1724
+				 *
1725
+				 * @since 1.6.6
1726
+				 */
1727
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1728
+
1729
+				$show_zip_in_address = false;
1730
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1731
+					$show_zip_in_address = true;
1732
+				}
1733
+				/**
1734
+				 * Filter "show zip in address" value.
1735
+				 *
1736
+				 * @since 1.6.6
1737
+				 */
1738
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1739
+
1740
+
1741
+			}
1742
+
1743
+		}
1744
+
1745
+
1746
+		if ($post->{$html_var}) {
1747
+
1748
+			$field_icon = geodir_field_icon_proccess( $cf );
1749
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1750
+				$field_icon_af = '';
1751
+			} elseif ( $field_icon == '' ) {
1752
+				$field_icon_af = '<i class="fa fa-home"></i>';
1753
+			} else {
1754
+				$field_icon_af = $field_icon;
1755
+				$field_icon    = '';
1756
+			}
1757 1757
             
1758 1758
 
1759 1759
 
1760
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1761
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1762
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1763
-            $html .= '</span>';
1760
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1761
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1762
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1763
+			$html .= '</span>';
1764 1764
 
1765 1765
 
1766
-            if ( $post->post_address ) {
1767
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1768
-            }
1769
-            if ($show_city_in_address && $post->post_city ) {
1770
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1771
-            }
1772
-            if ($show_region_in_address && $post->post_region ) {
1773
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1774
-            }
1775
-            if ($show_zip_in_address && $post->post_zip ) {
1776
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1777
-            }
1778
-            if ($show_country_in_address && $post->post_country ) {
1779
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1780
-            }
1781
-            $html .= '</div>';
1766
+			if ( $post->post_address ) {
1767
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1768
+			}
1769
+			if ($show_city_in_address && $post->post_city ) {
1770
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1771
+			}
1772
+			if ($show_region_in_address && $post->post_region ) {
1773
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1774
+			}
1775
+			if ($show_zip_in_address && $post->post_zip ) {
1776
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1777
+			}
1778
+			if ($show_country_in_address && $post->post_country ) {
1779
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1780
+			}
1781
+			$html .= '</div>';
1782 1782
 
1783
-        }
1783
+		}
1784 1784
 
1785
-    }
1785
+	}
1786 1786
 
1787 1787
 
1788
-    return $html;
1788
+	return $html;
1789 1789
 }
1790 1790
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1791 1791
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +298 added lines, -298 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_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_{$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_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_{$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_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_{$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_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_{$location}_{$html_var}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_{$location}_{$html_var}")) {
62 62
         /**
63 63
          * Filter the checkbox html by location and individual custom field.
64 64
          *
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
          * @param array $cf The custom field array.
67 67
          * @since 1.6.6
68 68
          */
69
-        $html = apply_filters("geodir_custom_field_output_checkbox_{$location}_{$html_var}",$html,$cf);
69
+        $html = apply_filters("geodir_custom_field_output_checkbox_{$location}_{$html_var}", $html, $cf);
70 70
     }
71 71
 
72 72
     // If not html then we run the standard output.
73
-    if(empty($html)){
73
+    if (empty($html)) {
74 74
 
75
-        if ( (int) $post->{$html_var} == 1 ):
75
+        if ((int) $post->{$html_var} == 1):
76 76
 
77
-            if ( $post->{$html_var} == '1' ):
78
-                $html_val = __( 'Yes', 'geodirectory' );
77
+            if ($post->{$html_var} == '1'):
78
+                $html_val = __('Yes', 'geodirectory');
79 79
             else:
80
-                $html_val = __( 'No', 'geodirectory' );
80
+                $html_val = __('No', 'geodirectory');
81 81
             endif;
82 82
 
83 83
             $field_icon = geodir_field_icon_proccess($cf);
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
                 $field_icon = '';
91 91
             }
92 92
 
93
-            $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;
94
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
95
-            $html .= '</span>' . $html_val . '</div>';
93
+            $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;
94
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
95
+            $html .= '</span>'.$html_val.'</div>';
96 96
         endif;
97 97
 
98 98
     }
99 99
 
100 100
     return $html;
101 101
 }
102
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
102
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
103 103
 
104 104
 
105 105
 /**
@@ -112,21 +112,21 @@  discard block
 block discarded – undo
112 112
  *
113 113
  * @return string The html to output for the custom field.
114 114
  */
115
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
115
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
116 116
 
117 117
     // check we have the post value
118
-    if(is_int($p)){$post = geodir_get_post_info($p);}
119
-    else{ global $post;}
118
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
119
+    else { global $post; }
120 120
 
121
-    if(!is_array($cf) && $cf!=''){
121
+    if (!is_array($cf) && $cf != '') {
122 122
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
123
-        if(!$cf){return NULL;}
123
+        if (!$cf) {return NULL; }
124 124
     }
125 125
 
126 126
     $html_var = $cf['htmlvar_name'];
127 127
 
128 128
     // Check if there is a location specific filter.
129
-    if(has_filter("geodir_custom_field_output_fieldset_{$location}")){
129
+    if (has_filter("geodir_custom_field_output_fieldset_{$location}")) {
130 130
         /**
131 131
          * Filter the fieldset html by location.
132 132
          *
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
          * @param array $cf The custom field array.
135 135
          * @since 1.6.6
136 136
          */
137
-        $html = apply_filters("geodir_custom_field_output_fieldset_{$location}",$html,$cf);
137
+        $html = apply_filters("geodir_custom_field_output_fieldset_{$location}", $html, $cf);
138 138
     }
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_output_fieldset_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_output_fieldset_{$html_var}")) {
142 142
         /**
143 143
          * Filter the fieldset html by individual custom field.
144 144
          *
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
          * @param array $cf The custom field array.
148 148
          * @since 1.6.6
149 149
          */
150
-        $html = apply_filters("geodir_custom_field_output_fieldset_{$html_var}",$html,$location,$cf);
150
+        $html = apply_filters("geodir_custom_field_output_fieldset_{$html_var}", $html, $location, $cf);
151 151
     }
152 152
 
153 153
     // Check if there is a custom field specific filter.
154
-    if(has_filter("geodir_custom_field_output_fieldset_{$location}_{$html_var}")){
154
+    if (has_filter("geodir_custom_field_output_fieldset_{$location}_{$html_var}")) {
155 155
         /**
156 156
          * Filter the fieldset html by location and individual custom field.
157 157
          *
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
          * @param array $cf The custom field array.
160 160
          * @since 1.6.6
161 161
          */
162
-        $html = apply_filters("geodir_custom_field_output_fieldset_{$location}_{$html_var}",$html,$cf);
162
+        $html = apply_filters("geodir_custom_field_output_fieldset_{$location}_{$html_var}", $html, $cf);
163 163
     }
164 164
 
165 165
     // If not html then we run the standard output.
166
-    if(empty($html)){
166
+    if (empty($html)) {
167 167
 
168 168
         global $field_set_start;
169 169
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
170 170
 
171 171
         if ($field_set_start == 1) {
172
-            echo '</div><div class="geodir-company_info field-group ' . $cf['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
172
+            echo '</div><div class="geodir-company_info field-group '.$cf['htmlvar_name'].'"><h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
173 173
         } else {
174
-            echo '<h2 class="'.$fieldset_class.'">' . __($cf['site_title'], 'geodirectory') . '</h2>';
174
+            echo '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
175 175
             $field_set_start = 1;
176 176
         }
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
     return $html;
181 181
 }
182
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
182
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
183 183
 
184 184
 
185 185
 /**
@@ -192,21 +192,21 @@  discard block
 block discarded – undo
192 192
  *
193 193
  * @return string The html to output for the custom field.
194 194
  */
195
-function geodir_cf_url($html,$location,$cf,$p=''){
195
+function geodir_cf_url($html, $location, $cf, $p = '') {
196 196
 
197 197
     // check we have the post value
198
-    if(is_int($p)){$post = geodir_get_post_info($p);}
199
-    else{ global $post;}
198
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
199
+    else { global $post; }
200 200
 
201
-    if(!is_array($cf) && $cf!=''){
201
+    if (!is_array($cf) && $cf != '') {
202 202
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
203
-        if(!$cf){return NULL;}
203
+        if (!$cf) {return NULL; }
204 204
     }
205 205
 
206 206
     $html_var = $cf['htmlvar_name'];
207 207
 
208 208
     // Check if there is a location specific filter.
209
-    if(has_filter("geodir_custom_field_output_url_{$location}")){
209
+    if (has_filter("geodir_custom_field_output_url_{$location}")) {
210 210
         /**
211 211
          * Filter the url html by location.
212 212
          *
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
          * @param array $cf The custom field array.
215 215
          * @since 1.6.6
216 216
          */
217
-        $html = apply_filters("geodir_custom_field_output_url_{$location}",$html,$cf);
217
+        $html = apply_filters("geodir_custom_field_output_url_{$location}", $html, $cf);
218 218
     }
219 219
 
220 220
     // Check if there is a custom field specific filter.
221
-    if(has_filter("geodir_custom_field_output_url_{$html_var}")){
221
+    if (has_filter("geodir_custom_field_output_url_{$html_var}")) {
222 222
         /**
223 223
          * Filter the url html by individual custom field.
224 224
          *
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
          * @param array $cf The custom field array.
228 228
          * @since 1.6.6
229 229
          */
230
-        $html = apply_filters("geodir_custom_field_output_url_{$html_var}",$html,$location,$cf);
230
+        $html = apply_filters("geodir_custom_field_output_url_{$html_var}", $html, $location, $cf);
231 231
     }
232 232
 
233 233
     // Check if there is a custom field specific filter.
234
-    if(has_filter("geodir_custom_field_output_url_{$location}_{$html_var}")){
234
+    if (has_filter("geodir_custom_field_output_url_{$location}_{$html_var}")) {
235 235
         /**
236 236
          * Filter the url html by location and individual custom field.
237 237
          *
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
          * @param array $cf The custom field array.
240 240
          * @since 1.6.6
241 241
          */
242
-        $html = apply_filters("geodir_custom_field_output_url_{$location}_{$html_var}",$html,$cf);
242
+        $html = apply_filters("geodir_custom_field_output_url_{$location}_{$html_var}", $html, $cf);
243 243
     }
244 244
 
245 245
     // If not html then we run the standard output.
246
-    if(empty($html)){
246
+    if (empty($html)) {
247 247
 
248 248
         if ($post->{$cf['htmlvar_name']}):
249 249
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
272 272
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
273
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
273
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
274 274
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
275 275
 
276 276
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
              * @param string $website Website URL.
287 287
              * @param int $post->ID Post ID.
288 288
              */
289
-            $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>';
289
+            $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>';
290 290
 
291 291
         endif;
292 292
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
     return $html;
296 296
 }
297
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
297
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
298 298
 
299 299
 
300 300
 /**
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
  *
308 308
  * @return string The html to output for the custom field.
309 309
  */
310
-function geodir_cf_phone($html,$location,$cf,$p=''){
310
+function geodir_cf_phone($html, $location, $cf, $p = '') {
311 311
 
312 312
     // check we have the post value
313
-    if(is_int($p)){$post = geodir_get_post_info($p);}
314
-    else{ global $post;}
313
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
314
+    else { global $post; }
315 315
 
316
-    if(!is_array($cf) && $cf!=''){
316
+    if (!is_array($cf) && $cf != '') {
317 317
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
318
-        if(!$cf){return NULL;}
318
+        if (!$cf) {return NULL; }
319 319
     }
320 320
 
321 321
     $html_var = $cf['htmlvar_name'];
322 322
 
323 323
     // Check if there is a location specific filter.
324
-    if(has_filter("geodir_custom_field_output_phone_{$location}")){
324
+    if (has_filter("geodir_custom_field_output_phone_{$location}")) {
325 325
         /**
326 326
          * Filter the phone html by location.
327 327
          *
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
          * @param array $cf The custom field array.
330 330
          * @since 1.6.6
331 331
          */
332
-        $html = apply_filters("geodir_custom_field_output_phone_{$location}",$html,$cf);
332
+        $html = apply_filters("geodir_custom_field_output_phone_{$location}", $html, $cf);
333 333
     }
334 334
 
335 335
     // Check if there is a custom field specific filter.
336
-    if(has_filter("geodir_custom_field_output_phone_{$html_var}")){
336
+    if (has_filter("geodir_custom_field_output_phone_{$html_var}")) {
337 337
         /**
338 338
          * Filter the phone html by individual custom field.
339 339
          *
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
          * @param array $cf The custom field array.
343 343
          * @since 1.6.6
344 344
          */
345
-        $html = apply_filters("geodir_custom_field_output_phone_{$html_var}",$html,$location,$cf);
345
+        $html = apply_filters("geodir_custom_field_output_phone_{$html_var}", $html, $location, $cf);
346 346
     }
347 347
 
348 348
     // Check if there is a custom field specific filter.
349
-    if(has_filter("geodir_custom_field_output_phone_{$location}_{$html_var}")){
349
+    if (has_filter("geodir_custom_field_output_phone_{$location}_{$html_var}")) {
350 350
         /**
351 351
          * Filter the phone html by location and individual custom field.
352 352
          *
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
          * @param array $cf The custom field array.
355 355
          * @since 1.6.6
356 356
          */
357
-        $html = apply_filters("geodir_custom_field_output_phone_{$location}_{$html_var}",$html,$cf);
357
+        $html = apply_filters("geodir_custom_field_output_phone_{$location}_{$html_var}", $html, $cf);
358 358
     }
359 359
 
360 360
     // If not html then we run the standard output.
361
-    if(empty($html)){
361
+    if (empty($html)) {
362 362
 
363 363
         if ($post->{$cf['htmlvar_name']}):
364 364
 
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
             }
374 374
 
375 375
 
376
-            $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 .
377
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
378
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
376
+            $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.
377
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
378
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
379 379
 
380 380
         endif;
381 381
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 
384 384
     return $html;
385 385
 }
386
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
386
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
387 387
 
388 388
 
389 389
 /**
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
  *
397 397
  * @return string The html to output for the custom field.
398 398
  */
399
-function geodir_cf_time($html,$location,$cf,$p=''){
399
+function geodir_cf_time($html, $location, $cf, $p = '') {
400 400
 
401 401
     // check we have the post value
402
-    if(is_int($p)){$post = geodir_get_post_info($p);}
403
-    else{ global $post;}
402
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
403
+    else { global $post; }
404 404
 
405
-    if(!is_array($cf) && $cf!=''){
405
+    if (!is_array($cf) && $cf != '') {
406 406
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
407
-        if(!$cf){return NULL;}
407
+        if (!$cf) {return NULL; }
408 408
     }
409 409
 
410 410
     $html_var = $cf['htmlvar_name'];
411 411
 
412 412
     // Check if there is a location specific filter.
413
-    if(has_filter("geodir_custom_field_output_time_{$location}")){
413
+    if (has_filter("geodir_custom_field_output_time_{$location}")) {
414 414
         /**
415 415
          * Filter the time html by location.
416 416
          *
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
          * @param array $cf The custom field array.
419 419
          * @since 1.6.6
420 420
          */
421
-        $html = apply_filters("geodir_custom_field_output_time_{$location}",$html,$cf);
421
+        $html = apply_filters("geodir_custom_field_output_time_{$location}", $html, $cf);
422 422
     }
423 423
 
424 424
     // Check if there is a custom field specific filter.
425
-    if(has_filter("geodir_custom_field_output_time_{$html_var}")){
425
+    if (has_filter("geodir_custom_field_output_time_{$html_var}")) {
426 426
         /**
427 427
          * Filter the time html by individual custom field.
428 428
          *
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
          * @param array $cf The custom field array.
432 432
          * @since 1.6.6
433 433
          */
434
-        $html = apply_filters("geodir_custom_field_output_time_{$html_var}",$html,$location,$cf);
434
+        $html = apply_filters("geodir_custom_field_output_time_{$html_var}", $html, $location, $cf);
435 435
     }
436 436
 
437 437
     // Check if there is a custom field specific filter.
438
-    if(has_filter("geodir_custom_field_output_time_{$location}_{$html_var}")){
438
+    if (has_filter("geodir_custom_field_output_time_{$location}_{$html_var}")) {
439 439
         /**
440 440
          * Filter the time html by location and individual custom field.
441 441
          *
@@ -443,11 +443,11 @@  discard block
 block discarded – undo
443 443
          * @param array $cf The custom field array.
444 444
          * @since 1.6.6
445 445
          */
446
-        $html = apply_filters("geodir_custom_field_output_time_{$location}_{$html_var}",$html,$cf);
446
+        $html = apply_filters("geodir_custom_field_output_time_{$location}_{$html_var}", $html, $cf);
447 447
     }
448 448
 
449 449
     // If not html then we run the standard output.
450
-    if(empty($html)){
450
+    if (empty($html)) {
451 451
 
452 452
         if ($post->{$cf['htmlvar_name']}):
453 453
 
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
             }
468 468
 
469 469
 
470
-            $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;
471
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
472
-            $html .= '</span>' . $value . '</div>';
470
+            $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;
471
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
472
+            $html .= '</span>'.$value.'</div>';
473 473
 
474 474
         endif;
475 475
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 
478 478
     return $html;
479 479
 }
480
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
480
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
481 481
 
482 482
 
483 483
 /**
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
  *
491 491
  * @return string The html to output for the custom field.
492 492
  */
493
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
493
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
494 494
 
495 495
     // check we have the post value
496
-    if(is_int($p)){$post = geodir_get_post_info($p);}
497
-    else{ global $post;}
496
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
497
+    else { global $post; }
498 498
 
499
-    if(!is_array($cf) && $cf!=''){
499
+    if (!is_array($cf) && $cf != '') {
500 500
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
501
-        if(!$cf){return NULL;}
501
+        if (!$cf) {return NULL; }
502 502
     }
503 503
 
504 504
     $html_var = $cf['htmlvar_name'];
505 505
 
506 506
     // Check if there is a location specific filter.
507
-    if(has_filter("geodir_custom_field_output_datepicker_{$location}")){
507
+    if (has_filter("geodir_custom_field_output_datepicker_{$location}")) {
508 508
         /**
509 509
          * Filter the datepicker html by location.
510 510
          *
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
          * @param array $cf The custom field array.
513 513
          * @since 1.6.6
514 514
          */
515
-        $html = apply_filters("geodir_custom_field_output_datepicker_{$location}",$html,$cf);
515
+        $html = apply_filters("geodir_custom_field_output_datepicker_{$location}", $html, $cf);
516 516
     }
517 517
 
518 518
     // Check if there is a custom field specific filter.
519
-    if(has_filter("geodir_custom_field_output_datepicker_{$html_var}")){
519
+    if (has_filter("geodir_custom_field_output_datepicker_{$html_var}")) {
520 520
         /**
521 521
          * Filter the datepicker html by individual custom field.
522 522
          *
@@ -525,11 +525,11 @@  discard block
 block discarded – undo
525 525
          * @param array $cf The custom field array.
526 526
          * @since 1.6.6
527 527
          */
528
-        $html = apply_filters("geodir_custom_field_output_datepicker_{$html_var}",$html,$location,$cf);
528
+        $html = apply_filters("geodir_custom_field_output_datepicker_{$html_var}", $html, $location, $cf);
529 529
     }
530 530
 
531 531
     // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_output_datepicker_{$location}_{$html_var}")){
532
+    if (has_filter("geodir_custom_field_output_datepicker_{$location}_{$html_var}")) {
533 533
         /**
534 534
          * Filter the datepicker html by location and individual custom field.
535 535
          *
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
          * @param array $cf The custom field array.
538 538
          * @since 1.6.6
539 539
          */
540
-        $html = apply_filters("geodir_custom_field_output_datepicker_{$location}_{$html_var}",$html,$cf);
540
+        $html = apply_filters("geodir_custom_field_output_datepicker_{$location}_{$html_var}", $html, $cf);
541 541
     }
542 542
 
543 543
     // If not html then we run the standard output.
544
-    if(empty($html)){
544
+    if (empty($html)) {
545 545
 
546 546
         if ($post->{$cf['htmlvar_name']}):
547 547
 
@@ -552,21 +552,21 @@  discard block
 block discarded – undo
552 552
             }
553 553
             // check if we need to change the format or not
554 554
             $date_format_len = strlen(str_replace(' ', '', $date_format));
555
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
555
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
556 556
 
557
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
558
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
557
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
558
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
559 559
 
560 560
                 $date_format = str_replace($search, $replace, $date_format);
561 561
 
562
-                $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
563
-            }else{
562
+                $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
563
+            } else {
564 564
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
565 565
             }
566 566
 
567
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
567
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
568 568
                 $value = date_i18n($date_format, strtotime($post_htmlvar_value));
569
-            }else{
569
+            } else {
570 570
                 return '';
571 571
             }
572 572
 
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
 
584 584
 
585 585
 
586
-            $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;
587
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
588
-            $html .= '</span>' . $value . '</div>';
586
+            $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;
587
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
588
+            $html .= '</span>'.$value.'</div>';
589 589
 
590 590
         endif;
591 591
 
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
     return $html;
595 595
 }
596
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
596
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
597 597
 
598 598
 
599 599
 /**
@@ -606,21 +606,21 @@  discard block
 block discarded – undo
606 606
  *
607 607
  * @return string The html to output for the custom field.
608 608
  */
609
-function geodir_cf_text($html,$location,$cf,$p=''){
609
+function geodir_cf_text($html, $location, $cf, $p = '') {
610 610
 
611 611
     // check we have the post value
612
-    if(is_int($p)){$post = geodir_get_post_info($p);}
613
-    else{ global $post;}
612
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
613
+    else { global $post; }
614 614
 
615
-    if(!is_array($cf) && $cf!=''){
615
+    if (!is_array($cf) && $cf != '') {
616 616
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
617
-        if(!$cf){return NULL;}
617
+        if (!$cf) {return NULL; }
618 618
     }
619 619
 
620 620
     $html_var = $cf['htmlvar_name'];
621 621
 
622 622
     // Check if there is a location specific filter.
623
-    if(has_filter("geodir_custom_field_output_text_{$location}")){
623
+    if (has_filter("geodir_custom_field_output_text_{$location}")) {
624 624
         /**
625 625
          * Filter the text html by location.
626 626
          *
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
          * @param array $cf The custom field array.
629 629
          * @since 1.6.6
630 630
          */
631
-        $html = apply_filters("geodir_custom_field_output_text_{$location}",$html,$cf);
631
+        $html = apply_filters("geodir_custom_field_output_text_{$location}", $html, $cf);
632 632
     }
633 633
 
634 634
     // Check if there is a custom field specific filter.
635
-    if(has_filter("geodir_custom_field_output_text_{$html_var}")){
635
+    if (has_filter("geodir_custom_field_output_text_{$html_var}")) {
636 636
         /**
637 637
          * Filter the text html by individual custom field.
638 638
          *
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
          * @param array $cf The custom field array.
642 642
          * @since 1.6.6
643 643
          */
644
-        $html = apply_filters("geodir_custom_field_output_text_{$html_var}",$html,$location,$cf);
644
+        $html = apply_filters("geodir_custom_field_output_text_{$html_var}", $html, $location, $cf);
645 645
     }
646 646
 
647 647
     // Check if there is a custom field specific filter.
648
-    if(has_filter("geodir_custom_field_output_text_{$location}_{$html_var}")){
648
+    if (has_filter("geodir_custom_field_output_text_{$location}_{$html_var}")) {
649 649
         /**
650 650
          * Filter the text html by location and individual custom field.
651 651
          *
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
          * @param array $cf The custom field array.
654 654
          * @since 1.6.6
655 655
          */
656
-        $html = apply_filters("geodir_custom_field_output_text_{$location}_{$html_var}",$html,$cf);
656
+        $html = apply_filters("geodir_custom_field_output_text_{$location}_{$html_var}", $html, $cf);
657 657
     }
658 658
 
659 659
     // If not html then we run the standard output.
660
-    if(empty($html)){
660
+    if (empty($html)) {
661 661
 
662
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
662
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
663 663
 
664 664
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
665 665
 
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
             }
675 675
 
676 676
 
677
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
678
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
679
-            $html .= '</span>' . $post->{$cf['htmlvar_name']} . '</div>';
677
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
678
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
679
+            $html .= '</span>'.$post->{$cf['htmlvar_name']}.'</div>';
680 680
 
681 681
         endif;
682 682
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 
685 685
     return $html;
686 686
 }
687
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
687
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
688 688
 
689 689
 
690 690
 /**
@@ -697,21 +697,21 @@  discard block
 block discarded – undo
697 697
  *
698 698
  * @return string The html to output for the custom field.
699 699
  */
700
-function geodir_cf_radio($html,$location,$cf,$p=''){
700
+function geodir_cf_radio($html, $location, $cf, $p = '') {
701 701
 
702 702
     // check we have the post value
703
-    if(is_int($p)){$post = geodir_get_post_info($p);}
704
-    else{ global $post;}
703
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
704
+    else { global $post; }
705 705
 
706
-    if(!is_array($cf) && $cf!=''){
706
+    if (!is_array($cf) && $cf != '') {
707 707
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
708
-        if(!$cf){return NULL;}
708
+        if (!$cf) {return NULL; }
709 709
     }
710 710
 
711 711
     $html_var = $cf['htmlvar_name'];
712 712
 
713 713
     // Check if there is a location specific filter.
714
-    if(has_filter("geodir_custom_field_output_radio_{$location}")){
714
+    if (has_filter("geodir_custom_field_output_radio_{$location}")) {
715 715
         /**
716 716
          * Filter the radio html by location.
717 717
          *
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
          * @param array $cf The custom field array.
720 720
          * @since 1.6.6
721 721
          */
722
-        $html = apply_filters("geodir_custom_field_output_radio_{$location}",$html,$cf);
722
+        $html = apply_filters("geodir_custom_field_output_radio_{$location}", $html, $cf);
723 723
     }
724 724
 
725 725
     // Check if there is a custom field specific filter.
726
-    if(has_filter("geodir_custom_field_output_radio_{$html_var}")){
726
+    if (has_filter("geodir_custom_field_output_radio_{$html_var}")) {
727 727
         /**
728 728
          * Filter the radio html by individual custom field.
729 729
          *
@@ -732,11 +732,11 @@  discard block
 block discarded – undo
732 732
          * @param array $cf The custom field array.
733 733
          * @since 1.6.6
734 734
          */
735
-        $html = apply_filters("geodir_custom_field_output_radio_{$html_var}",$html,$location,$cf);
735
+        $html = apply_filters("geodir_custom_field_output_radio_{$html_var}", $html, $location, $cf);
736 736
     }
737 737
 
738 738
     // Check if there is a custom field specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_{$location}_{$html_var}")){
739
+    if (has_filter("geodir_custom_field_output_radio_{$location}_{$html_var}")) {
740 740
         /**
741 741
          * Filter the radio html by location and individual custom field.
742 742
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_{$location}_{$html_var}",$html,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_{$location}_{$html_var}", $html, $cf);
748 748
     }
749 749
 
750 750
     // If not html then we run the standard output.
751
-    if(empty($html)){
751
+    if (empty($html)) {
752 752
 
753 753
         $html_val = __($post->{$cf['htmlvar_name']}, 'geodirectory');
754 754
         if ($post->{$cf['htmlvar_name']} != ''):
@@ -782,16 +782,16 @@  discard block
 block discarded – undo
782 782
             }
783 783
 
784 784
 
785
-            $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;
786
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
787
-            $html .= '</span>' . $html_val . '</div>';
785
+            $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;
786
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
787
+            $html .= '</span>'.$html_val.'</div>';
788 788
         endif;
789 789
 
790 790
     }
791 791
 
792 792
     return $html;
793 793
 }
794
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
794
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
795 795
 
796 796
 
797 797
 /**
@@ -804,21 +804,21 @@  discard block
 block discarded – undo
804 804
  *
805 805
  * @return string The html to output for the custom field.
806 806
  */
807
-function geodir_cf_select($html,$location,$cf,$p=''){
807
+function geodir_cf_select($html, $location, $cf, $p = '') {
808 808
 
809 809
     // check we have the post value
810
-    if(is_int($p)){$post = geodir_get_post_info($p);}
811
-    else{ global $post;}
810
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
811
+    else { global $post; }
812 812
 
813
-    if(!is_array($cf) && $cf!=''){
813
+    if (!is_array($cf) && $cf != '') {
814 814
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
815
-        if(!$cf){return NULL;}
815
+        if (!$cf) {return NULL; }
816 816
     }
817 817
 
818 818
     $html_var = $cf['htmlvar_name'];
819 819
 
820 820
     // Check if there is a location specific filter.
821
-    if(has_filter("geodir_custom_field_output_select_{$location}")){
821
+    if (has_filter("geodir_custom_field_output_select_{$location}")) {
822 822
         /**
823 823
          * Filter the select html by location.
824 824
          *
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
          * @param array $cf The custom field array.
827 827
          * @since 1.6.6
828 828
          */
829
-        $html = apply_filters("geodir_custom_field_output_select_{$location}",$html,$cf);
829
+        $html = apply_filters("geodir_custom_field_output_select_{$location}", $html, $cf);
830 830
     }
831 831
 
832 832
     // Check if there is a custom field specific filter.
833
-    if(has_filter("geodir_custom_field_output_select_{$html_var}")){
833
+    if (has_filter("geodir_custom_field_output_select_{$html_var}")) {
834 834
         /**
835 835
          * Filter the select html by individual custom field.
836 836
          *
@@ -839,11 +839,11 @@  discard block
 block discarded – undo
839 839
          * @param array $cf The custom field array.
840 840
          * @since 1.6.6
841 841
          */
842
-        $html = apply_filters("geodir_custom_field_output_select_{$html_var}",$html,$location,$cf);
842
+        $html = apply_filters("geodir_custom_field_output_select_{$html_var}", $html, $location, $cf);
843 843
     }
844 844
 
845 845
     // Check if there is a custom field specific filter.
846
-    if(has_filter("geodir_custom_field_output_select_{$location}_{$html_var}")){
846
+    if (has_filter("geodir_custom_field_output_select_{$location}_{$html_var}")) {
847 847
         /**
848 848
          * Filter the select html by location and individual custom field.
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_{$location}_{$html_var}",$html,$cf);
854
+        $html = apply_filters("geodir_custom_field_output_select_{$location}_{$html_var}", $html, $cf);
855 855
     }
856 856
 
857 857
     // If not html then we run the standard output.
858
-    if(empty($html)){
858
+    if (empty($html)) {
859 859
 
860 860
         if ($post->{$cf['htmlvar_name']}):
861 861
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -883,16 +883,16 @@  discard block
 block discarded – undo
883 883
             }
884 884
 
885 885
 
886
-            $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;
887
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
888
-            $html .= '</span>' . $field_value . '</div>';
886
+            $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;
887
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
888
+            $html .= '</span>'.$field_value.'</div>';
889 889
         endif;
890 890
 
891 891
     }
892 892
 
893 893
     return $html;
894 894
 }
895
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
895
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
896 896
 
897 897
 
898 898
 /**
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
  *
906 906
  * @return string The html to output for the custom field.
907 907
  */
908
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
908
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
909 909
 
910 910
     // check we have the post value
911
-    if(is_int($p)){$post = geodir_get_post_info($p);}
912
-    else{ global $post;}
911
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
912
+    else { global $post; }
913 913
 
914
-    if(!is_array($cf) && $cf!=''){
914
+    if (!is_array($cf) && $cf != '') {
915 915
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
916
-        if(!$cf){return NULL;}
916
+        if (!$cf) {return NULL; }
917 917
     }
918 918
 
919 919
     $html_var = $cf['htmlvar_name'];
920 920
 
921 921
     // Check if there is a location specific filter.
922
-    if(has_filter("geodir_custom_field_output_multiselect_{$location}")){
922
+    if (has_filter("geodir_custom_field_output_multiselect_{$location}")) {
923 923
         /**
924 924
          * Filter the multiselect html by location.
925 925
          *
@@ -927,11 +927,11 @@  discard block
 block discarded – undo
927 927
          * @param array $cf The custom field array.
928 928
          * @since 1.6.6
929 929
          */
930
-        $html = apply_filters("geodir_custom_field_output_multiselect_{$location}",$html,$cf);
930
+        $html = apply_filters("geodir_custom_field_output_multiselect_{$location}", $html, $cf);
931 931
     }
932 932
 
933 933
     // Check if there is a custom field specific filter.
934
-    if(has_filter("geodir_custom_field_output_multiselect_{$html_var}")){
934
+    if (has_filter("geodir_custom_field_output_multiselect_{$html_var}")) {
935 935
         /**
936 936
          * Filter the multiselect html by individual custom field.
937 937
          *
@@ -940,11 +940,11 @@  discard block
 block discarded – undo
940 940
          * @param array $cf The custom field array.
941 941
          * @since 1.6.6
942 942
          */
943
-        $html = apply_filters("geodir_custom_field_output_multiselect_{$html_var}",$html,$location,$cf);
943
+        $html = apply_filters("geodir_custom_field_output_multiselect_{$html_var}", $html, $location, $cf);
944 944
     }
945 945
 
946 946
     // Check if there is a custom field specific filter.
947
-    if(has_filter("geodir_custom_field_output_multiselect_{$location}_{$html_var}")){
947
+    if (has_filter("geodir_custom_field_output_multiselect_{$location}_{$html_var}")) {
948 948
         /**
949 949
          * Filter the multiselect html by location and individual custom field.
950 950
          *
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
          * @param array $cf The custom field array.
953 953
          * @since 1.6.6
954 954
          */
955
-        $html = apply_filters("geodir_custom_field_output_multiselect_{$location}_{$html_var}",$html,$cf);
955
+        $html = apply_filters("geodir_custom_field_output_multiselect_{$location}_{$html_var}", $html, $cf);
956 956
     }
957 957
 
958 958
     // If not html then we run the standard output.
959
-    if(empty($html)){
959
+    if (empty($html)) {
960 960
 
961 961
 
962 962
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -991,15 +991,15 @@  discard block
 block discarded – undo
991 991
             }
992 992
 
993 993
 
994
-            $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;
995
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
994
+            $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;
995
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
996 996
             $html .= '</span>';
997 997
 
998 998
             if (count($option_values) > 1) {
999 999
                 $html .= '<ul>';
1000 1000
 
1001 1001
                 foreach ($option_values as $val) {
1002
-                    $html .= '<li>' . $val . '</li>';
1002
+                    $html .= '<li>'.$val.'</li>';
1003 1003
                 }
1004 1004
 
1005 1005
                 $html .= '</ul>';
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
     return $html;
1016 1016
 }
1017
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1017
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1018 1018
 
1019 1019
 
1020 1020
 /**
@@ -1027,21 +1027,21 @@  discard block
 block discarded – undo
1027 1027
  *
1028 1028
  * @return string The html to output for the custom field.
1029 1029
  */
1030
-function geodir_cf_email($html,$location,$cf,$p=''){
1030
+function geodir_cf_email($html, $location, $cf, $p = '') {
1031 1031
 
1032 1032
     // check we have the post value
1033
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1034
-    else{ global $post;}
1033
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1034
+    else { global $post; }
1035 1035
 
1036
-    if(!is_array($cf) && $cf!=''){
1036
+    if (!is_array($cf) && $cf != '') {
1037 1037
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1038
-        if(!$cf){return NULL;}
1038
+        if (!$cf) {return NULL; }
1039 1039
     }
1040 1040
 
1041 1041
     $html_var = $cf['htmlvar_name'];
1042 1042
 
1043 1043
     // Check if there is a location specific filter.
1044
-    if(has_filter("geodir_custom_field_output_email_{$location}")){
1044
+    if (has_filter("geodir_custom_field_output_email_{$location}")) {
1045 1045
         /**
1046 1046
          * Filter the email html by location.
1047 1047
          *
@@ -1049,11 +1049,11 @@  discard block
 block discarded – undo
1049 1049
          * @param array $cf The custom field array.
1050 1050
          * @since 1.6.6
1051 1051
          */
1052
-        $html = apply_filters("geodir_custom_field_output_email_{$location}",$html,$cf);
1052
+        $html = apply_filters("geodir_custom_field_output_email_{$location}", $html, $cf);
1053 1053
     }
1054 1054
 
1055 1055
     // Check if there is a custom field specific filter.
1056
-    if(has_filter("geodir_custom_field_output_email_{$html_var}")){
1056
+    if (has_filter("geodir_custom_field_output_email_{$html_var}")) {
1057 1057
         /**
1058 1058
          * Filter the email html by individual custom field.
1059 1059
          *
@@ -1062,11 +1062,11 @@  discard block
 block discarded – undo
1062 1062
          * @param array $cf The custom field array.
1063 1063
          * @since 1.6.6
1064 1064
          */
1065
-        $html = apply_filters("geodir_custom_field_output_email_{$html_var}",$html,$location,$cf);
1065
+        $html = apply_filters("geodir_custom_field_output_email_{$html_var}", $html, $location, $cf);
1066 1066
     }
1067 1067
 
1068 1068
     // Check if there is a custom field specific filter.
1069
-    if(has_filter("geodir_custom_field_output_email_{$location}_{$html_var}")){
1069
+    if (has_filter("geodir_custom_field_output_email_{$location}_{$html_var}")) {
1070 1070
         /**
1071 1071
          * Filter the email html by location and individual custom field.
1072 1072
          *
@@ -1074,11 +1074,11 @@  discard block
 block discarded – undo
1074 1074
          * @param array $cf The custom field array.
1075 1075
          * @since 1.6.6
1076 1076
          */
1077
-        $html = apply_filters("geodir_custom_field_output_email_{$location}_{$html_var}",$html,$cf);
1077
+        $html = apply_filters("geodir_custom_field_output_email_{$location}_{$html_var}", $html, $cf);
1078 1078
     }
1079 1079
 
1080 1080
     // If not html then we run the standard output.
1081
-    if(empty($html)){
1081
+    if (empty($html)) {
1082 1082
 
1083 1083
         global $preview;
1084 1084
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
             if (!$preview) {
1095 1095
                 $b_send_inquiry = 'b_send_inquiry';
1096 1096
                 $b_sendtofriend = 'b_sendtofriend';
1097
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1097
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1098 1098
             }
1099 1099
 
1100 1100
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1108,26 +1108,26 @@  discard block
 block discarded – undo
1108 1108
             }
1109 1109
 
1110 1110
 
1111
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1111
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1112 1112
             $seperator = '';
1113 1113
             if ($post->{$cf['htmlvar_name']}) {
1114
-                $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1114
+                $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1115 1115
                 $seperator = ' | ';
1116 1116
             }
1117 1117
 
1118 1118
             if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
1119
-                $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1119
+                $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1120 1120
             }
1121 1121
 
1122 1122
             $html .= '</span></div>';
1123 1123
 
1124 1124
 
1125 1125
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1126
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1126
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1127 1127
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1128
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1128
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1129 1129
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1130
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1130
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1131 1131
             }
1132 1132
 
1133 1133
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1147,11 +1147,11 @@  discard block
 block discarded – undo
1147 1147
                 }
1148 1148
 
1149 1149
 
1150
-                $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;
1151
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1150
+                $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;
1151
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1152 1152
                 $html .= '</span><span class="geodir-email-address-output">';
1153 1153
                 $email = $post->{$cf['htmlvar_name']} ;
1154
-                if($e_split = explode('@',$email)){
1154
+                if ($e_split = explode('@', $email)) {
1155 1155
                     /**
1156 1156
                      * Filter email custom field name output.
1157 1157
                      *
@@ -1160,10 +1160,10 @@  discard block
 block discarded – undo
1160 1160
                      * @param string $email The email string being output.
1161 1161
                      * @param array $cf Custom field variables array.
1162 1162
                      */
1163
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1164
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1165
-                }else{
1166
-                    $html .=  $email;
1163
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1164
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1165
+                } else {
1166
+                    $html .= $email;
1167 1167
                 }
1168 1168
                 $html .= '</span></div>';
1169 1169
             }
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 
1175 1175
     return $html;
1176 1176
 }
1177
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1177
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1178 1178
 
1179 1179
 
1180 1180
 /**
@@ -1187,21 +1187,21 @@  discard block
 block discarded – undo
1187 1187
  *
1188 1188
  * @return string The html to output for the custom field.
1189 1189
  */
1190
-function geodir_cf_file($html,$location,$cf,$p=''){
1190
+function geodir_cf_file($html, $location, $cf, $p = '') {
1191 1191
 
1192 1192
     // check we have the post value
1193
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1194
-    else{ global $post;}
1193
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1194
+    else { global $post; }
1195 1195
 
1196
-    if(!is_array($cf) && $cf!=''){
1196
+    if (!is_array($cf) && $cf != '') {
1197 1197
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1198
-        if(!$cf){return NULL;}
1198
+        if (!$cf) {return NULL; }
1199 1199
     }
1200 1200
 
1201 1201
     $html_var = $cf['htmlvar_name'];
1202 1202
 
1203 1203
     // Check if there is a location specific filter.
1204
-    if(has_filter("geodir_custom_field_output_file_{$location}")){
1204
+    if (has_filter("geodir_custom_field_output_file_{$location}")) {
1205 1205
         /**
1206 1206
          * Filter the file html by location.
1207 1207
          *
@@ -1209,11 +1209,11 @@  discard block
 block discarded – undo
1209 1209
          * @param array $cf The custom field array.
1210 1210
          * @since 1.6.6
1211 1211
          */
1212
-        $html = apply_filters("geodir_custom_field_output_file_{$location}",$html,$cf);
1212
+        $html = apply_filters("geodir_custom_field_output_file_{$location}", $html, $cf);
1213 1213
     }
1214 1214
 
1215 1215
     // Check if there is a custom field specific filter.
1216
-    if(has_filter("geodir_custom_field_output_file_{$html_var}")){
1216
+    if (has_filter("geodir_custom_field_output_file_{$html_var}")) {
1217 1217
         /**
1218 1218
          * Filter the file html by individual custom field.
1219 1219
          *
@@ -1222,11 +1222,11 @@  discard block
 block discarded – undo
1222 1222
          * @param array $cf The custom field array.
1223 1223
          * @since 1.6.6
1224 1224
          */
1225
-        $html = apply_filters("geodir_custom_field_output_file_{$html_var}",$html,$location,$cf);
1225
+        $html = apply_filters("geodir_custom_field_output_file_{$html_var}", $html, $location, $cf);
1226 1226
     }
1227 1227
 
1228 1228
     // Check if there is a custom field specific filter.
1229
-    if(has_filter("geodir_custom_field_output_file_{$location}_{$html_var}")){
1229
+    if (has_filter("geodir_custom_field_output_file_{$location}_{$html_var}")) {
1230 1230
         /**
1231 1231
          * Filter the file html by location and individual custom field.
1232 1232
          *
@@ -1234,11 +1234,11 @@  discard block
 block discarded – undo
1234 1234
          * @param array $cf The custom field array.
1235 1235
          * @since 1.6.6
1236 1236
          */
1237
-        $html = apply_filters("geodir_custom_field_output_file_{$location}_{$html_var}",$html,$cf);
1237
+        $html = apply_filters("geodir_custom_field_output_file_{$location}_{$html_var}", $html, $cf);
1238 1238
     }
1239 1239
 
1240 1240
     // If not html then we run the standard output.
1241
-    if(empty($html)){
1241
+    if (empty($html)) {
1242 1242
 
1243 1243
         if (!empty($post->{$cf['htmlvar_name']})):
1244 1244
 
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
             if (!empty($files)):
1247 1247
 
1248 1248
                 $extra_fields = !empty($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : NULL;
1249
-                $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'] : '';
1249
+                $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'] : '';
1250 1250
 
1251 1251
                 $file_paths = '';
1252 1252
                 foreach ($files as $file) {
@@ -1283,9 +1283,9 @@  discard block
 block discarded – undo
1283 1283
                             //$file_paths .= '<img src="'.$file.'"  />';	
1284 1284
                             $file_paths .= '</div>';
1285 1285
                         } else {
1286
-                            $ext_path = '_' . $html_var . '_';
1286
+                            $ext_path = '_'.$html_var.'_';
1287 1287
                             $filename = explode($ext_path, $filename);
1288
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1288
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1289 1289
                         }
1290 1290
                     }
1291 1291
                 }
@@ -1300,11 +1300,11 @@  discard block
 block discarded – undo
1300 1300
                     $field_icon = '';
1301 1301
                 }
1302 1302
 
1303
-                $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;
1303
+                $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;
1304 1304
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1305
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1305
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1306 1306
                 $html .= '</span>';
1307
-                $html .= $file_paths . '</div></div>';
1307
+                $html .= $file_paths.'</div></div>';
1308 1308
 
1309 1309
             endif;
1310 1310
         endif;
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
     return $html;
1315 1315
 }
1316
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1316
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1317 1317
 
1318 1318
 
1319 1319
 
@@ -1327,21 +1327,21 @@  discard block
 block discarded – undo
1327 1327
  *
1328 1328
  * @return string The html to output for the custom field.
1329 1329
  */
1330
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1330
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1331 1331
 
1332 1332
     // check we have the post value
1333
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1334
-    else{ global $post;}
1333
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1334
+    else { global $post; }
1335 1335
 
1336
-    if(!is_array($cf) && $cf!=''){
1336
+    if (!is_array($cf) && $cf != '') {
1337 1337
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1338
-        if(!$cf){return NULL;}
1338
+        if (!$cf) {return NULL; }
1339 1339
     }
1340 1340
 
1341 1341
     $html_var = $cf['htmlvar_name'];
1342 1342
 
1343 1343
     // Check if there is a location specific filter.
1344
-    if(has_filter("geodir_custom_field_output_textarea_{$location}")){
1344
+    if (has_filter("geodir_custom_field_output_textarea_{$location}")) {
1345 1345
         /**
1346 1346
          * Filter the textarea html by location.
1347 1347
          *
@@ -1349,11 +1349,11 @@  discard block
 block discarded – undo
1349 1349
          * @param array $cf The custom field array.
1350 1350
          * @since 1.6.6
1351 1351
          */
1352
-        $html = apply_filters("geodir_custom_field_output_textarea_{$location}",$html,$cf);
1352
+        $html = apply_filters("geodir_custom_field_output_textarea_{$location}", $html, $cf);
1353 1353
     }
1354 1354
 
1355 1355
     // Check if there is a custom field specific filter.
1356
-    if(has_filter("geodir_custom_field_output_textarea_{$html_var}")){
1356
+    if (has_filter("geodir_custom_field_output_textarea_{$html_var}")) {
1357 1357
         /**
1358 1358
          * Filter the textarea html by individual custom field.
1359 1359
          *
@@ -1362,11 +1362,11 @@  discard block
 block discarded – undo
1362 1362
          * @param array $cf The custom field array.
1363 1363
          * @since 1.6.6
1364 1364
          */
1365
-        $html = apply_filters("geodir_custom_field_output_textarea_{$html_var}",$html,$location,$cf);
1365
+        $html = apply_filters("geodir_custom_field_output_textarea_{$html_var}", $html, $location, $cf);
1366 1366
     }
1367 1367
 
1368 1368
     // Check if there is a custom field specific filter.
1369
-    if(has_filter("geodir_custom_field_output_textarea_{$location}_{$html_var}")){
1369
+    if (has_filter("geodir_custom_field_output_textarea_{$location}_{$html_var}")) {
1370 1370
         /**
1371 1371
          * Filter the textarea html by location and individual custom field.
1372 1372
          *
@@ -1374,11 +1374,11 @@  discard block
 block discarded – undo
1374 1374
          * @param array $cf The custom field array.
1375 1375
          * @since 1.6.6
1376 1376
          */
1377
-        $html = apply_filters("geodir_custom_field_output_textarea_{$location}_{$html_var}",$html,$cf);
1377
+        $html = apply_filters("geodir_custom_field_output_textarea_{$location}_{$html_var}", $html, $cf);
1378 1378
     }
1379 1379
 
1380 1380
     // If not html then we run the standard output.
1381
-    if(empty($html)){
1381
+    if (empty($html)) {
1382 1382
 
1383 1383
         if (!empty($post->{$cf['htmlvar_name']})) {
1384 1384
 
@@ -1393,9 +1393,9 @@  discard block
 block discarded – undo
1393 1393
             }
1394 1394
 
1395 1395
 
1396
-            $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;
1397
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1398
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1396
+            $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;
1397
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1398
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1399 1399
 
1400 1400
         }
1401 1401
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
     return $html;
1405 1405
 }
1406
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1406
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1407 1407
 
1408 1408
 
1409 1409
 
@@ -1417,21 +1417,21 @@  discard block
 block discarded – undo
1417 1417
  *
1418 1418
  * @return string The html to output for the custom field.
1419 1419
  */
1420
-function geodir_cf_html($html,$location,$cf,$p=''){
1420
+function geodir_cf_html($html, $location, $cf, $p = '') {
1421 1421
 
1422 1422
     // check we have the post value
1423
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1424
-    else{ global $post;}
1423
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1424
+    else { global $post; }
1425 1425
 
1426
-    if(!is_array($cf) && $cf!=''){
1426
+    if (!is_array($cf) && $cf != '') {
1427 1427
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1428
-        if(!$cf){return NULL;}
1428
+        if (!$cf) {return NULL; }
1429 1429
     }
1430 1430
 
1431 1431
     $html_var = $cf['htmlvar_name'];
1432 1432
 
1433 1433
     // Check if there is a location specific filter.
1434
-    if(has_filter("geodir_custom_field_output_html_{$location}")){
1434
+    if (has_filter("geodir_custom_field_output_html_{$location}")) {
1435 1435
         /**
1436 1436
          * Filter the html html by location.
1437 1437
          *
@@ -1439,11 +1439,11 @@  discard block
 block discarded – undo
1439 1439
          * @param array $cf The custom field array.
1440 1440
          * @since 1.6.6
1441 1441
          */
1442
-        $html = apply_filters("geodir_custom_field_output_html_{$location}",$html,$cf);
1442
+        $html = apply_filters("geodir_custom_field_output_html_{$location}", $html, $cf);
1443 1443
     }
1444 1444
 
1445 1445
     // Check if there is a custom field specific filter.
1446
-    if(has_filter("geodir_custom_field_output_html_{$html_var}")){
1446
+    if (has_filter("geodir_custom_field_output_html_{$html_var}")) {
1447 1447
         /**
1448 1448
          * Filter the html html by individual custom field.
1449 1449
          *
@@ -1452,11 +1452,11 @@  discard block
 block discarded – undo
1452 1452
          * @param array $cf The custom field array.
1453 1453
          * @since 1.6.6
1454 1454
          */
1455
-        $html = apply_filters("geodir_custom_field_output_html_{$html_var}",$html,$location,$cf);
1455
+        $html = apply_filters("geodir_custom_field_output_html_{$html_var}", $html, $location, $cf);
1456 1456
     }
1457 1457
 
1458 1458
     // Check if there is a custom field specific filter.
1459
-    if(has_filter("geodir_custom_field_output_html_{$location}_{$html_var}")){
1459
+    if (has_filter("geodir_custom_field_output_html_{$location}_{$html_var}")) {
1460 1460
         /**
1461 1461
          * Filter the html html by location and individual custom field.
1462 1462
          *
@@ -1464,11 +1464,11 @@  discard block
 block discarded – undo
1464 1464
          * @param array $cf The custom field array.
1465 1465
          * @since 1.6.6
1466 1466
          */
1467
-        $html = apply_filters("geodir_custom_field_output_html_{$location}_{$html_var}",$html,$cf);
1467
+        $html = apply_filters("geodir_custom_field_output_html_{$location}_{$html_var}", $html, $cf);
1468 1468
     }
1469 1469
 
1470 1470
     // If not html then we run the standard output.
1471
-    if(empty($html)){
1471
+    if (empty($html)) {
1472 1472
 
1473 1473
         if (!empty($post->{$cf['htmlvar_name']})) {
1474 1474
 
@@ -1482,9 +1482,9 @@  discard block
 block discarded – undo
1482 1482
                 $field_icon = '';
1483 1483
             }
1484 1484
 
1485
-            $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;
1486
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1487
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1485
+            $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;
1486
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1487
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1488 1488
 
1489 1489
         }
1490 1490
 
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 
1493 1493
     return $html;
1494 1494
 }
1495
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1495
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1496 1496
 
1497 1497
 
1498 1498
 
@@ -1506,21 +1506,21 @@  discard block
 block discarded – undo
1506 1506
  *
1507 1507
  * @return string The html to output for the custom field.
1508 1508
  */
1509
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1509
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1510 1510
 
1511 1511
     // check we have the post value
1512
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1513
-    else{ global $post;}
1512
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1513
+    else { global $post; }
1514 1514
 
1515
-    if(!is_array($cf) && $cf!=''){
1515
+    if (!is_array($cf) && $cf != '') {
1516 1516
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1517
-        if(!$cf){return NULL;}
1517
+        if (!$cf) {return NULL; }
1518 1518
     }
1519 1519
 
1520 1520
     $html_var = $cf['htmlvar_name'];
1521 1521
 
1522 1522
     // Check if there is a location specific filter.
1523
-    if(has_filter("geodir_custom_field_output_taxonomy_{$location}")){
1523
+    if (has_filter("geodir_custom_field_output_taxonomy_{$location}")) {
1524 1524
         /**
1525 1525
          * Filter the taxonomy html by location.
1526 1526
          *
@@ -1528,11 +1528,11 @@  discard block
 block discarded – undo
1528 1528
          * @param array $cf The custom field array.
1529 1529
          * @since 1.6.6
1530 1530
          */
1531
-        $html = apply_filters("geodir_custom_field_output_taxonomy_{$location}",$html,$cf);
1531
+        $html = apply_filters("geodir_custom_field_output_taxonomy_{$location}", $html, $cf);
1532 1532
     }
1533 1533
 
1534 1534
     // Check if there is a custom field specific filter.
1535
-    if(has_filter("geodir_custom_field_output_taxonomy_{$html_var}")){
1535
+    if (has_filter("geodir_custom_field_output_taxonomy_{$html_var}")) {
1536 1536
         /**
1537 1537
          * Filter the taxonomy html by individual custom field.
1538 1538
          *
@@ -1541,11 +1541,11 @@  discard block
 block discarded – undo
1541 1541
          * @param array $cf The custom field array.
1542 1542
          * @since 1.6.6
1543 1543
          */
1544
-        $html = apply_filters("geodir_custom_field_output_taxonomy_{$html_var}",$html,$location,$cf);
1544
+        $html = apply_filters("geodir_custom_field_output_taxonomy_{$html_var}", $html, $location, $cf);
1545 1545
     }
1546 1546
 
1547 1547
     // Check if there is a custom field specific filter.
1548
-    if(has_filter("geodir_custom_field_output_taxonomy_{$location}_{$html_var}")){
1548
+    if (has_filter("geodir_custom_field_output_taxonomy_{$location}_{$html_var}")) {
1549 1549
         /**
1550 1550
          * Filter the taxonomy html by location and individual custom field.
1551 1551
          *
@@ -1553,14 +1553,14 @@  discard block
 block discarded – undo
1553 1553
          * @param array $cf The custom field array.
1554 1554
          * @since 1.6.6
1555 1555
          */
1556
-        $html = apply_filters("geodir_custom_field_output_taxonomy_{$location}_{$html_var}",$html,$cf);
1556
+        $html = apply_filters("geodir_custom_field_output_taxonomy_{$location}_{$html_var}", $html, $cf);
1557 1557
     }
1558 1558
 
1559 1559
     // If not html then we run the standard output.
1560
-    if(empty($html)){
1560
+    if (empty($html)) {
1561 1561
 
1562
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1563
-            $post_taxonomy = $post->post_type . 'category';
1562
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1563
+            $post_taxonomy = $post->post_type.'category';
1564 1564
             $field_value = $post->{$html_var};
1565 1565
             $links = array();
1566 1566
             $terms = array();
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
                     if ($term != '') {
1579 1579
                         $term = get_term_by('id', $term, $html_var);
1580 1580
                         if (is_object($term)) {
1581
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1581
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1582 1582
                             $terms[] = $term;
1583 1583
                         }
1584 1584
                     }
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
                     $terms = $termsOrdered;
1593 1593
                 }
1594 1594
             }
1595
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1595
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1596 1596
 
1597 1597
             if ($html_value != '') {
1598 1598
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1605,9 +1605,9 @@  discard block
 block discarded – undo
1605 1605
                     $field_icon = '';
1606 1606
                 }
1607 1607
 
1608
-                $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;
1609
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1610
-                $html .= '</span> ' . $html_value . '</div>';
1608
+                $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;
1609
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1610
+                $html .= '</span> '.$html_value.'</div>';
1611 1611
             }
1612 1612
         }
1613 1613
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 
1616 1616
     return $html;
1617 1617
 }
1618
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1618
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1619 1619
 
1620 1620
 
1621 1621
 /**
@@ -1628,21 +1628,21 @@  discard block
 block discarded – undo
1628 1628
  *
1629 1629
  * @return string The html to output for the custom field.
1630 1630
  */
1631
-function geodir_cf_address($html,$location,$cf,$p=''){
1631
+function geodir_cf_address($html, $location, $cf, $p = '') {
1632 1632
 
1633 1633
     // check we have the post value
1634
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1635
-    else{ global $post;}
1634
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1635
+    else { global $post; }
1636 1636
 
1637
-    if(!is_array($cf) && $cf!=''){
1637
+    if (!is_array($cf) && $cf != '') {
1638 1638
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1639
-        if(!$cf){return NULL;}
1639
+        if (!$cf) {return NULL; }
1640 1640
     }
1641 1641
 
1642 1642
     $html_var = $cf['htmlvar_name'];
1643 1643
 
1644 1644
     // Check if there is a location specific filter.
1645
-    if(has_filter("geodir_custom_field_output_address_{$location}")){
1645
+    if (has_filter("geodir_custom_field_output_address_{$location}")) {
1646 1646
         /**
1647 1647
          * Filter the address html by location.
1648 1648
          *
@@ -1650,11 +1650,11 @@  discard block
 block discarded – undo
1650 1650
          * @param array $cf The custom field array.
1651 1651
          * @since 1.6.6
1652 1652
          */
1653
-        $html = apply_filters("geodir_custom_field_output_address_{$location}",$html,$cf);
1653
+        $html = apply_filters("geodir_custom_field_output_address_{$location}", $html, $cf);
1654 1654
     }
1655 1655
 
1656 1656
     // Check if there is a custom field specific filter.
1657
-    if(has_filter("geodir_custom_field_output_address_{$html_var}")){
1657
+    if (has_filter("geodir_custom_field_output_address_{$html_var}")) {
1658 1658
         /**
1659 1659
          * Filter the address html by individual custom field.
1660 1660
          *
@@ -1663,11 +1663,11 @@  discard block
 block discarded – undo
1663 1663
          * @param array $cf The custom field array.
1664 1664
          * @since 1.6.6
1665 1665
          */
1666
-        $html = apply_filters("geodir_custom_field_output_address_{$html_var}",$html,$location,$cf);
1666
+        $html = apply_filters("geodir_custom_field_output_address_{$html_var}", $html, $location, $cf);
1667 1667
     }
1668 1668
 
1669 1669
     // Check if there is a custom field specific filter.
1670
-    if(has_filter("geodir_custom_field_output_address_{$location}_{$html_var}")){
1670
+    if (has_filter("geodir_custom_field_output_address_{$location}_{$html_var}")) {
1671 1671
         /**
1672 1672
          * Filter the address html by location and individual custom field.
1673 1673
          *
@@ -1675,14 +1675,14 @@  discard block
 block discarded – undo
1675 1675
          * @param array $cf The custom field array.
1676 1676
          * @since 1.6.6
1677 1677
          */
1678
-        $html = apply_filters("geodir_custom_field_output_address_{$location}_{$html_var}",$html,$cf);
1678
+        $html = apply_filters("geodir_custom_field_output_address_{$location}_{$html_var}", $html, $cf);
1679 1679
     }
1680 1680
 
1681 1681
     // If not html then we run the standard output.
1682
-    if(empty($html)){
1682
+    if (empty($html)) {
1683 1683
 
1684 1684
         global $preview;
1685
-        $html_var = $cf['htmlvar_name'] . '_address';
1685
+        $html_var = $cf['htmlvar_name'].'_address';
1686 1686
 
1687 1687
         if ($cf['extra_fields']) {
1688 1688
 
@@ -1745,10 +1745,10 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
         if ($post->{$html_var}) {
1747 1747
 
1748
-            $field_icon = geodir_field_icon_proccess( $cf );
1749
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1748
+            $field_icon = geodir_field_icon_proccess($cf);
1749
+            if (strpos($field_icon, 'http') !== false) {
1750 1750
                 $field_icon_af = '';
1751
-            } elseif ( $field_icon == '' ) {
1751
+            } elseif ($field_icon == '') {
1752 1752
                 $field_icon_af = '<i class="fa fa-home"></i>';
1753 1753
             } else {
1754 1754
                 $field_icon_af = $field_icon;
@@ -1757,26 +1757,26 @@  discard block
 block discarded – undo
1757 1757
             
1758 1758
 
1759 1759
 
1760
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1761
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1762
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1760
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"  itemscope itemtype="http://schema.org/PostalAddress">';
1761
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1762
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1763 1763
             $html .= '</span>';
1764 1764
 
1765 1765
 
1766
-            if ( $post->post_address ) {
1767
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1766
+            if ($post->post_address) {
1767
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1768 1768
             }
1769
-            if ($show_city_in_address && $post->post_city ) {
1770
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1769
+            if ($show_city_in_address && $post->post_city) {
1770
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1771 1771
             }
1772
-            if ($show_region_in_address && $post->post_region ) {
1773
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1772
+            if ($show_region_in_address && $post->post_region) {
1773
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1774 1774
             }
1775
-            if ($show_zip_in_address && $post->post_zip ) {
1776
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1775
+            if ($show_zip_in_address && $post->post_zip) {
1776
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1777 1777
             }
1778
-            if ($show_country_in_address && $post->post_country ) {
1779
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1778
+            if ($show_country_in_address && $post->post_country) {
1779
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1780 1780
             }
1781 1781
             $html .= '</div>';
1782 1782
 
@@ -1787,4 +1787,4 @@  discard block
 block discarded – undo
1787 1787
 
1788 1788
     return $html;
1789 1789
 }
1790
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1791 1790
\ No newline at end of file
1791
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1792 1792
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +25 added lines, -38 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
27 26
 
28 27
     if(!is_array($cf) && $cf!=''){
29 28
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -76,8 +75,10 @@  discard block
 block discarded – undo
76 75
 
77 76
             if ( $post->{$html_var} == '1' ):
78 77
                 $html_val = __( 'Yes', 'geodirectory' );
79
-            else:
78
+            else {
79
+            	:
80 80
                 $html_val = __( 'No', 'geodirectory' );
81
+            }
81 82
             endif;
82 83
 
83 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -115,8 +116,7 @@  discard block
 block discarded – undo
115 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
116 117
 
117 118
     // check we have the post value
118
-    if(is_int($p)){$post = geodir_get_post_info($p);}
119
-    else{ global $post;}
119
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
120 120
 
121 121
     if(!is_array($cf) && $cf!=''){
122 122
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -195,8 +195,7 @@  discard block
 block discarded – undo
195 195
 function geodir_cf_url($html,$location,$cf,$p=''){
196 196
 
197 197
     // check we have the post value
198
-    if(is_int($p)){$post = geodir_get_post_info($p);}
199
-    else{ global $post;}
198
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
200 199
 
201 200
     if(!is_array($cf) && $cf!=''){
202 201
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -310,8 +309,7 @@  discard block
 block discarded – undo
310 309
 function geodir_cf_phone($html,$location,$cf,$p=''){
311 310
 
312 311
     // check we have the post value
313
-    if(is_int($p)){$post = geodir_get_post_info($p);}
314
-    else{ global $post;}
312
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
315 313
 
316 314
     if(!is_array($cf) && $cf!=''){
317 315
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -399,8 +397,7 @@  discard block
 block discarded – undo
399 397
 function geodir_cf_time($html,$location,$cf,$p=''){
400 398
 
401 399
     // check we have the post value
402
-    if(is_int($p)){$post = geodir_get_post_info($p);}
403
-    else{ global $post;}
400
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
404 401
 
405 402
     if(!is_array($cf) && $cf!=''){
406 403
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -452,9 +449,10 @@  discard block
 block discarded – undo
452 449
         if ($post->{$cf['htmlvar_name']}):
453 450
 
454 451
             $value = '';
455
-            if ($post->{$cf['htmlvar_name']} != '')
456
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
452
+            if ($post->{$cf['htmlvar_name']} != '') {
453
+                            //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457 454
                 $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
455
+            }
458 456
 
459 457
             $field_icon = geodir_field_icon_proccess($cf);
460 458
             if (strpos($field_icon, 'http') !== false) {
@@ -493,8 +491,7 @@  discard block
 block discarded – undo
493 491
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
494 492
 
495 493
     // check we have the post value
496
-    if(is_int($p)){$post = geodir_get_post_info($p);}
497
-    else{ global $post;}
494
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
498 495
 
499 496
     if(!is_array($cf) && $cf!=''){
500 497
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -560,13 +557,13 @@  discard block
 block discarded – undo
560 557
                 $date_format = str_replace($search, $replace, $date_format);
561 558
 
562 559
                 $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
563
-            }else{
560
+            } else{
564 561
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
565 562
             }
566 563
 
567 564
             if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
568 565
                 $value = date_i18n($date_format, strtotime($post_htmlvar_value));
569
-            }else{
566
+            } else{
570 567
                 return '';
571 568
             }
572 569
 
@@ -609,8 +606,7 @@  discard block
 block discarded – undo
609 606
 function geodir_cf_text($html,$location,$cf,$p=''){
610 607
 
611 608
     // check we have the post value
612
-    if(is_int($p)){$post = geodir_get_post_info($p);}
613
-    else{ global $post;}
609
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
614 610
 
615 611
     if(!is_array($cf) && $cf!=''){
616 612
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -700,8 +696,7 @@  discard block
 block discarded – undo
700 696
 function geodir_cf_radio($html,$location,$cf,$p=''){
701 697
 
702 698
     // check we have the post value
703
-    if(is_int($p)){$post = geodir_get_post_info($p);}
704
-    else{ global $post;}
699
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
705 700
 
706 701
     if(!is_array($cf) && $cf!=''){
707 702
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -807,8 +802,7 @@  discard block
 block discarded – undo
807 802
 function geodir_cf_select($html,$location,$cf,$p=''){
808 803
 
809 804
     // check we have the post value
810
-    if(is_int($p)){$post = geodir_get_post_info($p);}
811
-    else{ global $post;}
805
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
812 806
 
813 807
     if(!is_array($cf) && $cf!=''){
814 808
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -908,8 +902,7 @@  discard block
 block discarded – undo
908 902
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
909 903
 
910 904
     // check we have the post value
911
-    if(is_int($p)){$post = geodir_get_post_info($p);}
912
-    else{ global $post;}
905
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
913 906
 
914 907
     if(!is_array($cf) && $cf!=''){
915 908
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1030,8 +1023,7 @@  discard block
 block discarded – undo
1030 1023
 function geodir_cf_email($html,$location,$cf,$p=''){
1031 1024
 
1032 1025
     // check we have the post value
1033
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1034
-    else{ global $post;}
1026
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1035 1027
 
1036 1028
     if(!is_array($cf) && $cf!=''){
1037 1029
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1162,7 +1154,7 @@  discard block
 block discarded – undo
1162 1154
                      */
1163 1155
                     $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1164 1156
                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1165
-                }else{
1157
+                } else{
1166 1158
                     $html .=  $email;
1167 1159
                 }
1168 1160
                 $html .= '</span></div>';
@@ -1190,8 +1182,7 @@  discard block
 block discarded – undo
1190 1182
 function geodir_cf_file($html,$location,$cf,$p=''){
1191 1183
 
1192 1184
     // check we have the post value
1193
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1194
-    else{ global $post;}
1185
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1195 1186
 
1196 1187
     if(!is_array($cf) && $cf!=''){
1197 1188
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1330,8 +1321,7 @@  discard block
 block discarded – undo
1330 1321
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1331 1322
 
1332 1323
     // check we have the post value
1333
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1334
-    else{ global $post;}
1324
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1335 1325
 
1336 1326
     if(!is_array($cf) && $cf!=''){
1337 1327
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1420,8 +1410,7 @@  discard block
 block discarded – undo
1420 1410
 function geodir_cf_html($html,$location,$cf,$p=''){
1421 1411
 
1422 1412
     // check we have the post value
1423
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1424
-    else{ global $post;}
1413
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1425 1414
 
1426 1415
     if(!is_array($cf) && $cf!=''){
1427 1416
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1509,8 +1498,7 @@  discard block
 block discarded – undo
1509 1498
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1510 1499
 
1511 1500
     // check we have the post value
1512
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1513
-    else{ global $post;}
1501
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1514 1502
 
1515 1503
     if(!is_array($cf) && $cf!=''){
1516 1504
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1631,8 +1619,7 @@  discard block
 block discarded – undo
1631 1619
 function geodir_cf_address($html,$location,$cf,$p=''){
1632 1620
 
1633 1621
     // check we have the post value
1634
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1635
-    else{ global $post;}
1622
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1636 1623
 
1637 1624
     if(!is_array($cf) && $cf!=''){
1638 1625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_input_functions.php 3 patches
Indentation   +703 added lines, -703 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_cfi_fieldset($html,$cf){
21 21
 
22
-    $html_var = $cf['htmlvar_name'];
23
-
24
-    // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
-        /**
27
-         * Filter the fieldset html by individual custom field.
28
-         *
29
-         * @param string $html The html to filter.
30
-         * @param array $cf The custom field array.
31
-         * @since 1.6.6
32
-         */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
-    }
35
-
36
-    // If no html then we run the standard output.
37
-    if(empty($html)) {
38
-
39
-        ob_start(); // Start  buffering;
40
-        ?>
22
+	$html_var = $cf['htmlvar_name'];
23
+
24
+	// Check if there is a custom field specific filter.
25
+	if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
+		/**
27
+		 * Filter the fieldset html by individual custom field.
28
+		 *
29
+		 * @param string $html The html to filter.
30
+		 * @param array $cf The custom field array.
31
+		 * @since 1.6.6
32
+		 */
33
+		$html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
+	}
35
+
36
+	// If no html then we run the standard output.
37
+	if(empty($html)) {
38
+
39
+		ob_start(); // Start  buffering;
40
+		?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?>
43 43
             <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . $cf['desc'] . ' )</small>';
45
-            } ?></h5>
44
+				echo '<small>( ' . $cf['desc'] . ' )</small>';
45
+			} ?></h5>
46 46
         <?php
47
-        $html = ob_get_clean();
48
-    }
47
+		$html = ob_get_clean();
48
+	}
49 49
 
50
-    return $html;
50
+	return $html;
51 51
 }
52 52
 add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
53 53
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function geodir_cfi_text($html,$cf){
66 66
 
67
-    $html_var = $cf['htmlvar_name'];
68
-
69
-    // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
-        /**
72
-         * Filter the text html by individual custom field.
73
-         *
74
-         * @param string $html The html to filter.
75
-         * @param array $cf The custom field array.
76
-         * @since 1.6.6
77
-         */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
-    }
80
-
81
-    // If no html then we run the standard output.
82
-    if(empty($html)) {
83
-
84
-        ob_start(); // Start  buffering;
85
-
86
-        $value = geodir_get_cf_value($cf);
87
-        $type = $cf['type'];
88
-        //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
-
92
-        //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
-            $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
96
-
97
-        // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
-            $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
101
-        ?>
67
+	$html_var = $cf['htmlvar_name'];
68
+
69
+	// Check if there is a custom field specific filter.
70
+	if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
+		/**
72
+		 * Filter the text html by individual custom field.
73
+		 *
74
+		 * @param string $html The html to filter.
75
+		 * @param array $cf The custom field array.
76
+		 * @since 1.6.6
77
+		 */
78
+		$html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
+	}
80
+
81
+	// If no html then we run the standard output.
82
+	if(empty($html)) {
83
+
84
+		ob_start(); // Start  buffering;
85
+
86
+		$value = geodir_get_cf_value($cf);
87
+		$type = $cf['type'];
88
+		//number and float validation $validation_pattern
89
+		if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
+		elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
+
92
+		//validation
93
+		if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
+			$validation = 'pattern="'.$cf['validation_pattern'].'"';
95
+		}else{$validation='';}
96
+
97
+		// validation message
98
+		if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
+			$validation_msg = 'title="'.$cf['validation_msg'].'"';
100
+		}else{$validation_msg='';}
101
+		?>
102 102
 
103 103
         <div id="<?php echo $cf['name'];?>_row"
104 104
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
107
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108 108
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
109 109
             </label>
110 110
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         </div>
117 117
 
118 118
         <?php
119
-        $html = ob_get_clean();
120
-    }
119
+		$html = ob_get_clean();
120
+	}
121 121
 
122
-    return $html;
122
+	return $html;
123 123
 }
124 124
 add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
125 125
 
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function geodir_cfi_email($html,$cf){
137 137
 
138
-    $html_var = $cf['htmlvar_name'];
138
+	$html_var = $cf['htmlvar_name'];
139 139
 
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
-        /**
143
-         * Filter the email html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param array $cf The custom field array.
147
-         * @since 1.6.6
148
-         */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
-    }
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
+		/**
143
+		 * Filter the email html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param array $cf The custom field array.
147
+		 * @since 1.6.6
148
+		 */
149
+		$html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
+	}
151 151
 
152
-    // If no html then we run the standard output.
153
-    if(empty($html)) {
152
+	// If no html then we run the standard output.
153
+	if(empty($html)) {
154 154
 
155
-        ob_start(); // Start  buffering;
156
-        $value = geodir_get_cf_value($cf);
155
+		ob_start(); // Start  buffering;
156
+		$value = geodir_get_cf_value($cf);
157 157
 
158
-        if ($value == $cf['default']) {
159
-            $value = '';
160
-        }?>
158
+		if ($value == $cf['default']) {
159
+			$value = '';
160
+		}?>
161 161
 
162 162
         <div id="<?php echo $cf['name'];?>_row"
163 163
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
166
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167 167
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
168 168
             </label>
169 169
             <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         </div>
176 176
 
177 177
         <?php
178
-        $html = ob_get_clean();
179
-    }
178
+		$html = ob_get_clean();
179
+	}
180 180
 
181
-    return $html;
181
+	return $html;
182 182
 }
183 183
 add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
184 184
 
@@ -195,35 +195,35 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_cfi_phone($html,$cf){
197 197
 
198
-    $html_var = $cf['htmlvar_name'];
198
+	$html_var = $cf['htmlvar_name'];
199 199
 
200
-    // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
-        /**
203
-         * Filter the phone html by individual custom field.
204
-         *
205
-         * @param string $html The html to filter.
206
-         * @param array $cf The custom field array.
207
-         * @since 1.6.6
208
-         */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
-    }
200
+	// Check if there is a custom field specific filter.
201
+	if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
+		/**
203
+		 * Filter the phone html by individual custom field.
204
+		 *
205
+		 * @param string $html The html to filter.
206
+		 * @param array $cf The custom field array.
207
+		 * @since 1.6.6
208
+		 */
209
+		$html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
+	}
211 211
 
212
-    // If no html then we run the standard output.
213
-    if(empty($html)) {
212
+	// If no html then we run the standard output.
213
+	if(empty($html)) {
214 214
 
215
-        ob_start(); // Start  buffering;
216
-        $value = geodir_get_cf_value($cf);
215
+		ob_start(); // Start  buffering;
216
+		$value = geodir_get_cf_value($cf);
217 217
 
218
-        if ($value == $cf['default']) {
219
-            $value = '';
220
-        }?>
218
+		if ($value == $cf['default']) {
219
+			$value = '';
220
+		}?>
221 221
 
222 222
         <div id="<?php echo $cf['name'];?>_row"
223 223
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
226
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227 227
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
228 228
             </label>
229 229
             <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
         </div>
236 236
 
237 237
         <?php
238
-        $html = ob_get_clean();
239
-    }
238
+		$html = ob_get_clean();
239
+	}
240 240
 
241
-    return $html;
241
+	return $html;
242 242
 }
243 243
 add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
244 244
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
  */
256 256
 function geodir_cfi_url($html,$cf){
257 257
 
258
-    $html_var = $cf['htmlvar_name'];
258
+	$html_var = $cf['htmlvar_name'];
259 259
 
260
-    // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
-        /**
263
-         * Filter the url html by individual custom field.
264
-         *
265
-         * @param string $html The html to filter.
266
-         * @param array $cf The custom field array.
267
-         * @since 1.6.6
268
-         */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
-    }
260
+	// Check if there is a custom field specific filter.
261
+	if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
+		/**
263
+		 * Filter the url html by individual custom field.
264
+		 *
265
+		 * @param string $html The html to filter.
266
+		 * @param array $cf The custom field array.
267
+		 * @since 1.6.6
268
+		 */
269
+		$html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
+	}
271 271
 
272
-    // If no html then we run the standard output.
273
-    if(empty($html)) {
272
+	// If no html then we run the standard output.
273
+	if(empty($html)) {
274 274
 
275
-        ob_start(); // Start  buffering;
276
-        $value = geodir_get_cf_value($cf);
275
+		ob_start(); // Start  buffering;
276
+		$value = geodir_get_cf_value($cf);
277 277
 
278
-        if ($value == $cf['default']) {
279
-            $value = '';
280
-        }?>
278
+		if ($value == $cf['default']) {
279
+			$value = '';
280
+		}?>
281 281
 
282 282
         <div id="<?php echo $cf['name'];?>_row"
283 283
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
286
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287 287
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
288 288
             </label>
289 289
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         </div>
299 299
 
300 300
         <?php
301
-        $html = ob_get_clean();
302
-    }
301
+		$html = ob_get_clean();
302
+	}
303 303
 
304
-    return $html;
304
+	return $html;
305 305
 }
306 306
 add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
307 307
 
@@ -317,48 +317,48 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function geodir_cfi_radio($html,$cf){
319 319
 
320
-    $html_var = $cf['htmlvar_name'];
320
+	$html_var = $cf['htmlvar_name'];
321 321
 
322
-    // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
-        /**
325
-         * Filter the radio html by individual custom field.
326
-         *
327
-         * @param string $html The html to filter.
328
-         * @param array $cf The custom field array.
329
-         * @since 1.6.6
330
-         */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
-    }
322
+	// Check if there is a custom field specific filter.
323
+	if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
+		/**
325
+		 * Filter the radio html by individual custom field.
326
+		 *
327
+		 * @param string $html The html to filter.
328
+		 * @param array $cf The custom field array.
329
+		 * @since 1.6.6
330
+		 */
331
+		$html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
+	}
333 333
 
334
-    // If no html then we run the standard output.
335
-    if(empty($html)) {
334
+	// If no html then we run the standard output.
335
+	if(empty($html)) {
336 336
 
337
-        ob_start(); // Start  buffering;
338
-        $value = geodir_get_cf_value($cf);
337
+		ob_start(); // Start  buffering;
338
+		$value = geodir_get_cf_value($cf);
339 339
 
340
-        ?>
340
+		?>
341 341
         <div id="<?php echo $cf['name'];?>_row"
342 342
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
345
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346 346
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349
-                $option_values = geodir_string_values_to_options($cf['option_values'], true);
349
+				$option_values = geodir_string_values_to_options($cf['option_values'], true);
350 350
 
351
-                if (!empty($option_values)) {
352
-                    foreach ($option_values as $option_value) {
353
-                        if (empty($option_value['optgroup'])) {
354
-                            ?>
351
+				if (!empty($option_values)) {
352
+					foreach ($option_values as $option_value) {
353
+						if (empty($option_value['optgroup'])) {
354
+							?>
355 355
                             <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357
-                        }
358
-                    }
359
-                }
360
-            }
361
-            ?>
357
+						}
358
+					}
359
+				}
360
+			}
361
+			?>
362 362
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         </div>
367 367
 
368 368
         <?php
369
-        $html = ob_get_clean();
370
-    }
369
+		$html = ob_get_clean();
370
+	}
371 371
 
372
-    return $html;
372
+	return $html;
373 373
 }
374 374
 add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
375 375
 
@@ -385,44 +385,44 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_cfi_checkbox($html,$cf){
387 387
 
388
-    $html_var = $cf['htmlvar_name'];
388
+	$html_var = $cf['htmlvar_name'];
389 389
 
390
-    // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
-        /**
393
-         * Filter the checkbox html by individual custom field.
394
-         *
395
-         * @param string $html The html to filter.
396
-         * @param array $cf The custom field array.
397
-         * @since 1.6.6
398
-         */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
-    }
390
+	// Check if there is a custom field specific filter.
391
+	if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
+		/**
393
+		 * Filter the checkbox html by individual custom field.
394
+		 *
395
+		 * @param string $html The html to filter.
396
+		 * @param array $cf The custom field array.
397
+		 * @since 1.6.6
398
+		 */
399
+		$html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
+	}
401 401
 
402
-    // If no html then we run the standard output.
403
-    if(empty($html)) {
402
+	// If no html then we run the standard output.
403
+	if(empty($html)) {
404 404
 
405
-        ob_start(); // Start  buffering;
406
-        $value = geodir_get_cf_value($cf);
405
+		ob_start(); // Start  buffering;
406
+		$value = geodir_get_cf_value($cf);
407 407
 
408
-        if ($value == $cf['default']) {
409
-            $value = '';
410
-        }?>
408
+		if ($value == $cf['default']) {
409
+			$value = '';
410
+		}?>
411 411
 
412 412
         <div id="<?php echo $cf['name'];?>_row"
413 413
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
414 414
             <label>
415 415
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
416
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417 417
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
418 418
             </label>
419 419
             <?php if ($value != '1') {
420
-                $value = '0';
421
-            }?>
420
+				$value = '0';
421
+			}?>
422 422
             <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
423 423
             <input  <?php if ($value == '1') {
424
-                echo 'checked="checked"';
425
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
424
+				echo 'checked="checked"';
425
+			}?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426 426
                  onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
427 427
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
428 428
             <?php if ($cf['is_required']) { ?>
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
         </div>
432 432
 
433 433
         <?php
434
-        $html = ob_get_clean();
435
-    }
434
+		$html = ob_get_clean();
435
+	}
436 436
 
437
-    return $html;
437
+	return $html;
438 438
 }
439 439
 add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
440 440
 
@@ -450,52 +450,52 @@  discard block
 block discarded – undo
450 450
  */
451 451
 function geodir_cfi_textarea($html,$cf){
452 452
 
453
-    $html_var = $cf['htmlvar_name'];
453
+	$html_var = $cf['htmlvar_name'];
454 454
 
455
-    // Check if there is a custom field specific filter.
456
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
457
-        /**
458
-         * Filter the textarea html by individual custom field.
459
-         *
460
-         * @param string $html The html to filter.
461
-         * @param array $cf The custom field array.
462
-         * @since 1.6.6
463
-         */
464
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
465
-    }
455
+	// Check if there is a custom field specific filter.
456
+	if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
457
+		/**
458
+		 * Filter the textarea html by individual custom field.
459
+		 *
460
+		 * @param string $html The html to filter.
461
+		 * @param array $cf The custom field array.
462
+		 * @since 1.6.6
463
+		 */
464
+		$html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
465
+	}
466 466
 
467
-    // If no html then we run the standard output.
468
-    if(empty($html)) {
467
+	// If no html then we run the standard output.
468
+	if(empty($html)) {
469 469
 
470
-        ob_start(); // Start  buffering;
471
-        $value = geodir_get_cf_value($cf);
470
+		ob_start(); // Start  buffering;
471
+		$value = geodir_get_cf_value($cf);
472 472
 
473
-        $extra_fields = unserialize($cf['extra_fields']);
474
-        ?>
473
+		$extra_fields = unserialize($cf['extra_fields']);
474
+		?>
475 475
 
476 476
         <div id="<?php echo $cf['name'];?>_row"
477 477
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
478 478
             <label>
479 479
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
480
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481 481
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
482 482
             </label><?php
483 483
 
484 484
 
485
-            if (is_array($extra_fields) && in_array('1', $extra_fields)) {
485
+			if (is_array($extra_fields) && in_array('1', $extra_fields)) {
486 486
 
487
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
487
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
488 488
 
489 489
             <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
490 490
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
491 491
                 </div><?php
492 492
 
493
-            } else {
493
+			} else {
494 494
 
495
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
495
+				?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
496 496
                             id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
497 497
 
498
-            }?>
498
+			}?>
499 499
 
500 500
 
501 501
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
         </div>
506 506
 
507 507
         <?php
508
-        $html = ob_get_clean();
509
-    }
508
+		$html = ob_get_clean();
509
+	}
510 510
 
511
-    return $html;
511
+	return $html;
512 512
 }
513 513
 add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
514 514
 
@@ -524,53 +524,53 @@  discard block
 block discarded – undo
524 524
  */
525 525
 function geodir_cfi_select($html,$cf){
526 526
 
527
-    $html_var = $cf['htmlvar_name'];
527
+	$html_var = $cf['htmlvar_name'];
528 528
 
529
-    // Check if there is a custom field specific filter.
530
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
531
-        /**
532
-         * Filter the select html by individual custom field.
533
-         *
534
-         * @param string $html The html to filter.
535
-         * @param array $cf The custom field array.
536
-         * @since 1.6.6
537
-         */
538
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
539
-    }
529
+	// Check if there is a custom field specific filter.
530
+	if(has_filter("geodir_custom_field_input_select_{$html_var}")){
531
+		/**
532
+		 * Filter the select html by individual custom field.
533
+		 *
534
+		 * @param string $html The html to filter.
535
+		 * @param array $cf The custom field array.
536
+		 * @since 1.6.6
537
+		 */
538
+		$html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
539
+	}
540 540
 
541
-    // If no html then we run the standard output.
542
-    if(empty($html)) {
541
+	// If no html then we run the standard output.
542
+	if(empty($html)) {
543 543
 
544
-        ob_start(); // Start  buffering;
545
-        $value = geodir_get_cf_value($cf);
544
+		ob_start(); // Start  buffering;
545
+		$value = geodir_get_cf_value($cf);
546 546
 
547
-        ?>
547
+		?>
548 548
         <div id="<?php echo $cf['name'];?>_row"
549 549
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 550
             <label>
551 551
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
552
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553 553
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
554 554
             </label>
555 555
             <?php
556
-            $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
557
-            $select_options = '';
558
-            if (!empty($option_values_arr)) {
559
-                foreach ($option_values_arr as $option_row) {
560
-                    if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
562
-
563
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
564
-                    } else {
565
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
566
-                        $option_value = isset($option_row['value']) ? $option_row['value'] : '';
567
-                        $selected = $option_value == $value ? 'selected="selected"' : '';
568
-
569
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
570
-                    }
571
-                }
572
-            }
573
-            ?>
556
+			$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
557
+			$select_options = '';
558
+			if (!empty($option_values_arr)) {
559
+				foreach ($option_values_arr as $option_row) {
560
+					if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
562
+
563
+						$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
564
+					} else {
565
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
566
+						$option_value = isset($option_row['value']) ? $option_row['value'] : '';
567
+						$selected = $option_value == $value ? 'selected="selected"' : '';
568
+
569
+						$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
570
+					}
571
+				}
572
+			}
573
+			?>
574 574
             <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
575 575
                     class="geodir_textfield textfield_x chosen_select"
576 576
                     data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
         </div>
583 583
 
584 584
         <?php
585
-        $html = ob_get_clean();
586
-    }
585
+		$html = ob_get_clean();
586
+	}
587 587
 
588
-    return $html;
588
+	return $html;
589 589
 }
590 590
 add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
591 591
 
@@ -601,36 +601,36 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function geodir_cfi_multiselect($html,$cf){
603 603
 
604
-    $html_var = $cf['htmlvar_name'];
605
-
606
-    // Check if there is a custom field specific filter.
607
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
608
-        /**
609
-         * Filter the multiselect html by individual custom field.
610
-         *
611
-         * @param string $html The html to filter.
612
-         * @param array $cf The custom field array.
613
-         * @since 1.6.6
614
-         */
615
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
616
-    }
617
-
618
-    // If no html then we run the standard output.
619
-    if(empty($html)) {
620
-
621
-        ob_start(); // Start  buffering;
622
-        $value = geodir_get_cf_value($cf);
623
-
624
-        $multi_display = 'select';
625
-        if (!empty($val['extra_fields'])) {
626
-            $multi_display = unserialize($val['extra_fields']);
627
-        }
628
-        ?>
604
+	$html_var = $cf['htmlvar_name'];
605
+
606
+	// Check if there is a custom field specific filter.
607
+	if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
608
+		/**
609
+		 * Filter the multiselect html by individual custom field.
610
+		 *
611
+		 * @param string $html The html to filter.
612
+		 * @param array $cf The custom field array.
613
+		 * @since 1.6.6
614
+		 */
615
+		$html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
616
+	}
617
+
618
+	// If no html then we run the standard output.
619
+	if(empty($html)) {
620
+
621
+		ob_start(); // Start  buffering;
622
+		$value = geodir_get_cf_value($cf);
623
+
624
+		$multi_display = 'select';
625
+		if (!empty($val['extra_fields'])) {
626
+			$multi_display = unserialize($val['extra_fields']);
627
+		}
628
+		?>
629 629
         <div id="<?php echo $cf['name']; ?>_row"
630 630
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
631 631
             <label>
632 632
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
633
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
633
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
634 634
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
635 635
             </label>
636 636
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
@@ -641,55 +641,55 @@  discard block
 block discarded – undo
641 641
                         data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
642 642
                         option-ajaxchosen="false">
643 643
                     <?php
644
-                    } else {
645
-                        echo '<ul class="gd_multi_choice">';
646
-                    }
647
-
648
-                    $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
649
-                    $select_options = '';
650
-                    if (!empty($option_values_arr)) {
651
-                        foreach ($option_values_arr as $option_row) {
652
-                            if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
653
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
654
-
655
-                                if ($multi_display == 'select') {
656
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
657
-                                } else {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
659
-                                }
660
-                            } else {
661
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
662
-                                $option_value = isset($option_row['value']) ? $option_row['value'] : '';
663
-                                $selected = $option_value == $value ? 'selected="selected"' : '';
664
-                                $selected = '';
665
-                                $checked = '';
666
-
667
-                                if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
668
-                                    if (!is_array($value)) {
669
-                                        $value_array = explode(',', $value);
670
-                                    } else {
671
-                                        $value_array = $value;
672
-                                    }
673
-
674
-                                    if (is_array($value_array)) {
675
-                                        if (in_array($option_value, $value_array)) {
676
-                                            $selected = 'selected="selected"';
677
-                                            $checked = 'checked="checked"';
678
-                                        }
679
-                                    }
680
-                                }
681
-
682
-                                if ($multi_display == 'select') {
683
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
684
-                                } else {
685
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
686
-                                }
687
-                            }
688
-                        }
689
-                    }
690
-                    echo $select_options;
691
-
692
-                    if ($multi_display == 'select') { ?></select></div>
644
+					} else {
645
+						echo '<ul class="gd_multi_choice">';
646
+					}
647
+
648
+					$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
649
+					$select_options = '';
650
+					if (!empty($option_values_arr)) {
651
+						foreach ($option_values_arr as $option_row) {
652
+							if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
653
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
654
+
655
+								if ($multi_display == 'select') {
656
+									$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
657
+								} else {
658
+									$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
659
+								}
660
+							} else {
661
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
662
+								$option_value = isset($option_row['value']) ? $option_row['value'] : '';
663
+								$selected = $option_value == $value ? 'selected="selected"' : '';
664
+								$selected = '';
665
+								$checked = '';
666
+
667
+								if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
668
+									if (!is_array($value)) {
669
+										$value_array = explode(',', $value);
670
+									} else {
671
+										$value_array = $value;
672
+									}
673
+
674
+									if (is_array($value_array)) {
675
+										if (in_array($option_value, $value_array)) {
676
+											$selected = 'selected="selected"';
677
+											$checked = 'checked="checked"';
678
+										}
679
+									}
680
+								}
681
+
682
+								if ($multi_display == 'select') {
683
+									$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
684
+								} else {
685
+									$select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
686
+								}
687
+							}
688
+						}
689
+					}
690
+					echo $select_options;
691
+
692
+					if ($multi_display == 'select') { ?></select></div>
693 693
         <?php } else { ?></ul><?php } ?>
694 694
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
695 695
             <?php if ($cf['is_required']) { ?>
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
             <?php } ?>
698 698
         </div>
699 699
         <?php
700
-        $html = ob_get_clean();
701
-    }
700
+		$html = ob_get_clean();
701
+	}
702 702
 
703
-    return $html;
703
+	return $html;
704 704
 }
705 705
 add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
706 706
 
@@ -716,32 +716,32 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function geodir_cfi_html($html,$cf){
718 718
 
719
-    $html_var = $cf['htmlvar_name'];
719
+	$html_var = $cf['htmlvar_name'];
720 720
 
721
-    // Check if there is a custom field specific filter.
722
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
723
-        /**
724
-         * Filter the html html by individual custom field.
725
-         *
726
-         * @param string $html The html to filter.
727
-         * @param array $cf The custom field array.
728
-         * @since 1.6.6
729
-         */
730
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
731
-    }
721
+	// Check if there is a custom field specific filter.
722
+	if(has_filter("geodir_custom_field_input_html_{$html_var}")){
723
+		/**
724
+		 * Filter the html html by individual custom field.
725
+		 *
726
+		 * @param string $html The html to filter.
727
+		 * @param array $cf The custom field array.
728
+		 * @since 1.6.6
729
+		 */
730
+		$html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
731
+	}
732 732
 
733
-    // If no html then we run the standard output.
734
-    if(empty($html)) {
733
+	// If no html then we run the standard output.
734
+	if(empty($html)) {
735 735
 
736
-        ob_start(); // Start  buffering;
737
-        $value = geodir_get_cf_value($cf);
738
-        ?>
736
+		ob_start(); // Start  buffering;
737
+		$value = geodir_get_cf_value($cf);
738
+		?>
739 739
 
740 740
         <div id="<?php echo $cf['name']; ?>_row"
741 741
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
742 742
             <label>
743 743
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
744
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
744
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
745 745
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
746 746
             </label>
747 747
 
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
         </div>
760 760
 
761 761
         <?php
762
-        $html = ob_get_clean();
763
-    }
762
+		$html = ob_get_clean();
763
+	}
764 764
 
765
-    return $html;
765
+	return $html;
766 766
 }
767 767
 add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
768 768
 
@@ -779,67 +779,67 @@  discard block
 block discarded – undo
779 779
  */
780 780
 function geodir_cfi_datepicker($html,$cf){
781 781
 
782
-    $html_var = $cf['htmlvar_name'];
782
+	$html_var = $cf['htmlvar_name'];
783 783
 
784
-    // Check if there is a custom field specific filter.
785
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
786
-        /**
787
-         * Filter the datepicker html by individual custom field.
788
-         *
789
-         * @param string $html The html to filter.
790
-         * @param array $cf The custom field array.
791
-         * @since 1.6.6
792
-         */
793
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
794
-    }
784
+	// Check if there is a custom field specific filter.
785
+	if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
786
+		/**
787
+		 * Filter the datepicker html by individual custom field.
788
+		 *
789
+		 * @param string $html The html to filter.
790
+		 * @param array $cf The custom field array.
791
+		 * @since 1.6.6
792
+		 */
793
+		$html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
794
+	}
795 795
 
796
-    // If no html then we run the standard output.
797
-    if(empty($html)) {
796
+	// If no html then we run the standard output.
797
+	if(empty($html)) {
798 798
 
799
-        ob_start(); // Start  buffering;
800
-        $value = geodir_get_cf_value($cf);
799
+		ob_start(); // Start  buffering;
800
+		$value = geodir_get_cf_value($cf);
801 801
 
802
-        $extra_fields = unserialize($cf['extra_fields']);
803
-        $name = $cf['name'];
802
+		$extra_fields = unserialize($cf['extra_fields']);
803
+		$name = $cf['name'];
804 804
 
805
-        if ($extra_fields['date_format'] == '')
806
-            $extra_fields['date_format'] = 'yy-mm-dd';
805
+		if ($extra_fields['date_format'] == '')
806
+			$extra_fields['date_format'] = 'yy-mm-dd';
807 807
 
808
-        $date_format = $extra_fields['date_format'];
809
-        $jquery_date_format  = $date_format;
808
+		$date_format = $extra_fields['date_format'];
809
+		$jquery_date_format  = $date_format;
810 810
 
811 811
 
812
-        // check if we need to change the format or not
813
-        $date_format_len = strlen(str_replace(' ', '', $date_format));
814
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
812
+		// check if we need to change the format or not
813
+		$date_format_len = strlen(str_replace(' ', '', $date_format));
814
+		if($date_format_len>5){// if greater then 5 then it's the old style format.
815 815
 
816
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
816
+			$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
+			$replace = array('d','j','l','m','n','F','Y');//PHP date format
818 818
 
819
-            $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
821
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
822
-        }
819
+			$date_format = str_replace($search, $replace, $date_format);
820
+		}else{
821
+			$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
822
+		}
823 823
 
824
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
-        if($value && !isset($_REQUEST['backandedit'])) {
826
-            $time = strtotime($value);
827
-            $value = date_i18n($date_format, $time);
828
-        }
824
+		if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
+		if($value && !isset($_REQUEST['backandedit'])) {
826
+			$time = strtotime($value);
827
+			$value = date_i18n($date_format, $time);
828
+		}
829 829
 
830
-        ?>
830
+		?>
831 831
         <script type="text/javascript">
832 832
 
833 833
             jQuery(function () {
834 834
 
835 835
                 jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
836
-                    /**
837
-                     * Used to add extra option to datepicker per custom field.
838
-                     *
839
-                     * @since 1.5.7
840
-                     * @param string $name The custom field name.
841
-                     */
842
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
836
+					/**
837
+					 * Used to add extra option to datepicker per custom field.
838
+					 *
839
+					 * @since 1.5.7
840
+					 * @param string $name The custom field name.
841
+					 */
842
+					echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
843 843
 
844 844
                 jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
845 845
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
             <label>
856 856
 
857 857
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
858
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
858
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
859 859
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
860 860
             </label>
861 861
 
@@ -869,10 +869,10 @@  discard block
 block discarded – undo
869 869
         </div>
870 870
 
871 871
         <?php
872
-        $html = ob_get_clean();
873
-    }
872
+		$html = ob_get_clean();
873
+	}
874 874
 
875
-    return $html;
875
+	return $html;
876 876
 }
877 877
 add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
878 878
 
@@ -888,31 +888,31 @@  discard block
 block discarded – undo
888 888
  */
889 889
 function geodir_cfi_time($html,$cf){
890 890
 
891
-    $html_var = $cf['htmlvar_name'];
891
+	$html_var = $cf['htmlvar_name'];
892 892
 
893
-    // Check if there is a custom field specific filter.
894
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
895
-        /**
896
-         * Filter the time html by individual custom field.
897
-         *
898
-         * @param string $html The html to filter.
899
-         * @param array $cf The custom field array.
900
-         * @since 1.6.6
901
-         */
902
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
903
-    }
893
+	// Check if there is a custom field specific filter.
894
+	if(has_filter("geodir_custom_field_input_time_{$html_var}")){
895
+		/**
896
+		 * Filter the time html by individual custom field.
897
+		 *
898
+		 * @param string $html The html to filter.
899
+		 * @param array $cf The custom field array.
900
+		 * @since 1.6.6
901
+		 */
902
+		$html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
903
+	}
904 904
 
905
-    // If no html then we run the standard output.
906
-    if(empty($html)) {
905
+	// If no html then we run the standard output.
906
+	if(empty($html)) {
907 907
 
908
-        ob_start(); // Start  buffering;
909
-        $value = geodir_get_cf_value($cf);
908
+		ob_start(); // Start  buffering;
909
+		$value = geodir_get_cf_value($cf);
910 910
 
911
-        $name = $cf['name'];
911
+		$name = $cf['name'];
912 912
 
913
-        if ($value != '')
914
-            $value = date('H:i', strtotime($value));
915
-        ?>
913
+		if ($value != '')
914
+			$value = date('H:i', strtotime($value));
915
+		?>
916 916
         <script type="text/javascript">
917 917
             jQuery(document).ready(function () {
918 918
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
             <label>
929 929
 
930 930
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
931
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
931
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
932 932
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
933 933
             </label>
934 934
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
             <?php } ?>
941 941
         </div>
942 942
         <?php
943
-        $html = ob_get_clean();
944
-    }
943
+		$html = ob_get_clean();
944
+	}
945 945
 
946
-    return $html;
946
+	return $html;
947 947
 }
948 948
 add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
949 949
 
@@ -959,100 +959,100 @@  discard block
 block discarded – undo
959 959
  */
960 960
 function geodir_cfi_address($html,$cf){
961 961
 
962
-    $html_var = $cf['htmlvar_name'];
963
-
964
-    // Check if there is a custom field specific filter.
965
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
966
-        /**
967
-         * Filter the address html by individual custom field.
968
-         *
969
-         * @param string $html The html to filter.
970
-         * @param array $cf The custom field array.
971
-         * @since 1.6.6
972
-         */
973
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
974
-    }
975
-
976
-    // If no html then we run the standard output.
977
-    if(empty($html)) {
978
-
979
-        global $gd_session;
980
-        ob_start(); // Start  buffering;
981
-        $value = geodir_get_cf_value($cf);
982
-        $name = $cf['name'];
983
-        $type = $cf['type'];
984
-        $admin_desc = $cf['desc'];
985
-        $is_required = $cf['is_required'];
986
-        $required_msg = $cf['required_msg'];
987
-        $site_title = $cf['site_title'];
988
-        $is_admin = $cf['is_admin'];
989
-        $extra_fields = unserialize($cf['extra_fields']);
990
-        $prefix = $name . '_';
991
-
992
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
993
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
994
-        ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
995
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
996
-
997
-        $address = '';
998
-        $zip = '';
999
-        $mapview = '';
1000
-        $mapzoom = '';
1001
-        $lat = '';
1002
-        $lng = '';
1003
-
1004
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1005
-            $post = $gd_ses_listing;
1006
-            $address = $post[$prefix . 'address'];
1007
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1008
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1009
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1010
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1011
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1012
-        } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1013
-            $post_info = (array)$post_info;
1014
-
1015
-            $address = $post_info[$prefix . 'address'];
1016
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1017
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1018
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1019
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1020
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1021
-        }
1022
-
1023
-        $location = geodir_get_default_location();
1024
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1025
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1026
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1027
-
1028
-        $lat_lng_blank = false;
1029
-        if (empty($lat) && empty($lng)) {
1030
-            $lat_lng_blank = true;
1031
-        }
1032
-
1033
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1034
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1035
-
1036
-        /**
1037
-         * Filter the default latitude.
1038
-         *
1039
-         * @since 1.0.0
1040
-         *
1041
-         * @param float $lat Default latitude.
1042
-         * @param bool $is_admin For admin use only?.
1043
-         */
1044
-        $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1045
-        /**
1046
-         * Filter the default longitude.
1047
-         *
1048
-         * @since 1.0.0
1049
-         *
1050
-         * @param float $lat Default longitude.
1051
-         * @param bool $is_admin For admin use only?.
1052
-         */
1053
-        $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1054
-
1055
-        ?>
962
+	$html_var = $cf['htmlvar_name'];
963
+
964
+	// Check if there is a custom field specific filter.
965
+	if(has_filter("geodir_custom_field_input_address_{$html_var}")){
966
+		/**
967
+		 * Filter the address html by individual custom field.
968
+		 *
969
+		 * @param string $html The html to filter.
970
+		 * @param array $cf The custom field array.
971
+		 * @since 1.6.6
972
+		 */
973
+		$html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
974
+	}
975
+
976
+	// If no html then we run the standard output.
977
+	if(empty($html)) {
978
+
979
+		global $gd_session;
980
+		ob_start(); // Start  buffering;
981
+		$value = geodir_get_cf_value($cf);
982
+		$name = $cf['name'];
983
+		$type = $cf['type'];
984
+		$admin_desc = $cf['desc'];
985
+		$is_required = $cf['is_required'];
986
+		$required_msg = $cf['required_msg'];
987
+		$site_title = $cf['site_title'];
988
+		$is_admin = $cf['is_admin'];
989
+		$extra_fields = unserialize($cf['extra_fields']);
990
+		$prefix = $name . '_';
991
+
992
+		($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
993
+		($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
994
+		($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
995
+		($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
996
+
997
+		$address = '';
998
+		$zip = '';
999
+		$mapview = '';
1000
+		$mapzoom = '';
1001
+		$lat = '';
1002
+		$lng = '';
1003
+
1004
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1005
+			$post = $gd_ses_listing;
1006
+			$address = $post[$prefix . 'address'];
1007
+			$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1008
+			$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1009
+			$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1010
+			$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1011
+			$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1012
+		} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1013
+			$post_info = (array)$post_info;
1014
+
1015
+			$address = $post_info[$prefix . 'address'];
1016
+			$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1017
+			$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1018
+			$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1019
+			$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1020
+			$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1021
+		}
1022
+
1023
+		$location = geodir_get_default_location();
1024
+		if (empty($city)) $city = isset($location->city) ? $location->city : '';
1025
+		if (empty($region)) $region = isset($location->region) ? $location->region : '';
1026
+		if (empty($country)) $country = isset($location->country) ? $location->country : '';
1027
+
1028
+		$lat_lng_blank = false;
1029
+		if (empty($lat) && empty($lng)) {
1030
+			$lat_lng_blank = true;
1031
+		}
1032
+
1033
+		if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1034
+		if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1035
+
1036
+		/**
1037
+		 * Filter the default latitude.
1038
+		 *
1039
+		 * @since 1.0.0
1040
+		 *
1041
+		 * @param float $lat Default latitude.
1042
+		 * @param bool $is_admin For admin use only?.
1043
+		 */
1044
+		$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1045
+		/**
1046
+		 * Filter the default longitude.
1047
+		 *
1048
+		 * @since 1.0.0
1049
+		 *
1050
+		 * @param float $lat Default longitude.
1051
+		 * @param bool $is_admin For admin use only?.
1052
+		 */
1053
+		$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1054
+
1055
+		?>
1056 1056
 
1057 1057
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1058 1058
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1071,17 +1071,17 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
 
1073 1073
         <?php
1074
-        /**
1075
-         * Called after the address input on the add listings.
1076
-         *
1077
-         * This is used by the location manage to add further locations info etc.
1078
-         *
1079
-         * @since 1.0.0
1080
-         * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1081
-         */
1082
-        do_action('geodir_address_extra_listing_fields', $cf);
1083
-
1084
-        if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1074
+		/**
1075
+		 * Called after the address input on the add listings.
1076
+		 *
1077
+		 * This is used by the location manage to add further locations info etc.
1078
+		 *
1079
+		 * @since 1.0.0
1080
+		 * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1081
+		 */
1082
+		do_action('geodir_address_extra_listing_fields', $cf);
1083
+
1084
+		if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1085 1085
 
1086 1086
             <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1087 1087
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
@@ -1102,22 +1102,22 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
             <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1104 1104
                 <?php
1105
-                /**
1106
-                 * Contains add listing page map functions.
1107
-                 *
1108
-                 * @since 1.0.0
1109
-                 */
1110
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1111
-                if ($lat_lng_blank) {
1112
-                    $lat = '';
1113
-                    $lng = '';
1114
-                }
1115
-                ?>
1105
+				/**
1106
+				 * Contains add listing page map functions.
1107
+				 *
1108
+				 * @since 1.0.0
1109
+				 */
1110
+				include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1111
+				if ($lat_lng_blank) {
1112
+					$lat = '';
1113
+					$lng = '';
1114
+				}
1115
+				?>
1116 1116
                 <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span>
1117 1117
             </div>
1118 1118
             <?php
1119
-            /* show lat lng */
1120
-            $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1119
+			/* show lat lng */
1120
+			$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1121 1121
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1122 1122
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1123 1123
                 <label>
@@ -1158,27 +1158,27 @@  discard block
 block discarded – undo
1158 1158
                                                             class="gd-checkbox"
1159 1159
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1160 1160
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1161
-                            echo 'checked="checked"';
1162
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1161
+							echo 'checked="checked"';
1162
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1163 1163
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1164 1164
                                                              class="gd-checkbox"
1165 1165
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1166 1166
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1167
-                            echo 'checked="checked"';
1168
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1167
+							echo 'checked="checked"';
1168
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1169 1169
 
1170 1170
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1171 1171
                                                             class="gd-checkbox"
1172 1172
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1173 1173
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1174
-                            echo 'checked="checked"';
1175
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1174
+							echo 'checked="checked"';
1175
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1176 1176
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1177 1177
                                                             class="gd-checkbox"
1178 1178
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1179 1179
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1180
-                            echo 'checked="checked"';
1181
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1180
+							echo 'checked="checked"';
1181
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1182 1182
 
1183 1183
 
1184 1184
             </div>
@@ -1186,14 +1186,14 @@  discard block
 block discarded – undo
1186 1186
 
1187 1187
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1188 1188
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1189
-                echo esc_attr($mapzoom);
1190
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1189
+				echo esc_attr($mapzoom);
1190
+			} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1191 1191
         <?php }
1192 1192
 
1193
-        $html = ob_get_clean();
1194
-    }
1193
+		$html = ob_get_clean();
1194
+	}
1195 1195
 
1196
-    return $html;
1196
+	return $html;
1197 1197
 }
1198 1198
 add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1199 1199
 
@@ -1210,137 +1210,137 @@  discard block
 block discarded – undo
1210 1210
  */
1211 1211
 function geodir_cfi_taxonomy($html,$cf){
1212 1212
 
1213
-    $html_var = $cf['htmlvar_name'];
1214
-
1215
-    // Check if there is a custom field specific filter.
1216
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1217
-        /**
1218
-         * Filter the taxonomy html by individual custom field.
1219
-         *
1220
-         * @param string $html The html to filter.
1221
-         * @param array $cf The custom field array.
1222
-         * @since 1.6.6
1223
-         */
1224
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1225
-    }
1226
-
1227
-    // If no html then we run the standard output.
1228
-    if(empty($html)) {
1229
-
1230
-        ob_start(); // Start  buffering;
1231
-        $value = geodir_get_cf_value($cf);
1232
-
1233
-        $name = $cf['name'];
1234
-        $site_title = $cf['site_title'];
1235
-        $admin_desc = $cf['desc'];
1236
-        $is_required = $cf['is_required'];
1237
-        $is_admin = $cf['is_admin'];
1238
-        $required_msg = $cf['required_msg'];
1239
-
1240
-        if ($value == $cf['default']) {
1241
-            $value = '';
1242
-        } ?>
1213
+	$html_var = $cf['htmlvar_name'];
1214
+
1215
+	// Check if there is a custom field specific filter.
1216
+	if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1217
+		/**
1218
+		 * Filter the taxonomy html by individual custom field.
1219
+		 *
1220
+		 * @param string $html The html to filter.
1221
+		 * @param array $cf The custom field array.
1222
+		 * @since 1.6.6
1223
+		 */
1224
+		$html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1225
+	}
1226
+
1227
+	// If no html then we run the standard output.
1228
+	if(empty($html)) {
1229
+
1230
+		ob_start(); // Start  buffering;
1231
+		$value = geodir_get_cf_value($cf);
1232
+
1233
+		$name = $cf['name'];
1234
+		$site_title = $cf['site_title'];
1235
+		$admin_desc = $cf['desc'];
1236
+		$is_required = $cf['is_required'];
1237
+		$is_admin = $cf['is_admin'];
1238
+		$required_msg = $cf['required_msg'];
1239
+
1240
+		if ($value == $cf['default']) {
1241
+			$value = '';
1242
+		} ?>
1243 1243
         <div id="<?php echo $name;?>_row"
1244 1244
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1245 1245
             <label>
1246 1246
                 <?php $site_title = __($site_title, 'geodirectory');
1247
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1247
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1248 1248
                 <?php if ($is_required) echo '<span>*</span>';?>
1249 1249
             </label>
1250 1250
 
1251 1251
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1252 1252
                 <?php
1253
-                global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1253
+				global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1254 1254
 
1255
-                $exclude_cats = array();
1255
+				$exclude_cats = array();
1256 1256
 
1257
-                if ($is_admin == '1') {
1257
+				if ($is_admin == '1') {
1258 1258
 
1259
-                    $post_type = get_post_type();
1259
+					$post_type = get_post_type();
1260 1260
 
1261
-                    $package_info = array();
1261
+					$package_info = array();
1262 1262
 
1263
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1263
+					$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1264 1264
 
1265
-                    if (!empty($package_info)) {
1265
+					if (!empty($package_info)) {
1266 1266
 
1267
-                        if (isset($package_info['cat']) && $package_info['cat'] != '') {
1267
+						if (isset($package_info['cat']) && $package_info['cat'] != '') {
1268 1268
 
1269
-                            $exclude_cats = explode(',', $package_info['cat']);
1269
+							$exclude_cats = explode(',', $package_info['cat']);
1270 1270
 
1271
-                        }
1272
-                    }
1273
-                }
1271
+						}
1272
+					}
1273
+				}
1274 1274
 
1275
-                $cat_display = unserialize($cf['extra_fields']);
1275
+				$cat_display = unserialize($cf['extra_fields']);
1276 1276
 
1277
-                if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1277
+				if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1278 1278
 
1279
-                    $post_cat = implode(",", $post_cat[$name]);
1279
+					$post_cat = implode(",", $post_cat[$name]);
1280 1280
 
1281
-                } else {
1282
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1283
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1284
-                }
1281
+				} else {
1282
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1283
+						$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1284
+				}
1285 1285
 
1286 1286
 
1287
-                global $geodir_addon_list;
1288
-                if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1287
+				global $geodir_addon_list;
1288
+				if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1289 1289
 
1290
-                    $catadd_limit = $wpdb->get_var(
1291
-                        $wpdb->prepare(
1292
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1293
-                            array($package_id)
1294
-                        )
1295
-                    );
1290
+					$catadd_limit = $wpdb->get_var(
1291
+						$wpdb->prepare(
1292
+							"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1293
+							array($package_id)
1294
+						)
1295
+					);
1296 1296
 
1297 1297
 
1298
-                } else {
1299
-                    $catadd_limit = 0;
1300
-                }
1298
+				} else {
1299
+					$catadd_limit = 0;
1300
+				}
1301 1301
 
1302 1302
 
1303
-                if ($cat_display != '' && $cat_display != 'ajax_chained') {
1303
+				if ($cat_display != '' && $cat_display != 'ajax_chained') {
1304 1304
 
1305
-                    $required_limit_msg = '';
1306
-                    if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1305
+					$required_limit_msg = '';
1306
+					if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1307 1307
 
1308
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1308
+						$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1309 1309
 
1310
-                    } else {
1311
-                        $required_limit_msg = $required_msg;
1312
-                    }
1310
+					} else {
1311
+						$required_limit_msg = $required_msg;
1312
+					}
1313 1313
 
1314
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1314
+					echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1315 1315
 
1316 1316
 
1317
-                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1317
+					if ($cat_display == 'select' || $cat_display == 'multiselect') {
1318 1318
 
1319
-                        $cat_display == '';
1320
-                        $multiple = '';
1321
-                        if ($cat_display == 'multiselect')
1322
-                            $multiple = 'multiple="multiple"';
1319
+						$cat_display == '';
1320
+						$multiple = '';
1321
+						if ($cat_display == 'multiselect')
1322
+							$multiple = 'multiple="multiple"';
1323 1323
 
1324
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1324
+						echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1325 1325
 
1326 1326
 
1327
-                        if ($cat_display == 'select')
1328
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1327
+						if ($cat_display == 'select')
1328
+							echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1329 1329
 
1330
-                    }
1330
+					}
1331 1331
 
1332
-                    echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1332
+					echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1333 1333
 
1334
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1335
-                        echo '</select>';
1334
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
1335
+						echo '</select>';
1336 1336
 
1337
-                } else {
1337
+				} else {
1338 1338
 
1339
-                    echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1339
+					echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1340 1340
 
1341
-                }
1341
+				}
1342 1342
 
1343
-                ?>
1343
+				?>
1344 1344
             </div>
1345 1345
 
1346 1346
             <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1350,10 +1350,10 @@  discard block
 block discarded – undo
1350 1350
         </div>
1351 1351
 
1352 1352
         <?php
1353
-        $html = ob_get_clean();
1354
-    }
1353
+		$html = ob_get_clean();
1354
+	}
1355 1355
 
1356
-    return $html;
1356
+	return $html;
1357 1357
 }
1358 1358
 add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1359 1359
 
@@ -1369,74 +1369,74 @@  discard block
 block discarded – undo
1369 1369
  */
1370 1370
 function geodir_cfi_file($html,$cf){
1371 1371
 
1372
-    $html_var = $cf['htmlvar_name'];
1372
+	$html_var = $cf['htmlvar_name'];
1373 1373
 
1374
-    // Check if there is a custom field specific filter.
1375
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1376
-        /**
1377
-         * Filter the file html by individual custom field.
1378
-         *
1379
-         * @param string $html The html to filter.
1380
-         * @param array $cf The custom field array.
1381
-         * @since 1.6.6
1382
-         */
1383
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1384
-    }
1374
+	// Check if there is a custom field specific filter.
1375
+	if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1376
+		/**
1377
+		 * Filter the file html by individual custom field.
1378
+		 *
1379
+		 * @param string $html The html to filter.
1380
+		 * @param array $cf The custom field array.
1381
+		 * @since 1.6.6
1382
+		 */
1383
+		$html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1384
+	}
1385 1385
 
1386
-    // If no html then we run the standard output.
1387
-    if(empty($html)) {
1386
+	// If no html then we run the standard output.
1387
+	if(empty($html)) {
1388 1388
 
1389
-        ob_start(); // Start  buffering;
1390
-        $value = geodir_get_cf_value($cf);
1389
+		ob_start(); // Start  buffering;
1390
+		$value = geodir_get_cf_value($cf);
1391 1391
 
1392
-        $name = $cf['name'];
1393
-        $site_title = $cf['site_title'];
1394
-        $admin_desc = $cf['desc'];
1395
-        $is_required = $cf['is_required'];
1396
-        $required_msg = $cf['required_msg'];
1397
-        $extra_fields = unserialize($cf['extra_fields']);
1392
+		$name = $cf['name'];
1393
+		$site_title = $cf['site_title'];
1394
+		$admin_desc = $cf['desc'];
1395
+		$is_required = $cf['is_required'];
1396
+		$required_msg = $cf['required_msg'];
1397
+		$extra_fields = unserialize($cf['extra_fields']);
1398 1398
 
1399 1399
 
1400
-        // adjust values here
1401
-        $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1400
+		// adjust values here
1401
+		$file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1402 1402
 
1403
-        if ($value != '') {
1403
+		if ($value != '') {
1404 1404
 
1405
-            $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1405
+			$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1406 1406
 
1407
-        } else
1408
-            $file_value = '';
1407
+		} else
1408
+			$file_value = '';
1409 1409
 
1410
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1411
-            $file_multiple = true; // allow multiple files upload
1412
-        else
1413
-            $file_multiple = false;
1410
+		if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1411
+			$file_multiple = true; // allow multiple files upload
1412
+		else
1413
+			$file_multiple = false;
1414 1414
 
1415
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1416
-            $file_image_limit = $extra_fields['image_limit'];
1417
-        else
1418
-            $file_image_limit = 1;
1415
+		if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1416
+			$file_image_limit = $extra_fields['image_limit'];
1417
+		else
1418
+			$file_image_limit = 1;
1419 1419
 
1420
-        $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1420
+		$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1421 1421
 
1422
-        $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1422
+		$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1423 1423
 
1424
-        if (!empty($file_value)) {
1425
-            $curImages = explode(',', $file_value);
1426
-            if (!empty($curImages))
1427
-                $file_totImg = count($curImages);
1428
-        }
1424
+		if (!empty($file_value)) {
1425
+			$curImages = explode(',', $file_value);
1426
+			if (!empty($curImages))
1427
+				$file_totImg = count($curImages);
1428
+		}
1429 1429
 
1430
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1431
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1430
+		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1431
+		$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1432 1432
 
1433
-        ?>
1433
+		?>
1434 1434
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
1435 1435
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
1436 1436
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
1437 1437
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
1438 1438
 			</h5>   <?php */
1439
-        ?>
1439
+		?>
1440 1440
 
1441 1441
         <div id="<?php echo $name;?>_row"
1442 1442
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1445 1445
                 <label
1446 1446
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1447
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1447
+					echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1448 1448
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1449 1449
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1450 1450
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1456,17 +1456,17 @@  discard block
 block discarded – undo
1456 1456
                 <?php } ?>
1457 1457
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1458 1458
                        value="<?php if (isset($file_totImg)) {
1459
-                           echo esc_attr($file_totImg);
1460
-                       } else {
1461
-                           echo '0';
1462
-                       } ?>"/>
1459
+						   echo esc_attr($file_totImg);
1460
+					   } else {
1461
+						   echo '0';
1462
+					   } ?>"/>
1463 1463
 
1464 1464
                 <div style="float:left; width:55%;">
1465 1465
                     <div
1466 1466
                         class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1467 1467
                         id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
1468 1468
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1469
-                        ?>
1469
+						?>
1470 1470
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1471 1471
                                value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1472 1472
                                class="geodir_button" style="margin-top:10px;"/>
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
                         style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
1486 1486
                     </div>
1487 1487
                     <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
1488
-                    ?>
1488
+					?>
1489 1489
 
1490 1490
                     <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
1491 1491
 
@@ -1499,9 +1499,9 @@  discard block
 block discarded – undo
1499 1499
 
1500 1500
 
1501 1501
         <?php
1502
-        $html = ob_get_clean();
1503
-    }
1502
+		$html = ob_get_clean();
1503
+	}
1504 1504
 
1505
-    return $html;
1505
+	return $html;
1506 1506
 }
1507 1507
 add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1508 1508
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string The html to output for the custom field.
19 19
  */
20
-function geodir_cfi_fieldset($html,$cf){
20
+function geodir_cfi_fieldset($html, $cf) {
21 21
 
22 22
     $html_var = $cf['htmlvar_name'];
23 23
 
24 24
     // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
25
+    if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) {
26 26
         /**
27 27
          * Filter the fieldset html by individual custom field.
28 28
          *
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
          * @param array $cf The custom field array.
31 31
          * @since 1.6.6
32 32
          */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
33
+        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf);
34 34
     }
35 35
 
36 36
     // If no html then we run the standard output.
37
-    if(empty($html)) {
37
+    if (empty($html)) {
38 38
 
39 39
         ob_start(); // Start  buffering;
40 40
         ?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?>
43
-            <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . $cf['desc'] . ' )</small>';
43
+            <?php if ($cf['desc'] != '') {
44
+                echo '<small>( '.$cf['desc'].' )</small>';
45 45
             } ?></h5>
46 46
         <?php
47 47
         $html = ob_get_clean();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     return $html;
51 51
 }
52
-add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
52
+add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2);
53 53
 
54 54
 
55 55
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string The html to output for the custom field.
64 64
  */
65
-function geodir_cfi_text($html,$cf){
65
+function geodir_cfi_text($html, $cf) {
66 66
 
67 67
     $html_var = $cf['htmlvar_name'];
68 68
 
69 69
     // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
70
+    if (has_filter("geodir_custom_field_input_text_{$html_var}")) {
71 71
         /**
72 72
          * Filter the text html by individual custom field.
73 73
          *
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
          * @param array $cf The custom field array.
76 76
          * @since 1.6.6
77 77
          */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
78
+        $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf);
79 79
     }
80 80
 
81 81
     // If no html then we run the standard output.
82
-    if(empty($html)) {
82
+    if (empty($html)) {
83 83
 
84 84
         ob_start(); // Start  buffering;
85 85
 
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; }
90
+        elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; }
91 91
 
92 92
         //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
93
+        if (isset($cf['validation_pattern']) && $cf['validation_pattern']) {
94 94
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
95
+        } else {$validation = ''; }
96 96
 
97 97
         // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
98
+        if (isset($cf['validation_msg']) && $cf['validation_msg']) {
99 99
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
100
+        } else {$validation_msg = ''; }
101 101
         ?>
102 102
 
103
-        <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+        <div id="<?php echo $cf['name']; ?>_row"
104
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 107
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
108
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
109 109
             </label>
110
-            <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
112
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
110
+            <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
111
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
112
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
113 113
             <?php if ($cf['is_required']) { ?>
114 114
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
115 115
             <?php } ?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     return $html;
123 123
 }
124
-add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
124
+add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2);
125 125
 
126 126
 
127 127
 /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return string The html to output for the custom field.
135 135
  */
136
-function geodir_cfi_email($html,$cf){
136
+function geodir_cfi_email($html, $cf) {
137 137
 
138 138
     $html_var = $cf['htmlvar_name'];
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_input_email_{$html_var}")) {
142 142
         /**
143 143
          * Filter the email html by individual custom field.
144 144
          *
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
          * @param array $cf The custom field array.
147 147
          * @since 1.6.6
148 148
          */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
149
+        $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf);
150 150
     }
151 151
 
152 152
     // If no html then we run the standard output.
153
-    if(empty($html)) {
153
+    if (empty($html)) {
154 154
 
155 155
         ob_start(); // Start  buffering;
156 156
         $value = geodir_get_cf_value($cf);
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
             $value = '';
160 160
         }?>
161 161
 
162
-        <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
162
+        <div id="<?php echo $cf['name']; ?>_row"
163
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 166
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
167
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
168 168
             </label>
169
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
170
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
171
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
169
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
170
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
171
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
172 172
             <?php if ($cf['is_required']) { ?>
173 173
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
174 174
             <?php } ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     return $html;
182 182
 }
183
-add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
183
+add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2);
184 184
 
185 185
 
186 186
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string The html to output for the custom field.
195 195
  */
196
-function geodir_cfi_phone($html,$cf){
196
+function geodir_cfi_phone($html, $cf) {
197 197
 
198 198
     $html_var = $cf['htmlvar_name'];
199 199
 
200 200
     // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
201
+    if (has_filter("geodir_custom_field_input_phone_{$html_var}")) {
202 202
         /**
203 203
          * Filter the phone html by individual custom field.
204 204
          *
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
          * @param array $cf The custom field array.
207 207
          * @since 1.6.6
208 208
          */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
209
+        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf);
210 210
     }
211 211
 
212 212
     // If no html then we run the standard output.
213
-    if(empty($html)) {
213
+    if (empty($html)) {
214 214
 
215 215
         ob_start(); // Start  buffering;
216 216
         $value = geodir_get_cf_value($cf);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $value = '';
220 220
         }?>
221 221
 
222
-        <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
222
+        <div id="<?php echo $cf['name']; ?>_row"
223
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 226
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
227
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
228 228
             </label>
229
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
230
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
231
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
229
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
230
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
231
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
232 232
             <?php if ($cf['is_required']) { ?>
233 233
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
234 234
             <?php } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     return $html;
242 242
 }
243
-add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
243
+add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string The html to output for the custom field.
255 255
  */
256
-function geodir_cfi_url($html,$cf){
256
+function geodir_cfi_url($html, $cf) {
257 257
 
258 258
     $html_var = $cf['htmlvar_name'];
259 259
 
260 260
     // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
261
+    if (has_filter("geodir_custom_field_input_url_{$html_var}")) {
262 262
         /**
263 263
          * Filter the url html by individual custom field.
264 264
          *
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
          * @param array $cf The custom field array.
267 267
          * @since 1.6.6
268 268
          */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
269
+        $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf);
270 270
     }
271 271
 
272 272
     // If no html then we run the standard output.
273
-    if(empty($html)) {
273
+    if (empty($html)) {
274 274
 
275 275
         ob_start(); // Start  buffering;
276 276
         $value = geodir_get_cf_value($cf);
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             $value = '';
280 280
         }?>
281 281
 
282
-        <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
282
+        <div id="<?php echo $cf['name']; ?>_row"
283
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 286
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
287
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
288 288
             </label>
289
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
289
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
290
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
291 291
                    oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
292 292
                    onchange="try{setCustomValidity('')}catch(e){}"
293 293
             />
294
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
294
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
295 295
             <?php if ($cf['is_required']) { ?>
296 296
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
297 297
             <?php } ?>
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     return $html;
305 305
 }
306
-add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
306
+add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2);
307 307
 
308 308
 
309 309
 /**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The html to output for the custom field.
317 317
  */
318
-function geodir_cfi_radio($html,$cf){
318
+function geodir_cfi_radio($html, $cf) {
319 319
 
320 320
     $html_var = $cf['htmlvar_name'];
321 321
 
322 322
     // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
323
+    if (has_filter("geodir_custom_field_input_radio_{$html_var}")) {
324 324
         /**
325 325
          * Filter the radio html by individual custom field.
326 326
          *
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
          * @param array $cf The custom field array.
329 329
          * @since 1.6.6
330 330
          */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
331
+        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf);
332 332
     }
333 333
 
334 334
     // If no html then we run the standard output.
335
-    if(empty($html)) {
335
+    if (empty($html)) {
336 336
 
337 337
         ob_start(); // Start  buffering;
338 338
         $value = geodir_get_cf_value($cf);
339 339
 
340 340
         ?>
341
-        <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
341
+        <div id="<?php echo $cf['name']; ?>_row"
342
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 345
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
346
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349 349
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
                     foreach ($option_values as $option_value) {
353 353
                         if (empty($option_value['optgroup'])) {
354 354
                             ?>
355
-                            <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
355
+                            <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357 357
                         }
358 358
                     }
359 359
                 }
360 360
             }
361 361
             ?>
362
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
362
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
365 365
             <?php } ?>
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     return $html;
373 373
 }
374
-add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
374
+add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2);
375 375
 
376 376
 
377 377
 /**
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return string The html to output for the custom field.
385 385
  */
386
-function geodir_cfi_checkbox($html,$cf){
386
+function geodir_cfi_checkbox($html, $cf) {
387 387
 
388 388
     $html_var = $cf['htmlvar_name'];
389 389
 
390 390
     // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
391
+    if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) {
392 392
         /**
393 393
          * Filter the checkbox html by individual custom field.
394 394
          *
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
          * @param array $cf The custom field array.
397 397
          * @since 1.6.6
398 398
          */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
399
+        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf);
400 400
     }
401 401
 
402 402
     // If no html then we run the standard output.
403
-    if(empty($html)) {
403
+    if (empty($html)) {
404 404
 
405 405
         ob_start(); // Start  buffering;
406 406
         $value = geodir_get_cf_value($cf);
@@ -409,22 +409,22 @@  discard block
 block discarded – undo
409 409
             $value = '';
410 410
         }?>
411 411
 
412
-        <div id="<?php echo $cf['name'];?>_row"
413
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
412
+        <div id="<?php echo $cf['name']; ?>_row"
413
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
414 414
             <label>
415 415
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416 416
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
417
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
418 418
             </label>
419 419
             <?php if ($value != '1') {
420 420
                 $value = '0';
421 421
             }?>
422
-            <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
422
+            <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/>
423 423
             <input  <?php if ($value == '1') {
424 424
                 echo 'checked="checked"';
425
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
-                 onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
427
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
425
+            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox"
426
+                 onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/>
427
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
428 428
             <?php if ($cf['is_required']) { ?>
429 429
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
430 430
             <?php } ?>
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
     return $html;
438 438
 }
439
-add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
439
+add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2);
440 440
 
441 441
 
442 442
 /**
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
  *
449 449
  * @return string The html to output for the custom field.
450 450
  */
451
-function geodir_cfi_textarea($html,$cf){
451
+function geodir_cfi_textarea($html, $cf) {
452 452
 
453 453
     $html_var = $cf['htmlvar_name'];
454 454
 
455 455
     // Check if there is a custom field specific filter.
456
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
456
+    if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) {
457 457
         /**
458 458
          * Filter the textarea html by individual custom field.
459 459
          *
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
          * @param array $cf The custom field array.
462 462
          * @since 1.6.6
463 463
          */
464
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
464
+        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf);
465 465
     }
466 466
 
467 467
     // If no html then we run the standard output.
468
-    if(empty($html)) {
468
+    if (empty($html)) {
469 469
 
470 470
         ob_start(); // Start  buffering;
471 471
         $value = geodir_get_cf_value($cf);
@@ -473,32 +473,32 @@  discard block
 block discarded – undo
473 473
         $extra_fields = unserialize($cf['extra_fields']);
474 474
         ?>
475 475
 
476
-        <div id="<?php echo $cf['name'];?>_row"
477
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
476
+        <div id="<?php echo $cf['name']; ?>_row"
477
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
478 478
             <label>
479 479
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480 480
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
481
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
482 482
             </label><?php
483 483
 
484 484
 
485 485
             if (is_array($extra_fields) && in_array('1', $extra_fields)) {
486 486
 
487
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
487
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
488 488
 
489
-            <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
489
+            <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor">
490 490
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
491 491
                 </div><?php
492 492
 
493 493
             } else {
494 494
 
495
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
496
-                            id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
495
+                ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>"
496
+                            id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php
497 497
 
498 498
             }?>
499 499
 
500 500
 
501
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
501
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
502 502
             <?php if ($cf['is_required']) { ?>
503 503
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
504 504
             <?php } ?>
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
     return $html;
512 512
 }
513
-add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
513
+add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2);
514 514
 
515 515
 
516 516
 /**
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
  *
523 523
  * @return string The html to output for the custom field.
524 524
  */
525
-function geodir_cfi_select($html,$cf){
525
+function geodir_cfi_select($html, $cf) {
526 526
 
527 527
     $html_var = $cf['htmlvar_name'];
528 528
 
529 529
     // Check if there is a custom field specific filter.
530
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
530
+    if (has_filter("geodir_custom_field_input_select_{$html_var}")) {
531 531
         /**
532 532
          * Filter the select html by individual custom field.
533 533
          *
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
          * @param array $cf The custom field array.
536 536
          * @since 1.6.6
537 537
          */
538
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
538
+        $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf);
539 539
     }
540 540
 
541 541
     // If no html then we run the standard output.
542
-    if(empty($html)) {
542
+    if (empty($html)) {
543 543
 
544 544
         ob_start(); // Start  buffering;
545 545
         $value = geodir_get_cf_value($cf);
546 546
 
547 547
         ?>
548
-        <div id="<?php echo $cf['name'];?>_row"
549
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
548
+        <div id="<?php echo $cf['name']; ?>_row"
549
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 550
             <label>
551 551
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552 552
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
553
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
554 554
             </label>
555 555
             <?php
556 556
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -560,22 +560,22 @@  discard block
 block discarded – undo
560 560
                     if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
561 561
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
562 562
 
563
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
563
+                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
564 564
                     } else {
565 565
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
566 566
                         $option_value = isset($option_row['value']) ? $option_row['value'] : '';
567 567
                         $selected = $option_value == $value ? 'selected="selected"' : '';
568 568
 
569
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
569
+                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
570 570
                     }
571 571
                 }
572 572
             }
573 573
             ?>
574
-            <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
574
+            <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
575 575
                     class="geodir_textfield textfield_x chosen_select"
576
-                    data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
577
-                    option-ajaxchosen="false"><?php echo $select_options;?></select>
578
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
576
+                    data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
577
+                    option-ajaxchosen="false"><?php echo $select_options; ?></select>
578
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
579 579
             <?php if ($cf['is_required']) { ?>
580 580
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
581 581
             <?php } ?>
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
     return $html;
589 589
 }
590
-add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
590
+add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2);
591 591
 
592 592
 
593 593
 /**
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
  *
600 600
  * @return string The html to output for the custom field.
601 601
  */
602
-function geodir_cfi_multiselect($html,$cf){
602
+function geodir_cfi_multiselect($html, $cf) {
603 603
 
604 604
     $html_var = $cf['htmlvar_name'];
605 605
 
606 606
     // Check if there is a custom field specific filter.
607
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
607
+    if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) {
608 608
         /**
609 609
          * Filter the multiselect html by individual custom field.
610 610
          *
@@ -612,11 +612,11 @@  discard block
 block discarded – undo
612 612
          * @param array $cf The custom field array.
613 613
          * @since 1.6.6
614 614
          */
615
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
615
+        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf);
616 616
     }
617 617
 
618 618
     // If no html then we run the standard output.
619
-    if(empty($html)) {
619
+    if (empty($html)) {
620 620
 
621 621
         ob_start(); // Start  buffering;
622 622
         $value = geodir_get_cf_value($cf);
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
654 654
 
655 655
                                 if ($multi_display == 'select') {
656
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
656
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
657 657
                                 } else {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
658
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
659 659
                                 }
660 660
                             } else {
661 661
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
                                 }
681 681
 
682 682
                                 if ($multi_display == 'select') {
683
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
683
+                                    $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
684 684
                                 } else {
685
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
685
+                                    $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
686 686
                                 }
687 687
                             }
688 688
                         }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 
703 703
     return $html;
704 704
 }
705
-add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
705
+add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2);
706 706
 
707 707
 
708 708
 /**
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
  *
715 715
  * @return string The html to output for the custom field.
716 716
  */
717
-function geodir_cfi_html($html,$cf){
717
+function geodir_cfi_html($html, $cf) {
718 718
 
719 719
     $html_var = $cf['htmlvar_name'];
720 720
 
721 721
     // Check if there is a custom field specific filter.
722
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
722
+    if (has_filter("geodir_custom_field_input_html_{$html_var}")) {
723 723
         /**
724 724
          * Filter the html html by individual custom field.
725 725
          *
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
          * @param array $cf The custom field array.
728 728
          * @since 1.6.6
729 729
          */
730
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
730
+        $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf);
731 731
     }
732 732
 
733 733
     // If no html then we run the standard output.
734
-    if(empty($html)) {
734
+    if (empty($html)) {
735 735
 
736 736
         ob_start(); // Start  buffering;
737 737
         $value = geodir_get_cf_value($cf);
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
     return $html;
766 766
 }
767
-add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
767
+add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2);
768 768
 
769 769
 
770 770
 
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
  *
778 778
  * @return string The html to output for the custom field.
779 779
  */
780
-function geodir_cfi_datepicker($html,$cf){
780
+function geodir_cfi_datepicker($html, $cf) {
781 781
 
782 782
     $html_var = $cf['htmlvar_name'];
783 783
 
784 784
     // Check if there is a custom field specific filter.
785
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
785
+    if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) {
786 786
         /**
787 787
          * Filter the datepicker html by individual custom field.
788 788
          *
@@ -790,11 +790,11 @@  discard block
 block discarded – undo
790 790
          * @param array $cf The custom field array.
791 791
          * @since 1.6.6
792 792
          */
793
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
793
+        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf);
794 794
     }
795 795
 
796 796
     // If no html then we run the standard output.
797
-    if(empty($html)) {
797
+    if (empty($html)) {
798 798
 
799 799
         ob_start(); // Start  buffering;
800 800
         $value = geodir_get_cf_value($cf);
@@ -806,23 +806,23 @@  discard block
 block discarded – undo
806 806
             $extra_fields['date_format'] = 'yy-mm-dd';
807 807
 
808 808
         $date_format = $extra_fields['date_format'];
809
-        $jquery_date_format  = $date_format;
809
+        $jquery_date_format = $date_format;
810 810
 
811 811
 
812 812
         // check if we need to change the format or not
813 813
         $date_format_len = strlen(str_replace(' ', '', $date_format));
814
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
814
+        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
815 815
 
816
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
817
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
816
+            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
817
+            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
818 818
 
819 819
             $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
821
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
820
+        } else {
821
+            $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
822 822
         }
823 823
 
824
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
825
-        if($value && !isset($_REQUEST['backandedit'])) {
824
+        if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
825
+        if ($value && !isset($_REQUEST['backandedit'])) {
826 826
             $time = strtotime($value);
827 827
             $value = date_i18n($date_format, $time);
828 828
         }
@@ -832,37 +832,37 @@  discard block
 block discarded – undo
832 832
 
833 833
             jQuery(function () {
834 834
 
835
-                jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
835
+                jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php
836 836
                     /**
837 837
                      * Used to add extra option to datepicker per custom field.
838 838
                      *
839 839
                      * @since 1.5.7
840 840
                      * @param string $name The custom field name.
841 841
                      */
842
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
842
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
843 843
 
844
-                jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
844
+                jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
845 845
 
846
-                <?php if(!empty($value)){?>
847
-                jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>");
846
+                <?php if (!empty($value)) {?>
847
+                jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>");
848 848
                 <?php } ?>
849 849
 
850 850
             });
851 851
 
852 852
         </script>
853
-        <div id="<?php echo $name;?>_row"
854
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
853
+        <div id="<?php echo $name; ?>_row"
854
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
855 855
             <label>
856 856
 
857 857
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
858 858
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
859
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
859
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
860 860
             </label>
861 861
 
862
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
863
-                   value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
862
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
863
+                   value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
864 864
 
865
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
865
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
866 866
             <?php if ($cf['is_required']) { ?>
867 867
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
868 868
             <?php } ?>
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 
875 875
     return $html;
876 876
 }
877
-add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
877
+add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2);
878 878
 
879 879
 
880 880
 /**
@@ -886,12 +886,12 @@  discard block
 block discarded – undo
886 886
  *
887 887
  * @return string The html to output for the custom field.
888 888
  */
889
-function geodir_cfi_time($html,$cf){
889
+function geodir_cfi_time($html, $cf) {
890 890
 
891 891
     $html_var = $cf['htmlvar_name'];
892 892
 
893 893
     // Check if there is a custom field specific filter.
894
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
894
+    if (has_filter("geodir_custom_field_input_time_{$html_var}")) {
895 895
         /**
896 896
          * Filter the time html by individual custom field.
897 897
          *
@@ -899,11 +899,11 @@  discard block
 block discarded – undo
899 899
          * @param array $cf The custom field array.
900 900
          * @since 1.6.6
901 901
          */
902
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
902
+        $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf);
903 903
     }
904 904
 
905 905
     // If no html then we run the standard output.
906
-    if(empty($html)) {
906
+    if (empty($html)) {
907 907
 
908 908
         ob_start(); // Start  buffering;
909 909
         $value = geodir_get_cf_value($cf);
@@ -916,25 +916,25 @@  discard block
 block discarded – undo
916 916
         <script type="text/javascript">
917 917
             jQuery(document).ready(function () {
918 918
 
919
-                jQuery('#<?php echo $name;?>').timepicker({
919
+                jQuery('#<?php echo $name; ?>').timepicker({
920 920
                     showPeriod: true,
921 921
                     showLeadingZero: true,
922 922
                     showPeriod: true,
923 923
                 });
924 924
             });
925 925
         </script>
926
-        <div id="<?php echo $name;?>_row"
927
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
926
+        <div id="<?php echo $name; ?>_row"
927
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
928 928
             <label>
929 929
 
930 930
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
931 931
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
932
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
932
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
933 933
             </label>
934
-            <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
935
-                   id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
934
+            <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>"
935
+                   id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
936 936
 
937
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
937
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
938 938
             <?php if ($cf['is_required']) { ?>
939 939
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
940 940
             <?php } ?>
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
     return $html;
947 947
 }
948
-add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
948
+add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2);
949 949
 
950 950
 
951 951
 /**
@@ -957,12 +957,12 @@  discard block
 block discarded – undo
957 957
  *
958 958
  * @return string The html to output for the custom field.
959 959
  */
960
-function geodir_cfi_address($html,$cf){
960
+function geodir_cfi_address($html, $cf) {
961 961
 
962 962
     $html_var = $cf['htmlvar_name'];
963 963
 
964 964
     // Check if there is a custom field specific filter.
965
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
965
+    if (has_filter("geodir_custom_field_input_address_{$html_var}")) {
966 966
         /**
967 967
          * Filter the address html by individual custom field.
968 968
          *
@@ -970,11 +970,11 @@  discard block
 block discarded – undo
970 970
          * @param array $cf The custom field array.
971 971
          * @since 1.6.6
972 972
          */
973
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
973
+        $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf);
974 974
     }
975 975
 
976 976
     // If no html then we run the standard output.
977
-    if(empty($html)) {
977
+    if (empty($html)) {
978 978
 
979 979
         global $gd_session;
980 980
         ob_start(); // Start  buffering;
@@ -987,12 +987,12 @@  discard block
 block discarded – undo
987 987
         $site_title = $cf['site_title'];
988 988
         $is_admin = $cf['is_admin'];
989 989
         $extra_fields = unserialize($cf['extra_fields']);
990
-        $prefix = $name . '_';
990
+        $prefix = $name.'_';
991 991
 
992
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
993
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
992
+        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
993
+        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
994 994
         ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
995
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
995
+        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
996 996
 
997 997
         $address = '';
998 998
         $zip = '';
@@ -1003,21 +1003,21 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1005 1005
             $post = $gd_ses_listing;
1006
-            $address = $post[$prefix . 'address'];
1007
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1008
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1009
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1010
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1011
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1006
+            $address = $post[$prefix.'address'];
1007
+            $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1008
+            $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1009
+            $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1010
+            $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1011
+            $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1012 1012
         } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1013
-            $post_info = (array)$post_info;
1014
-
1015
-            $address = $post_info[$prefix . 'address'];
1016
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1017
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1018
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1019
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1020
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1013
+            $post_info = (array) $post_info;
1014
+
1015
+            $address = $post_info[$prefix.'address'];
1016
+            $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1017
+            $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1018
+            $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1019
+            $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1020
+            $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1021 1021
         }
1022 1022
 
1023 1023
         $location = geodir_get_default_location();
@@ -1054,16 +1054,16 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
         ?>
1056 1056
 
1057
-        <div id="geodir_<?php echo $prefix . 'address';?>_row"
1058
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1057
+        <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1058
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1059 1059
             <label>
1060 1060
                 <?php _e($address_title, 'geodirectory'); ?>
1061
-                <?php if ($is_required) echo '<span>*</span>';?>
1061
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1062 1062
             </label>
1063
-            <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1064
-                   id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1063
+            <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>"
1064
+                   id="<?php echo $prefix.'address'; ?>" class="geodir_textfield"
1065 1065
                    value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1066
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1066
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1067 1067
             <?php if ($is_required) { ?>
1068 1068
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1069 1069
             <?php } ?>
@@ -1083,14 +1083,14 @@  discard block
 block discarded – undo
1083 1083
 
1084 1084
         if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1085 1085
 
1086
-            <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1086
+            <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1087 1087
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
1088 1088
                 <label>
1089 1089
                     <?php _e($zip_title, 'geodirectory'); ?>
1090 1090
                     <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1091 1091
                 </label>
1092
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1093
-                       id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1092
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1093
+                       id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1094 1094
                        value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1095 1095
                 <?php /*if($is_required) {?>
1096 1096
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1100,14 +1100,14 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
         <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1102 1102
 
1103
-            <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1103
+            <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1104 1104
                 <?php
1105 1105
                 /**
1106 1106
                  * Contains add listing page map functions.
1107 1107
                  *
1108 1108
                  * @since 1.0.0
1109 1109
                  */
1110
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1110
+                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1111 1111
                 if ($lat_lng_blank) {
1112 1112
                     $lat = '';
1113 1113
                     $lng = '';
@@ -1118,14 +1118,14 @@  discard block
 block discarded – undo
1118 1118
             <?php
1119 1119
             /* show lat lng */
1120 1120
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1121
-            <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1121
+            <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1122 1122
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1123 1123
                 <label>
1124 1124
                     <?php echo PLACE_ADDRESS_LAT; ?>
1125 1125
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1126 1126
                 </label>
1127
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1128
-                       id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1127
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1128
+                       id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1129 1129
                        value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1130 1130
                 <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1131 1131
                 <?php if ($is_required) { ?>
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
                 <?php } ?>
1134 1134
             </div>
1135 1135
 
1136
-            <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1136
+            <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1137 1137
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1138 1138
                 <label>
1139 1139
                     <?php echo PLACE_ADDRESS_LNG; ?>
1140 1140
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1141 1141
                 </label>
1142
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1143
-                       id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1142
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1143
+                       id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1144 1144
                        value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1145 1145
                 <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1146 1146
                 <?php if ($is_required) { ?>
@@ -1150,32 +1150,32 @@  discard block
 block discarded – undo
1150 1150
         <?php } ?>
1151 1151
 
1152 1152
         <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1153
-            <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1153
+            <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1154 1154
                 <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1155 1155
 
1156 1156
 
1157 1157
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1158 1158
                                                             class="gd-checkbox"
1159
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1160
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1159
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1160
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1161 1161
                             echo 'checked="checked"';
1162 1162
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1163 1163
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1164 1164
                                                              class="gd-checkbox"
1165
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1165
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1166 1166
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1167 1167
                             echo 'checked="checked"';
1168 1168
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1169 1169
 
1170 1170
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1171 1171
                                                             class="gd-checkbox"
1172
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1172
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1173 1173
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1174 1174
                             echo 'checked="checked"';
1175 1175
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1176 1176
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1177 1177
                                                             class="gd-checkbox"
1178
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1178
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1179 1179
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1180 1180
                             echo 'checked="checked"';
1181 1181
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1188 1188
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1189 1189
                 echo esc_attr($mapzoom);
1190
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1190
+            } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1191 1191
         <?php }
1192 1192
 
1193 1193
         $html = ob_get_clean();
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
     return $html;
1197 1197
 }
1198
-add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1198
+add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2);
1199 1199
 
1200 1200
 
1201 1201
 
@@ -1208,12 +1208,12 @@  discard block
 block discarded – undo
1208 1208
  *
1209 1209
  * @return string The html to output for the custom field.
1210 1210
  */
1211
-function geodir_cfi_taxonomy($html,$cf){
1211
+function geodir_cfi_taxonomy($html, $cf) {
1212 1212
 
1213 1213
     $html_var = $cf['htmlvar_name'];
1214 1214
 
1215 1215
     // Check if there is a custom field specific filter.
1216
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1216
+    if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) {
1217 1217
         /**
1218 1218
          * Filter the taxonomy html by individual custom field.
1219 1219
          *
@@ -1221,11 +1221,11 @@  discard block
 block discarded – undo
1221 1221
          * @param array $cf The custom field array.
1222 1222
          * @since 1.6.6
1223 1223
          */
1224
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1224
+        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf);
1225 1225
     }
1226 1226
 
1227 1227
     // If no html then we run the standard output.
1228
-    if(empty($html)) {
1228
+    if (empty($html)) {
1229 1229
 
1230 1230
         ob_start(); // Start  buffering;
1231 1231
         $value = geodir_get_cf_value($cf);
@@ -1240,15 +1240,15 @@  discard block
 block discarded – undo
1240 1240
         if ($value == $cf['default']) {
1241 1241
             $value = '';
1242 1242
         } ?>
1243
-        <div id="<?php echo $name;?>_row"
1244
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1243
+        <div id="<?php echo $name; ?>_row"
1244
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1245 1245
             <label>
1246 1246
                 <?php $site_title = __($site_title, 'geodirectory');
1247 1247
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1248
-                <?php if ($is_required) echo '<span>*</span>';?>
1248
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1249 1249
             </label>
1250 1250
 
1251
-            <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1251
+            <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1252 1252
                 <?php
1253 1253
                 global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1254 1254
 
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
                     $package_info = array();
1262 1262
 
1263
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1263
+                    $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1264 1264
 
1265 1265
                     if (!empty($package_info)) {
1266 1266
 
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 
1290 1290
                     $catadd_limit = $wpdb->get_var(
1291 1291
                         $wpdb->prepare(
1292
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1292
+                            "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1293 1293
                             array($package_id)
1294 1294
                         )
1295 1295
                     );
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
                     $required_limit_msg = '';
1306 1306
                     if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1307 1307
 
1308
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1308
+                        $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1309 1309
 
1310 1310
                     } else {
1311 1311
                         $required_limit_msg = $required_msg;
1312 1312
                     }
1313 1313
 
1314
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1314
+                    echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1315 1315
 
1316 1316
 
1317 1317
                     if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1321,11 +1321,11 @@  discard block
 block discarded – undo
1321 1321
                         if ($cat_display == 'multiselect')
1322 1322
                             $multiple = 'multiple="multiple"';
1323 1323
 
1324
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1324
+                        echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
1325 1325
 
1326 1326
 
1327 1327
                         if ($cat_display == 'select')
1328
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1328
+                            echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1329 1329
 
1330 1330
                     }
1331 1331
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                 ?>
1344 1344
             </div>
1345 1345
 
1346
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1346
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1347 1347
             <?php if ($is_required) { ?>
1348 1348
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1349 1349
             <?php } ?>
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
     return $html;
1357 1357
 }
1358
-add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1358
+add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2);
1359 1359
 
1360 1360
 
1361 1361
 /**
@@ -1367,12 +1367,12 @@  discard block
 block discarded – undo
1367 1367
  *
1368 1368
  * @return string The html to output for the custom field.
1369 1369
  */
1370
-function geodir_cfi_file($html,$cf){
1370
+function geodir_cfi_file($html, $cf) {
1371 1371
 
1372 1372
     $html_var = $cf['htmlvar_name'];
1373 1373
 
1374 1374
     // Check if there is a custom field specific filter.
1375
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1375
+    if (has_filter("geodir_custom_field_input_file_{$html_var}")) {
1376 1376
         /**
1377 1377
          * Filter the file html by individual custom field.
1378 1378
          *
@@ -1380,11 +1380,11 @@  discard block
 block discarded – undo
1380 1380
          * @param array $cf The custom field array.
1381 1381
          * @since 1.6.6
1382 1382
          */
1383
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1383
+        $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf);
1384 1384
     }
1385 1385
 
1386 1386
     // If no html then we run the standard output.
1387
-    if(empty($html)) {
1387
+    if (empty($html)) {
1388 1388
 
1389 1389
         ob_start(); // Start  buffering;
1390 1390
         $value = geodir_get_cf_value($cf);
@@ -1427,8 +1427,8 @@  discard block
 block discarded – undo
1427 1427
                 $file_totImg = count($curImages);
1428 1428
         }
1429 1429
 
1430
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1431
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1430
+        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
1431
+        $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
1432 1432
 
1433 1433
         ?>
1434 1434
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -1438,13 +1438,13 @@  discard block
 block discarded – undo
1438 1438
 			</h5>   <?php */
1439 1439
         ?>
1440 1440
 
1441
-        <div id="<?php echo $name;?>_row"
1442
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1441
+        <div id="<?php echo $name; ?>_row"
1442
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1443 1443
 
1444 1444
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1445 1445
                 <label
1446 1446
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1447
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1447
+                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
1448 1448
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1449 1449
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1450 1450
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
                        id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
1453 1453
                 <?php if ($allowed_file_types != '') { ?>
1454 1454
                     <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
1455
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
1455
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
1456 1456
                 <?php } ?>
1457 1457
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1458 1458
                        value="<?php if (isset($file_totImg)) {
@@ -1468,10 +1468,10 @@  discard block
 block discarded – undo
1468 1468
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1469 1469
                         ?>
1470 1470
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1471
-                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1471
+                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
1472 1472
                                class="geodir_button" style="margin-top:10px;"/>
1473 1473
                             <span class="ajaxnonceplu"
1474
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
1474
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
1475 1475
                         <?php if ($file_width && $file_height): ?>
1476 1476
                             <span class="plupload-resize"></span>
1477 1477
                             <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 
1492 1492
                 </div>
1493 1493
             </div>
1494
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
1494
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
1495 1495
             <?php if ($is_required) { ?>
1496 1496
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1497 1497
             <?php } ?>
@@ -1504,4 +1504,4 @@  discard block
 block discarded – undo
1504 1504
 
1505 1505
     return $html;
1506 1506
 }
1507
-add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1508 1507
\ No newline at end of file
1508
+add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2);
1509 1509
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +191 added lines, -68 removed lines patch added patch discarded remove patch
@@ -86,26 +86,31 @@  discard block
 block discarded – undo
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91 90
 
92 91
         //validation
93 92
         if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94 93
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
94
+        } else{$validation='';}
96 95
 
97 96
         // validation message
98 97
         if(isset($cf['validation_msg']) && $cf['validation_msg']){
99 98
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
99
+        } else{$validation_msg='';}
101 100
         ?>
102 101
 
103 102
         <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+             class="<?php if ($cf['is_required']) {
104
+	echo 'required_field';
105
+}
106
+?> geodir_form_row clearfix gd-fieldset-details">
105 107
             <label>
106 108
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 109
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
110
+                <?php if ($cf['is_required']) {
111
+	echo '<span>*</span>';
112
+}
113
+?>
109 114
             </label>
110 115
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111 116
                    value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -160,11 +165,17 @@  discard block
 block discarded – undo
160 165
         }?>
161 166
 
162 167
         <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
168
+             class="<?php if ($cf['is_required']) {
169
+	echo 'required_field';
170
+}
171
+?> geodir_form_row clearfix gd-fieldset-details">
164 172
             <label>
165 173
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 174
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
175
+                <?php if ($cf['is_required']) {
176
+	echo '<span>*</span>';
177
+}
178
+?>
168 179
             </label>
169 180
             <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
170 181
                    value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -220,11 +231,17 @@  discard block
 block discarded – undo
220 231
         }?>
221 232
 
222 233
         <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
234
+             class="<?php if ($cf['is_required']) {
235
+	echo 'required_field';
236
+}
237
+?> geodir_form_row clearfix gd-fieldset-details">
224 238
             <label>
225 239
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 240
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
241
+                <?php if ($cf['is_required']) {
242
+	echo '<span>*</span>';
243
+}
244
+?>
228 245
             </label>
229 246
             <input field_type="<?php echo $cf['type'];?>" name="<?php  $cf['name'];?>" id="<?php echo $cf['name'];?>"
230 247
                    value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -280,11 +297,17 @@  discard block
 block discarded – undo
280 297
         }?>
281 298
 
282 299
         <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
300
+             class="<?php if ($cf['is_required']) {
301
+	echo 'required_field';
302
+}
303
+?> geodir_form_row clearfix gd-fieldset-details">
284 304
             <label>
285 305
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 306
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
307
+                <?php if ($cf['is_required']) {
308
+	echo '<span>*</span>';
309
+}
310
+?>
288 311
             </label>
289 312
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290 313
                    value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -339,11 +362,17 @@  discard block
 block discarded – undo
339 362
 
340 363
         ?>
341 364
         <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
365
+             class="<?php if ($cf['is_required']) {
366
+	echo 'required_field';
367
+}
368
+?> geodir_form_row clearfix gd-fieldset-details">
343 369
             <label>
344 370
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 371
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
372
+                <?php if ($cf['is_required']) {
373
+	echo '<span>*</span>';
374
+}
375
+?>
347 376
             </label>
348 377
             <?php if ($cf['option_values']) {
349 378
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -410,11 +439,17 @@  discard block
 block discarded – undo
410 439
         }?>
411 440
 
412 441
         <div id="<?php echo $cf['name'];?>_row"
413
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
442
+             class="<?php if ($cf['is_required']) {
443
+	echo 'required_field';
444
+}
445
+?> geodir_form_row clearfix gd-fieldset-details">
414 446
             <label>
415 447
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
416 448
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
417
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
449
+                <?php if ($cf['is_required']) {
450
+	echo '<span>*</span>';
451
+}
452
+?>
418 453
             </label>
419 454
             <?php if ($value != '1') {
420 455
                 $value = '0';
@@ -474,11 +509,17 @@  discard block
 block discarded – undo
474 509
         ?>
475 510
 
476 511
         <div id="<?php echo $cf['name'];?>_row"
477
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
512
+             class="<?php if ($cf['is_required']) {
513
+	echo 'required_field';
514
+}
515
+?> geodir_form_row clearfix gd-fieldset-details">
478 516
             <label>
479 517
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
480 518
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
481
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
519
+                <?php if ($cf['is_required']) {
520
+	echo '<span>*</span>';
521
+}
522
+?>
482 523
             </label><?php
483 524
 
484 525
 
@@ -546,11 +587,17 @@  discard block
 block discarded – undo
546 587
 
547 588
         ?>
548 589
         <div id="<?php echo $cf['name'];?>_row"
549
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
590
+             class="<?php if ($cf['is_required']) {
591
+	echo 'required_field';
592
+}
593
+?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550 594
             <label>
551 595
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
552 596
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
553
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
597
+                <?php if ($cf['is_required']) {
598
+	echo '<span>*</span>';
599
+}
600
+?>
554 601
             </label>
555 602
             <?php
556 603
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -627,11 +674,17 @@  discard block
 block discarded – undo
627 674
         }
628 675
         ?>
629 676
         <div id="<?php echo $cf['name']; ?>_row"
630
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
677
+             class="<?php if ($cf['is_required']) {
678
+	echo 'required_field';
679
+}
680
+?> geodir_form_row clearfix gd-fieldset-details">
631 681
             <label>
632 682
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
633 683
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
634
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
684
+                <?php if ($cf['is_required']) {
685
+	echo '<span>*</span>';
686
+}
687
+?>
635 688
             </label>
636 689
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
637 690
             <?php if ($multi_display == 'select') { ?>
@@ -738,11 +791,17 @@  discard block
 block discarded – undo
738 791
         ?>
739 792
 
740 793
         <div id="<?php echo $cf['name']; ?>_row"
741
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
794
+             class="<?php if ($cf['is_required']) {
795
+	echo 'required_field';
796
+}
797
+?> geodir_form_row clearfix gd-fieldset-details">
742 798
             <label>
743 799
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
744 800
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
745
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
801
+                <?php if ($cf['is_required']) {
802
+	echo '<span>*</span>';
803
+}
804
+?>
746 805
             </label>
747 806
 
748 807
             <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -802,8 +861,9 @@  discard block
 block discarded – undo
802 861
         $extra_fields = unserialize($cf['extra_fields']);
803 862
         $name = $cf['name'];
804 863
 
805
-        if ($extra_fields['date_format'] == '')
806
-            $extra_fields['date_format'] = 'yy-mm-dd';
864
+        if ($extra_fields['date_format'] == '') {
865
+                    $extra_fields['date_format'] = 'yy-mm-dd';
866
+        }
807 867
 
808 868
         $date_format = $extra_fields['date_format'];
809 869
         $jquery_date_format  = $date_format;
@@ -817,7 +877,7 @@  discard block
 block discarded – undo
817 877
             $replace = array('d','j','l','m','n','F','Y');//PHP date format
818 878
 
819 879
             $date_format = str_replace($search, $replace, $date_format);
820
-        }else{
880
+        } else{
821 881
             $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
822 882
         }
823 883
 
@@ -851,12 +911,18 @@  discard block
 block discarded – undo
851 911
 
852 912
         </script>
853 913
         <div id="<?php echo $name;?>_row"
854
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
914
+             class="<?php if ($cf['is_required']) {
915
+	echo 'required_field';
916
+}
917
+?> geodir_form_row clearfix gd-fieldset-details">
855 918
             <label>
856 919
 
857 920
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
858 921
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
859
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
922
+                <?php if ($cf['is_required']) {
923
+	echo '<span>*</span>';
924
+}
925
+?>
860 926
             </label>
861 927
 
862 928
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -910,8 +976,9 @@  discard block
 block discarded – undo
910 976
 
911 977
         $name = $cf['name'];
912 978
 
913
-        if ($value != '')
914
-            $value = date('H:i', strtotime($value));
979
+        if ($value != '') {
980
+                    $value = date('H:i', strtotime($value));
981
+        }
915 982
         ?>
916 983
         <script type="text/javascript">
917 984
             jQuery(document).ready(function () {
@@ -924,12 +991,18 @@  discard block
 block discarded – undo
924 991
             });
925 992
         </script>
926 993
         <div id="<?php echo $name;?>_row"
927
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
994
+             class="<?php if ($cf['is_required']) {
995
+	echo 'required_field';
996
+}
997
+?> geodir_form_row clearfix gd-fieldset-details">
928 998
             <label>
929 999
 
930 1000
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
931 1001
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
932
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
1002
+                <?php if ($cf['is_required']) {
1003
+	echo '<span>*</span>';
1004
+}
1005
+?>
933 1006
             </label>
934 1007
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
935 1008
                    id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1021,17 +1094,27 @@  discard block
 block discarded – undo
1021 1094
         }
1022 1095
 
1023 1096
         $location = geodir_get_default_location();
1024
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1025
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1026
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1097
+        if (empty($city)) {
1098
+        	$city = isset($location->city) ? $location->city : '';
1099
+        }
1100
+        if (empty($region)) {
1101
+        	$region = isset($location->region) ? $location->region : '';
1102
+        }
1103
+        if (empty($country)) {
1104
+        	$country = isset($location->country) ? $location->country : '';
1105
+        }
1027 1106
 
1028 1107
         $lat_lng_blank = false;
1029 1108
         if (empty($lat) && empty($lng)) {
1030 1109
             $lat_lng_blank = true;
1031 1110
         }
1032 1111
 
1033
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1034
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1112
+        if (empty($lat)) {
1113
+        	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1114
+        }
1115
+        if (empty($lng)) {
1116
+        	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1117
+        }
1035 1118
 
1036 1119
         /**
1037 1120
          * Filter the default latitude.
@@ -1055,10 +1138,16 @@  discard block
 block discarded – undo
1055 1138
         ?>
1056 1139
 
1057 1140
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1058
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1141
+             class="<?php if ($is_required) {
1142
+	echo 'required_field';
1143
+}
1144
+?> geodir_form_row clearfix gd-fieldset-details">
1059 1145
             <label>
1060 1146
                 <?php _e($address_title, 'geodirectory'); ?>
1061
-                <?php if ($is_required) echo '<span>*</span>';?>
1147
+                <?php if ($is_required) {
1148
+	echo '<span>*</span>';
1149
+}
1150
+?>
1062 1151
             </label>
1063 1152
             <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1064 1153
                    id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1119,10 +1208,16 @@  discard block
 block discarded – undo
1119 1208
             /* show lat lng */
1120 1209
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1121 1210
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1122
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1211
+                 class="<?php if ($is_required) {
1212
+	echo 'required_field';
1213
+}
1214
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1123 1215
                 <label>
1124 1216
                     <?php echo PLACE_ADDRESS_LAT; ?>
1125
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1217
+                    <?php if ($is_required) {
1218
+	echo '<span>*</span>';
1219
+}
1220
+?>
1126 1221
                 </label>
1127 1222
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1128 1223
                        id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1134,10 +1229,16 @@  discard block
 block discarded – undo
1134 1229
             </div>
1135 1230
 
1136 1231
             <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1137
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1232
+                 class="<?php if ($is_required) {
1233
+	echo 'required_field';
1234
+}
1235
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1138 1236
                 <label>
1139 1237
                     <?php echo PLACE_ADDRESS_LNG; ?>
1140
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1238
+                    <?php if ($is_required) {
1239
+	echo '<span>*</span>';
1240
+}
1241
+?>
1141 1242
                 </label>
1142 1243
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1143 1244
                        id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1241,11 +1342,17 @@  discard block
 block discarded – undo
1241 1342
             $value = '';
1242 1343
         } ?>
1243 1344
         <div id="<?php echo $name;?>_row"
1244
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1345
+             class="<?php if ($is_required) {
1346
+	echo 'required_field';
1347
+}
1348
+?> geodir_form_row clearfix gd-fieldset-details">
1245 1349
             <label>
1246 1350
                 <?php $site_title = __($site_title, 'geodirectory');
1247 1351
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1248
-                <?php if ($is_required) echo '<span>*</span>';?>
1352
+                <?php if ($is_required) {
1353
+	echo '<span>*</span>';
1354
+}
1355
+?>
1249 1356
             </label>
1250 1357
 
1251 1358
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1279,8 +1386,9 @@  discard block
 block discarded – undo
1279 1386
                     $post_cat = implode(",", $post_cat[$name]);
1280 1387
 
1281 1388
                 } else {
1282
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1283
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1389
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1390
+                                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1391
+                    }
1284 1392
                 }
1285 1393
 
1286 1394
 
@@ -1318,21 +1426,24 @@  discard block
 block discarded – undo
1318 1426
 
1319 1427
                         $cat_display == '';
1320 1428
                         $multiple = '';
1321
-                        if ($cat_display == 'multiselect')
1322
-                            $multiple = 'multiple="multiple"';
1429
+                        if ($cat_display == 'multiselect') {
1430
+                                                    $multiple = 'multiple="multiple"';
1431
+                        }
1323 1432
 
1324 1433
                         echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1325 1434
 
1326 1435
 
1327
-                        if ($cat_display == 'select')
1328
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1436
+                        if ($cat_display == 'select') {
1437
+                                                    echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1438
+                        }
1329 1439
 
1330 1440
                     }
1331 1441
 
1332 1442
                     echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1333 1443
 
1334
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1335
-                        echo '</select>';
1444
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1445
+                                            echo '</select>';
1446
+                    }
1336 1447
 
1337 1448
                 } else {
1338 1449
 
@@ -1404,18 +1515,23 @@  discard block
 block discarded – undo
1404 1515
 
1405 1516
             $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1406 1517
 
1407
-        } else
1408
-            $file_value = '';
1518
+        } else {
1519
+                    $file_value = '';
1520
+        }
1409 1521
 
1410
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1411
-            $file_multiple = true; // allow multiple files upload
1412
-        else
1413
-            $file_multiple = false;
1522
+        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
1523
+                    $file_multiple = true;
1524
+        }
1525
+        // allow multiple files upload
1526
+        else {
1527
+                    $file_multiple = false;
1528
+        }
1414 1529
 
1415
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1416
-            $file_image_limit = $extra_fields['image_limit'];
1417
-        else
1418
-            $file_image_limit = 1;
1530
+        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
1531
+                    $file_image_limit = $extra_fields['image_limit'];
1532
+        } else {
1533
+                    $file_image_limit = 1;
1534
+        }
1419 1535
 
1420 1536
         $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1421 1537
 
@@ -1423,8 +1539,9 @@  discard block
 block discarded – undo
1423 1539
 
1424 1540
         if (!empty($file_value)) {
1425 1541
             $curImages = explode(',', $file_value);
1426
-            if (!empty($curImages))
1427
-                $file_totImg = count($curImages);
1542
+            if (!empty($curImages)) {
1543
+                            $file_totImg = count($curImages);
1544
+            }
1428 1545
         }
1429 1546
 
1430 1547
         $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -1439,12 +1556,18 @@  discard block
 block discarded – undo
1439 1556
         ?>
1440 1557
 
1441 1558
         <div id="<?php echo $name;?>_row"
1442
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1559
+             class="<?php if ($is_required) {
1560
+	echo 'required_field';
1561
+}
1562
+?> geodir_form_row clearfix gd-fieldset-details">
1443 1563
 
1444 1564
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1445 1565
                 <label
1446 1566
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1447
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1567
+                    echo $site_title; ?><?php if ($is_required) {
1568
+                    	echo '<span>*</span>';
1569
+                    }
1570
+                    ?></label>
1448 1571
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1449 1572
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1450 1573
                        value="<?php echo esc_attr($file_value); ?>"/>
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +316 added lines, -316 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 $cf_arr = geodir_custom_fields($post_type);
26 26
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 $field_admin_title = '';
33 33
 if (isset($field_info->admin_title))
34
-    $field_admin_title = $field_info->admin_title;
34
+	$field_admin_title = $field_info->admin_title;
35 35
 
36 36
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
37 37
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 //print_r($field_info);
52 52
 
53 53
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
54
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
54
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
55 55
 }elseif(isset($cf['icon']) && $cf['icon']){
56
-    $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
56
+	$field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
57 57
 }else{
58
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
58
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
59 59
 }
60 60
 
61 61
 ?>
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
66 66
         <?php
67 67
 
68
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
69
-        ?>
68
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
69
+		?>
70 70
 
71 71
         <?php if ($default): ?>
72 72
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
@@ -75,37 +75,37 @@  discard block
 block discarded – undo
75 75
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
76 76
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
77 77
         <?php endif;
78
-        if ($field_type == 'fieldset') {
79
-            ?>
78
+		if ($field_type == 'fieldset') {
79
+			?>
80 80
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
81 81
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
82 82
             <b style="cursor:pointer;"
83 83
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
84 84
         <?php
85
-        } else {echo $field_icon;
86
-            ?>
85
+		} else {echo $field_icon;
86
+			?>
87 87
             <b style="cursor:pointer;"
88 88
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
89 89
         <?php
90
-        }
91
-        ?>
90
+		}
91
+		?>
92 92
     </div>
93 93
 
94 94
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
95 95
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
96 96
          style="display:<?php if ($field_ins_upd == 'submit') {
97
-             echo 'block;';
98
-         } else {
99
-             echo 'none;';
100
-         } ?>">
97
+			 echo 'block;';
98
+		 } else {
99
+			 echo 'none;';
100
+		 } ?>">
101 101
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
102 102
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
103 103
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
104 104
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
105 105
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
106 106
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
107
-            echo $field_info->data_type;
108
-        } ?>"/>
107
+			echo $field_info->data_type;
108
+		} ?>"/>
109 109
         <input type="hidden" name="is_active" id="is_active" value="1"/>
110 110
 
111 111
         <input type="hidden" name="is_default" value="<?php echo $field_info->is_default;?>" /><?php // show in sidebar value?>
@@ -117,37 +117,37 @@  discard block
 block discarded – undo
117 117
 
118 118
             <?php
119 119
 
120
-            // data_type
121
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
120
+			// data_type
121
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
122 122
 
123
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
123
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
124 124
 
125
-            }else{
126
-                $value = '';
127
-                if (isset($field_info->data_type)) {
128
-                    $value = esc_attr($field_info->data_type);
129
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
130
-                    $value = $cf['defaults']['data_type'];
131
-                }
132
-                ?>
125
+			}else{
126
+				$value = '';
127
+				if (isset($field_info->data_type)) {
128
+					$value = esc_attr($field_info->data_type);
129
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
130
+					$value = $cf['defaults']['data_type'];
131
+				}
132
+				?>
133 133
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
134 134
             <?php
135
-            }
135
+			}
136 136
 
137 137
 
138
-            // admin_title
139
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
138
+			// admin_title
139
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
140 140
 
141
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
141
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
142 142
 
143
-            }else{
144
-                $value = '';
145
-                if (isset($field_info->admin_title)) {
146
-                    $value = esc_attr($field_info->admin_title);
147
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
148
-                    $value = $cf['defaults']['admin_title'];
149
-                }
150
-                ?>
143
+			}else{
144
+				$value = '';
145
+				if (isset($field_info->admin_title)) {
146
+					$value = esc_attr($field_info->admin_title);
147
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
148
+					$value = $cf['defaults']['admin_title'];
149
+				}
150
+				?>
151 151
                 <li>
152 152
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
153 153
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -161,22 +161,22 @@  discard block
 block discarded – undo
161 161
                     </div>
162 162
                 </li>
163 163
                 <?php
164
-            }
164
+			}
165 165
 
166 166
 
167
-            // site_title
168
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
167
+			// site_title
168
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
169 169
 
170
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
170
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
171 171
 
172
-            }else{
173
-                $value = '';
174
-                if (isset($field_info->site_title)) {
175
-                    $value = esc_attr($field_info->site_title);
176
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
177
-                    $value = $cf['defaults']['site_title'];
178
-                }
179
-                ?>
172
+			}else{
173
+				$value = '';
174
+				if (isset($field_info->site_title)) {
175
+					$value = esc_attr($field_info->site_title);
176
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
177
+					$value = $cf['defaults']['site_title'];
178
+				}
179
+				?>
180 180
                 <li>
181 181
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
182 182
                         <div class="gdcf-tooltip">
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
                     </div>
190 190
                 </li>
191 191
                 <?php
192
-            }
192
+			}
193 193
 
194 194
 
195
-            // admin_desc
196
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
195
+			// admin_desc
196
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
197 197
 
198
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
198
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
199 199
 
200
-            }else{
201
-                $value = '';
202
-                if (isset($field_info->admin_desc)) {
203
-                    $value = esc_attr($field_info->admin_desc);
204
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
205
-                    $value = $cf['defaults']['admin_desc'];
206
-                }
207
-                ?>
200
+			}else{
201
+				$value = '';
202
+				if (isset($field_info->admin_desc)) {
203
+					$value = esc_attr($field_info->admin_desc);
204
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
205
+					$value = $cf['defaults']['admin_desc'];
206
+				}
207
+				?>
208 208
                 <li>
209 209
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
210 210
                         <div class="gdcf-tooltip">
@@ -217,23 +217,23 @@  discard block
 block discarded – undo
217 217
                     </div>
218 218
                 </li>
219 219
                 <?php
220
-            }
220
+			}
221 221
 
222 222
 
223 223
 
224
-            // htmlvar_name
225
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
224
+			// htmlvar_name
225
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
226 226
 
227
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
227
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
228 228
 
229
-            }else{
230
-                $value = '';
231
-                if (isset($field_info->htmlvar_name)) {
232
-                    $value = esc_attr($field_info->htmlvar_name);
233
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
234
-                    $value = $cf['defaults']['htmlvar_name'];
235
-                }
236
-                ?>
229
+			}else{
230
+				$value = '';
231
+				if (isset($field_info->htmlvar_name)) {
232
+					$value = esc_attr($field_info->htmlvar_name);
233
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
234
+					$value = $cf['defaults']['htmlvar_name'];
235
+				}
236
+				?>
237 237
                 <li>
238 238
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
239 239
                         <div class="gdcf-tooltip">
@@ -243,29 +243,29 @@  discard block
 block discarded – undo
243 243
                     <div class="gd-cf-input-wrap">
244 244
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
245 245
                                value="<?php if ($value) {
246
-                                   echo preg_replace('/geodir_/', '', $value, 1);
247
-                               }?>" <?php if ($default) {
248
-                            echo 'readonly="readonly"';
249
-                        }?> />
246
+								   echo preg_replace('/geodir_/', '', $value, 1);
247
+							   }?>" <?php if ($default) {
248
+							echo 'readonly="readonly"';
249
+						}?> />
250 250
                     </div>
251 251
                 </li>
252 252
                 <?php
253
-            }
253
+			}
254 254
 
255 255
 
256
-            // is_active
257
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
256
+			// is_active
257
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
258 258
 
259
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
259
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
260 260
 
261
-            }else{
262
-                $value = '';
263
-                if (isset($field_info->is_active)) {
264
-                    $value = esc_attr($field_info->is_active);
265
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
266
-                    $value = $cf['defaults']['is_active'];
267
-                }
268
-                ?>
261
+			}else{
262
+				$value = '';
263
+				if (isset($field_info->is_active)) {
264
+					$value = esc_attr($field_info->is_active);
265
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
266
+					$value = $cf['defaults']['is_active'];
267
+				}
268
+				?>
269 269
                 <li <?php echo $field_display; ?>>
270 270
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
271 271
                         <div class="gdcf-tooltip">
@@ -276,35 +276,35 @@  discard block
 block discarded – undo
276 276
 
277 277
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
278 278
                             <?php if ($value == '1') {
279
-                                echo 'checked';
280
-                            } ?>/>
279
+								echo 'checked';
280
+							} ?>/>
281 281
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
282 282
 
283 283
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
284 284
                             <?php if ($value == '0' || !$value) {
285
-                                echo 'checked';
286
-                            } ?>/>
285
+								echo 'checked';
286
+							} ?>/>
287 287
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
288 288
 
289 289
                     </div>
290 290
                 </li>
291 291
                 <?php
292
-            }
292
+			}
293 293
 
294 294
 
295
-            // for_admin_use
296
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
295
+			// for_admin_use
296
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
297 297
 
298
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
298
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
299 299
 
300
-            }else{
301
-                $value = '';
302
-                if (isset($field_info->for_admin_use)) {
303
-                    $value = esc_attr($field_info->for_admin_use);
304
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
305
-                    $value = $cf['defaults']['for_admin_use'];
306
-                }
307
-                ?>
300
+			}else{
301
+				$value = '';
302
+				if (isset($field_info->for_admin_use)) {
303
+					$value = esc_attr($field_info->for_admin_use);
304
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
305
+					$value = $cf['defaults']['for_admin_use'];
306
+				}
307
+				?>
308 308
                 <li>
309 309
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
310 310
                         <div class="gdcf-tooltip">
@@ -315,47 +315,47 @@  discard block
 block discarded – undo
315 315
 
316 316
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
317 317
                             <?php if ($value == '1') {
318
-                                echo 'checked';
319
-                            } ?>/>
318
+								echo 'checked';
319
+							} ?>/>
320 320
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
321 321
 
322 322
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
323 323
                             <?php if ($value == '0' || !$value) {
324
-                                echo 'checked';
325
-                            } ?>/>
324
+								echo 'checked';
325
+							} ?>/>
326 326
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
327 327
 
328 328
                     </div>
329 329
                 </li>
330 330
                 <?php
331
-            }
331
+			}
332 332
 
333 333
 
334
-            // default_value
335
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
334
+			// default_value
335
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
336 336
 
337
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
337
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
338 338
 
339
-            }else{
340
-                $value = '';
341
-                if (isset($field_info->default_value)) {
342
-                    $value = esc_attr($field_info->default_value);
343
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
344
-                    $value = $cf['defaults']['default_value'];
345
-                }
346
-                ?>
339
+			}else{
340
+				$value = '';
341
+				if (isset($field_info->default_value)) {
342
+					$value = esc_attr($field_info->default_value);
343
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
344
+					$value = $cf['defaults']['default_value'];
345
+				}
346
+				?>
347 347
                 <li>
348 348
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
349 349
                         <div class="gdcf-tooltip">
350 350
                             <?php
351
-                            if ($field_type == 'checkbox') {
352
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
353
-                            } else if ($field_type == 'email') {
354
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
355
-                            } else {
356
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
357
-                            }
358
-                            ?>
351
+							if ($field_type == 'checkbox') {
352
+								_e('Should the checkbox be checked by default?', 'geodirectory');
353
+							} else if ($field_type == 'email') {
354
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
355
+							} else {
356
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
357
+							}
358
+							?>
359 359
                         </div>
360 360
                     </label>
361 361
                     <div class="gd-cf-input-wrap">
@@ -372,17 +372,17 @@  discard block
 block discarded – undo
372 372
                     </div>
373 373
                 </li>
374 374
                 <?php
375
-            }
375
+			}
376 376
 
377 377
 
378
-            // show_in
379
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
378
+			// show_in
379
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
380 380
 
381
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
381
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
382 382
 
383
-            }else{
384
-                $value = '';
385
-                ?>
383
+			}else{
384
+				$value = '';
385
+				?>
386 386
                 <li>
387 387
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
388 388
                         <div class="gdcf-tooltip">
@@ -393,42 +393,42 @@  discard block
 block discarded – undo
393 393
 
394 394
                         <?php
395 395
 
396
-                        /*
396
+						/*
397 397
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
398 398
 						 */
399
-                        $show_in_locations = array(
400
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
401
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
402
-                            "[listing]" => __("Listings page", 'geodirectory'),
403
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
404
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
405
-                        );
406
-
407
-                        /**
408
-                         * Filter the locations array for where to display custom fields.
409
-                         *
410
-                         * @since 1.6.6
411
-                         * @param array $show_in_locations The array of locations and descriptions.
412
-                         * @param object $field_info The field being displayed info.
413
-                         * @param string $field_info The type of field.
414
-                         */
415
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
399
+						$show_in_locations = array(
400
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
401
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
402
+							"[listing]" => __("Listings page", 'geodirectory'),
403
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
404
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
405
+						);
406
+
407
+						/**
408
+						 * Filter the locations array for where to display custom fields.
409
+						 *
410
+						 * @since 1.6.6
411
+						 * @param array $show_in_locations The array of locations and descriptions.
412
+						 * @param object $field_info The field being displayed info.
413
+						 * @param string $field_info The type of field.
414
+						 */
415
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
416 416
 
417 417
 
418
-                        // remove some locations for some field types
418
+						// remove some locations for some field types
419 419
 
420
-                        // don't show new tab option for some types
420
+						// don't show new tab option for some types
421 421
 
422
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
423
-                        }else{
424
-                            unset($show_in_locations['[owntab]']);
425
-                        }
422
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
423
+						}else{
424
+							unset($show_in_locations['[owntab]']);
425
+						}
426 426
 
427
-                        if(!$display_on_listing){
428
-                            unset($show_in_locations['[listings]']);
429
-                        }
427
+						if(!$display_on_listing){
428
+							unset($show_in_locations['[listings]']);
429
+						}
430 430
 
431
-                        ?>
431
+						?>
432 432
 
433 433
                         <select multiple="multiple" name="show_in[]"
434 434
                                 id="show_in"
@@ -438,38 +438,38 @@  discard block
 block discarded – undo
438 438
                                 option-ajaxchosen="false">
439 439
                             <?php
440 440
 
441
-                            $show_in_values = explode(',',$field_info->show_in);
441
+							$show_in_values = explode(',',$field_info->show_in);
442 442
 
443
-                            foreach( $show_in_locations as $key => $val){
444
-                                $selected = '';
443
+							foreach( $show_in_locations as $key => $val){
444
+								$selected = '';
445 445
 
446
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
447
-                                    $selected = 'selected';
448
-                                }
446
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
447
+									$selected = 'selected';
448
+								}
449 449
 
450
-                                ?>
450
+								?>
451 451
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
452 452
                                 <?php
453
-                            }
454
-                            ?>
453
+							}
454
+							?>
455 455
                         </select>
456 456
                     </div>
457 457
                 </li>
458 458
                 <?php
459
-            }
459
+			}
460 460
 
461 461
 
462
-            // advanced_editor
463
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
462
+			// advanced_editor
463
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
464 464
 
465
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
465
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
466 466
 
467
-            }
467
+			}
468 468
 
469 469
 
470 470
 
471 471
 
472
-            ?>
472
+			?>
473 473
 
474 474
 
475 475
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -482,38 +482,38 @@  discard block
 block discarded – undo
482 482
 
483 483
             <?php
484 484
 
485
-            $pricearr = array();
486
-            if (isset($field_info->packages) && $field_info->packages != '') {
487
-                $pricearr = explode(',', trim($field_info->packages, ','));
488
-            } else {
489
-                $package_info = array();
485
+			$pricearr = array();
486
+			if (isset($field_info->packages) && $field_info->packages != '') {
487
+				$pricearr = explode(',', trim($field_info->packages, ','));
488
+			} else {
489
+				$package_info = array();
490 490
 
491
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
492
-                $pricearr[] = $package_info->pid;
493
-            }
491
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
492
+				$pricearr[] = $package_info->pid;
493
+			}
494 494
 
495
-            ob_start()
496
-            ?>
495
+			ob_start()
496
+			?>
497 497
 
498 498
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
499 499
                 <?php
500
-                if (!empty($pricearr)) {
501
-                    foreach ($pricearr as $val) {
502
-                        ?>
500
+				if (!empty($pricearr)) {
501
+					foreach ($pricearr as $val) {
502
+						?>
503 503
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
504
-                    }
505
-                }
506
-                ?>
504
+					}
505
+				}
506
+				?>
507 507
             </select>
508 508
 
509 509
             <?php
510
-            $html = ob_get_clean();
510
+			$html = ob_get_clean();
511 511
 
512 512
 			/**
513 513
 			 * Filter the price packages list.
514 514
 			 *
515 515
 			 * Filter the price packages list in custom field form in admin
516
-             * custom fields settings.
516
+			 * custom fields settings.
517 517
 			 *
518 518
 			 * @since 1.0.0
519 519
 			 *
@@ -522,25 +522,25 @@  discard block
 block discarded – undo
522 522
 			 */
523 523
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
524 524
 
525
-            ?>
525
+			?>
526 526
 
527 527
 
528 528
 
529 529
             <?php
530 530
 
531
-            // is_required
532
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
531
+			// is_required
532
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
533 533
 
534
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
534
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
535 535
 
536
-            }else{
537
-                $value = '';
538
-                if (isset($field_info->is_required)) {
539
-                    $value = esc_attr($field_info->is_required);
540
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
541
-                    $value = $cf['defaults']['is_required'];
542
-                }
543
-                ?>
536
+			}else{
537
+				$value = '';
538
+				if (isset($field_info->is_required)) {
539
+					$value = esc_attr($field_info->is_required);
540
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
541
+					$value = $cf['defaults']['is_required'];
542
+				}
543
+				?>
544 544
                 <li>
545 545
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
546 546
                         <div class="gdcf-tooltip">
@@ -552,14 +552,14 @@  discard block
 block discarded – undo
552 552
 
553 553
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
554 554
                             <?php if ($value == '1') {
555
-                                echo 'checked';
556
-                            } ?>/>
555
+								echo 'checked';
556
+							} ?>/>
557 557
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
558 558
 
559 559
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
560 560
                             <?php if ($value == '0' || !$value) {
561
-                                echo 'checked';
562
-                            } ?>/>
561
+								echo 'checked';
562
+							} ?>/>
563 563
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
564 564
 
565 565
                     </div>
@@ -567,21 +567,21 @@  discard block
 block discarded – undo
567 567
                 </li>
568 568
 
569 569
                 <?php
570
-            }
570
+			}
571 571
 
572
-            // required_msg
573
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
572
+			// required_msg
573
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
574 574
 
575
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
575
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
576 576
 
577
-            }else{
578
-                $value = '';
579
-                if (isset($field_info->required_msg)) {
580
-                    $value = esc_attr($field_info->required_msg);
581
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
582
-                    $value = $cf['defaults']['required_msg'];
583
-                }
584
-                ?>
577
+			}else{
578
+				$value = '';
579
+				if (isset($field_info->required_msg)) {
580
+					$value = esc_attr($field_info->required_msg);
581
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
582
+					$value = $cf['defaults']['required_msg'];
583
+				}
584
+				?>
585 585
                 <li class="cf-is-required-msg"<?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
586 586
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
587 587
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -595,38 +595,38 @@  discard block
 block discarded – undo
595 595
                     </div>
596 596
                 </li>
597 597
                 <?php
598
-            }
598
+			}
599 599
 
600 600
 
601
-            // required_msg
602
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
601
+			// required_msg
602
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
603 603
 
604
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
604
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
605 605
 
606
-            }
606
+			}
607 607
 
608 608
 
609
-            // extra_fields
610
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
609
+			// extra_fields
610
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
611 611
 
612
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
612
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
613 613
 
614
-            }
614
+			}
615 615
 
616 616
 
617
-            // field_icon
618
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
617
+			// field_icon
618
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
619 619
 
620
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
620
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
621 621
 
622
-            }else{
623
-                $value = '';
624
-                if (isset($field_info->field_icon)) {
625
-                    $value = esc_attr($field_info->field_icon);
626
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
627
-                    $value = $cf['defaults']['field_icon'];
628
-                }
629
-                ?>
622
+			}else{
623
+				$value = '';
624
+				if (isset($field_info->field_icon)) {
625
+					$value = esc_attr($field_info->field_icon);
626
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
627
+					$value = $cf['defaults']['field_icon'];
628
+				}
629
+				?>
630 630
                 <li>
631 631
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
632 632
 
@@ -644,22 +644,22 @@  discard block
 block discarded – undo
644 644
 
645 645
                 </li>
646 646
                 <?php
647
-            }
647
+			}
648 648
 
649 649
 
650
-            // css_class
651
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
650
+			// css_class
651
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
652 652
 
653
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
653
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
654 654
 
655
-            }else{
656
-                $value = '';
657
-                if (isset($field_info->css_class)) {
658
-                    $value = esc_attr($field_info->css_class);
659
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
660
-                    $value = $cf['defaults']['css_class'];
661
-                }
662
-                ?>
655
+			}else{
656
+				$value = '';
657
+				if (isset($field_info->css_class)) {
658
+					$value = esc_attr($field_info->css_class);
659
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
660
+					$value = $cf['defaults']['css_class'];
661
+				}
662
+				?>
663 663
                 <li>
664 664
 
665 665
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -671,43 +671,43 @@  discard block
 block discarded – undo
671 671
                     <div class="gd-cf-input-wrap">
672 672
                         <input type="text" name="css_class" id="css_class"
673 673
                                value="<?php if (isset($field_info->css_class)) {
674
-                                   echo esc_attr($field_info->css_class);
675
-                               }?>"/>
674
+								   echo esc_attr($field_info->css_class);
675
+							   }?>"/>
676 676
                     </div>
677 677
                 </li>
678 678
                 <?php
679
-            }
679
+			}
680 680
 
681 681
 
682
-            // cat_sort
683
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
682
+			// cat_sort
683
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
684 684
 
685
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
685
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
686 686
 
687
-            }else{
688
-                $value = '';
689
-                if (isset($field_info->cat_sort)) {
690
-                    $value = esc_attr($field_info->cat_sort);
691
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
692
-                    $value = $cf['defaults']['cat_sort'];
693
-                }
694
-                ?>
687
+			}else{
688
+				$value = '';
689
+				if (isset($field_info->cat_sort)) {
690
+					$value = esc_attr($field_info->cat_sort);
691
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
692
+					$value = $cf['defaults']['cat_sort'];
693
+				}
694
+				?>
695 695
                 <li>
696 696
                     <h3><?php
697
-                        /**
698
-                         * Filter the section title.
699
-                         *
700
-                         * Filter the section title in custom field form in admin
701
-                         * custom fields settings.
702
-                         *
703
-                         * @since 1.0.0
704
-                         *
705
-                         * @param string $title Title of the section.
706
-                         * @param string $field_type Current field type.
707
-                         */
708
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
709
-
710
-                        ?></h3>
697
+						/**
698
+						 * Filter the section title.
699
+						 *
700
+						 * Filter the section title in custom field form in admin
701
+						 * custom fields settings.
702
+						 *
703
+						 * @since 1.0.0
704
+						 *
705
+						 * @param string $title Title of the section.
706
+						 * @param string $field_type Current field type.
707
+						 */
708
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
709
+
710
+						?></h3>
711 711
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
712 712
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
713 713
                         <div class="gdcf-tooltip">
@@ -719,40 +719,40 @@  discard block
 block discarded – undo
719 719
 
720 720
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
721 721
                             <?php if ($value == '1') {
722
-                                echo 'checked';
723
-                            } ?>/>
722
+								echo 'checked';
723
+							} ?>/>
724 724
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
725 725
 
726 726
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
727 727
                             <?php if (!$value) {
728
-                                echo 'checked';
729
-                            } ?>/>
728
+								echo 'checked';
729
+							} ?>/>
730 730
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
731 731
 
732 732
                     </div>
733 733
                 </li>
734 734
                 <?php
735
-            }
736
-
737
-
738
-
739
-            switch ($field_type):
740
-                case 'html':
741
-                case 'file':
742
-                case 'url':
743
-                case 'fieldset':
744
-                    break;
745
-                default:
746
-
747
-                    /**
748
-                     * Called at the end of the advanced custom fields settings page loop.
749
-                     *
750
-                     * Can be used to add or deal with different settings types.
751
-                     *
752
-                     * @since 1.0.0
753
-                     * @param object $field_info The current fields info.
754
-                     */
755
-                    do_action('geodir_advance_custom_fields', $field_info);?>
735
+			}
736
+
737
+
738
+
739
+			switch ($field_type):
740
+				case 'html':
741
+				case 'file':
742
+				case 'url':
743
+				case 'fieldset':
744
+					break;
745
+				default:
746
+
747
+					/**
748
+					 * Called at the end of the advanced custom fields settings page loop.
749
+					 *
750
+					 * Can be used to add or deal with different settings types.
751
+					 *
752
+					 * @since 1.0.0
753
+					 * @param object $field_info The current fields info.
754
+					 */
755
+					do_action('geodir_advance_custom_fields', $field_info);?>
756 756
 
757 757
 
758 758
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
29 29
 
30
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
30
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
31 31
 
32 32
 $field_admin_title = '';
33 33
 if (isset($field_info->admin_title))
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
54 54
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
55
-}elseif(isset($cf['icon']) && $cf['icon']){
55
+}elseif (isset($cf['icon']) && $cf['icon']) {
56 56
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
57
-}else{
57
+} else {
58 58
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
59 59
 }
60 60
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
66 66
         <?php
67 67
 
68
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
68
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
69 69
         ?>
70 70
 
71 71
         <?php if ($default): ?>
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
81 81
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
82 82
             <b style="cursor:pointer;"
83
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
83
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
84 84
         <?php
85 85
         } else {echo $field_icon;
86 86
             ?>
87 87
             <b style="cursor:pointer;"
88
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
88
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type.')'); ?></b>
89 89
         <?php
90 90
         }
91 91
         ?>
@@ -108,43 +108,43 @@  discard block
 block discarded – undo
108 108
         } ?>"/>
109 109
         <input type="hidden" name="is_active" id="is_active" value="1"/>
110 110
 
111
-        <input type="hidden" name="is_default" value="<?php echo $field_info->is_default;?>" /><?php // show in sidebar value?>
112
-        <input type="hidden" name="show_on_listing" value="<?php echo $field_info->show_on_listing;?>" />
113
-        <input type="hidden" name="show_on_detail" value="<?php echo $field_info->show_on_listing;?>" />
114
-        <input type="hidden" name="show_as_tab" value="<?php echo $field_info->show_as_tab;?>" />
111
+        <input type="hidden" name="is_default" value="<?php echo $field_info->is_default; ?>" /><?php // show in sidebar value?>
112
+        <input type="hidden" name="show_on_listing" value="<?php echo $field_info->show_on_listing; ?>" />
113
+        <input type="hidden" name="show_on_detail" value="<?php echo $field_info->show_on_listing; ?>" />
114
+        <input type="hidden" name="show_as_tab" value="<?php echo $field_info->show_as_tab; ?>" />
115 115
 
116 116
         <ul class="widefat post fixed" border="0" style="width:100%;">
117 117
 
118 118
             <?php
119 119
 
120 120
             // data_type
121
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
121
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
122 122
 
123
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
123
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
124 124
 
125
-            }else{
125
+            } else {
126 126
                 $value = '';
127 127
                 if (isset($field_info->data_type)) {
128 128
                     $value = esc_attr($field_info->data_type);
129
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
129
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
130 130
                     $value = $cf['defaults']['data_type'];
131 131
                 }
132 132
                 ?>
133
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
133
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
134 134
             <?php
135 135
             }
136 136
 
137 137
 
138 138
             // admin_title
139
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
139
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
140 140
 
141
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
141
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
142 142
 
143
-            }else{
143
+            } else {
144 144
                 $value = '';
145 145
                 if (isset($field_info->admin_title)) {
146 146
                     $value = esc_attr($field_info->admin_title);
147
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
147
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
148 148
                     $value = $cf['defaults']['admin_title'];
149 149
                 }
150 150
                 ?>
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                     </label>
158 158
                     <div class="gd-cf-input-wrap">
159 159
                         <input type="text" name="admin_title" id="admin_title"
160
-                               value="<?php echo $value;?>"/>
160
+                               value="<?php echo $value; ?>"/>
161 161
                     </div>
162 162
                 </li>
163 163
                 <?php
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
             // site_title
168
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
168
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
169 169
 
170
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
170
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
171 171
 
172
-            }else{
172
+            } else {
173 173
                 $value = '';
174 174
                 if (isset($field_info->site_title)) {
175 175
                     $value = esc_attr($field_info->site_title);
176
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
176
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
177 177
                     $value = $cf['defaults']['site_title'];
178 178
                 }
179 179
                 ?>
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
 
194 194
 
195 195
             // admin_desc
196
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
196
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
197 197
 
198
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
198
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
199 199
 
200
-            }else{
200
+            } else {
201 201
                 $value = '';
202 202
                 if (isset($field_info->admin_desc)) {
203 203
                     $value = esc_attr($field_info->admin_desc);
204
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
204
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
205 205
                     $value = $cf['defaults']['admin_desc'];
206 206
                 }
207 207
                 ?>
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                     </label>
214 214
                     <div class="gd-cf-input-wrap">
215 215
                         <input type="text" name="admin_desc" id="admin_desc"
216
-                               value="<?php echo $value;?>"/>
216
+                               value="<?php echo $value; ?>"/>
217 217
                     </div>
218 218
                 </li>
219 219
                 <?php
@@ -222,26 +222,26 @@  discard block
 block discarded – undo
222 222
 
223 223
 
224 224
             // htmlvar_name
225
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
225
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
226 226
 
227
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
227
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
228 228
 
229
-            }else{
229
+            } else {
230 230
                 $value = '';
231 231
                 if (isset($field_info->htmlvar_name)) {
232 232
                     $value = esc_attr($field_info->htmlvar_name);
233
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
233
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
234 234
                     $value = $cf['defaults']['htmlvar_name'];
235 235
                 }
236 236
                 ?>
237 237
                 <li>
238
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
238
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
239 239
                         <div class="gdcf-tooltip">
240 240
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
241 241
                         </div>
242 242
                     </label>
243 243
                     <div class="gd-cf-input-wrap">
244
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
244
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
245 245
                                value="<?php if ($value) {
246 246
                                    echo preg_replace('/geodir_/', '', $value, 1);
247 247
                                }?>" <?php if ($default) {
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
 
255 255
 
256 256
             // is_active
257
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
257
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
258 258
 
259
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
259
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
260 260
 
261
-            }else{
261
+            } else {
262 262
                 $value = '';
263 263
                 if (isset($field_info->is_active)) {
264 264
                     $value = esc_attr($field_info->is_active);
265
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
265
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
266 266
                     $value = $cf['defaults']['is_active'];
267 267
                 }
268 268
                 ?>
@@ -274,17 +274,17 @@  discard block
 block discarded – undo
274 274
                     </label>
275 275
                     <div class="gd-cf-input-wrap gd-switch">
276 276
 
277
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
277
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
278 278
                             <?php if ($value == '1') {
279 279
                                 echo 'checked';
280 280
                             } ?>/>
281
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
281
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
282 282
 
283
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
283
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
284 284
                             <?php if ($value == '0' || !$value) {
285 285
                                 echo 'checked';
286 286
                             } ?>/>
287
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
287
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
288 288
 
289 289
                     </div>
290 290
                 </li>
@@ -293,15 +293,15 @@  discard block
 block discarded – undo
293 293
 
294 294
 
295 295
             // for_admin_use
296
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
296
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
297 297
 
298
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
298
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
299 299
 
300
-            }else{
300
+            } else {
301 301
                 $value = '';
302 302
                 if (isset($field_info->for_admin_use)) {
303 303
                     $value = esc_attr($field_info->for_admin_use);
304
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
304
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
305 305
                     $value = $cf['defaults']['for_admin_use'];
306 306
                 }
307 307
                 ?>
@@ -313,17 +313,17 @@  discard block
 block discarded – undo
313 313
                     </label>
314 314
                     <div class="gd-cf-input-wrap gd-switch">
315 315
 
316
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
316
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
317 317
                             <?php if ($value == '1') {
318 318
                                 echo 'checked';
319 319
                             } ?>/>
320
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
320
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
321 321
 
322
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
322
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
323 323
                             <?php if ($value == '0' || !$value) {
324 324
                                 echo 'checked';
325 325
                             } ?>/>
326
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
326
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
327 327
 
328 328
                     </div>
329 329
                 </li>
@@ -332,20 +332,20 @@  discard block
 block discarded – undo
332 332
 
333 333
 
334 334
             // default_value
335
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
335
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
336 336
 
337
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
337
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
338 338
 
339
-            }else{
339
+            } else {
340 340
                 $value = '';
341 341
                 if (isset($field_info->default_value)) {
342 342
                     $value = esc_attr($field_info->default_value);
343
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
343
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
344 344
                     $value = $cf['defaults']['default_value'];
345 345
                 }
346 346
                 ?>
347 347
                 <li>
348
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
348
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
349 349
                         <div class="gdcf-tooltip">
350 350
                             <?php
351 351
                             if ($field_type == 'checkbox') {
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
                         <?php if ($field_type == 'checkbox') { ?>
363 363
                             <select name="default_value" id="default_value">
364 364
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
365
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
365
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
366 366
                             </select>
367 367
                         <?php } else if ($field_type == 'email') { ?>
368
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
368
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
369 369
                         <?php } else { ?>
370
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
370
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
371 371
                         <?php } ?>
372 372
                     </div>
373 373
                 </li>
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 
377 377
 
378 378
             // show_in
379
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
379
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
380 380
 
381
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
381
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
382 382
 
383
-            }else{
383
+            } else {
384 384
                 $value = '';
385 385
                 ?>
386 386
                 <li>
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                          * @param object $field_info The field being displayed info.
413 413
                          * @param string $field_info The type of field.
414 414
                          */
415
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
415
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
416 416
 
417 417
 
418 418
                         // remove some locations for some field types
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
                         // don't show new tab option for some types
421 421
 
422 422
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
423
-                        }else{
423
+                        } else {
424 424
                             unset($show_in_locations['[owntab]']);
425 425
                         }
426 426
 
427
-                        if(!$display_on_listing){
427
+                        if (!$display_on_listing) {
428 428
                             unset($show_in_locations['[listings]']);
429 429
                         }
430 430
 
@@ -438,17 +438,17 @@  discard block
 block discarded – undo
438 438
                                 option-ajaxchosen="false">
439 439
                             <?php
440 440
 
441
-                            $show_in_values = explode(',',$field_info->show_in);
441
+                            $show_in_values = explode(',', $field_info->show_in);
442 442
 
443
-                            foreach( $show_in_locations as $key => $val){
443
+                            foreach ($show_in_locations as $key => $val) {
444 444
                                 $selected = '';
445 445
 
446
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
446
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
447 447
                                     $selected = 'selected';
448 448
                                 }
449 449
 
450 450
                                 ?>
451
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
451
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
452 452
                                 <?php
453 453
                             }
454 454
                             ?>
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
 
461 461
 
462 462
             // advanced_editor
463
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
463
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
464 464
 
465
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
465
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
466 466
 
467 467
             }
468 468
 
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 
474 474
 
475 475
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
476
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
476
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
477 477
 
478 478
             <?php // we dont need to show the sort order ?>
479
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
479
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
480 480
 
481 481
 
482 482
 
@@ -529,15 +529,15 @@  discard block
 block discarded – undo
529 529
             <?php
530 530
 
531 531
             // is_required
532
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
532
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
533 533
 
534
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
534
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
535 535
 
536
-            }else{
536
+            } else {
537 537
                 $value = '';
538 538
                 if (isset($field_info->is_required)) {
539 539
                     $value = esc_attr($field_info->is_required);
540
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
540
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
541 541
                     $value = $cf['defaults']['is_required'];
542 542
                 }
543 543
                 ?>
@@ -550,17 +550,17 @@  discard block
 block discarded – undo
550 550
 
551 551
                     <div class="gd-cf-input-wrap gd-switch">
552 552
 
553
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
553
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
554 554
                             <?php if ($value == '1') {
555 555
                                 echo 'checked';
556 556
                             } ?>/>
557
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
557
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
558 558
 
559
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
559
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
560 560
                             <?php if ($value == '0' || !$value) {
561 561
                                 echo 'checked';
562 562
                             } ?>/>
563
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
563
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
564 564
 
565 565
                     </div>
566 566
 
@@ -570,19 +570,19 @@  discard block
 block discarded – undo
570 570
             }
571 571
 
572 572
             // required_msg
573
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
573
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
574 574
 
575
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
575
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
576 576
 
577
-            }else{
577
+            } else {
578 578
                 $value = '';
579 579
                 if (isset($field_info->required_msg)) {
580 580
                     $value = esc_attr($field_info->required_msg);
581
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
581
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
582 582
                     $value = $cf['defaults']['required_msg'];
583 583
                 }
584 584
                 ?>
585
-                <li class="cf-is-required-msg"<?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
585
+                <li class="cf-is-required-msg"<?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
586 586
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
587 587
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
588 588
                         <div class="gdcf-tooltip">
@@ -599,31 +599,31 @@  discard block
 block discarded – undo
599 599
 
600 600
 
601 601
             // required_msg
602
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
602
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
603 603
 
604
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
604
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
605 605
 
606 606
             }
607 607
 
608 608
 
609 609
             // extra_fields
610
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
610
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
611 611
 
612
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
612
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
613 613
 
614 614
             }
615 615
 
616 616
 
617 617
             // field_icon
618
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
618
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
619 619
 
620
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
620
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
621 621
 
622
-            }else{
622
+            } else {
623 623
                 $value = '';
624 624
                 if (isset($field_info->field_icon)) {
625 625
                     $value = esc_attr($field_info->field_icon);
626
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
626
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
627 627
                     $value = $cf['defaults']['field_icon'];
628 628
                 }
629 629
                 ?>
@@ -634,12 +634,12 @@  discard block
 block discarded – undo
634 634
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
635 635
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
636 636
                         <div class="gdcf-tooltip">
637
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
637
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
638 638
                         </div>
639 639
                     </label>
640 640
                     <div class="gd-cf-input-wrap">
641 641
                         <input type="text" name="field_icon" id="field_icon"
642
-                               value="<?php echo $value;?>"/>
642
+                               value="<?php echo $value; ?>"/>
643 643
                     </div>
644 644
 
645 645
                 </li>
@@ -648,15 +648,15 @@  discard block
 block discarded – undo
648 648
 
649 649
 
650 650
             // css_class
651
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
651
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
652 652
 
653
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
653
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
654 654
 
655
-            }else{
655
+            } else {
656 656
                 $value = '';
657 657
                 if (isset($field_info->css_class)) {
658 658
                     $value = esc_attr($field_info->css_class);
659
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
659
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
660 660
                     $value = $cf['defaults']['css_class'];
661 661
                 }
662 662
                 ?>
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                     <label for="css_class" class="gd-cf-tooltip-wrap">
666 666
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
667 667
                         <div class="gdcf-tooltip">
668
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
668
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
669 669
                         </div>
670 670
                     </label>
671 671
                     <div class="gd-cf-input-wrap">
@@ -680,15 +680,15 @@  discard block
 block discarded – undo
680 680
 
681 681
 
682 682
             // cat_sort
683
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
683
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
684 684
 
685
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
685
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
686 686
 
687
-            }else{
687
+            } else {
688 688
                 $value = '';
689 689
                 if (isset($field_info->cat_sort)) {
690 690
                     $value = esc_attr($field_info->cat_sort);
691
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
691
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
692 692
                     $value = $cf['defaults']['cat_sort'];
693 693
                 }
694 694
                 ?>
@@ -711,23 +711,23 @@  discard block
 block discarded – undo
711 711
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
712 712
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
713 713
                         <div class="gdcf-tooltip">
714
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
714
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
715 715
                         </div>
716 716
                     </label>
717 717
 
718 718
                     <div class="gd-cf-input-wrap gd-switch">
719 719
 
720
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
720
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
721 721
                             <?php if ($value == '1') {
722 722
                                 echo 'checked';
723 723
                             } ?>/>
724
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
724
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
725 725
 
726
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
726
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
727 727
                             <?php if (!$value) {
728 728
                                 echo 'checked';
729 729
                             } ?>/>
730
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
730
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
731 731
 
732 732
                     </div>
733 733
                 </li>
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
                      * @since 1.0.0
753 753
                      * @param object $field_info The current fields info.
754 754
                      */
755
-                    do_action('geodir_advance_custom_fields', $field_info);?>
755
+                    do_action('geodir_advance_custom_fields', $field_info); ?>
756 756
 
757 757
 
758 758
                 <?php endswitch; ?>
@@ -764,10 +764,10 @@  discard block
 block discarded – undo
764 764
                     <h3></h3>
765 765
                 </label>
766 766
                 <div class="gd-cf-input-wrap">
767
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
767
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
768 768
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
769 769
                     <?php if (!$default): ?>
770
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
770
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
771 771
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
772 772
                                                             class="button"/></a>
773 773
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +41 added lines, -36 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 $cf_arr = geodir_custom_fields($post_type);
26 27
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
@@ -30,8 +31,9 @@  discard block
 block discarded – undo
30 31
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
31 32
 
32 33
 $field_admin_title = '';
33
-if (isset($field_info->admin_title))
34
-    $field_admin_title = $field_info->admin_title;
34
+if (isset($field_info->admin_title)) {
35
+    $field_admin_title = $field_info->admin_title;
36
+}
35 37
 
36 38
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
37 39
 
@@ -52,9 +54,9 @@  discard block
 block discarded – undo
52 54
 
53 55
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
54 56
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
55
-}elseif(isset($cf['icon']) && $cf['icon']){
57
+} elseif(isset($cf['icon']) && $cf['icon']){
56 58
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
57
-}else{
59
+} else{
58 60
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
59 61
 }
60 62
 
@@ -70,8 +72,11 @@  discard block
 block discarded – undo
70 72
 
71 73
         <?php if ($default): ?>
72 74
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
73
-        <?php else: ?>
74
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
75
+        <?php else {
76
+	: ?>
77
+            <div title="<?php _e('Click to remove field', 'geodirectory');
78
+}
79
+?>"
75 80
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
76 81
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
77 82
         <?php endif;
@@ -122,11 +127,11 @@  discard block
 block discarded – undo
122 127
 
123 128
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
124 129
 
125
-            }else{
130
+            } else{
126 131
                 $value = '';
127 132
                 if (isset($field_info->data_type)) {
128 133
                     $value = esc_attr($field_info->data_type);
129
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
134
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
130 135
                     $value = $cf['defaults']['data_type'];
131 136
                 }
132 137
                 ?>
@@ -140,11 +145,11 @@  discard block
 block discarded – undo
140 145
 
141 146
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
142 147
 
143
-            }else{
148
+            } else{
144 149
                 $value = '';
145 150
                 if (isset($field_info->admin_title)) {
146 151
                     $value = esc_attr($field_info->admin_title);
147
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
152
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
148 153
                     $value = $cf['defaults']['admin_title'];
149 154
                 }
150 155
                 ?>
@@ -169,11 +174,11 @@  discard block
 block discarded – undo
169 174
 
170 175
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
171 176
 
172
-            }else{
177
+            } else{
173 178
                 $value = '';
174 179
                 if (isset($field_info->site_title)) {
175 180
                     $value = esc_attr($field_info->site_title);
176
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
181
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
177 182
                     $value = $cf['defaults']['site_title'];
178 183
                 }
179 184
                 ?>
@@ -197,11 +202,11 @@  discard block
 block discarded – undo
197 202
 
198 203
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
199 204
 
200
-            }else{
205
+            } else{
201 206
                 $value = '';
202 207
                 if (isset($field_info->admin_desc)) {
203 208
                     $value = esc_attr($field_info->admin_desc);
204
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
209
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
205 210
                     $value = $cf['defaults']['admin_desc'];
206 211
                 }
207 212
                 ?>
@@ -226,11 +231,11 @@  discard block
 block discarded – undo
226 231
 
227 232
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
228 233
 
229
-            }else{
234
+            } else{
230 235
                 $value = '';
231 236
                 if (isset($field_info->htmlvar_name)) {
232 237
                     $value = esc_attr($field_info->htmlvar_name);
233
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
238
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
234 239
                     $value = $cf['defaults']['htmlvar_name'];
235 240
                 }
236 241
                 ?>
@@ -258,11 +263,11 @@  discard block
 block discarded – undo
258 263
 
259 264
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
260 265
 
261
-            }else{
266
+            } else{
262 267
                 $value = '';
263 268
                 if (isset($field_info->is_active)) {
264 269
                     $value = esc_attr($field_info->is_active);
265
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
270
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
266 271
                     $value = $cf['defaults']['is_active'];
267 272
                 }
268 273
                 ?>
@@ -297,11 +302,11 @@  discard block
 block discarded – undo
297 302
 
298 303
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
299 304
 
300
-            }else{
305
+            } else{
301 306
                 $value = '';
302 307
                 if (isset($field_info->for_admin_use)) {
303 308
                     $value = esc_attr($field_info->for_admin_use);
304
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
309
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
305 310
                     $value = $cf['defaults']['for_admin_use'];
306 311
                 }
307 312
                 ?>
@@ -336,11 +341,11 @@  discard block
 block discarded – undo
336 341
 
337 342
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
338 343
 
339
-            }else{
344
+            } else{
340 345
                 $value = '';
341 346
                 if (isset($field_info->default_value)) {
342 347
                     $value = esc_attr($field_info->default_value);
343
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
348
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
344 349
                     $value = $cf['defaults']['default_value'];
345 350
                 }
346 351
                 ?>
@@ -380,7 +385,7 @@  discard block
 block discarded – undo
380 385
 
381 386
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
382 387
 
383
-            }else{
388
+            } else{
384 389
                 $value = '';
385 390
                 ?>
386 391
                 <li>
@@ -420,7 +425,7 @@  discard block
 block discarded – undo
420 425
                         // don't show new tab option for some types
421 426
 
422 427
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
423
-                        }else{
428
+                        } else{
424 429
                             unset($show_in_locations['[owntab]']);
425 430
                         }
426 431
 
@@ -533,11 +538,11 @@  discard block
 block discarded – undo
533 538
 
534 539
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
535 540
 
536
-            }else{
541
+            } else{
537 542
                 $value = '';
538 543
                 if (isset($field_info->is_required)) {
539 544
                     $value = esc_attr($field_info->is_required);
540
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
545
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
541 546
                     $value = $cf['defaults']['is_required'];
542 547
                 }
543 548
                 ?>
@@ -574,11 +579,11 @@  discard block
 block discarded – undo
574 579
 
575 580
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
576 581
 
577
-            }else{
582
+            } else{
578 583
                 $value = '';
579 584
                 if (isset($field_info->required_msg)) {
580 585
                     $value = esc_attr($field_info->required_msg);
581
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
586
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
582 587
                     $value = $cf['defaults']['required_msg'];
583 588
                 }
584 589
                 ?>
@@ -619,11 +624,11 @@  discard block
 block discarded – undo
619 624
 
620 625
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
621 626
 
622
-            }else{
627
+            } else{
623 628
                 $value = '';
624 629
                 if (isset($field_info->field_icon)) {
625 630
                     $value = esc_attr($field_info->field_icon);
626
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
631
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
627 632
                     $value = $cf['defaults']['field_icon'];
628 633
                 }
629 634
                 ?>
@@ -652,11 +657,11 @@  discard block
 block discarded – undo
652 657
 
653 658
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
654 659
 
655
-            }else{
660
+            } else{
656 661
                 $value = '';
657 662
                 if (isset($field_info->css_class)) {
658 663
                     $value = esc_attr($field_info->css_class);
659
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
664
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
660 665
                     $value = $cf['defaults']['css_class'];
661 666
                 }
662 667
                 ?>
@@ -684,11 +689,11 @@  discard block
 block discarded – undo
684 689
 
685 690
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
686 691
 
687
-            }else{
692
+            } else{
688 693
                 $value = '';
689 694
                 if (isset($field_info->cat_sort)) {
690 695
                     $value = esc_attr($field_info->cat_sort);
691
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
696
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
692 697
                     $value = $cf['defaults']['cat_sort'];
693 698
                 }
694 699
                 ?>
Please login to merge, or discard this patch.